[Biojava-dev] Jronn ModelLoader resource problem

P. Troshin to.petr at gmail.com
Wed May 9 23:52:38 UTC 2012


Steve,

I am guess, you wanted the following change:

final BufferedReader bfr = new BufferedReader(
                    new InputStreamReader(
                            ModelLoader.class.getResourceAsStream(String
                                    .format("model%d.rec", i))));

Note the lack of / before the model.That seems to work fine.
Does this work for you?

Thanks,
Peter


On 10 May 2012 00:39, P. Troshin <to.petr at gmail.com> wrote:

> Hi Steve,
>
> I am glad to hear that you find the predictor useful in your work.
> However, I am afraid we may not be able to apply your patch as it breaks
> the executable Jronn jar, it seems like the models cannot be loaded from
> within the Jar file when your patch is applied. Could you tell us a bit
> more about your setup? Why you cannot load the models with the old method?
>
> Thanks,
> Peter
>
>
>
> On 9 May 2012 00:31, Steve Darnell <darnells at dnastar.com> wrote:
>
>> 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
>>
>>
>> _______________________________________________
>> biojava-dev mailing list
>> biojava-dev at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/biojava-dev
>>
>
>



More information about the biojava-dev mailing list