[Biojava-dev] Jronn ModelLoader resource problem
Steve Darnell
darnells at dnastar.com
Tue May 8 23:31:16 UTC 2012
Greetings,
I am having problems with loading resources for the Jronn (protein disorder) ModelLoader. With my usage, my program cannot locate the modelN.rec associated with the biojava3-protein-disorder module. I know that my program can locate other BioJava resources, such as the Blosum65 matrix in the biojava3-alignment module used by the SeqRes2AtomAligner class.
I noticed that ModelLoader.loadModels() uses a different coding pattern for getting a resource as a stream than other areas of BioJava. ModelLoader.loadModels() uses ClassLoader.getSystemResourceAsStream while SubstitutionMartixHelper.getReader uses $BIOJAVA_CLASS.class.getResourceAsStream().
The following change to ModelLoader.java (line 163) works in my use case:
> Original
final BufferedReader bfr = new BufferedReader(
new InputStreamReader(ClassLoader.getSystemResourceAsStream(
"model" + i + ".rec"),
"ISO-8859-1"));
< Patch
final BufferedReader bfr = new BufferedReader(
new InputStreamReader(ModelLoader.class.getResourceAsStream(
String.format("/model%d.rec", i))
));
It appears that using the non-system resource method in the patch code searches for resources in more locations that the system resource method in the original code (http://docs.oracle.com/javase/6/docs/technotes/guides/lang/resources.html). The existing Jronn unit test for continues to work with the patch without modification.
I am asking for the ModelLoader class in org.biojava3.ronn (from the biojava3-protein-disorder module) to be modified as described before the next BioJava release, making the code more robust and more consistent with existing BioJava coding patterns. I would be happy to address any questions or comments.
Best regards,
Steve
--
Steve Darnell
DNASTAR, Inc.
Madison, WI USA
More information about the biojava-dev
mailing list