<div dir="ltr">Hi Mao,<div><br></div><div>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. </div><div><br></div><div>Unfortunately there is currently no method implemented 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 columns 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="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 1, 2016 at 2:51 AM, mao qin <span dir="ltr"><<a href="mailto:mqin@outlook.com" target="_blank">mqin@outlook.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#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   GGTTAA-TTAATT 12<br>
      null   ----AACTAAATT  9<br>
      null   AGTTAA-TTAACC 12<br>
      <br>
    </p>
    Code:<br>
    public class TestMSA {<br>
    public static void main(String[] args) throws
    CompoundNotFoundException {<br>
            // TODO Auto-generated method stub<br>
            DNASequence s1 = new DNASequence("GGTTAATTAATT",
    AmbiguityDNACompoundSet.getDNACompoundSet());<br>
            DNASequence s2 = new DNASequence("AACTAAATT",
    AmbiguityDNACompoundSet.getDNACompoundSet());<br>
            DNASequence s3 = new DNASequence("AGTTAATTAACC",
    AmbiguityDNACompoundSet.getDNACompoundSet());<br>
            List<DNASequence> seqs = new
    ArrayList<DNASequence>();<br>
            seqs.add(s1);<br>
            seqs.add(s2);<br>
            seqs.add(s3);<br>
            Profile<DNASequence, NucleotideCompound> profile =
    Alignments.getMultipleSequenceAlignment(seqs);        <br>
            System.out.printf("Clustalw:%n%s%n",
    profile.toString(StringFormat.CLUSTALW));<br>
            ConcurrencyTools.shutdown();<br>
        }<br>
    }<span class="HOEnZb"><font color="#888888"><br>
    <br>
    <pre cols="72">-- 
All the best!

Mao Qin 
Agricultural Genomes Insititute at Shenzhen
<a href="mailto:mqin@outlook.com" target="_blank">mqin@outlook.com</a></pre>
  </font></span></div>

</blockquote></div><br><br>
</div></div>