Re: programming error

Andy Yates <[email protected]>
Newsgroups gmane.comp.java.bio.general
Message-ID <[email protected]>
If you want to do frame based translation then there is an easier way of accomplishing this. The TranscriptionEngine allows you to translate in multiple frames and retrieve that information in a Map such as:

TranscriptionEngine te = TranscriptionEngine.getDefault();
Frame[] frames = Frame.getForwardFrames();
Map<Frame, Sequence<AminoAcidCompound>> results = te.multipleFrameTranslation(dna, frames);

Change the static call on Frame to Frame.getAllFrames() then you will do a full 6 frame translation.

Also I would avoid calling the getSequenceAsString() method until you need to output it to screen. The Sequence interface provides an adequate set of methods for testing length of a sequence. However if you want is the longest translation then I would replace that with (assuming the above code):

List<Sequence<AminoAcidCompound>> translations = new ArrayList<Sequence<AminoAcidCompound>>(results.getValues());
Collections.sort(translations, new Comparator<Sequence<AminoAcidCompound>>() {
  public int compare(Sequence<AminoAcidCompound> o1, Sequence<AminoAcidCompound> o2) {
    Integer o1Length = o1.getLength();
    Integer o2Length = o2.getLength();
    return o1Length.compareTo(o2Length);
  }
});
Sequence<AminoAcidCompound> longest = translations.get(translations.size()-1);

However I would like to see what errors you are pulling up from BioJava3 in case there is a scenario we are not currently taking into account

Andy

On 14 Feb 2011, at 02:27, Shamanou van Leeuwen wrote:

> On 13-02-11 20:11, Scooter Willis wrote:
>> Depending on what you need you may want to try out biojava3.
>> 
>> On Sun, Feb 13, 2011 at 9:32 AM, Shamanou van Leeuwen
>> <[email protected]>  wrote:
>>> hi guys,
>>> 
>>> i made am making a tool to translate dna to protein using biojava.
>>> But  i am getting some errors that is do not fully understand.
>>> Can somebody please tell me what i am doing wrong?
>>> 
>>> 
>>> script:
>>> http://pastebin.com/TJSjkgqK
>>> 
>>> errors:
>>> http://pastebin.com/iFXYWEZB
>>> _______________________________________________
>>> Biojava-l mailing list  -  [email protected]
>>> http://lists.open-bio.org/mailman/listinfo/biojava-l
>>> 
>>> 
> i a, trying biojava 3 now but i am still doing something wrong.
> 
> http://pastebin.com/uLz934gr
> _______________________________________________
> Biojava-l mailing list  -  [email protected]
> http://lists.open-bio.org/mailman/listinfo/biojava-l

-- 
Andrew Yates                   Ensembl Genomes Engineer
EMBL-EBI                       Tel: +44-(0)1223-492538
Wellcome Trust Genome Campus   Fax: +44-(0)1223-494468
Cambridge CB10 1SD, UK         http://www.ensemblgenomes.org/





_______________________________________________
Biojava-l mailing list  -  [email protected]
http://lists.open-bio.org/mailman/listinfo/biojava-l
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.