Re: Get Consensus after MSA
Andreas Prlic <[email protected]> Fri, 3 Jun 2016 16:04:10 -0700
| Newsgroups | gmane.comp.java.bio.general |
|---|---|
| Message-ID | <CALthepxVUptw07Qk9YF9rpr17ww=UcExeRq62yHhENoqX7hLNw@mail.gmail.com> |
--===============6535864521119361095== Content-Type: multipart/alternative; boundary=94eb2c0950369cc6f2053467bd1e --94eb2c0950369cc6f2053467bd1e Content-Type: text/plain; charset=UTF-8 Hi Mao, Please don't mail me directly, but keep questions on the mailing lists, or on github. This is so other people who have the same question can benefit from this as well. Unfortunately there is currently no method implemented to get the consensus of an alignment. That's something you would need to build yourself. You need to iterate over all columns of an alignment and get the consensus for each column. Any pull requests that add this feature in a convenient way are welcome, Thanks, Andreas On Wed, Jun 1, 2016 at 2:51 AM, mao qin <[email protected]> wrote: > Hi Andreas, > > Greetings! > > I am using BioJava jar packages of alignment, core and genome under > version 4.1.0 and forester-1.038.jar. > > And after multiple sequences alignment, I want to get the consensus of MSA > output. I have check the example of BioJava Cookbook for two seqs but it > was not suitable for MSA. And I looked up the codes of related class, but > did not afford the method for directly getting the consensus seq. > > Do you have any suggestions about doing that? Do I need to implement this > object by myself? > > Thanks! > > The example output is as follow: > > Clustalw: > CLUSTAL W MSA from BioJava > > null GGTTAA-TTAATT 12 > null ----AACTAAATT 9 > null AGTTAA-TTAACC 12 > > Code: > public class TestMSA { > public static void main(String[] args) throws CompoundNotFoundException { > // TODO Auto-generated method stub > DNASequence s1 = new DNASequence("GGTTAATTAATT", > AmbiguityDNACompoundSet.getDNACompoundSet()); > DNASequence s2 = new DNASequence("AACTAAATT", > AmbiguityDNACompoundSet.getDNACompoundSet()); > DNASequence s3 = new DNASequence("AGTTAATTAACC", > AmbiguityDNACompoundSet.getDNACompoundSet()); > List<DNASequence> seqs = new ArrayList<DNASequence>(); > seqs.add(s1); > seqs.add(s2); > seqs.add(s3); > Profile<DNASequence, NucleotideCompound> profile = > Alignments.getMultipleSequenceAlignment(seqs); > System.out.printf("Clustalw:%n%s%n", > profile.toString(StringFormat.CLUSTALW)); > ConcurrencyTools.shutdown(); > } > } > > -- > All the best! > > Mao Qin > Agricultural Genomes Insititute at [email protected] > > --94eb2c0950369cc6f2053467bd1e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi Mao,<div><br></div><div>Please don't mail me direct= ly, but keep questions on the mailing lists, or on github. This is so other= people who have the same question can benefit from this as well.=C2=A0</di= v><div><br></div><div>Unfortunately there is currently no method implemente= d to get the consensus of an alignment. That's something you would need= to build yourself.</div><div><br></div><div>You need to iterate over all c= olumns of an alignment and get the consensus for each column.</div><div><br= ></div><div>Any pull requests that add this feature in a convenient way are= welcome,</div><div><br></div><div>Thanks,</div><div><br></div><div>Andreas= </div><div><br></div><div><br></div><div class=3D"gmail_extra"><br><div cla= ss=3D"gmail_quote">On Wed, Jun 1, 2016 at 2:51 AM, mao qin <span dir=3D"ltr= "><<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]= m</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margi= n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> =20 =20 =20 <div bgcolor=3D"#FFFFFF" text=3D"#000000"> <p>Hi Andreas,</p> <p>Greetings!<br> </p> <p>I am using BioJava jar packages of alignment, core and genome under version 4.1.0 and forester-1.038.jar.</p> <p>And after multiple sequences alignment, I want to get the consensus of MSA output. I have check the example of BioJava Cookbook for two seqs but it was not suitable for MSA. And I looked up the codes of related class, but did not afford the method for directly getting the consensus seq. <br> </p> <p>Do you have any suggestions about doing that? Do I need to implement this object by myself?</p> <p>Thanks!<br> </p> <p>The example output is as follow:</p> <p>Clustalw:<br> CLUSTAL W MSA from BioJava<br> <br> null=C2=A0=C2=A0 GGTTAA-TTAATT 12<br> null=C2=A0=C2=A0 ----AACTAAATT=C2=A0 9<br> null=C2=A0=C2=A0 AGTTAA-TTAACC 12<br> <br> </p> Code:<br> public class TestMSA {<br> public static void main(String[] args) throws CompoundNotFoundException {<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // TODO Auto-generated method stu= b<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 DNASequence s1 =3D new DNASequenc= e("GGTTAATTAATT", AmbiguityDNACompoundSet.getDNACompoundSet());<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 DNASequence s2 =3D new DNASequenc= e("AACTAAATT", AmbiguityDNACompoundSet.getDNACompoundSet());<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 DNASequence s3 =3D new DNASequenc= e("AGTTAATTAACC", AmbiguityDNACompoundSet.getDNACompoundSet());<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 List<DNASequence> seqs =3D = new ArrayList<DNASequence>();<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 seqs.add(s1);<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 seqs.add(s2);<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 seqs.add(s3);<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 Profile<DNASequence, Nucleotid= eCompound> profile =3D Alignments.getMultipleSequenceAlignment(seqs);=C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 <br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 System.out.printf("Clustalw:= %n%s%n", profile.toString(StringFormat.CLUSTALW));<br> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 ConcurrencyTools.shutdown();<br> =C2=A0=C2=A0=C2=A0 }<br> }<span class=3D"HOEnZb"><font color=3D"#888888"><br> <br> <pre cols=3D"72">--=20 All the best! Mao Qin=20 Agricultural Genomes Insititute at Shenzhen <a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a><= /pre> </font></span></div> </blockquote></div><br><br> </div></div> --94eb2c0950369cc6f2053467bd1e-- --===============6535864521119361095== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Biojava-l mailing list - [email protected] http://mailman.open-bio.org/mailman/listinfo/biojava-l --===============6535864521119361095==--