Skip to content

Commit

Permalink
Color alignmet insert sizes only if they are paired
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 19, 2018
1 parent 71b6358 commit 3dbb199
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/JBrowse/Store/SeqFeature/BAM.js
Expand Up @@ -27,6 +27,7 @@ class BamSlightlyLazyFeature {
_get_pair_orientation() { return this.record.getPairOrientation()}
_get_unmapped() { return this.record.isSegmentUnmapped()}
_get_next_seq_id() { return this.record.isPaired() ? this._store._refIdToName(this.record._next_refid()) : undefined }
_get_is_paired() { return this.record.isPaired() }
_get_next_pos() { return this.record.isPaired() ? this.record._next_pos() : undefined }
_get_next_segment_position() { return this.record.isPaired()
? ( this._store._refIdToName(this.record._next_refid())+':'+(this.record._next_pos()+1)) : undefined}
Expand Down
1 change: 1 addition & 0 deletions src/JBrowse/Store/SeqFeature/CRAM.js
Expand Up @@ -32,6 +32,7 @@ class CramSlightlyLazyFeature {
_get_multi_segment_first() { return this.record.isRead1()}
_get_multi_segment_last() { return this.record.isRead2()}
_get_multi_segment_next_segment_reversed() { return this.record.isMateReverseComplemented()}
_get_is_paired() { return !!this.record.mate }
_get_unmapped() { return this.record.isSegmentUnmapped()}
_get_template_length() { return this.record.templateLength || this.record.templateSize}
_get_next_seq_id() { return this.record.mate ? this._store._refIdToName(this.record.mate.sequenceId) : undefined }
Expand Down
17 changes: 10 additions & 7 deletions src/JBrowse/View/FeatureGlyph/AlignmentColoring.js
Expand Up @@ -80,13 +80,16 @@ var AlignmentColoring = {
},

colorByOrientation(feature, score, glyph, track) {
if (feature.get('seq_id') != feature.get('next_seq_id')) {
return 'orange'
} else if (track.upperPercentile < Math.abs(feature.get('template_length'))) {
return 'red'
} else if (track.lowerPercentile > Math.abs(feature.get('template_length'))) {
return 'pink'
if (feature.get('is_paired')) {
if(feature.get('seq_id') != feature.get('next_seq_id')) {
return 'orange'
} else if (track.upperPercentile < Math.abs(feature.get('template_length'))) {
return 'red'
} else if (track.lowerPercentile > Math.abs(feature.get('template_length'))) {
return 'pink'
}
}

const type = Util.orientationTypes[track.config.orientationType]
const orientation = type[feature.get('pair_orientation')]
const map = {
Expand All @@ -100,7 +103,7 @@ var AlignmentColoring = {
},

colorByInsertDistance(feature, score, glyph, track) {
if (feature.get('seq_id') != feature.get('next_seq_id')) {
if (feature.get('is_paired') && feature.get('seq_id') != feature.get('next_seq_id')) {
return 'orange'
}

Expand Down
2 changes: 1 addition & 1 deletion src/JBrowse/View/Track/BlockBased.js
Expand Up @@ -958,7 +958,7 @@ return declare( [Component,DetailsMixin,FeatureFiltererMixin,Destroyable],
new TrackConfigEditor( that.config )
.show( function( result ) {
// replace this track's configuration
that.browser.cookie('track-' + that.name, JSON.stringify(result.config));
that.browser.cookie('track-' + that.name, JSON.stringify(result.conf));
that.browser.publish( '/jbrowse/v1/v/tracks/replace', [result.conf] );
});
}
Expand Down

0 comments on commit 3dbb199

Please sign in to comment.