A JBrowse plugin that adds some custom glyphs for variants on a "multi VCF" file (VCF with multiple samples)
MultiVariantViewer/View/Track/Grid
- displays all genotypes for featuresMultiVariantViewer/View/Track/LDTrack
- displays ld triangle on the genome browserMultiVariantViewer/View/Track/Matrix
- displays all genotypes for features in matrix form
style->height
- Pixel height for each sample. Default: 12 for grid, 1 for matrixstyle->offset
- Pixel offset between each sample. Default: 0style->ref_color
- Color for reference allele. Default greystyle->het_color
- Color for heterozygous allele. Default cyanstyle->hom_color
- Color for homozygous allele. Default bluestyle->no_call
- Color for no call allele. Default whitestyle->matrixColor
- If you make ref_color, het_color, no_call and hom_color null, then this function is called to determine the color. See below for function prototype
The matrixColor callback can change those colors if ref_color/het_color/hom_color are set to null. The matrixColor function signature is function(feature, type, genotype)
where type
is either 'ref', 'nocall', or 'alt' and genotype
is the actual genotype as 0|0 or 0|1 or similar and feature
contains all info about a particular variant
showLabels
- Display subtrack labels (default: true)showTooltips
- Display mouseover tooltips with subtrack name and description (default: true)clickTooltips
- Display tooltips on click instead of mouseover if showTooltips is true (default: false)labelFont
- Specify subtrack label font CSS e.g. "6px sans-serif"labelWidth
- Specify a specific width for all subtrack labels. Default autosizes to each sublabel's length, which can look uglyincludeIndels
- Include indels. Default false since if these are overlapping it will complicate the display. By default only renders things with type SNV
sublabels
- An array of structures like {"name": "sample1", "color": "red", "description": "Optional description or sample displayed on mouseover", "population": "CEU"}sublabelsCsv
- A CSV file containing columns name,color,population (put a header for the column names in the CSV). Then set "sublabelsCsv": "sublabels.csv" for examplesortByPopulation
- Sorts samples by population specified in sublabels. Also available from track menusortBySublabels
- Sorts samples by the order of the sublabels in the config
The sublabels are optional, and the sample names from the VCF are shown if not specified, but coloring the labels and things can be added via sublabels
style.elt
the height of a single element of the matrix
ldviewer
- URL for the linkage_server service. Default http://localhost:4730/maf
- Set minor allele frequency cutoff. Default 0.01
[tracks.variant]
urlTemplate=file.vcf.gz
storeClass=JBrowse/Store/SeqFeature/VCFTabix
type=MultiVariantViewer/View/Track/Grid
showLabels=true
[tracks.matrix]
urlTemplate=file.vcf.gz
storeClass=JBrowse/Store/SeqFeature/VCFTabix
type=MultiVariantViewer/View/Track/Matrix
Assumes that the ldserver is running on port 4730 on localhost. Of course change localhost if serving to the public, and you may also want to reverse proxy the port onto port 80 to avoid any weird firewall blocking that would be the consequence of serving on a different port
[tracks.matrix]
urlTemplate=file.vcf.gz
storeClass=JBrowse/Store/SeqFeature/VCFTabix
type=MultiVariantViewer/View/Track/LDTrack
ldserver=http://localhost:4730/
You can also add colors and population info for the subtrackl labels
[tracks.variant_with_colors]
urlTemplate=file.vcf.gz
storeClass=JBrowse/Store/SeqFeature/VCFTabix
type=MultiVariantViewer/View/Track/Grid
showLabels=true
labelFont=4px sans-serif
style.height=10
sublabels+=json:{"name": "sample1", "color": "blue", "description": "mouseover description", "population": "CEU"}
sublabels+=json:{"name": "sample2", "color": "red", "description": "mouseover description", "population": "CEU"}
Note that sublabel config is not necessarily, it is only used to add colors and population info
Also note that adding style.height=10 sets how tall each subtrack is.
The above configs are tracks.conf based, but you can do the same thing in trackList.json too
In trackList.json format
{
"type": "MultiVariantViewer/View/Track/Grid",
"urlTemplate": "variants.vcf.gz",
"label": "Variant track",
"storeClass": "JBrowse/Store/SeqFeature/VCFTabix",
"showLabels": true
}
See test subdirectory for example, you can use http://localhost/jbrowse/?data=plugins/MultiVariantViewer/test/data to see the sample data
Shows 1000genomes VCF data, tooltips on sidebar
Displays matrix of variants
Shows LD
Clone the repo to your plugins directory and name it MultiVariantViewer
git clone https://github.com/cmdcolin/multivariantviewer MultiVariantViewer
Then add it to your jbrowse config
"plugins": ["MultiVariantViewer"]
See http://gmod.org/wiki/JBrowse_FAQ#How_do_I_install_a_plugin for more details
Optionally, LD can be calculated from the VCF files on the server side using plink and rendered as a classic block view.
- tabix
- plink2 aka plink 1.9
npm install
node linkage_server/index.js
You might also find it useful to use a node.js taskrunner like forever or pm2