Open mcmanuslab opened 1 year ago
I think passing a File
to be parsed using the file
field of the Seqviz
component is now deprecated.
The recommendation is to use seqparse
. It seems to me the library supports Snapgene file format. I would recommend trying two alternatives. One uses an async
function to the change listener so you can make use of the await
syntax on seqparse.
<script src="https://unpkg.com/seqparse"></script>
document.getElementById('snapgeneFileInput').addEventListener('change', async function(event) {
<!-- some lines below -->
var fileContent = e.target.result[0]
var parsedFile = await seqparse(fileContent)
window.seqviz
.Viewer("seqvizViewer", {
seq: parsedFile.seq,
annotations: parsedFile.annotations,
name: parsedFile.name,
....
})
<!-- some more lines -->
The second option would be to pass a callback function on the then
function to instantiate your page.
<!-- some lines below -->
var fileContent = e.target.result[0]
seqparse(fileContent).then((parsedFile) => {
window.seqviz
.Viewer("seqvizViewer", {
seq: parsedFile.seq,
annotations: parsedFile.annotations,
name: parsedFile.name,
....
})
})
<!-- some more lines -->
Let us know if it works for you.
Thanks! If it's deprecated, I'll note that genebank formatted files display quite nicely-- it seems like a Snapgene format issue.
From a quick glance at the Seqparse GitHub repository, it seems that this library is primarily designed to be used in a Node.js environment or in backend Python applications, rather than directly in the browser like I am using Seqviz.
Do you know whether Seqparse is feasible in a front-end browser implementation?
Is it possible to share your snapgene file? Possibly seqparse
used on the
deprecated parameter file is not correct parsing your file.
Is it possible to share your snapgene file? Possibly
seqparse
used on the deprecated parameter file is not correct parsing your file.
I agree this is likely (a bug in seqparse
). If you share the file @mcmanuslab (either the exact one or a modified one w/ the same errant behavior) we can add it to our test cases and fix it in seqparse
: https://github.com/Lattice-Automation/seqparse/tree/main/src/examples/snapgene
FWIW seqviz
should still work file with file input... and that's unlikely to be removed (for backwards compatibility). The flag being deprecated is to signal that seqviz
is really about visualization/presentation, and parsing sequence files is a bit more business logic than should have been in the library at the start
Hello @mcmanuslab , is this still an issue? If so, could you share the file that was causing the issue? Thank you!
The bug
The goal is to display a snapgene formated file in a browser. This does not appear to be working correctly. However, a genbank formatted vector of the same file works perfectly.
Expected and observed behavior
The expected behavior is to display a map and a sequence. However, the map is missing features and a title. The sequence displays, but it appears that non-DNA text also appears.
Screenshot
The local environment:
Test code below