Closed foreveremain closed 2 years ago
Stepping through in the Javascript debugger, it seems that the first time JSUtil.getFileAsBytes() is called (for 'examples/uniref50.fa') it works ok, the second time (for 'examples/plantfdx.annotations') it returns null (resulting in downstream exceptions). Details are in the depths of JSUtil.getFileContents$O$Z().
We may have to wait till @BobHanson brings the latest swingjs/j2s to Jalview-JS/develop for this to be fixed.
Stepping deeper through the execution in JSUtil.getFileContents(), at line 62 var stream=Clazz.new_($I$(2,1).c$$S,[uri]).getContent$();
So as if J2S has somehow lost the context for the URI the second time around. And yet, parameters "features examples/exampleFeatures.txt" runs through here without error. Weird. Tried renaming the file and uri to 'plantfdx.txt', but still getting FileNotFoundException.
Sounds like a good tip. I'm pretty much done with a major upgrade of the transpiler and SwingJS. I've been holding off pushing that to Jalview because we will need a full recompile of all the pieces. Just to avoid all the messages, I think. I should be able to get to that in the next few days.
Bob
On Wed, Feb 5, 2020 at 1:25 AM Mungo Carstairs notifications@github.com wrote:
Stepping deeper through the execution in JSUtil.getFileContents(), at line 62 var stream=Clazz.new_($I$(2,1).c$$S,[uri]).getContent$();
- first time, uri = 'http://./examples/plantfdx.annotations', code runs without error
- second time, uri = 'http://./examples/uniref50.fa', Firefox debugger reports 'Error loading this URI: Unknown source', followed by java.io.FileNotFoundException: opening http:// ./examples/plantfdx.annotations
So as if J2S has somehow lost the context for the URI the second time around.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jalview/jalview-js/issues/6?email_source=notifications&email_token=AEHNCW42IHNPLGJBYRECHMLRBJSVDA5CNFSM4KP3N6JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEK2NF3I#issuecomment-582275821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHNCW6UPF7CKXKHTFBMPW3RBJSVDANCNFSM4KP3N6JA .
-- Robert M. Hanson Professor of Chemistry St. Olaf College Northfield, MN http://www.stolaf.edu/people/hansonr
If nature does not answer first what we want, it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
Annotations file problem looks like DataSourceType.RELATIVE_URL (added 06-2018 for JalviewJS) is not one of the enums checked in jalview.io.AnnotationFile.readAnnotationFile(), so this method is passed through without loading the file. Compare FileParse.parse() which has a branch for RELATIVE_URL. Will try copying code from there to AnnotationFile. [Edit] that worked. AnnotationFile lies outside the 'usual' FileParse hierarchy so duplicates some of the code.
this code ? public boolean readAnnotationFile(AlignmentI al, HiddenColumns hidden, String file, DataSourceType sourceType) { BufferedReader in = null; try { if (sourceType == DataSourceType.FILE) { in = new BufferedReader(new FileReader(file)); } else if (sourceType == DataSourceType.URL) { URL url = new URL(file); in = new BufferedReader(new InputStreamReader(url.openStream())); } else if (sourceType == DataSourceType.PASTE) { in = new BufferedReader(new StringReader(file)); } else if (sourceType == DataSourceType.CLASSLOADER) { java.io.InputStream is = getClass().getResourceAsStream("/" + file); if (is != null) { in = new BufferedReader(new java.io.InputStreamReader(is)); } }
that code should be in fileparse anyhow - from past experience with the applet, we need to keep all the code that resolves data sources in one place.
https://issues.jalview.org/browse/JAL-3603 resolves loading annotation file from URL parameter in JalviewJS
Finally resolving for 2.11.2.0 release.
https://jalview.github.io/jalview-js/JalviewJS.html?open%20examples/uniref50.fa%20annotations%20/examples/plantfdx.annotations
Should show an alignment with manual annotations. Currently produces a stacktrace.