broadinstitute / single_cell_portal_core

Rails/Docker application for the Broad Institute's single cell RNA-seq data portal
https://singlecell.broadinstitute.org
BSD 3-Clause "New" or "Revised" License
62 stars 26 forks source link

Enable cell filtering in IGV via URL, fix a search case (SCP-5673) #2079

Closed eweitz closed 3 months ago

eweitz commented 3 months ago

This lets users link to filtered IGV states, which helps share epigenomic insights. It also fixes a bug with search and IGV.

Overview

Previously, users could instantly filter tracks, but they could not persist or share those filtered results. Also, a bug caused IGV to error when the user loaded IGV, then changed to a no-gene or multi-gene view, then returned to any single-gene IGV view.

Now, cell filtering results can be saved in IGV by simply copying the current URL. Loading the URL restores that filtered IGV state. This makes it easy to share chromatin accessibility insights with collaborators and research audiences.

Video

Here's how it looks!

https://github.com/user-attachments/assets/bf01965f-0abd-4caa-a506-697f5055639e

Test

To manually test, if you'd like:

  1. Go to a study that has an ATAC fragment BED file, e.g. the 3k cell PBMC 10x multiome example dataset
  2. Search gene SPIB
  3. Go to "Genome" tab
  4. Click "Filter plotted cells"
  5. Click root checkbox in "Atac cluster" facet, to deselect all filters
  6. Click filter for "5"
  7. Confirm ATAC fragment track updates
  8. Click the "<-" button to the right of the gene search box
  9. In the default, 0-gene view, search for ANXA1
  10. Confirm "Genome" tab is in view, and IGV shows your new gene and the ATAC track
  11. Clear your filters
  12. Confirm ATAC track updates
  13. Apply a filter
  14. Confirm ATAC track updates
  15. Refresh page
  16. Confirm ATAC track shows state from step 14 (unfiltered ATAC might very briefly appear; unideal but expected)

Also note that these changes required updating to the latest upstream IGV, which e.g. changes the genes track to show Ensembl transcript ID instead of gene name / symbol. The familiar gene name is still visible in the search bar and related genes ideogram. As a separate task, it might help to refine IGV or our UI so users can easily discern which genes are in the genomic frame, which becomes more pertinent if the user drags or zooms.

This satisfies SCP-5673.

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 22.85714% with 27 lines in your changes missing coverage. Please review.

Project coverage is 69.55%. Comparing base (9bda4aa) to head (3821f55).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2079/graphs/tree.svg?width=650&height=150&src=pr&token=HMWE5BO2a4&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute)](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2079?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute) ```diff @@ Coverage Diff @@ ## ew-robust-igv-filters #2079 +/- ## ========================================================= - Coverage 69.62% 69.55% -0.08% ========================================================= Files 323 323 Lines 27181 27208 +27 Branches 2240 2252 +12 ========================================================= - Hits 18925 18924 -1 - Misses 8131 8159 +28 Partials 125 125 ``` | [Files](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2079?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute) | Coverage Δ | | |---|---|---| | [...vascript/components/explore/ExploreDisplayTabs.jsx](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2079?src=pr&el=tree&filepath=app%2Fjavascript%2Fcomponents%2Fexplore%2FExploreDisplayTabs.jsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute#diff-YXBwL2phdmFzY3JpcHQvY29tcG9uZW50cy9leHBsb3JlL0V4cGxvcmVEaXNwbGF5VGFicy5qc3g=) | `60.41% <ø> (ø)` | | | [app/javascript/components/explore/GenomeView.jsx](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2079?src=pr&el=tree&filepath=app%2Fjavascript%2Fcomponents%2Fexplore%2FGenomeView.jsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute#diff-YXBwL2phdmFzY3JpcHQvY29tcG9uZW50cy9leHBsb3JlL0dlbm9tZVZpZXcuanN4) | `45.07% <22.85%> (-3.86%)` | :arrow_down: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/broadinstitute/single_cell_portal_core/pull/2079/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=broadinstitute)