[Biojava-l] programming error

Andy Yates ayates at ebi.ac.uk
Mon Feb 14 10:07:12 UTC 2011


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
>> <mandarijnopw8 at gmail.com>  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  -  Biojava-l at lists.open-bio.org
>>> 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  -  Biojava-l at lists.open-bio.org
> 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/








More information about the Biojava-l mailing list