Hello,
I am working with Biojava and I am trying to run CookbookMSA. I have all requested jars, but I get an error
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.biojava3.core.sequence.location.SimpleLocation
at org.biojava3.alignment.SimpleAlignedSequence.setLocation(SimpleAlignedSequence.java:351)
at org.biojava3.alignment.SimpleAlignedSequence.<init>(SimpleAlignedSequence.java:88)
at org.biojava3.alignment.SimpleProfile.<init>(SimpleProfile.java:119)
at org.biojava3.alignment.SimpleSequencePair.<init>(SimpleSequencePair.java:86)
at org.biojava3.alignment.SimpleSequencePair.<init>(SimpleSequencePair.java:69)
at org.biojava3.alignment.routines.AnchoredPairwiseSequenceAligner.setProfile(AnchoredPairwiseSequenceAligner.java:137)
at org.biojava3.alignment.template.AbstractMatrixAligner.align(AbstractMatrixAligner.java:344)
at org.biojava3.alignment.template.AbstractPairwiseSequenceAligner.getPair(AbstractPairwiseSequenceAligner.java:112)
at org.biojava3.alignment.FractionalIdentityScorer.align(FractionalIdentityScorer.java:112)
at org.biojava3.alignment.FractionalIdentityScorer.getMaxScore(FractionalIdentityScorer.java:92)
at org.biojava3.alignment.template.AbstractScorer.getDistance(AbstractScorer.java:40)
at org.biojava3.alignment.template.AbstractScorer.getDistance(AbstractScorer.java:35)
at org.biojava3.alignment.GuideTree.<init>(GuideTree.java:82)
at org.biojava3.alignment.Alignments.getMultipleSequenceAlignment(Alignments.java:183)
at Alignment.multipleSequenceAlignment(Alignment.java:29)
at Alignment.main(Alignment.java:18)
I am woking on latest version of Eclipse Luna, Windows System. My code is:
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
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 Alignment {
public static void main(String[] args) {
String[] ids = new String[] {"Q21691", "O48771"};
try {
multipleSequenceAlignment(ids);
} catch (Exception e){
e.printStackTrace();
}
}
private static void multipleSequenceAlignment(String[] ids) throws Exception {
List<ProteinSequence> lst = new ArrayList<ProteinSequence>();
for (String id : ids) {
lst.add(getSequenceForId(id));
}
Profile<ProteinSequence, AminoAcidCompound> 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());
return seq;
}
}
What might be a problem?
Hi, a bit of your code and info on the platform and OS would help a lot. Thank you!
I have added code