[Biojava-dev] Error parsing XEMBL

Carlisia P. Campos carlisia at bu.edu
Mon Aug 11 09:47:06 EDT 2003


Hello there,

I have encountered what seems to be a problem with biojava. I adapted a  
piece of code offered by Mark Schreiber to parse the XEMBL xml string  
that corresponds to the accession number "Y13287" and got the error  
below. The code also goes below. If anyone knows of a work around  
please let me know.

Best,
--Carlisia



   public static String convert(String agaveString) {
     String seq_S = "";

     try {
       AGAVEHandler handler = new AGAVEHandler();

       SeqIOListener siol = new SeqIOAdapter();
       handler.setFeatureListener(siol);

       SAX2StAXAdaptor adaptor = new SAX2StAXAdaptor(handler);
       //XMLReader xmlReader =  
SAXParserFactory.newInstance().newSAXParser();
       SAXParser saxParser =  
SAXParserFactory.newInstance().newSAXParser();
       XMLReader xmlReader = saxParser.getXMLReader();
      // XMLReader xmlReader = new SAXParser();
       //FileReader fr = new FileReader(args[0]);
       InputSource is = new InputSource(new StringReader(agaveString));

       xmlReader.setContentHandler(adaptor);
       xmlReader.parse(is);

       for(Iterator i = handler.getSequences();i.hasNext();){
         Sequence s = (Sequence)i.next();
         seq_S = s.seqString();
       }
     }
     catch(SAXException se) {
       se.printStackTrace();
     }
     catch(ParserConfigurationException pce) {
       pce.printStackTrace();
     }
     catch(IOException ioe) {
       ioe.printStackTrace();
     }
     return seq_S;
   }



This happens once the program reaches the line that contains:  
xmlReader.parse(is):

java.lang.IllegalArgumentException: Location [41,239] is outside 1..237
	at  
org.biojava.bio.seq.impl.SimpleFeature.<init>(SimpleFeature.java:306)
	at  
org.biojava.bio.seq.impl.SimpleStrandedFeature.<init>(SimpleStrandedFeat 
ure.java:74)
	at java.lang.reflect.Constructor.newInstance(Native Method)
	at  
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFea 
tureRealizer.java:138)
rethrown as org.biojava.bio.BioException: Couldn't realize feature
	at  
org.biojava.bio.seq.SimpleFeatureRealizer$TemplateImpl.realize(SimpleFea 
tureRealizer.java:144)
	at  
org.biojava.bio.seq.SimpleFeatureRealizer.realizeFeature(SimpleFeatureRe 
alizer.java:94)
	at  
org.biojava.bio.seq.impl.SimpleSequence.realizeFeature(SimpleSequence.ja 
va:198)
	at  
org.biojava.bio.seq.impl.SimpleFeature.realizeFeature(SimpleFeature.java 
:328)
	at  
org.biojava.bio.seq.impl.SimpleFeature.createFeature(SimpleFeature.java: 
337)
	at  
org.biojava.bio.seq.io.agave.StAXFeatureHandler.realizeSubFeatures(StAXF 
eatureHandler.java:349)
	at  
org.biojava.bio.seq.io.agave.StAXFeatureHandler.addFeatureToSequence(StA 
XFeatureHandler.java:377)
	at  
org.biojava.bio.seq.io.agave.AGAVEBioSeqHandler.endElementHandler(AGAVEB 
ioSeqHandler.java:192)
	at  
org.biojava.bio.seq.io.agave.StAXFeatureHandler.endElement(StAXFeatureHa 
ndler.java:807)
	at  
org.biojava.bio.seq.io.agave.SAX2StAXAdaptor.endElement(SAX2StAXAdaptor. 
java:161)
	at  
oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParse 
r.java:1203)
	at  
oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingP 
arser.java:294)
	at  
oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingPars 
er.java:261)
	at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:147)
	at com.carlisia.ws.bio.XEMBL2Sequence.convert(XEMBL2Sequence.java:78)
	at  
com.carlisia.ws.bio.XEMBL2Sequence.getSequence(XEMBL2Sequence.java:42)
	at  
com.carlisia.ws.bio.TranscribeDNAtoRNA.transcribeDNAtoRNAEMBL(Transcribe 
DNAtoRNA.java:63)
	at  
com.carlisia.ws.bio.TranscribeDNAtoRNA.main(TranscribeDNAtoRNA.java:71)
Debugger disconnected from local process.
ggcggtcggtctcgccttgtcgccagctccattttcctctctttctcttcccctttccttcgcgcccaagag 
cgcctcccagcctcgtagggtggtcacggagcccctgcgccttttccttgctcgggtcctgcgtccgcgcct 
gccccgccatgaatgaggagtacgacgtgatcgtgctgggcaccggcctgacggtgggcgccagggctgagg 
ggccggggctgagcagccggg
Process exited with exit code 0.



More information about the biojava-dev mailing list