[Biojava-l] BioException from SeqIOTools
Ren, Zhen
zren at amylin.com
Tue Apr 8 11:01:24 EDT 2003
Hi, there,
Can anyone tell me what is wrong in the following snippet? I can not attach you my troubling big FASTA file with lots of protein sequences in it. When the problematic sequence is extracted from the file, the exception disappears. Thanks so much.
Zhen
import java.io.*;
import org.biojava.bio.*;
import org.biojava.bio.seq.*;
import org.biojava.bio.seq.io.*;
public class TestSeqIOTools {
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: java TestSeqIOTools filename.fasta");
System.exit(1);
}
try {
BufferedReader fin = new BufferedReader(new FileReader(args[0]));
SequenceIterator stream = SeqIOTools.readFastaProtein(fin);
while(stream.hasNext()) {
Sequence seq = stream.nextSequence();
System.out.println(">" + seq.getName());
System.out.println(seq.seqString());
}
fin.close();
} catch(BioException e) {
System.err.println("BioException: " + e.getMessage());
e.printStackTrace();
System.exit(0);
} catch(IOException ex) {
System.err.println("IOException: " + ex.getMessage());
}
}
}
C:\Biojava\trouble>javac TestSeqIOTools.java
C:\Biojava\trouble>java TestSeqIOTools mySeqs.fasta
......
>AAY11855;
MTRECPSPAPGPGAPLSGSVLAEAAVVFAVVLSIHATVW
BioException: Could not read sequence
java.io.IOException: Can't reset: Mark invalid parseStart=89 bytesRead=512
at org.biojava.bio.seq.io.FastaFormat.readSequenceData(FastaFormat.java:170)
at org.biojava.bio.seq.io.FastaFormat.readSequence(FastaFormat.java:120)
at org.biojava.bio.seq.io.StreamReader.nextSequence(StreamReader.java:100)
rethrown as org.biojava.bio.BioException: Could not read sequence
at org.biojava.bio.seq.io.StreamReader.nextSequence(StreamReader.java:103)
at TestSeqIOTools.main(TestSeqIOTools.java:19)
More information about the Biojava-l
mailing list