-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #441 from piotr-gawron/vcf-allel-vis
add bar graph support for VCFs and enable subscribing to variant track clicks (thanks @piotr-gawron!)
- Loading branch information
Showing
13 changed files
with
236 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* @flow | ||
*/ | ||
'use strict'; | ||
|
||
import {expect} from 'chai'; | ||
|
||
import pileup from '../../main/pileup'; | ||
import dataCanvas from 'data-canvas'; | ||
import {waitFor} from '../async'; | ||
|
||
import ReactTestUtils from 'react-addons-test-utils'; | ||
|
||
describe('VariantTrack', function() { | ||
var testDiv = document.getElementById('testdiv'); | ||
|
||
beforeEach(() => { | ||
testDiv.style.width = '700px'; | ||
dataCanvas.RecordingContext.recordAll(); | ||
}); | ||
|
||
afterEach(() => { | ||
dataCanvas.RecordingContext.reset(); | ||
// avoid pollution between tests. | ||
testDiv.innerHTML = ''; | ||
}); | ||
var {drawnObjects} = dataCanvas.RecordingContext; | ||
|
||
function ready() { | ||
return testDiv.getElementsByTagName('canvas').length > 0 && | ||
drawnObjects(testDiv, '.variants').length > 0; | ||
} | ||
|
||
it('should render variants', function() { | ||
var variantClickedData = null; | ||
var variantClicked = function (data) { | ||
variantClickedData = data; | ||
}; | ||
var p = pileup.create(testDiv, { | ||
range: {contig: '17', start: 9386380, stop: 9537390}, | ||
tracks: [ | ||
{ | ||
viz: pileup.viz.genome(), | ||
data: pileup.formats.twoBit({ | ||
url: '/test-data/test.2bit' | ||
}), | ||
isReference: true | ||
}, | ||
{ | ||
data: pileup.formats.vcf({ | ||
url: '/test-data/test.vcf' | ||
}), | ||
viz: pileup.viz.variants(), | ||
options: {onVariantClicked: variantClicked}, | ||
} | ||
] | ||
}); | ||
|
||
return waitFor(ready, 2000) | ||
.then(() => { | ||
var variants = drawnObjects(testDiv, '.variants'); | ||
expect(variants.length).to.be.equal(1); | ||
var canvasList = testDiv.getElementsByTagName('canvas'); | ||
var canvas = canvasList[1]; | ||
expect(variantClickedData).to.be.null; | ||
|
||
//check clicking on variant | ||
ReactTestUtils.Simulate.click(canvas,{nativeEvent: {offsetX: -0.5, offsetY: -15.5}}); | ||
|
||
expect(variantClickedData).to.not.be.null; | ||
p.destroy(); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
##fileformat=VCFv4.1 | ||
##source=VarScan2 | ||
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total depth of quality bases"> | ||
##INFO=<ID=SOMATIC,Number=0,Type=Flag,Description="Indicates if record is a somatic mutation"> | ||
##INFO=<ID=SS,Number=1,Type=String,Description="Somatic status of variant (0=Reference,1=Germline,2=Somatic,3=LOH, or 5=Unknown)"> | ||
##INFO=<ID=SSC,Number=1,Type=String,Description="Somatic score in Phred scale (0-255) derived from somatic p-value"> | ||
##INFO=<ID=GPV,Number=1,Type=Float,Description="Fisher's Exact Test P-value of tumor+normal versus no variant for Germline calls"> | ||
##INFO=<ID=SPV,Number=1,Type=Float,Description="Fisher's Exact Test P-value of tumor versus normal for Somatic/LOH calls"> | ||
##FILTER=<ID=str10,Description="Less than 10% or more than 90% of variant supporting reads on one strand"> | ||
##FILTER=<ID=indelError,Description="Likely artifact due to indel reads at this position"> | ||
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype"> | ||
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality"> | ||
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth"> | ||
##FORMAT=<ID=RD,Number=1,Type=Integer,Description="Depth of reference-supporting bases (reads1)"> | ||
##FORMAT=<ID=AD,Number=1,Type=Integer,Description="Depth of variant-supporting bases (reads2)"> | ||
##FORMAT=<ID=FREQ,Number=1,Type=String,Description="Variant allele frequency"> | ||
##FORMAT=<ID=DP4,Number=4,Type=Integer,Description="Strand read counts: ref/fwd, ref/rev, var/fwd, var/rev"> | ||
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NORMAL TUMOR | ||
20 61795 . G T . PASS DP=81;SS=1;SSC=2;GPV=4.6768E-16;SPV=5.4057E-1;AF=0.7 GT:GQ:DP:RD:AD:FREQ:DP4 0/1:.:44:22:22:50%:16,6,9,13 0/1:.:37:18:19:51.35%:10,8,10,9 | ||
20 62731 . C A,G . PASS DP=68;SS=1;SSC=1;GPV=1.4855E-11;SPV=7.5053E-1;AF=0.4,0.5 GT:GQ:DP:RD:AD:FREQ:DP4 0/1:.:32:17:15:46.88%:9,8,9,6 0/1:.:36:21:15:41.67%:8,13,8,7 | ||
20 61731 . C A,G,T . PASS DP=68;SS=1;SSC=1;GPV=1.4855E-11;SPV=7.5053E-1;AF=0.4,0.6,0.3 GT:GQ:DP:RD:AD:FREQ:DP4 0/1:.:32:17:15:46.88%:9,8,9,6 0/1:.:36:21:15:41.67%:8,13,8,7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
##fileformat=VCFv4.1 | ||
##source=VarScan2 | ||
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total depth of quality bases"> | ||
##INFO=<ID=SOMATIC,Number=0,Type=Flag,Description="Indicates if record is a somatic mutation"> | ||
##INFO=<ID=SS,Number=1,Type=String,Description="Somatic status of variant (0=Reference,1=Germline,2=Somatic,3=LOH, or 5=Unknown)"> | ||
##INFO=<ID=SSC,Number=1,Type=String,Description="Somatic score in Phred scale (0-255) derived from somatic p-value"> | ||
##INFO=<ID=GPV,Number=1,Type=Float,Description="Fisher's Exact Test P-value of tumor+normal versus no variant for Germline calls"> | ||
##INFO=<ID=SPV,Number=1,Type=Float,Description="Fisher's Exact Test P-value of tumor versus normal for Somatic/LOH calls"> | ||
##FILTER=<ID=str10,Description="Less than 10% or more than 90% of variant supporting reads on one strand"> | ||
##FILTER=<ID=indelError,Description="Likely artifact due to indel reads at this position"> | ||
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype"> | ||
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality"> | ||
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth"> | ||
##FORMAT=<ID=RD,Number=1,Type=Integer,Description="Depth of reference-supporting bases (reads1)"> | ||
##FORMAT=<ID=AD,Number=1,Type=Integer,Description="Depth of variant-supporting bases (reads2)"> | ||
##FORMAT=<ID=FREQ,Number=1,Type=String,Description="Variant allele frequency"> | ||
##FORMAT=<ID=DP4,Number=4,Type=Integer,Description="Strand read counts: ref/fwd, ref/rev, var/fwd, var/rev"> | ||
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NORMAL TUMOR | ||
17 9386385 . G T . PASS DP=81;SS=1;SSC=2;GPV=4.6768E-16;SPV=5.4057E-1;AF=0.7 GT:GQ:DP:RD:AD:FREQ:DP4 0/1:.:44:22:22:50%:16,6,9,13 0/1:.:37:18:19:51.35%:10,8,10,9 |