Skip to content

Commit

Permalink
Merge pull request #47 from compbiocore/develop
Browse files Browse the repository at this point in the history
Fix Grouped Read Depth Heatmap color pallete / Fix genomic range filters / Update README / Clarify Docs
  • Loading branch information
Fernando Gelin authored Apr 4, 2019
2 parents bd8e078 + d0d0607 commit f172c5e
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 197 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)|[![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

Expand All @@ -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:

Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
130 changes: 22 additions & 108 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
@@ -1,133 +1,47 @@
# Plotting
# Examples

##General notes: visualization options
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.

Here we describe VIVA options for plotting. All plots can be generated in a single command.
Once Julia and VariantVisualization.jl are installed, you can run the following examples and should see the same outputs.

VIVA orders all variants by chromosomal location for plotting.
## Default Options

VIVA graphics are generated with PlotlyJS.jl. Graphics can be saved in *HTML*, *PDF*, *SVG*, *PNG*, and *EPS* formats.

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.

To create *publication quality, scalable graphics* for presentations and publications, we recommend saving graphics as PDF.

## 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`
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)

```
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 test_4X_191.vcf -t Default_Options
```
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.
![Default Genotype Heatmap](assets/Genotype_Default_Options.html)

*flags*: `--y_axis_labels`, `-y`
![Default Read Depth Heatmap](assets/Read_Depth_Default_Options.html)

*arguments*: `chromosomes`, `positions`, `hoverlabels_only`
## Grouping Samples by Metadata Traits and Generating all Four Plots

`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
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.

default: `chromosomes`
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.)

```
julia VIVA -f example.vcf `-y` `hoverlabels_only`
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
```

## X-axis label options
![Grouped Genotype Heatmap](assets/Read_Depth_Grouped_by_Sequencing_Site.html)

Choose an option for displaying x-axis ticklabels showing the sample id of samples included heatmaps and scatter plots.
![Grouped Read Depth Heatmap](assets/Genotype_Grouped_by_Sequencing_Site.html)

*flags*: `--x_axis_labels`.`x`
![Grouped Variant Average Read Depth Scatter Plot](assets/Average_Variant_Read_Depthtest_4X_191.vcf.html)

*arguments*: if `true`, displays samples names labels on x-axis. if `false`, does not display x-axis sample labels.
![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

default: `true`
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 example.vcf `-x`
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
```

## Export heatmap data as numerical array
![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)

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`
```


7 changes: 4 additions & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Getting Started

### *Command Line Tool and Jupyter Notebook*
# *VIVA Command Line Tool and Jupyter Notebook*

## Description

Expand Down Expand Up @@ -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)

51 changes: 36 additions & 15 deletions docs/src/installation.md
Original file line number Diff line number Diff line change
@@ -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.

1 change: 0 additions & 1 deletion src/VariantVisualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
41 changes: 0 additions & 41 deletions src/batch_julia_runtimes.jl

This file was deleted.

2 changes: 0 additions & 2 deletions src/open_jupyter_notebook.jl

This file was deleted.

Loading

0 comments on commit f172c5e

Please sign in to comment.