Question: Gviz - display/indicate soft-clipped bases - indicate supplementary alignments
0
gravatar for thackl
3.1 years ago by
thackl0
thackl0 wrote:

I am using Gviz to visualize mappings of PacBio data (bam files) onto contigs. I was wondering if there is any way to display soft-clipped bases at read ends, or at least indicate reads with soft-/hard-clipped ends. That would help a lot in spotting structural variations and potential misassemblies.

Similarly, being able to indicate supplementary alignments of the same query read - e.g. display them in the same way as gapped mappings - would help a lot.

Would be great if anyone had an idea on how this can be done with Gviz. (I am also open to alternative approaches)

gviz bam pacbio • 704 views
ADD COMMENTlink modified 3.1 years ago by florian.hahne@novartis.com1.6k • written 3.1 years ago by thackl0
Answer: Gviz - display/indicate soft-clipped bases - indicate supplementary alignments
1
gravatar for Hervé Pagès
3.1 years ago by
Hervé Pagès ♦♦ 14k
United States
Hervé Pagès ♦♦ 14k wrote:

Hi,

A blunt approach would be to segregate the alignments first (i.e. before using Gviz) and then display each group separately by creating one AlignmentsTrack object per group. For example separating the soft-clipped alignments from the non-soft-clipped ones could be done by splitting the GAlignments object containing the reads with split(gal, grepl("S", cigar(gal))). The result is a GAlignmentsList object of length 2 with 1 list element per group. To separate the secondary alignments from the primary ones you can either load the 2 groups from the BAM file separately (by calling readGAlignments() twice and passing a ScanBamParam object with the appropriate scanBamFlag() each time) or load all the alignments with the flag field as a metadata column and split the GAlignments object with split(gal, bamFlagAsBitMatrix(mcols(gal)$flag, "isSecondaryAlignment")).

The resulting plot might not be very appealing though so hopefully there is a better way to go...

H.

ADD COMMENTlink written 3.1 years ago by Hervé Pagès ♦♦ 14k

I like the idea of splitting into clipped/non-clipped reads. But as you said, it is a practical, but not really satisfying solution :)

ADD REPLYlink written 3.1 years ago by thackl0
Answer: Gviz - display/indicate soft-clipped bases - indicate supplementary alignments
1
gravatar for florian.hahne@novartis.com
3.1 years ago by
Switzerland

I guess we could indicate the soft-clipping information for the individual reads in a similar fashion as it is done in IGV. This involves parsing the CIGAR string, and I am not sure how complex that is going to be. Will take a look at this if I find the time, but this is certainly not going to be a quick fix.

Florian

ADD COMMENTlink written 3.1 years ago by florian.hahne@novartis.com1.6k

Yes, that's what I was afraid of. But rather than including the entire stretch of unmapped bases (as IGV does and which needs to be accounted for in stacking etc), would it be possible to just color or mark the start/end of  a read if the cigar starts/ends with an S/H?

ADD REPLYlink written 3.1 years ago by thackl0

Still means that we have to touch the CIGAR string for each read. Whether we parse the whole thing or just look for the heads and tails doesn't make much of a difference.The drawing later on is already vectorized, and breaking up a read stretch into sub-sections doesn't make much of a difference as far as I can tell.

If you feel compelled please go ahead and take a look at the Gviz source code. Maybe you can come up with a quick solution before I find the time to look at this.

ADD REPLYlink written 3.1 years ago by florian.hahne@novartis.com1.6k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 199 users visited in the last hour