Using Biojava, I want to read multiple sequences and make an alignment for distance tree. I tried using cook book but I am getting an error, can anyone help me with this problem?

import java.net.URL;

import java.util.ArrayList;

import java.util.List;

import org.biojava3.alignment.Alignments;

import org.biojava3.alignment.Alignments.PairwiseSequenceScorerType;

import org.biojava3.alignment.Alignments.ProfileProfileAlignerType;

import org.biojava3.alignment.GuideTree;

import org.biojava3.alignment.SimpleGapPenalty;

import org.biojava3.alignment.SimpleSubstitutionMatrix;

import org.biojava3.alignment.template.GapPenalty;

import org.biojava3.alignment.template.PairwiseSequenceScorer;

import org.biojava3.alignment.template.Profile;

import org.biojava3.alignment.template.SubstitutionMatrix;

import org.biojava3.core.sequence.ProteinSequence;

import org.biojava3.core.sequence.compound.AminoAcidCompound;

import org.biojava3.core.sequence.io.FastaReaderHelper;

import org.biojava3.core.util.ConcurrencyTools;

import org.biojava3.alignment.Alignments;

import org.biojava3.alignment.template.Profile;

import org.biojava3.core.sequence.ProteinSequence;

import org.biojava3.core.sequence.compound.AminoAcidCompound;

import org.biojava3.core.sequence.io.FastaReaderHelper;

import org.biojava3.core.util.ConcurrencyTools;

public class CookbookMSA {

public static void main(String[] args) {

String[] ids = new String[] {"Q21691", "Q21495", "O48771"};

try {

multipleSequenceAlignment(ids);

} catch (Exception e){

e.printStackTrace();

}

}

private static void multipleSequenceAlignment(String[] ids) throws Exception {

List lst = new ArrayList();

for (String id : ids) {

lst.add(getSequenceForId(id));

}

Profile profile = Alignments.getMultipleSequenceAlignment(lst);

System.out.printf("Clustalw:%n%s%n", profile);

ConcurrencyTools.shutdown();

}

private static ProteinSequence getSequenceForId(String uniProtId) throws Exception {

URL uniprotFasta = new URL(String.format("http://www.uniprot.org/uniprot/%s.fasta";, uniProtId));

ProteinSequence seq = FastaReaderHelper.readFastaProteinSequence(uniprotFasta.openStream()).get(uniProtId);

System.out.printf("id : %s %s%n%s%n", uniProtId, seq, seq.getOriginalHeader());

//seq.doMultAlign();

return seq;

}

}

errors for this code :

I added forester.jar even though its not supporting

Exception in thread "main" java.lang.NoSuchMethodError: org.forester.phylogenyinference.BasicSymmetricalDistanceMatrix.getIndex(Ljava/lang/String;)I

at org.biojava3.alignment.GuideTree$Node.(GuideTree.java:186)

at org.biojava3.alignment.GuideTree$Node.(GuideTree.java:188)

at org.biojava3.alignment.GuideTree$Node.(GuideTree.java:188)

at org.biojava3.alignment.GuideTree$Node.(GuideTree.java:172)

at org.biojava3.alignment.GuideTree.(GuideTree.java:86)

at org.biojava3.alignment.Alignments.getMultipleSequenceAlignment(Alignments.java:183)

at org.biojava3.alignment.CookbookMSA.multipleSequenceAlignment(CookbookMSA.java:43)

at org.biojava3.alignment.CookbookMSA.main(CookbookMSA.java:32)

More Shameer Pillarisetti's questions See All
Similar questions and discussions