[Biojava-l] readFasta problem
xyz
mitlox at op.pl
Thu Apr 8 11:30:52 UTC 2010
Hello,
I would like to read fasta file without to specify whether it is DNA,
RNA or Protein in code and I wrote this code
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import org.biojava.bio.BioException;
import org.biojavax.SimpleNamespace;
import org.biojavax.bio.seq.RichSequence;
import org.biojavax.bio.seq.RichSequenceIterator;
public class SortFasta {
public static void main(String[] args) throws FileNotFoundException,
BioException {
BufferedReader br = new BufferedReader(new
FileReader("sortFasta.fasta"));
SimpleNamespace ns = new SimpleNamespace("biojava");
// You can use any of the convenience methods found in the BioJava 1.6 API
//RichSequenceIterator rsi = RichSequence.IOTools.readFastaDNA(br, ns);
RichSequenceIterator rsi = RichSequence.IOTools.readFasta(br, null, ns);
// Since a single file can contain more than a sequence, you need
// to iterate over rsi to get the information.
while (rsi.hasNext()) {
RichSequence rs = rsi.nextRichSequence();
System.out.println(rs.getComments());
System.out.println(rs.seqString());
}
}
}
but unfortunately it I have got following error:
it the details that follow to biojava-l at biojava.org or post a bug
report to http://bugzilla.open-bio.org/
Format_object=org.biojavax.bio.seq.io.FastaFormat
Accession=
Id=
Comments=problem parsing symbols
Parse_block=atccccc
Stack trace follows ....
at
org.biojavax.bio.seq.io.FastaFormat.readRichSequence(FastaFormat.java:222)
at
org.biojavax.bio.seq.io.RichStreamReader.nextRichSequence(RichStreamReader.java:110) ...
1 more Caused by: java.lang.NullPointerException at
org.biojava.bio.symbol.SimpleSymbolList.<init>(SimpleSymbolList.java:165)
at
org.biojavax.bio.seq.io.FastaFormat.readRichSequence(FastaFormat.java:213) ...
2 more Java Result: 1
What did I wrong?
Thank you in advance.
Best regards,
More information about the Biojava-l
mailing list