[Biojava-l] what it needs to do this with (Bio)Java...

Matthew Pocock mrp@sanger.ac.uk
Thu, 20 Apr 2000 17:53:44 +0100


Hi Gerald.

The truthful answer is that you can't do everything with minimal effort (as of 3:10
pm). The biggest missing feature is Genbank & EMBL writing. You should be able to
roll your own with no more effort than it would take you any other way. Support for
this should be added to the seq.io Genbank and EMBL classes.

Now for the other stuff...

>         o given a Java String object that contains a nucleotide sequence,
> construct a "NT-Sequence" object

// get the DNA residue list - this is the most complicated thing that you need
unless
// you want to annotate features

ResidueList resList = DNATools.createDNA("agcggtccataagc");

// ok - so you decided that you want to annotate features - so construct a
// SimpleSequence object from resList

Sequence seq = new SimpleSequence(
  resList, "urn://sequence/-", "anonymous",
  Annotation.EMPTY_ANNOTATION
);


>
>         o given a file of FASTA-formatted nt-sequences, instantiate a
> Collection of "NT-Sequence" objects

// we need to set some stuff up first - declare that the FASTA file is DNA,
// that it is a FASTA file & that we want to use the pure-jave implementation
// of a sequence, as well as getting a stream that reads from the file
InputStream seqIn = new FileInputStream(fastaFile);
Alphabet DNA = DNATools.getAlphabet();
ResidueParser dnaParser = DNA.getParser("symbol");
SequenceFormat sFormat = new FastaFormat();
SequenceFactory sFact = new SimpleSequenceFactory();

// now we can loop over each sequence & do something
for(
  SequenceIterator seqI = new StreamReader(seqIn, sFormat, rParser, sFact);
  seqI.hasNext();
) {
  Sequence seq = seqI.nextSequence();
  // do stuff with seqI
}

>         o given an "NT-Sequence" object, construct its reverse complement
> "NT-Sequence" object

ResidueList revComp = new ComplementResidueList(sourceDna);

>         o given an "NT-Sequence" object, construct its translated "AA-Sequence"
> object.

// we need to extract the codons & then translate them into Amino-Acids
ResidueList codons = new WindowedResidueList(revComp, 3);
ResidueList protein = new TranslatedResidueList(codons, GeneticCode.UNIVERSAL);

> Thanks for your time!!
>
>         cheers,
>         gerald

It is now 5:06pm - I have checked that the translation stuff works. There is a new
demo called 'TestTranslation' under demos/seq/ that tests the new GeneticCode
class.

Please do a complete cvs update to get all the latest goodies.

All the best

Matthew

>
> --
> _ Gerald.Loeffler@vienna.at _________________ Software Architect _
> _ http://www.imp.univie.ac.at ____ http://www.daemonstration.com _
> _ OOA&D, Java, J2EE, JSP, Servlets, JavaBeans, ODBMS, RDBMS, XML _
>
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l