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

Add better inversion visualization to read vs reference visualizations #2198

Merged
merged 11 commits into from
Aug 10, 2021

Conversation

cmdcolin
Copy link
Collaborator

@cmdcolin cmdcolin commented Aug 9, 2021

In the past PR #2024 the strand got ignored in read vs ref because after drawing negative strand alignments was added to the renderer, it was realized that strand was not specified correctly at that time of loading the data for read vs ref visualizations

This change makes the read vs reference strand become relative to the "original strand" the feature was on.

Intuitively if a read is on the forward strand, switches to the reverse, and back to forward

----->   <------ ----->

And the left most is the "primary" alignment (the rest are supplementary/split read alignments) then the strands are 1 for primary, -1 and then 1 for supp

But also the data can come in like

<------ -------> <------

This is fundamentally equivalent but the data is just from a reverse strand template. Therefore we flip the read orientation relative to the original strand when we plot it

Example showing inversion
localhost_3000__config=test_data%2Fconfig_demo json session=local-6er93LMsa

In this case the supplementary alignments do not store their cigar strings in the SA tag, so they are not plotted, but the data should otherwise be accurate. The overhand of the inverted polygon with the left side is also I believe expected. We can look at the SA tag and see that it says 5002 bases soft clipped for the inverted part, and this directly corresponds to it starting at position 5002 on the bottom panel (since the bottom panel is the literal sequence, it is just starting at position 5002 because thats how many bases are clipped off)

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Aug 9, 2021
@codecov
Copy link

codecov bot commented Aug 9, 2021

Codecov Report

Merging #2198 (9a25fb0) into main (ba45e95) will decrease coverage by 0.16%.
The diff coverage is 1.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2198      +/-   ##
==========================================
- Coverage   62.71%   62.54%   -0.17%     
==========================================
  Files         484      484              
  Lines       22641    22702      +61     
  Branches     5141     5151      +10     
==========================================
  Hits        14200    14200              
- Misses       8171     8232      +61     
  Partials      270      270              
Impacted Files Coverage Δ
...lignmentsFeatureDetail/AlignmentsFeatureDetail.tsx 41.42% <0.00%> (-1.22%) ⬇️
plugins/dotplot-view/src/index.ts 31.69% <0.00%> (-7.79%) ⬇️
plugins/linear-comparative-view/src/index.tsx 24.07% <0.00%> (-3.30%) ⬇️
products/jbrowse-web/src/sessionModelFactory.ts 58.18% <0.00%> (-0.90%) ⬇️
...otplot-view/src/DotplotRenderer/DotplotRenderer.ts 66.25% <33.33%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba45e95...9a25fb0. Read the comment docs.

@cmdcolin
Copy link
Collaborator Author

cmdcolin commented Aug 9, 2021

localhost_3000__config=test_data%2Fconfig_demo json session=local-6er93LMsa (1)
figure trying to help explain/confirm the overlap seen

@cmdcolin
Copy link
Collaborator Author

cmdcolin commented Aug 9, 2021

Actually the overhang went away with 79c662f which is more expected...the breakpoint of the inversion is quite sharp so no overhang is expected. The coding issue is that the clipping needs to be read from the end of the cigar string instead of the front in this case, and the getClip function actually had that designed in...

Screenshot looks cleaner now

localhost_3000__config=test_data%2Fconfig_demo json session=local-_9VqSMY9Wt

@cmdcolin cmdcolin force-pushed the inversion_plotting_read_vs_ref branch from a4dd0df to 9a25fb0 Compare August 9, 2021 12:53
@cmdcolin
Copy link
Collaborator Author

cmdcolin commented Aug 9, 2021

Added a couple more updates from an older branch, the aim of which is to merge overlapping or close-to-overlapping reference genome intervals on the top panel instead of breaking them into separate displayedRegions which gives better continuity I think

Some screenshots

localhost_3000__config=test_data%2Fconfig_demo json (1)

localhost_3000__config=test_data%2Fconfig_demo json session=local-OTUvk8w1I

@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 Aug 9, 2021
@cmdcolin cmdcolin merged commit b5cb5ab into main Aug 10, 2021
@cmdcolin cmdcolin deleted the inversion_plotting_read_vs_ref branch August 10, 2021 12:36
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.

1 participant