[Biojava-l] programming error
Andy Yates
ayates at ebi.ac.uk
Mon Feb 14 16:13:35 UTC 2011
I've added a bit to the original cookbook page we had. I can migrate these changes to the cookbook front page later on in the week
Andy
On 14 Feb 2011, at 15:42, Andreas Prlic wrote:
> Hi Andy,
>
> Could we get a Cookbook page for this? sounds like it would be good to have a bit more docu on this topic ...
>
> Thanks!
>
> Andreas
>
> On Mon, Feb 14, 2011 at 2:07 AM, Andy Yates <ayates at ebi.ac.uk> wrote:
> 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/
>
>
>
>
>
> _______________________________________________
> Biojava-l mailing list - Biojava-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-l
>
>
>
> --
> -----------------------------------------------------------------------
> Dr. Andreas Prlic
> Senior Scientist, RCSB PDB Protein Data Bank
> University of California, San Diego
> (+1) 858.246.0526
> -----------------------------------------------------------------------
--
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