From 8a9a7577cef6d8cc219ad386b55e13c315c9a200 Mon Sep 17 00:00:00 2001 From: George Tollefson Date: Thu, 4 Apr 2019 11:26:31 -0400 Subject: [PATCH 1/7] docs(Readme): add windows appveyor status shield and change lifecycle badge to active --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a7ca79..3050e65 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ #### Visualization of Variants -| MacOS / Linux | License | Test Coverage | Documentation | Lifecycle | +| MacOS / Linux | Windows | License | Test Coverage | Documentation | Lifecycle | | --- | ---- | ------ | ------ | ---- | -|[![Travis](https://img.shields.io/travis/compbiocore/VariantVisualization.jl/master.svg?style=flat-square)](https://travis-ci.org/compbiocore/VariantVisualization.jl)| [![License](https://img.shields.io/badge/license-MIT-orange.svg?style=flat-square)](https://github.com/compbiocore/VariantVisualization.jl/blob/clean-up/LICENSE.md)| [![Codecov](https://img.shields.io/codecov/c/github/compbiocore/VariantVisualization.jl.svg?style=flat-square)](https://codecov.io/gh/compbiocore/VariantVisualization.jl/branch/master) | [![Docs](https://img.shields.io/badge/docs-stable-blue.svg?style=flat-square)](https://compbiocore.github.io/VariantVisualization.jl/stable) [![Docs](https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square)](https://compbiocore.github.io/VariantVisualization.jl/latest) | ![Lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg?style=flat-square) | +|[![Travis](https://img.shields.io/travis/compbiocore/VariantVisualization.jl/master.svg?style=flat-square)](https://travis-ci.org/compbiocore/VariantVisualization.jl)|[![Build status](https://ci.appveyor.com/api/projects/status/67hyn6rckulwr2dj/branch/master?svg=true)](https://ci.appveyor.com/project/fernandogelin/variantvisualization-jl/branch/master)|[![License](https://img.shields.io/badge/license-MIT-orange.svg?style=flat-square)](https://github.com/compbiocore/VariantVisualization.jl/blob/clean-up/LICENSE.md)|[![Codecov](https://img.shields.io/codecov/c/github/compbiocore/VariantVisualization.jl.svg?style=flat-square)](https://codecov.io/gh/compbiocore/VariantVisualization.jl/branch/master) | [![Docs](https://img.shields.io/badge/docs-stable-blue.svg?style=flat-square)](https://compbiocore.github.io/VariantVisualization.jl/stable) [![Docs](https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square)](https://compbiocore.github.io/VariantVisualization.jl/latest) | ![Lifecycle](https://img.shields.io/badge/lifecycle-active-green.svg?style=flat-square) | ## Overview From 5c14668fca8a7931f8cc8f9248e187c36ea31d93 Mon Sep 17 00:00:00 2001 From: George Tollefson Date: Thu, 4 Apr 2019 13:46:58 -0400 Subject: [PATCH 2/7] docs(Readme): added new coverage shield and removed unnecessary function import in /src/variantvisualization.jl Show test coverage from coveralls --- README.md | 2 +- src/VariantVisualization.jl | 1 - src/batch_julia_runtimes.jl | 41 ------------------------------------ src/open_jupyter_notebook.jl | 2 -- 4 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 src/batch_julia_runtimes.jl delete mode 100644 src/open_jupyter_notebook.jl diff --git a/README.md b/README.md index 3050e65..848fed9 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ | MacOS / Linux | Windows | License | Test Coverage | Documentation | Lifecycle | | --- | ---- | ------ | ------ | ---- | -|[![Travis](https://img.shields.io/travis/compbiocore/VariantVisualization.jl/master.svg?style=flat-square)](https://travis-ci.org/compbiocore/VariantVisualization.jl)|[![Build status](https://ci.appveyor.com/api/projects/status/67hyn6rckulwr2dj/branch/master?svg=true)](https://ci.appveyor.com/project/fernandogelin/variantvisualization-jl/branch/master)|[![License](https://img.shields.io/badge/license-MIT-orange.svg?style=flat-square)](https://github.com/compbiocore/VariantVisualization.jl/blob/clean-up/LICENSE.md)|[![Codecov](https://img.shields.io/codecov/c/github/compbiocore/VariantVisualization.jl.svg?style=flat-square)](https://codecov.io/gh/compbiocore/VariantVisualization.jl/branch/master) | [![Docs](https://img.shields.io/badge/docs-stable-blue.svg?style=flat-square)](https://compbiocore.github.io/VariantVisualization.jl/stable) [![Docs](https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square)](https://compbiocore.github.io/VariantVisualization.jl/latest) | ![Lifecycle](https://img.shields.io/badge/lifecycle-active-green.svg?style=flat-square) | +|[![Travis](https://img.shields.io/travis/compbiocore/VariantVisualization.jl/master.svg?style=flat-square)](https://travis-ci.org/compbiocore/VariantVisualization.jl)|[![Build status](https://ci.appveyor.com/api/projects/status/67hyn6rckulwr2dj/branch/master?svg=true)](https://ci.appveyor.com/project/fernandogelin/variantvisualization-jl/branch/master)|[![License](https://img.shields.io/badge/license-MIT-orange.svg?style=flat-square)](https://github.com/compbiocore/VariantVisualization.jl/blob/clean-up/LICENSE.md)|[![Coverage Status](https://coveralls.io/repos/github/compbiocore/VariantVisualization.jl/badge.svg?branch=master)](https://coveralls.io/github/compbiocore/VariantVisualization.jl?branch=master)|[![Docs](https://img.shields.io/badge/docs-stable-blue.svg?style=flat-square)](https://compbiocore.github.io/VariantVisualization.jl/stable) [![Docs](https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square)](https://compbiocore.github.io/VariantVisualization.jl/latest) | ![Lifecycle](https://img.shields.io/badge/lifecycle-active-green.svg?style=flat-square) | ## Overview diff --git a/src/VariantVisualization.jl b/src/VariantVisualization.jl index bd50bde..625dfe2 100644 --- a/src/VariantVisualization.jl +++ b/src/VariantVisualization.jl @@ -49,7 +49,6 @@ export translate_genotype_to_num_array, translate_readdepth_strings_to_num_array, genotype_heatmap_with_groups, - jupyter_main_new, returnXY_column1!, pass_genomic_range_siglist_filter, pass_genomic_range_filter, diff --git a/src/batch_julia_runtimes.jl b/src/batch_julia_runtimes.jl deleted file mode 100644 index 3090e00..0000000 --- a/src/batch_julia_runtimes.jl +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -#= -tic() -run(`julia viva_cli.jl -f combine_haplo-exo_AC_gatk406.vcf -l test/test_files/significantList_for_proteinstructures.csv --heatmap genotype`) -println("time to run sig_list heatmap:") -toc() - -tic() -run(`julia viva_cli.jl -f combine_haplo-exo_AC_gatk406.vcf -r chr1:0-400000000 --heatmap genotype`) -println("time to run chromosome range heatmap:") -toc() - -tic() -run(`julia viva_cli.jl -f combine_haplo-exo_AC_gatk406.vcf --pass_filter -r chr1:0-400000000 --heatmap genotype`) -println("time to run pass filter and chromosome range heatmap:") -toc() - -tic() -run(`julia viva_cli.jl -f combine_haplo-exo_AC_gatk406.vcf --pass_filter -x test/test_files/select_column_list.txt --heatmap genotype`) -println("time to run pass filter select 4 patients heatmap:") -toc() -=# -tic() -run(`julia viva_cli.jl -f combine_haplo-exo_AC_gatk406.vcf --pass_filter --group_samples test/test_files/sample_phenotype_matrix.csv control,case --heatmap genotype`) -println("time to run pass filter group samples by trait heatmap:") -toc() - -tic() -run(`julia viva_cli.jl -f combine_haplo-exo_AC_gatk406.vcf -l test/test_files/significantList_for_proteinstructures.csv --heatmap genotype --avg_dp samples`) -println("time to run sig_list heatmap and avg dp scatter plot for samples:") -toc() - -tic() -run(`julia viva_cli.jl -f combine_haplo-exo_AC_gatk406.vcf -l test/test_files/significantList_for_proteinstructures.csv --heatmap genotype --avg_dp samples`) -println("time to run sig_list heatmap and avg dp scatter plot for variants:") -toc() - -tic() -run(`julia viva_cli.jl -f combine_haplo-exo_AC_gatk406.vcf -x test/test_files/select_column_list.txt --heatmap genotype`) -println("time to run select columns with no filters heatmap:") -toc() diff --git a/src/open_jupyter_notebook.jl b/src/open_jupyter_notebook.jl deleted file mode 100644 index bcac03b..0000000 --- a/src/open_jupyter_notebook.jl +++ /dev/null @@ -1,2 +0,0 @@ -using IJulia -notebook() From ba1c7214c5efb0237543ae1db200a436a243780d Mon Sep 17 00:00:00 2001 From: George Tollefson Date: Thu, 4 Apr 2019 14:17:10 -0400 Subject: [PATCH 3/7] docs(docs): add installation page to manual. fix hyperlinks in index.md improve docs --- docs/mkdocs.yml | 1 + docs/src/index.md | 5 ++-- docs/src/installation.md | 51 ++++++++++++++++++++++++++++------------ 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index d242821..495590c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -28,6 +28,7 @@ docs_dir: 'build' pages: - Home: index.md - VIVA Manual: + - Installation and Setup: installation.md - Filtering Your VCF File: filtering_vcf.md - Making Plots: plotting.md - Examples: examples.md diff --git a/docs/src/index.md b/docs/src/index.md index eed9235..d515769 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -82,7 +82,8 @@ Use the following steps to use the VIVA Jupyter Notebook utility: ## Continue reading for: -* [Variant and Sample Selection](https://github.com/compbiocore/VariantVisualization.jl/tree/master/docs/src/filtering_vcf.md) +* [Variant and Sample Selection](https://compbiocore.github.io/VariantVisualization.jl/stable/filtering_vcf/) + +* [Plotting Options](https://compbiocore.github.io/VariantVisualization.jl/stable/plotting/) -* [Plotting Options](https://github.com/compbiocore/VariantVisualization.jl/tree/master/docs/src/plotting.md) diff --git a/docs/src/installation.md b/docs/src/installation.md index f5dc093..5bd8317 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -1,36 +1,57 @@ #Installation -##Install Julia v1.1.0 +### Install Julia v1.1.0 Download [Julia]("https://julialang.org/downloads/") -##Install the VariantVisualization.jl -Add `VariantVisualization.jl` at the package prompt in the Julia v1.1 REPL. +### Supported Operating Systems: -``` -julia +#### macOS -*press the ']' key to enter the package prompt* +Sierra, High Sierra, and Mojave. -(v1.1) pkg> add VariantVisualization +#### Windows -``` +Windows 10, Windows 7 -If successful, `VariantVisualization.jl` will be installed in your Julia packages directory (.julia/packages/) and VIVA command line tool should install with this. Adding `VariantVisualization.jl` runs a script to create an alias for the command line tool script in the bash shell. This allows the user to call VIVA from any directory. +### Command Line Tool +1. Add VariantVisualization.jl using Pkg in the Julia REPL: + a. run `using Pkg` + b. run `Pkg.clone("https://github.com/compbiocore/VariantVisualization.jl")` + c. run `Pkg.instantiate()` +2. Download the [VIVA](https://github.com/compbiocore/VariantVisualization.jl/blob/master/viva) tool script and save it to a working directory for your analysis. +3. Navigate to your working directory and follow the [VIVA manual](https://compbiocore.github.io/VariantVisualization.jl/latest/) to generate your plots. -##Install the Jupyter Notebook +### Jupyter Notebook -If you plan to use the Jupyter Notebook VIVA utility, install Jupyter then download the [VIVA Notebook](). +1. [Install Jupyter](https://jupyter.org/install) +2. Download the [VIVA Jupyter Notebook](https://github.com/compbiocore/VariantVisualization.jl/blob/master/VIVA.ipynb). +3. Follow the in-notebook instructions to generate your plots. -If you already have Jupyter installed, update following [these instructions](https://jupyter.readthedocs.io/en/latest/projects/upgrade-notebook.html) +### Latest Features +To stay up to date with cutting edge development features install VariantVisualization.jl from the Master branch. -##New Features -To stay up to date with new features before official version release, please check out the master branch. +Using git from the command line: ``` -julia +git clone https://github.com/compbiocore/VariantVisualization.jl +``` +or from the Julia REPL (useful if using the PowerShell and don't have git installed): + +```julia using Pkg Pkg.clone("https://github.com/compbiocore/VariantVisualization.jl") ``` + +### *For Developers* + +VIVA Jupyter notebook and the VIVA the command line tool are built with functions contained in our VariantVisualization.jl package. + +Developers may contribute to these open source tools by using [functions contained within VariantVisualization.jl](https://github.com/compbiocore/VariantVisualization.jl/tree/master/src/) which are carefully documented with docstrings. + +We have included in-line comments within the code for the [VIVA command line tool](https://github.com/compbiocore/VariantVisualization.jl/tree/master/viva). + +The ***VIVA Jupyter notebook*** is powered by a [main function](https://github.com/compbiocore/VariantVisualization.jl/tree/master/src/new_notebook_utils.jl) which takes arguments defined by the user in the notebook. We welcome users to post in issues to request a new feature or bug fix. + From 85a640ab98a3957966ca598eb05aff858bc7c726 Mon Sep 17 00:00:00 2001 From: George Tollefson Date: Thu, 4 Apr 2019 15:14:19 -0400 Subject: [PATCH 4/7] 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 Date: Thu, 4 Apr 2019 16:10:39 -0400 Subject: [PATCH 5/7] docs(AddExamplesSectionToDocs): added complete examples with embedded html graphics for easy introduction to viva use --- docs/src/examples.md | 42 ++++++++++++++++++++++++++++++-------- src/plot_utils.jl | 6 +++--- src/vcf_utils_complete.jl | 28 ++++++++++++------------- test/.DS_Store | Bin 8196 -> 8196 bytes viva | 3 +++ 5 files changed, 54 insertions(+), 25 deletions(-) diff --git a/docs/src/examples.md b/docs/src/examples.md index 7d7f6fd..c6240eb 100644 --- a/docs/src/examples.md +++ b/docs/src/examples.md @@ -1,20 +1,46 @@ # Examples +To run examples, download the five test files found [here](https://github.com/compbiocore/VariantVisualization.jl/tree/master/test/test_files) and put them into a working directory with the VIVA script. + +Once Julia and VariantVisualization.jl are installed, you can run the following examples and should see the same outputs. + ## Default Options 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) -![Default Genotype Heatmap](assets/VIVA_logo.png) -![Default Read Depth Heatmap](assets/VIVA_logo.png) +``` +julia VIVA -f test_4X_191.vcf -t Default_Options +``` + +![Default Genotype Heatmap](assets/Genotype_Default_Options.html) +![Default Read Depth Heatmap](assets/Read_Depth_Default_Options.html) -## Generate All VIVA Plots While Grouping Samples by Metadata Traits +## Grouping Samples by Metadata Traits and Generating all Four Plots 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. 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.) -![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 +``` +julia VIVA -f test_4X_191.vcf -t Grouped_by_Sequencing_Site -g sample_metadata_matrix.csv seq_site_1,seq_site_2 --avg_dp variant,sample +``` + +![Grouped Genotype Heatmap](assets/Read_Depth_Grouped_by_Sequencing_Site.html) + +![Grouped Read Depth Heatmap](assets/Genotype_Grouped_by_Sequencing_Site.html) + +![Grouped Variant Average Read Depth Scatter Plot](assets/Average_Variant_Read_Depthtest_4X_191.vcf.html) + +![Grouped Sample Average Read Depth Scatter Plot](assets/Average_Sample_Read_Depth_test_4X_191.vcf.html) + +##Genomic Range and Samples Selection - Genotype and Read Depth Heatmaps with Variant Position Labels + +Generate heatmaps of genotype and read depth values of variants selected within a genomic range, in this case, chromosome 4, nucleotides 200000-500000, with y-axis variant position labels. + +``` +julia VIVA -f test/test_files/test_4X_191.vcf -t Genomic_Range_Chr4:3076150-3076390 -r chr4:3076150-3076390 -y positions --select_samples select_samples_list.txt +``` + +![Genomic Range Genotype Heatmap](assets/Genotype_Genomic_Range_Chr4/3076150-3076390.html) +![Genomic Range Read Depth Heatmap](assets/Read_Depth_Genomic_Range_Chr4/3076150-3076390.html) + diff --git a/src/plot_utils.jl b/src/plot_utils.jl index baec34d..9d1bf4e 100644 --- a/src/plot_utils.jl +++ b/src/plot_utils.jl @@ -1,7 +1,7 @@ #heatmap plots for grouped and ungrouped genotype and read depth viz """ - genotype_heatmap2(input::Array{Any,2},title::AbstractString,filename,sample_names,gt_chromosome_labels,y_axis_label_option,x_axis_label_option,save_ext,chrom_label_info) + genotype_heatmap2(input::Array{Any,2},title::AbstractString,filename,sample_names,gt_chromosome_labels,y_axis_label_option,x_axis_label_option) generate heatmap of genotype data. """ function genotype_heatmap2(input,title,chrom_label_info,sample_names,chr_pos_tuple_list_rev,y_axis_label_option,x_axis_label_option) #chr_pos_tuple_list_rev is rev because heatmap in plotly mirrors list for some reason. @@ -36,7 +36,7 @@ function genotype_heatmap2(input,title,chrom_label_info,sample_names,chr_pos_tup layout = Layout( title = "$title_no_underscores", xaxis=attr(title="Sample ID", showgrid=false, zeroline=false, tickvals=sample_name_indices, - ticktext=sample_names, tickfont_size=5, tickangle=45,showticklabels=x_axis_label_option), + ticktext=sample_names, tickfont_size=5, tickangle=45,showticklabels=true), yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chrom_label_indices, ticktext=chrom_labels,tickfont_size=font_size,hovermode=true,automargin=true) ) @@ -365,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/src/vcf_utils_complete.jl b/src/vcf_utils_complete.jl index 5ad5518..8f11014 100644 --- a/src/vcf_utils_complete.jl +++ b/src/vcf_utils_complete.jl @@ -145,7 +145,7 @@ function io_genomic_range_vcf_filter(chr_range::String,vcf_filename::AbstractStr while !eof(reader) read!(reader, vcf_record) - if (VCF.chrom(vcf_record) == chrwhole) && (chr_range_high > VCF.pos(vcf_record) > chr_range_low) + if (VCF.chrom(vcf_record) == chrwhole) && (chr_range_high >= VCF.pos(vcf_record) >= chr_range_low) push!(vcf_subarray,copy(vcf_record)) end end @@ -154,7 +154,7 @@ function io_genomic_range_vcf_filter(chr_range::String,vcf_filename::AbstractStr while !eof(reader) read!(reader, vcf_record) - if (VCF.chrom(vcf_record) == chr) && (chr_range_high > VCF.pos(vcf_record) > chr_range_low) + if (VCF.chrom(vcf_record) == chr) && (chr_range_high >= VCF.pos(vcf_record) >= chr_range_low) push!(vcf_subarray,copy(vcf_record)) end end @@ -303,14 +303,14 @@ function pass_genomic_range_siglist_filter(vcf_filename,sig_list,chr_range::Abst #if occursin("chr",VCF.chrom(record1))#version if occursin("chr",VCF.chrom(record1)) - if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) break end else - if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) break end @@ -320,13 +320,13 @@ function pass_genomic_range_siglist_filter(vcf_filename,sig_list,chr_range::Abst if occursin("chr",VCF.chrom(record1)) - if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) break end else - if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) break end @@ -376,14 +376,14 @@ returns subarray of vcf records with io_pass_filter and io_genomic_range_vcf_fil chr = string(chr) - if (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) end else - if (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) end end @@ -394,13 +394,13 @@ returns subarray of vcf records with io_pass_filter and io_genomic_range_vcf_fil if typeof(VCF.chrom(vcf_record)) == String chr = string(chr) - if (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) end else - if (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.hasfilter(vcf_record)) && (VCF.filter(vcf_record) == String["PASS"]) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) end @@ -505,14 +505,14 @@ function genomic_range_siglist_filter(vcf_filename,sig_list,chr_range::AbstractS if typeof(VCF.chrom(vcf_record)) == String chr_sig = string(chr_sig) - if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) break end else - if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && ((VCF.chrom(vcf_record) == chrwhole)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) break end @@ -523,14 +523,14 @@ function genomic_range_siglist_filter(vcf_filename,sig_list,chr_range::AbstractS if typeof(VCF.chrom(vcf_record)) == String chr_sig = string(chr_sig) - if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) break end else - if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high > VCF.pos(vcf_record) > chr_range_low)) + if (VCF.chrom(vcf_record) == chr_sig) && (VCF.pos(vcf_record) == pos_sig) && ((VCF.chrom(vcf_record) == chr)) && ((chr_range_high >= VCF.pos(vcf_record) >= chr_range_low)) push!(vcf_subarray,copy(vcf_record)) break end diff --git a/test/.DS_Store b/test/.DS_Store index 2769642b585bbc588b53565221c88af4355de031..41f56031700bfa44c2ccb77ed3ce2b7688cb499f 100644 GIT binary patch delta 1325 zcmeIxPizcP90&0CMVU!o^le-Es?*g!YL%64H?>WXc3IU{QL5GY6Kp$!NxQSv*=}3K zIy52ZY2$B1f)G*%iMIZ85J`z}uo4^`M8ZW#xQL54ogPHe#L3AVX5M?h_se_l_nFu4 z@AqGCcBJ_{?wm!w{qCH;Vvkp}OTESMHpj5St81#WY3+8F8r8M#x{in*Hq4D$rzyU1 zPik+hS#J#+8}z*zgFHArL&+_eUsO_79!R7xM=DLHGn=BiskgLijorE$*}W-fwrYl| z8@o2^s%Av=ox0X3JMdXJ+u|k1PO}te}8q1jL;& z(b}0R+i8n@ls84~BeL4@!Np4`Z*C2TLSoOR1MczR3a6j*ZPwDOgJz_zLo>v_M#cKp z>A91~U#I29^8FrSKN86%Ub2F$COb$c=_3Q=6d5E#WQ5!#kH|BUAaBVB@`ZdQ-^h3J z1CuZrNtlWha1_9Wc_@Sz<*0xkHCT&vSdV&a!49;b6)Hk7(S<0waS(@b1V?cU$MbLw z=WziSaSeBI9}n;lqj-X+NZ=LT;Uhl9n(CU_b0i{DeBB|T7W6^_D8qDcCt8`@?ODsEOm^(Y$<7Ezs$rv3U#g zMRA|s6PB8S5_|jE5G~cD3&mn7Pd%J7#1c+K%tAR&L%g$JR{ZgZxLK&;sGsi~@OY(x zM5sovakQ0pMG_lI1h)$HoCapz?F$SJvK@rtSv2O`Me#sv={8R&+&&~JlAk_Ht}n6_ z7j*?u3c`^*vXR(`oj6G^36ODeo=lQiGEWxBbMl&eB%jDKSs~xZck%-SJhaF_CbD3F z8Re*e1$Agf3wB};_M!t$bi)fDB=n*mVGLsgqd1P!ID@k|2NhRw4c9S++}oJJBRs|v zJjF}A!Xn<|13qIJUsW}uhZ>kI6-s}xt^AAa+q48|W|rPqR90SPtKY6pWxArB>|mwQ z-^tR{*b#C|xjACCq0q2_V`oJZO`+Jpu;w_5L~pTS6UWh2OH4nv!eS8UY9`6Yo7QT< zKvNhR7jM>W5d^x1sj}WE8{N>zy4Nzm Date: Thu, 4 Apr 2019 16:12:58 -0400 Subject: [PATCH 6/7] refactor(removeUnnecessaryPrintingUsedDuringDevIn/SrcFiles): --- viva | 3 --- 1 file changed, 3 deletions(-) diff --git a/viva b/viva index c2aedf8..6aa7930 100755 --- a/viva +++ b/viva @@ -163,7 +163,6 @@ end =# if parsed_args["x_axis_labels"] == true - println("test2N") x_axis_label_option = true else x_axis_label_option = false @@ -441,8 +440,6 @@ if parsed_args["heatmap"] == "genotype,read_depth" || parsed_args["heatmap"] == gt_num_array,col_selectedcolumns = select_columns(parsed_args["select_samples"], gt_num_array, sample_names) sample_names=col_selectedcolumns - println(sample_names) - elseif parsed_args["select_samples"] != nothing && length(parsed_args["group_samples"]) == 2 println("Can not select samples with phenotype matrix provided. Please include same sample ids in phenotype matrix as in list of sample names to select.") From d0d0607f03fa62aac18f3c75d5d8ecda5f6c367e Mon Sep 17 00:00:00 2001 From: George Tollefson Date: Thu, 4 Apr 2019 16:27:25 -0400 Subject: [PATCH 7/7] docs(Readme): added link to examples to readme --- README.md | 8 ++++++-- docs/src/examples.md | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 848fed9..0c84a0d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,11 @@ VariantVisualization.jl is a package we built specifically to power the genetics To use VIVA, you must download the Julia programming language version >=1.0 and install the VariantVisualization.jl Julia package as well as the VIVA script. -## Getting Started: *Installation* +## Getting Started: + +Note: Once you have set up VIVA, you can quickly run the command line tool [examples](https://compbiocore.github.io/VariantVisualization.jl/stable/examples/) found in the documentation. + +*Installation* ### Supported Operating Systems: @@ -34,7 +38,7 @@ Windows 10, Windows 7 b. run `Pkg.clone("https://github.com/compbiocore/VariantVisualization.jl")` c. run `Pkg.instantiate()` 2. Download the [VIVA](https://github.com/compbiocore/VariantVisualization.jl/blob/master/viva) tool script and save it to a working directory for your analysis. -3. Navigate to your working directory and follow the [VIVA manual](https://compbiocore.github.io/VariantVisualization.jl/latest/) to generate your plots. +3. Navigate to your working directory and follow the [VIVA manual](https://compbiocore.github.io/VariantVisualization.jl/stable/) to generate your plots. ### Jupyter Notebook diff --git a/docs/src/examples.md b/docs/src/examples.md index c6240eb..1d890a8 100644 --- a/docs/src/examples.md +++ b/docs/src/examples.md @@ -13,6 +13,7 @@ julia VIVA -f test_4X_191.vcf -t Default_Options ``` ![Default Genotype Heatmap](assets/Genotype_Default_Options.html) + ![Default Read Depth Heatmap](assets/Read_Depth_Default_Options.html) ## Grouping Samples by Metadata Traits and Generating all Four Plots