[Biojava-l] Get Consensus after MSA

Andreas Prlic andreas.prlic at gmail.com
Fri Jun 3 23:04:10 UTC 2016


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 <mqin at outlook.com> 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 Shenzhenmqin at outlook.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biojava-l/attachments/20160603/c435c91a/attachment.html>


More information about the Biojava-l mailing list