From 85a640ab98a3957966ca598eb05aff858bc7c726 Mon Sep 17 00:00:00 2001 From: George Tollefson Date: Thu, 4 Apr 2019 15:14:19 -0400 Subject: [PATCH] fix(plot_Utils.Jl): fix read_depth heatmap color pallete when grouped --- docs/src/examples.md | 139 ++++--------------------------------------- docs/src/index.md | 2 +- src/plot_utils.jl | 13 ++-- test/.DS_Store | Bin 8196 -> 8196 bytes 4 files changed, 20 insertions(+), 134 deletions(-) diff --git a/docs/src/examples.md b/docs/src/examples.md index 9124d7d..7d7f6fd 100644 --- a/docs/src/examples.md +++ b/docs/src/examples.md @@ -1,133 +1,20 @@ -# Plotting +# Examples -##General notes: visualization options +## Default Options -Here we describe VIVA options for plotting. All plots can be generated in a single command. +Running VIVA with no options produces heatmaps of genotype and read depth values for all samples and variant positions in the VCF file with default options. You can read about VIVA's default settings [here](https://compbiocore.github.io/VariantVisualization.jl/stable/#default-options) -VIVA orders all variants by chromosomal location for plotting. +![Default Genotype Heatmap](assets/VIVA_logo.png) +![Default Read Depth Heatmap](assets/VIVA_logo.png) -VIVA graphics are generated with PlotlyJS.jl. Graphics can be saved in *HTML*, *PDF*, *SVG*, *PNG*, and *EPS* formats. +## Generate All VIVA Plots While Grouping Samples by Metadata Traits -To create *interactive visualization* files, save VIVA's graphics in HTML format. These files are sharable and support cursor hoverlabels, zooming, panning, and PNG screen capture. Cursor hoverlabel displays genomic position, sample id, and data value for each data point in heatmap and scatter plot visualizations. We recommend saving graphics to HTML for data exploration. +Group samples by sequencing facility and generate heatmaps of genotype and read depth values as well as scatter plots of average read depth for both all selected samples and all selected variant positions. -To create *publication quality, scalable graphics* for presentations and publications, we recommend saving graphics as PDF. +You can find grouping options [here]([options](https://compbiocore.github.io/VariantVisualization.jl/stable/filtering_vcf/#selecting-and-grouping-samples) to group samples by common traits.) -## Genotype and read depth heatmaps - -Plot a categorical heatmap of genotype values and a continuous value heatmap of read depth (coverage) values. - -*flags*: `--heatmap`,`-m` - -*arguments*: `genotype`, `read_depth`, or `genotype,read_depth` - -default: `genotype,read_depth` (plots both) - -``` -julia VIVA -f example.vcf -m genotype -``` - -## Average read depth scatter plots - -Generate scatter plots of average read depths across either samples or variants. Caps outlier read depth values at 100 to optimize resolution of visualization of values under 50. - - -*flags*: `--avg_dp` - -*arguments*: `samples`, `variants`, or `samples,variants` - -default: `none` - -``` -julia VIVA -f example.vcf --avg_dp variants -``` - -## Save file format - -Specify file format you wish to save all graphics as (eg. pdf, html, png). [REQUIRED] - -*flags*: `--save_format`, `-s` - -*arguments*: `html`, `pdf`, `svg`, `png`, `eps` - -default: `html` - -``` -julia VIVA -f example.vcf --avg_dp variants -``` - -## Output directory - -Specify output directory for saving all graphics. If directory doesn't exist, it creates the directory within the working directory. Defaults to "output." - -Select directory to save output files. If path doesn't exist, creates new directory. - -*flags*: `--output_directory`, `-o` - -*arguments*: filepath - -default: `output` - -``` -julia VIVA -f example.vcf -o my_output_directory -``` - -## Title - -Specify title to display on heatmap and use as filename for saving heatmap files. Use underscores instead of spaces. Underscores will be replaced with spaces in the heatmap title. - -*flags*: `--heatmap_title`, `-t` - -*arguments*: title_text - -default: original vcf filename - -``` -julia VIVA -f example.vcf -t your_heatmap_title -``` - -## Y-axis label options - -Choose an option for displaying y-axis ticklabels showing the genomic position of variants on heatmaps and scatter plots. - -*flags*: `--y_axis_labels`, `-y` - -*arguments*: `chromosomes`, `positions`, `hoverlabels_only` - -`chromosomes` separates chromosomes by adding chromosome label on the first variant of each new chromosome. -`positions` labels every variant position (recommended only for visualizing a few variants e.g. <20) -`hoverlabels_only` no genomic position labels - -default: `chromosomes` - -``` -julia VIVA -f example.vcf `-y` `hoverlabels_only` -``` - -## X-axis label options - -Choose an option for displaying x-axis ticklabels showing the sample id of samples included heatmaps and scatter plots. - -*flags*: `--x_axis_labels`.`x` - -*arguments*: if `true`, displays samples names labels on x-axis. if `false`, does not display x-axis sample labels. - -default: `true` - -``` -julia VIVA -f example.vcf `-x` -``` - -## Export heatmap data as numerical array - -Save input array to heatmap function with column and row labels. -Specifically, saves numerical array of genotype or read depth values for selected variants and samples as a .csv table with genomic positions and sample names for row names and column names respectively. - -*flags*: `--num_array`, `-n` - -*arguments*: none, this is a positional argument. - -``` -julia VIVA -f example.vcf `-n` -``` - - +![Grouped Genotype Heatmap](assets/VIVA_logo.png) +![Grouped Read Depth Heatmap](assets/VIVA_logo.png) +![Grouped Variant Average Read Depth Scatter Plot](assets/VIVA_logo.png) +![Grouped Sample Average Read Depth Scatter Plot](assets/VIVA_logo.png) + \ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md index d515769..35d9051 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -2,7 +2,7 @@ # Getting Started -### *Command Line Tool and Jupyter Notebook* +# *VIVA Command Line Tool and Jupyter Notebook* ## Description diff --git a/src/plot_utils.jl b/src/plot_utils.jl index 7b92517..baec34d 100644 --- a/src/plot_utils.jl +++ b/src/plot_utils.jl @@ -140,6 +140,8 @@ h_line_index_list = generate_hline_indices(number_rows,input) zauto=false,zmax=3,zmin=-2, transpose=true, + + #= colorscale = [ [0, "rgb(210, 213, 219)"], #light grey [0.2, "rgb(123, 125, 130)"], #dark grey @@ -149,8 +151,7 @@ h_line_index_list = generate_hline_indices(number_rows,input) [0.8, "rgb(65,165,137)"], #green [1, "rgb(251,231,65)"] #yellow ], - - #= +=# colorscale = [ [0, "rgb(174, 145, 255)"], #purple @@ -162,8 +163,6 @@ h_line_index_list = generate_hline_indices(number_rows,input) [1, "rgb(251,231,65)"] #yellow ], - =# - gridcolor = "#E2E2E2", showscale = true, colorbar = attr(tickvals = [-2, -1, 0, 1, 2, 3], @@ -344,7 +343,7 @@ function dp_heatmap2_with_groups(input::Array{Int64,2},title::String,chrom_label transpose=true, - +#= colorscale = [ [0, "rgb(210, 213, 219)"], #light grey @@ -356,7 +355,7 @@ function dp_heatmap2_with_groups(input::Array{Int64,2},title::String,chrom_label [1, "rgb(0,64,168)"] ], - #= + =# colorscale = [ [0, "rgb(174, 145, 255)"], #purple [0.125, "rgb(255, 220, 145)"], #gold @@ -366,7 +365,7 @@ function dp_heatmap2_with_groups(input::Array{Int64,2},title::String,chrom_label [0.5625, "rgb(43,124,255)"], [1, "rgb(0,64,168)"] ], - =# + colorbar = attr(tickvals = [-60, -40, -20, 0, 20, 40, 60, 80, 99], title="Depth / Trait", diff --git a/test/.DS_Store b/test/.DS_Store index a201f4e886d1603cff119981277e96bfa49a991c..2769642b585bbc588b53565221c88af4355de031 100644 GIT binary patch delta 1207 zcmeIxO-K}B7zgn8Z>jIVl<$sT>)1Ayl^L5KX|h(jOQ{(eR<55#vbwJ{sJrIOuGXPN zvJa|5G}WmvsV*Ht(vC_-Msz93OCJP59lF@fOHjSLdN z9?BY|wy1pg!?r^y=whS@a8Lp;b{tn63C&dy<(ao09Vefk?SM}h9pL)Wo0Qb>5mu-bU>0+6m?>}eY;yen_#gVe3*GW&&;J60e zG(JunpD`wAG#EXY2tJ}kdCPqEz!3#${n5gmMw9CPmXuNrG54$tpeMGz9@9oT1cU~Xl^YnlUQre z=U0PN5&5=N{Gjp*iM2(|-=>@6RbE_MC9(EExVKjgMRW_C^JTY(F=H}=B{Lf{-ely* z?4DARctj$QJmMm?WDDscePo!NBIn2`87FthUGjvyAg{?gGDkj=&*TgFO1>cp$w)ye z(!o#&2Z~S(7pmcg2MySU?bv}PbfOD>1fZZ7I{FdC0FK}oj^hMQ!hRZ;FpA5#f}41N zNlf7prtuszn8ho+#~eNxM&>SAuB)%34ZpW?{n<)z}aZ38P`Y~L<{;v zN(8$pLx|l|WDfsQYlgfeAGp+a5bl$P3@)^k>y)4}p;LoeY(yg$YG^_;TCoRS_&8G! zf}AOgK@4FShj182=c!KN49?;_F5n`r;u^+q9XBwJ3EabdF8A=ZJ9{cc`t=I^XZh(8 L{R