Hi Anna -
It seems the problem may be with the EMBL file.
java.lang.IllegalArgumentException: Location [1045891,1046196] is outside
1..1000000
This part indicates BioJava is trying to make a Feature with the Location
[1045891,1046196] which is outside the bounds of the available sequence. It is
not allowed
to create features outside of the available Sequence. Apparently BioJava
is able to find 1000000 bases. Is there actually more sequence than this in the
EMBL file?
There are two possible solutions (unless you can get a full version of the
EMBL file)...
1) If you are only interested in comparing Feature Locations you could use
a DummySequence of the appropriate length.
2) You could write a custom org.biojava.bio.seq.io.SeqIOFilter which
overloads the startFeature and method and only passes the Feature.Template
to the delegate if the Location in that Feature.Template is inside the
valid range.
If you want to use option 2 and need more help then post to the list.
- Mark
Mark Schreiber
Principal Scientist (Bioinformatics)
Novartis Institute for Tropical Diseases (NITD)
10 Biopolis Road
#05-01 Chromos
Singapore 138670
www.nitd.novartis.com
phone +65 6722 2973
fax +65 6722 2910
"Anna Henricson" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
01/13/2005 04:40 PM
To: "Biojava" <[EMAIL PROTECTED]>
cc: (bcc: Mark Schreiber/GP/Novartis)
Subject: [Biojava-l] IllegalArgumentException when parsing an
embl file
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
_______________________________________________
Biojava-l mailing list - [email protected]
http://biojava.org/mailman/listinfo/biojava-l
_______________________________________________
Biojava-l mailing list - [email protected]
http://biojava.org/mailman/listinfo/biojava-l