Mismatches show up as grey boxes in stead of the base that is the mismatch #516

Closed
thondeboer opened this Issue Sep 29, 2014 · 3 comments

Comments

Projects
None yet
2 participants
@thondeboer

I have a BAM file that was created with BWA, 0.7.10 that contains MD tags, but the JBRowse 1.11.4 we have does not seem to show the bases in most cases. The reads has a MD tag (See second screenshot) and you can also see on the right side of the first screenshot that SOME reads DO show the mismatch...

Why does my read show a grey box?
NOTE: The read that is showing the SNP is in a read that is a supplementary read...Could that be the reason it does not render the read correctly?

image

image

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Sep 29, 2014

Contributor

Would you be able to export a small snippet of the BAM data with samtools view for testing? The sample data that's part of jbrowse doesn't appear to have supplementary alignments.

+Thanks for the report

Contributor

cmdcolin commented Sep 29, 2014

Would you be able to export a small snippet of the BAM data with samtools view for testing? The sample data that's part of jbrowse doesn't appear to have supplementary alignments.

+Thanks for the report

@thondeboer

This comment has been minimized.

Show comment
Hide comment
@thondeboer

thondeboer Sep 29, 2014

Here's the whole BAM file set...It's only 5 megs, so got you the whole file...
https://www.dropbox.com/s/pkog4087wo2v6s1/JBrowse.zip?dl=0

Here's the whole BAM file set...It's only 5 megs, so got you the whole file...
https://www.dropbox.com/s/pkog4087wo2v6s1/JBrowse.zip?dl=0

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Oct 2, 2014

Contributor

Thanks for sharing this. From what I can tell, JBrowse is using both the CIGAR and the MD string to call SNPs. To do so, it does some arithmatic on getTemplateCoord, but I think this arithmetic is doing the wrong thing in the case of hard clipping because in the case of hard clipping, the bases are actually removed from the template!

Proposed patch:

diff --git a/src/JBrowse/Store/SeqFeature/_MismatchesMixin.js b/src/JBrowse/Store/SeqFeature/_MismatchesMixin.js
index 72968a0..b59e54e 100644
--- a/src/JBrowse/Store/SeqFeature/_MismatchesMixin.js
+++ b/src/JBrowse/Store/SeqFeature/_MismatchesMixin.js
@@ -126,7 +126,7 @@ return declare( null, {
             for( var i = 0; i < cigarOps.length && refOffset <= refCoord ; i++ ) {
                 var op  = cigarOps[i][0];
                 var len = cigarOps[i][1];
-                if( op == 'H' || op == 'S' || op == 'I' ) {
+                if( op == 'S' || op == 'I' ) {
                     templateOffset += len;
                 }
                 else if( op == 'D' || op == 'N' || op == 'P' ) {
Contributor

cmdcolin commented Oct 2, 2014

Thanks for sharing this. From what I can tell, JBrowse is using both the CIGAR and the MD string to call SNPs. To do so, it does some arithmatic on getTemplateCoord, but I think this arithmetic is doing the wrong thing in the case of hard clipping because in the case of hard clipping, the bases are actually removed from the template!

Proposed patch:

diff --git a/src/JBrowse/Store/SeqFeature/_MismatchesMixin.js b/src/JBrowse/Store/SeqFeature/_MismatchesMixin.js
index 72968a0..b59e54e 100644
--- a/src/JBrowse/Store/SeqFeature/_MismatchesMixin.js
+++ b/src/JBrowse/Store/SeqFeature/_MismatchesMixin.js
@@ -126,7 +126,7 @@ return declare( null, {
             for( var i = 0; i < cigarOps.length && refOffset <= refCoord ; i++ ) {
                 var op  = cigarOps[i][0];
                 var len = cigarOps[i][1];
-                if( op == 'H' || op == 'S' || op == 'I' ) {
+                if( op == 'S' || op == 'I' ) {
                     templateOffset += len;
                 }
                 else if( op == 'D' || op == 'N' || op == 'P' ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment