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

Save track data method on base track model #3439

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

cmdcolin
Copy link
Collaborator

@cmdcolin cmdcolin commented Jan 5, 2023

This adds a basic concept of performing a "save track data" function on the base track model

xref #3094

It attempts to export all feature types as GFF3 for the currently visible region right now

It downloads the features to the main thread and makes a best effort to translate them into GFF3 format

  • Allow plugins to register extra data format exports: this could be a pluggable element that the "SaveTrackData" dialog could ask for perhaps
  • Allow different track types to say what types of data formats they support exporting to. This would make it so that e.g. VariantTrack would primarily export as VCF, or AlignmentTracks as SAM
  • Allow adapter to provide the exported data. This could potentially provide "exact" exports matching the source data, giving original data lines instead of round-tripping through SimpleFeature
  • Incorporate current filters (e.g. filterBy from alignments track)
  • Unify the rubberband "get sequence" function with the "get features" function...e.g. we could highlight to get features to

As noted in the title, the "Save track data" feature is on the "Base track model". this is a bit awkward and currently accesses the "dynamic blocks of the view". this could suggest that this feature should be placed on the display model instead, or have some other way of obtaining regions

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Jan 5, 2023
@cmdcolin cmdcolin removed the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Jan 5, 2023
@cmdcolin
Copy link
Collaborator Author

cmdcolin commented Feb 6, 2023

tried making a minimal genbank export here

https://github.com/GMOD/jbrowse-components/tree/save_track_data_genbank

i'm not really fully in-the-know about how genbank works but the steps for this export are

  1. get features visible in view
  2. get min and max coordinate of these features
  3. fetch the underlying reference sequence between min..max
  4. export the genbank using a very base-level format similar to https://community.alliancegenome.org/t/genbank-format-downloading-from-jbrowse1-2/6772/4

this means the sequence exported is only that which spans the features in question. this is inspired by looking at this sample genbank record https://www.ncbi.nlm.nih.gov/Sitemap/samplerecord.html which refers to a sequence of about 5kb from 1..5028, but is actually in the middle of chrIX on yeast https://yeastgenome.org/locus/S000001402/sequence

that led me to subtract everything relative to this currently viewed region. the alternative would be exporting the entire chromosome sequence (which can be large) and then using true start/end coords.

image

cc @scottcain xref https://community.alliancegenome.org/t/genbank-format-downloading-from-jbrowse1-2/6772/4

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Feb 7, 2023
@cmdcolin cmdcolin force-pushed the save_track_data branch 2 times, most recently from 991e10f to d269640 Compare February 8, 2023 02:03
@cmdcolin
Copy link
Collaborator Author

cmdcolin commented Feb 8, 2023

added some genbank export to this branch

also downloaded snapgene free trial. the exports from this branch look approximately similar to a gbrowse genbank exports made from maizemine

Example

https://jbrowse.org/code/jb2/save_track_data/?config=test_data%2Fconfig_demo.json&session=share-FK-AH5RGz7&password=roZPQ

Screenshot from 2023-02-07 19-03-58

@cmdcolin cmdcolin added enhancement New feature or request and removed needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) labels Feb 8, 2023
@cmdcolin cmdcolin force-pushed the save_track_data branch 2 times, most recently from e379584 to 66981c0 Compare February 28, 2023 21:01
@codecov
Copy link

codecov bot commented Feb 28, 2023

Codecov Report

Attention: Patch coverage is 6.27451% with 239 lines in your changes missing coverage. Please review.

Project coverage is 62.14%. Comparing base (a097560) to head (83cbc05).
Report is 127 commits behind head on main.

Current head 83cbc05 differs from pull request most recent head f51bb83

Please upload reports for the commit f51bb83 to get more accurate results.

Files Patch % Lines
...eElementTypes/models/saveTrackFileTypes/genbank.ts 4.10% 70 Missing ⚠️
...leElementTypes/models/components/SaveTrackData.tsx 0.00% 51 Missing ⚠️
...ableElementTypes/models/saveTrackFileTypes/gff3.ts 6.25% 30 Missing ⚠️
packages/core/assemblyManager/util.ts 0.00% 19 Missing ⚠️
packages/core/rpc/methods/CoreSaveFeatureData.ts 0.00% 19 Missing ⚠️
packages/core/assemblyManager/loadRefNameMap.ts 0.00% 14 Missing ⚠️
.../variants/src/VariantTrack/saveTrackFormats/vcf.ts 0.00% 9 Missing ⚠️
packages/core/rpc/methods/CoreGetRegions.ts 11.11% 8 Missing ⚠️
...rc/LinearPileupDisplay/components/SetMaxHeight.tsx 0.00% 5 Missing ⚠️
...src/LinearBasicDisplay/components/SetMaxHeight.tsx 0.00% 5 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3439      +/-   ##
==========================================
- Coverage   62.61%   62.14%   -0.47%     
==========================================
  Files        1088     1096       +8     
  Lines       31495    31696     +201     
  Branches     7531     7565      +34     
==========================================
- Hits        19721    19699      -22     
- Misses      11602    11824     +222     
- Partials      172      173       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@scottcain
Copy link
Member

Added a bug report for GFF3 generation in that it doesn't produce a ##sequence-region directive: #3679

@scottcain
Copy link
Member

Added a bug report for GFF3 production that it gets strand wrong (1 or -1 instead of the standard + or -): #3678

@scottcain
Copy link
Member

Added a feature request to have the location info embedded in saved track data filenames: #3680

@cmdcolin
Copy link
Collaborator Author

updated to latest main at v2.6.2 @scottcain

@cmdcolin
Copy link
Collaborator Author

new work trying to push this forward a little bit that makes the set of file formats part of the track model. could also look at display model and/or adapter model potentially, but this is a step towards a little less hardcoded format

@cmdcolin
Copy link
Collaborator Author

address comment here #4029 (comment)

@cmdcolin cmdcolin force-pushed the save_track_data branch 2 times, most recently from 338a778 to 5258e84 Compare January 19, 2024 17:46
@cmdcolin cmdcolin force-pushed the save_track_data branch 2 times, most recently from f526a1c to 10a6cca Compare February 21, 2024 22:10
@cmdcolin cmdcolin force-pushed the save_track_data branch 2 times, most recently from c2f7229 to bf34073 Compare August 8, 2024 21:12
@cmdcolin cmdcolin force-pushed the save_track_data branch 2 times, most recently from 8708cf4 to 880efb8 Compare September 5, 2024 19:23
@cmdcolin cmdcolin force-pushed the save_track_data branch 2 times, most recently from 8bf2361 to 23fe569 Compare October 28, 2024 19:18
@cmdcolin cmdcolin force-pushed the save_track_data branch 3 times, most recently from bfb3dba to 0da7129 Compare November 23, 2024 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants