Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapgene format #241

Open
mcmanuslab opened this issue Nov 20, 2023 · 5 comments
Open

snapgene format #241

mcmanuslab opened this issue Nov 20, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@mcmanuslab
Copy link

mcmanuslab commented Nov 20, 2023

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

Screenshot 2023-11-19 at 5 14 13 PM

The local environment:

  • OS: MacOS
  • Browser: chrome
  • Version 119.0.6045.159/160

Test code below
Screenshot 2023-11-19 at 5 38 06 PM

@mcmanuslab mcmanuslab added the bug Something isn't working label Nov 20, 2023
@isaacguerreir
Copy link
Contributor

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.

@mcmanuslab
Copy link
Author

mcmanuslab commented Nov 22, 2023 via email

@isaacguerreir
Copy link
Contributor

isaacguerreir commented Nov 22, 2023 via email

@jjti
Copy link
Collaborator

jjti commented Nov 22, 2023

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

@guzmanvig
Copy link
Collaborator

Hello @mcmanuslab , is this still an issue? If so, could you share the file that was causing the issue? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants