GMOD / jbrowse-components

Source code for JBrowse 2, a modern React-based genome browser
https://jbrowse.org/jb2
Apache License 2.0
208 stars 62 forks source link

Inconsistent wrong SNP displayed #4502

Open Maarten-vd-Sande opened 3 months ago

Maarten-vd-Sande commented 3 months ago

Describe the bug

I have a cram file with amplicon sequencing reads, and a cram file with its corresponding "haplotypes". I work with a diploid, so that means I have at most two haplotypes per amplicon. I noticed a discrepancy between my reads and haplotypes, which concerned me. When coloring at the base I noticed the sequence is way off with the reference, and since it is a CRAM file it is extra strange (has no md tag, it is determined on the spot if I understand correctly). When I asked my colleagues to take a look, they couldn't reproduce it. Turns out, if I now re-load the session, this discrepancy doesn't occur. I am not sure what caused this difference, how frequently it occurs (first time for me), and whether other users have the same issue. The files that were loaded have not been changed in between. The problem is also that I can not reproduce it, so I also cannot make a minimal reproducable example :(

I think this issue can be ignored for now. Especially since it's a wild goose chase without MRE, but it might serve as a place to collect more unexpected behaviour like this if they occur more frequently.

To Reproduce

I can't reproduce it..

Screenshots

https://github.com/user-attachments/assets/f320dedf-4ff4-4569-998a-370d8328069d

I loaded some tracks from local files, those it cannot load from the session of course (hence the failed tracks)

Version:

firefox, with the web version. The unreleased frozen tracks 4 branch.

Additional context

cmdcolin commented 3 months ago

that is interesting. there is one thing that the frozen_tracks4 branch does that main does not, which is that it will actually put the entire track configuration into the session, instead of just a reference to the track by the track id.

this normally is ok but could, potentially, haven't traced exactly how, but lead to some weird behaviors that are hard to track down (for example mismatches between the config stored in the session and the config stored in config.json). technically, this is a bug that should be fixed on the frozen_tracks4 branch

example of a session in frozen_tracks4 (via Export session after opening a cram track)

``` { "session": { "drawerPosition": "right", "drawerWidth": 384, "widgets": { "hierarchicalTrackSelector": { "id": "hierarchicalTrackSelector", "type": "HierarchicalTrackSelectorWidget", "view": "integration_test", "faceted": { "filterText": "", "showSparse": false, "showFilters": true, "showOptions": false, "panelWidth": 400 } }, "GridBookmark": { "id": "GridBookmark", "type": "GridBookmarkWidget" } }, "activeWidgets": { "hierarchicalTrackSelector": "hierarchicalTrackSelector" }, "minimized": false, "id": "2wX7_b35sFh-wogU4RlRb", "name": "Integration test example 7/30/2024, 9:58:25 AM", "margin": 0, "views": [ { "id": "integration_test", "minimized": false, "type": "LinearGenomeView", "offsetPx": 2000, "bpPerPx": 0.05, "displayedRegions": [ { "refName": "ctgA", "start": 0, "end": 50001, "assemblyName": "volvox" } ], "tracks": [ { "id": "h6SRsqLADDZcEnU0J0KbX", "type": "AlignmentsTrack", "configuration": { "type": "AlignmentsTrack", "trackId": "volvox-long-reads-sv-cram", "name": "volvox-long reads with SV (cram)", "assemblyNames": [ "volvox" ], "category": [ "Alignments" ], "metadata": { "metadata from plugin": "added by umd_plugin.js using Core-preProcessTrackConfig" }, "adapter": { "type": "CramAdapter", "cramLocation": { "locationType": "UriLocation", "uri": "volvox-long-reads-sv.cram", "baseUri": "https://jbrowse.org/code/jb2/frozen_tracks4/test_data/volvox/config.json" }, "craiLocation": { "locationType": "UriLocation", "uri": "volvox-long-reads-sv.cram.crai", "baseUri": "https://jbrowse.org/code/jb2/frozen_tracks4/test_data/volvox/config.json" }, "sequenceAdapter": { "type": "TwoBitAdapter", "twoBitLocation": { "uri": "volvox.2bit", "locationType": "UriLocation", "baseUri": "https://jbrowse.org/code/jb2/frozen_tracks4/test_data/volvox/config.json" } } }, "displays": [ { "type": "LinearAlignmentsDisplay", "displayId": "volvox-long-reads-sv-cram-LinearAlignmentsDisplay" }, { "type": "LinearPileupDisplay", "displayId": "volvox-long-reads-sv-cram-LinearPileupDisplay" }, { "type": "LinearSNPCoverageDisplay", "displayId": "volvox-long-reads-sv-cram-LinearSNPCoverageDisplay" }, { "type": "LinearReadArcsDisplay", "displayId": "volvox-long-reads-sv-cram-LinearReadArcsDisplay" }, { "type": "LinearReadCloudDisplay", "displayId": "volvox-long-reads-sv-cram-LinearReadCloudDisplay" } ] }, "minimized": false, "displays": [ { "id": "MkQOisE0kzvTf2ZWq9viF", "type": "LinearAlignmentsDisplay", "PileupDisplay": { "id": "GkY7deK3Ukg9YH0RQNG_q", "type": "LinearPileupDisplay", "heightPreConfig": 205, "configuration": { "type": "LinearPileupDisplay", "displayId": "volvox-long-reads-sv-cram-LinearAlignmentsDisplay_LinearPileupDisplay_xyz" }, "filterBy": { "flagInclude": 0, "flagExclude": 1540 }, "jexlFilters": [], "showSoftClipping": false }, "SNPCoverageDisplay": { "id": "JXaEwZL3f48zCsQZtTufl", "type": "LinearSNPCoverageDisplay", "heightPreConfig": 45, "configuration": { "type": "LinearSNPCoverageDisplay", "displayId": "volvox-long-reads-sv-cram-LinearAlignmentsDisplay_snpcoverage_xyz" }, "selectedRendering": "", "resolution": 1, "constraints": {}, "filterBy": { "flagInclude": 0, "flagExclude": 1540 }, "jexlFilters": [] }, "snpCovHeight": 45, "configuration": { "type": "LinearAlignmentsDisplay", "displayId": "volvox-long-reads-sv-cram-LinearAlignmentsDisplay" }, "lowerPanelType": "LinearPileupDisplay" } ] } ], "hideHeader": false, "hideHeaderOverview": false, "hideNoTracksActive": false, "trackSelectorType": "hierarchical", "showCenterLine": false, "showCytobandsSetting": true, "trackLabels": "offset", "showGridlines": true, "highlight": [], "colorByCDS": false, "showBookmarkHighlights": true, "showBookmarkLabels": true } ], "sessionTracks": [], "sessionAssemblies": [], "temporaryAssemblies": [], "connectionInstances": [], "sessionConnections": [], "focusedViewId": "integration_test", "sessionPlugins": [] } } ```

example session from main after opening a cram track

``` { "session": { "drawerPosition": "right", "drawerWidth": 384, "widgets": { "hierarchicalTrackSelector": { "id": "hierarchicalTrackSelector", "type": "HierarchicalTrackSelectorWidget", "view": "integration_test", "faceted": { "filterText": "", "showSparse": false, "showFilters": true, "showOptions": false, "panelWidth": 400 } }, "GridBookmark": { "id": "GridBookmark", "type": "GridBookmarkWidget" } }, "activeWidgets": { "hierarchicalTrackSelector": "hierarchicalTrackSelector" }, "minimized": false, "id": "X2pTznil7TtrhV4z1r75O", "name": "Integration test example 7/30/2024, 9:58:25 AM", "margin": 0, "views": [ { "id": "integration_test", "minimized": false, "type": "LinearGenomeView", "offsetPx": 2000, "bpPerPx": 0.05, "displayedRegions": [ { "refName": "ctgA", "start": 0, "end": 50001, "assemblyName": "volvox" } ], "tracks": [ { "id": "ZfLTDGAGgASvA7MNwZe-R", "type": "AlignmentsTrack", "configuration": "volvox-long-reads-sv-cram", "minimized": false, "displays": [ { "id": "td2O2UMdbdkKFdlhNQF66", "type": "LinearAlignmentsDisplay", "PileupDisplay": { "id": "KLfnmVzVvgs9qtaRcw7bv", "type": "LinearPileupDisplay", "heightPreConfig": 205, "configuration": { "type": "LinearPileupDisplay", "displayId": "volvox-long-reads-sv-cram-LinearAlignmentsDisplay_LinearPileupDisplay_xyz" }, "filterBy": { "flagInclude": 0, "flagExclude": 1540 }, "jexlFilters": [], "showSoftClipping": false }, "SNPCoverageDisplay": { "id": "EvLGqRbKK7L8_CIR6hCX_", "type": "LinearSNPCoverageDisplay", "heightPreConfig": 45, "configuration": { "type": "LinearSNPCoverageDisplay", "displayId": "volvox-long-reads-sv-cram-LinearAlignmentsDisplay_snpcoverage_xyz" }, "selectedRendering": "", "resolution": 1, "constraints": {}, "filterBy": { "flagInclude": 0, "flagExclude": 1540 }, "jexlFilters": [] }, "snpCovHeight": 45, "configuration": "volvox-long-reads-sv-cram-LinearAlignmentsDisplay", "lowerPanelType": "LinearPileupDisplay" } ] } ], "hideHeader": false, "hideHeaderOverview": false, "hideNoTracksActive": false, "trackSelectorType": "hierarchical", "showCenterLine": false, "showCytobandsSetting": true, "trackLabels": "offset", "showGridlines": true, "highlight": [], "colorByCDS": false, "showTrackOutlines": true, "showBookmarkHighlights": true, "showBookmarkLabels": true } ], "sessionTracks": [], "sessionAssemblies": [], "temporaryAssemblies": [], "connectionInstances": [], "sessionConnections": [], "focusedViewId": "integration_test", "sessionPlugins": [] } } ```
Maarten-vd-Sande commented 3 months ago

But the strange part is that the original view is wrong. But the view from the exported session was correct.

cmdcolin commented 3 months ago

yep i can't explain the behavior exactly. if you get any more clues feel free to update. i can tag the issue as 'hard to reproduce' :)