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

Paired end reads linkage in BAM and CRAM file #521

Closed
Kinztan opened this issue Oct 17, 2014 · 25 comments
Closed

Paired end reads linkage in BAM and CRAM file #521

Kinztan opened this issue Oct 17, 2014 · 25 comments
Assignees
Labels
big task this takes a week or more of work feature req this adds new functionality to JBrowse 1 high priority related to a high-level project goal
Milestone

Comments

@Kinztan
Copy link

Kinztan commented Oct 17, 2014

Is there any function that can enable to visualize the paired end links between two pair ends. Just like the broad IGV did, it is quite important to visualize the linkage of pair end sequence to understand their mechanism. Is there any configuration I need to change for that?

@cmdcolin
Copy link
Contributor

Do you have a link for how this looks? I don't think we have this feature

http://www.broadinstitute.org/igv/view_as_pairs

You could however, color by template length, which might give you some ideas for how the paired end reads are linked in a region.

You can do this by using the style.color as a javascript callback (short mailing list thread here with example http://sourceforge.net/p/gmod/mailman/message/32619454/)

Other links
http://gmod.827538.n3.nabble.com/Gmod-ajax-connecting-paired-end-reads-with-Alignments2-td4045949.html

@cmdcolin
Copy link
Contributor

Note that "template_length" would be used in place of "length_on_ref" RE: http://sourceforge.net/p/gmod/mailman/message/32619454/

@selewis
Copy link

selewis commented Oct 18, 2014

Hi Colin,

We should discuss this because we -did- have a means of doing this that
should be re-instituted.

And the data needs to use a standardized method for indicating the pairs so
they may be recognized (not name-based preferably)

-S

On Fri, Oct 17, 2014 at 8:22 AM, Colin Diesh notifications@github.com
wrote:

Note that "template_length" would be used in place of "length_on_ref" RE:
http://sourceforge.net/p/gmod/mailman/message/32619454/


Reply to this email directly or view it on GitHub
#521 (comment).

@Kinztan
Copy link
Author

Kinztan commented Oct 23, 2014

So is that means currently jbrowse still does not have solution on visualizing paired end strands connected each other similar with IGV?

@cmdcolin
Copy link
Contributor

@Kinztan I don't think so although I haven't used IGV with paired end reads.

There are some other features in jbrowse that can sort of help with this however. For example, paired end reads are colored based on whether they are properly paired or whether there is aberrant pairing in jbrowse. This helps you quickly identify the reads that have strange pairing patterns (no mate pair, or abberant mate pair) and can call your attention.

We may also have a further discussion about this as @selewis said

@cmdcolin cmdcolin modified the milestone: 1.11.6 Jan 23, 2015
@cmdcolin
Copy link
Contributor

cmdcolin commented Feb 5, 2015

Some discussion that was sort of tangential was moved to here #560

@rbuels
Copy link
Collaborator

rbuels commented Feb 1, 2018

@scottcain you have some paired reads data that you have been working with at wormbase, could you maybe paste your configuration here?

@rbuels rbuels added feature req this adds new functionality to JBrowse 1 high priority related to a high-level project goal labels Feb 1, 2018
@scottcain
Copy link
Member

@rbuels, as much as I'd like for it to be generally applicable to BAM read pairs, the work I've done with pair ESTs is sufficiently different as to not be very helpful. What I've done hinges on preprocessing the EST match GFF and creating a parent "experimental_feature" feature that has the two match features as children. So it looks kind of like this:

experimental_feature
   match (for the 5' EST)
      match_part
      match_part
   match (for the 3' EST)
      match_part
      match_part

The only way I could see this working for BAM data would be if there were a process in JBrowse that would do the same sort of thing, but I have a hard time believing it would be anywhere near fast enough.

If it's helpful at all, the glyph I wrote is here:

https://github.com/WormBase/website-genome-browsers/blob/est_glyph/jbrowse/jbrowse/plugins/wormbase-glyphs/js/LinkedEST.js

@cmdcolin
Copy link
Contributor

cmdcolin commented Feb 1, 2018

This is a code for connecting bam reads that adds two new glyphs, one using arcs and another with lines https://github.com/elsiklab/apollo_lsaa/tree/master/client/PairedReadViewer

It uses the bam coordinate position of the mate pairs to just draw lines "towards" it's mate

@keiranmraine
Copy link
Contributor

@rbuels , WGS paired end data available here:

ftp://ngs.sanger.ac.uk/production/cancer/dockstore/cgpwgs/

Corresponding ref is Human GRCh37 (no chr prefix)

@rbuels
Copy link
Collaborator

rbuels commented Feb 3, 2018 via email

@rbuels rbuels added this to the 1.15.0 milestone May 2, 2018
@rbuels rbuels modified the milestones: 1.15.0, 1.15.1 May 15, 2018
@rbuels rbuels added the big task this takes a week or more of work label Jul 18, 2018
@rbuels
Copy link
Collaborator

rbuels commented Jul 18, 2018

implementation sketch

  • have a checkbox where you can turn on and off "connect paired reads", I guess it would default to on, but that could be configurable, cause this will have a significant performance hit
  • do the rendering in two passes. fetch all the data in one pass and make sure it's cached, then go through again and search the cache for each read's mate and aggregate them into parent/child features

@rbuels rbuels changed the title Paired end reads linkage in bam file Paired end reads linkage in BAM and CRAM file Jul 18, 2018
@cmdcolin
Copy link
Contributor

The IGV concept of "view as pairs" is probably sort of the idea we want to get at. They have this feature in igv js code here https://github.com/igvteam/igv.js/blob/master/js/bam/bamSource.js

An igv screenshot shows the idea, especially related to revealing structural issues like deletion it is great.

screenshot is near bottom of page here https://bioinformaticsdotca.github.io/BiCG_2017_module2_igv

@cmdcolin
Copy link
Contributor

A cursory look at the igvjs code looks like it is a bit different from the block based rendering that jbrowse uses. It gets a large "alignmentContainer" that gets all alignments within the current view plus a bit outside the boundaries of the view too. Then, when you scroll sideways far enough, it will then reload the "alignmentContainer" with new reads, and redo pairings. This type of strategy is something that can probably be emulated with the JBrowse codebase but it would be sort of a different strategy than the block based style track/store that is used in most tracks.

@rbuels
Copy link
Collaborator

rbuels commented Jul 21, 2018 via email

@cmdcolin
Copy link
Contributor

Nice idea. I'll see what that might entail...it sounds pretty reasonable

@cmdcolin
Copy link
Contributor

At least one scenario that is difficult when just looking at a small block-by-block basis is if a BAM pair is on either side of a block, then the block will basically have no knowledge of it.

Example, this view works at a zoomed out level with several pairs going across the deletion, but if you zoom in, such that you are inside the deletion, it looks glitchy.

Here's the nice non glitchy screenshot though :)
screenshot-localhost-2018 07 25-09-54-41

@scottcain
Copy link
Member

The alignmentContainer thing would be basically making the track one big glyph--that way everything knows about everything else in the view (and a little nearby, I imagine). It wouldn't be too hard to implement; it would be similar to what I did to make the paired ESTs work (though I built the "super object" by preprocessing the GFF). It would certainly work, but would it be performant?

@scottcain
Copy link
Member

Another thing that would be nice about the track being a single large glyph is that you'd be able to do things that are typically hard to do in a track, like sorting on arbitrary things: are they paired or not, are there splice junctions or not. Could make for a really nice display, putting the "important" things at the top of the track.

@rbuels rbuels modified the milestones: 1.15.1, 1.16.0 Aug 1, 2018
@cmdcolin
Copy link
Contributor

cmdcolin commented Aug 1, 2018

We reviewed example read pairing code from PairedReadViewer and looked at what our steps will probably be for obtaining solid functionality for this. Steps are probably as follows

step 1 refactor remotebinarystore with query aggregation
step 2 refactor bam module with query agg with read pairing
step 3 add pairing
step 4 add redispatching for region around current view
step 5 pull in pairedreadviewer glyphs

@cmdcolin
Copy link
Contributor

This was delivered in JBrowse 1.16.0!

Please give it a try and make new bugs if there are any issues or suggestions

@cmdcolin cmdcolin added this to the 1.16.0 milestone Dec 19, 2018
@cmdcolin cmdcolin added this to To do in JBrowse team board via automation Dec 19, 2018
@cmdcolin
Copy link
Contributor

@rbuels rbuels moved this from To do to Done in JBrowse team board Dec 30, 2018
@malonge
Copy link

malonge commented Dec 21, 2022

Hi there! Is this feature available on JBrowse2? It would be a very useful addition.

@cmdcolin
Copy link
Contributor

@malonge we recently added "Arc view" and "Read cloud" view to jbrowse 2, which helps show paired reads as linked entities

Some info here https://jbrowse.org/jb2/blog/2022/12/15/v2.3.1-release/

It doesn't draw the pairs using the "stacked layout" like you'd normally see, but instead draws arcs (for the "Arc view") or lays them out stratified by "insert size" on the y-axis (for the "Read cloud")

We may add the normal "stacked" layout as a feature in the future, but hopefully this helps :)

Some example links

@malonge
Copy link

malonge commented Dec 21, 2022

awesome thank you! looks like I need to update to a newer version of JBrowse2 (I am still using v2.0.1). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
big task this takes a week or more of work feature req this adds new functionality to JBrowse 1 high priority related to a high-level project goal
Projects
Development

No branches or pull requests

7 participants