Skip to content

Commit

Permalink
Add inversions to our simulated volvox bam file
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 31, 2018
1 parent 7e8b162 commit 410e090
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 22 deletions.
Binary file modified docs/tutorial/data_files/volvox-sv.bam
100644 → 100755
Binary file not shown.
Binary file modified docs/tutorial/data_files/volvox-sv.bam.bai
100644 → 100755
Binary file not shown.
59 changes: 57 additions & 2 deletions src/JBrowse/View/FeatureGlyph/Alignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,54 @@ define([
MismatchesMixin
) {

// adapted from igv.js, illumina standard --> <-- pairs are fr https://software.broadinstitute.org/software/igv/interpreting_pair_orientations
var orientationTypes = {
"fr": {

"F1R2": "LR",
"F2R1": "LR",

"F1F2": "LL",
"F2F1": "LL",

"R1R2": "RR",
"R2R1": "RR",

"R1F2": "RL",
"R2F1": "RL"
},

"rf": {

"R1F2": "LR",
"R2F1": "LR",

"R1R2": "LL",
"R2R1": "LL",

"F1F2": "RR",
"F2F1": "RR",

"F1R2": "RL",
"F2R1": "RL"
},

"ff": {

"F2F1": "LR",
"R1R2": "LR",

"F2R1": "LL",
"R1F2": "LL",

"R2F1": "RR",
"F1R2": "RR",

"R2R1": "RL",
"F1F2": "RL"
}
};

return declare( [BoxGlyph,MismatchesMixin], {

constructor: function() {
Expand All @@ -30,8 +78,14 @@ return declare( [BoxGlyph,MismatchesMixin], {
style: {
color: function( feature, path, glyph, track ) {
var strand = feature.get('strand');
if(Math.abs(strand) != 1 && strand != '+' && strand != '-')
if(Math.abs(strand) != 1 && strand != '+' && strand != '-') {
return track.colorForBase('reference');
}
else if(track.config.colorByOrientation) {
const type = orientationTypes[track.config.orientationType]
const orientation = type[feature.get('pair_orientation')]
return {"LR": "grey", "RR": "navy", "RL": "teal", "LL": "green" }[orientation];
}
else if(track.config.useXS) {
var xs = feature.get('xs')
var strand={'-':'color_rev_strand','+':'color_fwd_strand'}[xs];
Expand Down Expand Up @@ -99,7 +153,8 @@ return declare( [BoxGlyph,MismatchesMixin], {
height: 7,
marginBottom: 1,
showMismatches: true,
mismatchFont: 'bold 10px Courier New,monospace'
mismatchFont: 'bold 10px Courier New,monospace',
orientationType: 'fr'
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/JBrowse/View/FeatureGlyph/PairedAlignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ renderConnector( context, fRect ) {
_defaultConfig() {
return this._mergeConfigs(dojo.clone( this.inherited(arguments) ), {
readCloudLog: true,
readCloudStretch: 50,
readCloudStretch: 20,
style: {
connectorColor: '#333',
connectorThickness: 1,
Expand Down
24 changes: 5 additions & 19 deletions src/JBrowse/View/Track/Alignments2.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ return declare( [ CanvasFeatureTrack, AlignmentsMixin ], {
glyph: 'JBrowse/View/FeatureGlyph/Alignment',
maxFeatureGlyphExpansion: 0,
maxFeatureScreenDensity: 15,
colorByOrientation: true,
orientationType: 'fr',

hideDuplicateReads: true,
hideQCFailingReads: true,
Expand Down Expand Up @@ -141,26 +143,10 @@ return declare( [ CanvasFeatureTrack, AlignmentsMixin ], {
});
displayOptions.push({
label: 'Color by pair orientation',
type: 'dijit/RadioMenuItem',
group: 'g2',
type: 'dijit/CheckedMenuItem',
checked: this.config.colorByOrientation,
onClick: function(event) {
thisB.config.viewAsPairs = true
thisB.config.style.color = feat => {
if(feat.pairedFeature()) {
const ret = feat.getPairOrientation()
if(ret == 'F1R2') {
return 'green'
} else if(ret == 'R1R2') {
return 'red'
} else if(ret == 'F1F2') {
return 'purple'
} else if(ret == 'R1F2') {
return 'orange'
}
}
return 'grey'
}
thisB.config.glyph = 'JBrowse/View/FeatureGlyph/PairedAlignment'
thisB.config.colorByOrientation = this.get('checked');
thisB.browser.publish('/jbrowse/v1/v/tracks/replace', [thisB.config]);
}
});
Expand Down

0 comments on commit 410e090

Please sign in to comment.