Skip to content

Commit

Permalink
fix(plot_Utils.Jl): fix read_depth heatmap color pallete when grouped
Browse files Browse the repository at this point in the history
  • Loading branch information
gtollefson committed Apr 4, 2019
1 parent ba1c721 commit 85a640a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 134 deletions.
139 changes: 13 additions & 126 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
@@ -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)

2 changes: 1 addition & 1 deletion 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
13 changes: 6 additions & 7 deletions src/plot_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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],
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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",
Expand Down
Binary file modified test/.DS_Store
Binary file not shown.

0 comments on commit 85a640a

Please sign in to comment.