Hi!
I searched for possible solutions but did not find anything helpful. I'm trying to use the Gen Ontology sequence database in order to test an algorithm my professor gave to me on this huge set of data. I thought the easiest way would be to read out the FASTA-file via BioJava.
It is the first time for me to work with BioJava. I downloaded BioJava 4.0.0 via Manual Download an imported the external jars into my Eclipse project.
I simply tried to read the FASTA-file for now:
package controle;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import org.biojava.nbio.core.sequence.ProteinSequence;
import org.biojava.nbio.core.sequence.compound.AminoAcidCompound;
import org.biojava.nbio.core.sequence.compound.AminoAcidCompoundSet;
import org.biojava.nbio.core.sequence.io.FastaReader;
import org.biojava.nbio.core.sequence.io.FastaReaderHelper;
import org.biojava.nbio.core.sequence.io.GenericFastaHeaderParser;
import org.biojava.nbio.core.sequence.io.ProteinSequenceCreator;
public class ReadFasta {
public static void readFasta() throws IOException {
//Try with the FastaReaderHelper
LinkedHashMap<String, ProteinSequence> a;
try {
File file = new File("C:\\Users\\Patrick\\workspace\\Bachelor\\src\\go_20150425-seqdb.fasta");
a = FastaReaderHelper.readFastaProteinSequence(file);
for ( Entry<String, ProteinSequence> entry : a.entrySet() ) {
System.out.println( entry.getValue().getOriginalHeader() + "=" + entry.getValue().getSequenceAsString() );
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
When I try to call my method readFasta()
in main I get the following error code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.biojava.nbio.core.sequence.io.FastaReader.<clinit>(FastaReader.java:46)
at org.biojava.nbio.core.sequence.io.FastaReaderHelper.readFastaProteinSequence(FastaReaderHelper.java:97)
at org.biojava.nbio.core.sequence.io.FastaReaderHelper.readFastaProteinSequence(FastaReaderHelper.java:82)
at controle.ReadFasta.readFasta(ReadFasta.java:32)
at controle.Main.main(Main.java:13)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
I'm not totally sure if I have "installed" BioJava correctly or why this Problem occurs. Like I said I'm new to this and it would be nice if someone knows an solution or an easier way to deal with FASTA-files.
Greetings,
Patrick
Tagging the BioJava expert Pierre Lindenbaum