[Biojava-dev] [BioJava - Bug #3347] (New) GenbankFormat parser: missing title in reference causes ParseException

redmine at redmine.open-bio.org redmine at redmine.open-bio.org
Sat Apr 28 14:34:07 UTC 2012


Issue #3347 has been reported by Tjeerd Boerman.

----------------------------------------
Bug #3347: GenbankFormat parser: missing title in reference causes ParseException
https://redmine.open-bio.org/issues/3347

Author: Tjeerd Boerman
Status: New
Priority: Normal
Assignee: biojava-dev list
Category: bio
Target version: BioJava 1.8 - legacy
URL: 


I found that the GenbankFormat parser in BioJava 1.8.2 throws a ParseException when the input file contains a REFERENCE that has a PUBMED or MEDLINE field but no TITLE field. As far as I can tell from the specification, the TITLE field is not required ( http://www.ncbi.nlm.nih.gov/Sitemap/samplerecord#ReferenceB ). When no PUBMED or MEDLINE field is present in a REFERENCE, an omission of TITLE does not result in a crash.

The reason for the ParseException was that SimpleDocRef did not have a constructor for the specified case. The exception is:

---begin exception---
org.biojava.bio.seq.io.ParseException: 

A Exception Has Occurred During Parsing. 
Please submit 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.GenbankFormat
Accession=NP_619745
Id=20177418
Comments=Bad sequence section
Parse_block=REFERENCE   2  (residues 1 to 1646)AUTHORS   .JOURNAL   UnpublishedMEDLINE   95070779
Stack trace follows ....


	at org.biojavax.bio.seq.io.GenbankFormat.readRichSequence(GenbankFormat.java:544)
	at org.biojavax.bio.seq.io.GenbankFormatTest.readProteinFile(GenbankFormatTest.java:199)
	at org.biojavax.bio.seq.io.GenbankFormatTest.testReferenceWithoutTitle(GenbankFormatTest.java:109)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.IllegalArgumentException: Could not find constructor for class org.biojavax.SimpleDocRef(class java.util.ArrayList,class java.lang.String,class java.lang.String,class java.lang.String,class java.lang.Integer)
	at org.biojavax.SimpleRichObjectBuilder.buildObject(SimpleRichObjectBuilder.java:84)
	at org.biojavax.RichObjectFactory.getObject(RichObjectFactory.java:103)
	at org.biojavax.bio.seq.io.GenbankFormat.readRichSequence(GenbankFormat.java:406)
	... 21 more
Caused by: java.lang.NoSuchMethodException: org.biojavax.SimpleDocRef.<init>(java.util.List, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer)
	at java.lang.Class.getConstructor0(Unknown Source)
	at java.lang.Class.getConstructor(Unknown Source)
	at org.biojavax.SimpleRichObjectBuilder.buildObject(SimpleRichObjectBuilder.java:68)
	... 23 more
---end exception---

I have attached a patch that adds missing the constructor to SimpleDocRef and includes the missing case in the parsing logic in GenbankFormat. A unit test is also included.

Regards,
Tjeerd


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here and login: http://redmine.open-bio.org




More information about the biojava-dev mailing list