[Biojava-l] IllegalArgumentException when parsing an embl file
Anna Henricson
Anna.Henricson at cgb.ki.se
Thu Jan 13 03:40:05 EST 2005
Hi,
I'm parsing the feature table in an embl file to retrieve the information
under feature key CDS. For instance, I am calculating the number of exons,
the length of the exons, retrieving the protein sequence and id etc.
Sometimes an IllegalArgumentException is thrown by the code
sequence = seqIterator.nextSequence(); //(see below in this email)
I guess there is some problem in the embl file with the Location, so that
the Sequence cannot be instantiated, and as a result these sequences will
not be present in my resulting output file. Why is this exception thrown and
is there any way to avoid or handle this problem? Please bear in mind that I
am new to BioJava and therefore would greatly appreciate a more detailed
explanation.
Thanks!
/Anna
The code and the exceptions that are thrown are as follows:
....
private Sequence sequence;
....
SequenceIterator seqIterator = SeqIOTools.readEmbl (bufferedReader);
SequenceIterator seqIterator = SeqIOTools.readEmbl (bufferedReader);
while (seqIterator.hasNext()){
try{
sequence = seqIterator.nextSequence();
}
catch (BioException e){
e.printStackTrace();
}
catch (NoSuchElementException e){
e.printStackTrace();
}
....
java.lang.IllegalArgumentException: Location [1045891,1046196] is outside
1..1000000
at
org.biojava.bio.seq.impl.SimpleFeature.<init>(SimpleFeature.java:306)
at
org.biojava.bio.seq.impl.SimpleStrandedFeature.<init>(SimpleStrandedFeature.
java:74)
at sun.reflect.GeneratedConstructorAccessor1.newInstance(Unknown
Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFeature
Realizer.java:138)
rethrown as org.biojava.bio.BioException: Couldn't realize feature
at
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFeature
Realizer.java:144)
at
org.biojava.bio.seq.SimpleFeatureRealizer.realizeFeature(SimpleFeatureRealiz
er.java:94)
at
org.biojava.bio.seq.impl.SimpleSequence.realizeFeature(SimpleSequence.java:1
98)
at
org.biojava.bio.seq.impl.SimpleSequence.createFeature(SimpleSequence.java:20
4)
at
org.biojava.bio.seq.io.SequenceBuilderBase.makeSequence(SequenceBuilderBase.
java:168)
at
org.biojava.bio.seq.io.SmartSequenceBuilder.makeSequence(SmartSequenceBuilde
r.java:87)
at
org.biojava.bio.seq.io.SequenceBuilderFilter.makeSequence(SequenceBuilderFil
ter.java:98)
at
org.biojava.bio.seq.io.StreamReader.nextSequence(StreamReader.java:101)
at EmblFileParser.<init>(EmblFileParser.java:34)
at EmblToExintFormat.main(EmblToExintFormat.java:57)
--------------------------------------------
Anna Henricson, MSc, PhD student
Center for Genomics and Bioinformatics (CGB)
Karolinska Institutet
S-171 77 Stockholm
Sweden
Phone: +46 (0)8 524 87296
Fax: +46 (0)8 337983
More information about the Biojava-l
mailing list