Skip to content

Commit

Permalink
Merge pull request #53 from compbiocore/develop
Browse files Browse the repository at this point in the history
Fix sample labels when select columns, docs fixes
  • Loading branch information
Fernando Gelin authored Apr 18, 2019
2 parents 2f355e9 + 45db974 commit 16d1d2f
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 35 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)|[![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) |
|[![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/master/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 @@ -23,17 +23,11 @@ Note: Once you have set up VIVA, you can quickly run the command line tool [EXAM

### Supported Operating Systems:

#### macOS
macOS ( Sierra, High Sierra, and Mojave ), Windows, and Linux.

Sierra, High Sierra, and Mojave.
Expected Time for Installation: Installation time depends on your network bandwidth, but should take less than 10 minutes for VIVA installation to install all dependency packages. Installing and using Julia packages for the first time takes longer than when using them in subsequent sessions.

#### Windows

Windows 10, Windows 7

#### Linux

*Note*: When installing VariantVisualization.jl and running VIVA on Linux systems on remote compute clusters, you may need to load the OpenGl module in addition to loading the Julia module.
*Note*: When installing VariantVisualization.jl and running VIVA remote compute clusters, you may need to load the OpenGl module in addition to loading the Julia module.

### Command Line Tool

Expand Down
Binary file added docs/src/assets/Genotype_Genomic_Range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added docs/src/assets/Read_Depth_Genomic_Range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
18 changes: 11 additions & 7 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# 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.
To run examples:

Once Julia and VariantVisualization.jl are installed, you can run the following examples and should see the same outputs.
1. Install Julia and the VariantVisualization.jl package
2. 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.
3. Open the command line (Terminal or Powershell), copy the provided commands into the command line prompt, and press enter.
4. Your first VIVA run will take longer than usual (several minutes) because of the way Julia compiles packages. All subsequent runs will be much faster. Each example should take 30-50 seconds to run and you should see the same outputs as those below each demo.

We encourage you to also run these examples without the flag `-s png` to save and view interactive HTML graphics with cursor hovertext, zooming, panning, and screen capture features. View HTML graphics in your browser by opening the HTML file.

## Default Options

Expand All @@ -11,7 +16,6 @@ Running VIVA with no options produces heatmaps of genotype and read depth values
```
julia VIVA -f test_4X_191.vcf -t Default_Options -s png
```
![VIVA Logo](assets/VIVA_logo.png)
![Default Genotype Heatmap](assets/Genotype_Default_Options.png)

![Default Read Depth Heatmap](assets/Read_Depth_Default_Options.png)
Expand Down Expand Up @@ -39,9 +43,9 @@ julia VIVA -f test_4X_191.vcf -t Grouped_by_Sequencing_Site -g sample_metadata_m
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_4X_191.vcf -t Genomic_Range_Chr4:3076150-3076390 -r chr4:3076150-3076390 -y positions --select_samples select_samples_list.txt -s png
julia VIVA -f test_4X_191.vcf -t Genomic_Range -r chr4:3076150-3076390 -y positions --select_samples select_samples_list.txt -s png
```

![Genomic Range Genotype Heatmap](assets/Genotype_Genomic_Range_Chr4:3076150-3076390.png)
![Genomic Range Read Depth Heatmap](assets/Read_Depth_Genomic_Range_Chr4:3076150-3076390.png)
docs/src/assets/Read_Depth_Genomic_Range.png
![Genomic Range Genotype Heatmap](assets/Genotype_Genomic_Range.png)
![Genomic Range Read Depth Heatmap](assets/Read_Depth_Genomic_Range.png)

4 changes: 2 additions & 2 deletions src/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ function alias()
end

dir = split(@__DIR__, "/src")[1]
exe = joinpath(dir, "VIVA")
exe = joinpath(dir, "viva")

open(joinpath(homedir(), rcfile), "a+") do io
write(io, "\n # VIVA Alias \nalias VIVA=\"$exe\"")
write(io, "\n # viva Alias \nalias viva=\"$exe\"")
end
chmod(exe, 333)
end
24 changes: 12 additions & 12 deletions src/plot_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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=true),
ticktext=sample_names, 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)
)
Expand All @@ -49,7 +49,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, tickangle=45, showticklabels=x_axis_label_option),
yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chr_pos_tuple_indices,
ticktext=chr_pos_tuple_list,tickfont_size=font_size,hovermode=true,automargin=true)
)
Expand All @@ -62,7 +62,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, tickangle=45,showticklabels=x_axis_label_option),
yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chr_pos_tuple_indices,
ticktext=chr_pos_tuple_list,tickfont_size=font_size,hovermode=true,automargin=true,showticklabels=false)
)
Expand Down Expand Up @@ -192,7 +192,7 @@ h_line_index_list = generate_hline_indices(number_rows,input)
title = "$title_no_underscores",

xaxis=attr(title="Sample ID (Grouped by $(group1_label) | $(group2_label))", showgrid=false, zeroline=false, tickvals=sample_name_indices,
ticktext=id_list, tickfont_size=5, tickangle=45,showticklabels=x_axis_label_option),
ticktext=id_list, tickangle=45,showticklabels=x_axis_label_option),

yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chrom_label_indices,
ticktext=chrom_labels,tickfont_size=font_size,hovermode=true,automargin=true),
Expand All @@ -208,7 +208,7 @@ h_line_index_list = generate_hline_indices(number_rows,input)
title = "$title_no_underscores",

xaxis=attr(title="Sample ID (Grouped by $(group1_label) | $(group2_label))", showgrid=false, zeroline=false, tickvals=sample_name_indices,
ticktext=id_list, tickfont_size=5, tickangle=45,showticklabels=x_axis_label_option),
ticktext=id_list, tickangle=45,showticklabels=x_axis_label_option),

yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chr_pos_tuple_indices,
ticktext=chr_pos_tuple_list,tickfont_size=font_size,hovermode=true,automargin=true),
Expand All @@ -224,7 +224,7 @@ h_line_index_list = generate_hline_indices(number_rows,input)
layout = Layout(
title = "$title_no_underscores",
xaxis=attr(title="Sample ID (Grouped by $(group1_label) | $(group2_label))", showgrid=false, zeroline=false, tickvals=sample_name_indices,
ticktext=id_list, tickfont_size=5, tickangle=45,showticklabels=x_axis_label_option),
ticktext=id_list, tickangle=45,showticklabels=x_axis_label_option),

yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chr_pos_tuple_indices,
ticktext=chr_pos_tuple_list,tickfont_size=font_size,hovermode=true,automargin=true,showticklabels=false),
Expand Down Expand Up @@ -281,7 +281,7 @@ function dp_heatmap2(input, title, chrom_label_info, sample_names,chr_pos_tuple_
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, tickangle=45,showticklabels=x_axis_label_option),
yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chrom_label_indices,
ticktext=chrom_labels,tickfont_size=font_size,hovermode=true,automargin=true)
)
Expand All @@ -294,7 +294,7 @@ function dp_heatmap2(input, title, chrom_label_info, sample_names,chr_pos_tuple_
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, tickangle=45,showticklabels=x_axis_label_option),
yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chr_pos_tuple_indices,
ticktext=chr_pos_tuple_list,tickfont_size=font_size,hovermode=true,automargin=true)
)
Expand All @@ -307,7 +307,7 @@ function dp_heatmap2(input, title, chrom_label_info, sample_names,chr_pos_tuple_
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, tickangle=45,showticklabels=x_axis_label_option),
yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chr_pos_tuple_indices,
ticktext=chr_pos_tuple_list,tickfont_size=font_size,hovermode=true,automargin=true,showticklabels=false)
)
Expand Down Expand Up @@ -383,7 +383,7 @@ if y_axis_label_option == "chromosomes"

xaxis=attr(title="Sample ID (Grouped by $(group1_label) | $(group2_label))",
showgrid=false, zeroline=false, tickvals=sample_name_indices,
ticktext=id_list, tickfont_size=5, tickangle=45,showticklabels=x_axis_label_option),
ticktext=id_list, tickangle=45,showticklabels=x_axis_label_option),

yaxis=attr(title="Genomic Location", zeroline=false,
tickvals=chrom_label_indices,ticktext=chrom_labels,
Expand All @@ -402,7 +402,7 @@ elseif y_axis_label_option == "positions"

xaxis=attr(title="Sample ID (Grouped by $(group1_label) | $(group2_label))",
showgrid=false, zeroline=false, tickvals=sample_name_indices,
ticktext=id_list, tickfont_size=5, tickangle=45,showticklabels=x_axis_label_option),
ticktext=id_list, tickangle=45,showticklabels=x_axis_label_option),

yaxis=attr(title="Genomic Location", zeroline=false,
tickvals=chr_pos_tuple_indices,
Expand All @@ -421,7 +421,7 @@ elseif y_axis_label_option == "hover_positions"
layout = Layout(
title = "$title_no_underscores",
xaxis=attr(title="Sample ID (Grouped by $(group1_label) | $(group2_label))", showgrid=false, zeroline=false, tickvals=sample_name_indices,
ticktext=id_list, tickfont_size=5, tickangle=45,showticklabels=x_axis_label_option),
ticktext=id_list, tickangle=45,showticklabels=x_axis_label_option),

yaxis=attr(title="Genomic Location", zeroline=false, tickvals=chr_pos_tuple_indices,
ticktext=chr_pos_tuple_list,tickfont_size=font_size,hovermode=true,automargin=true,showticklabels=false),
Expand Down
4 changes: 3 additions & 1 deletion src/vcf_utils_complete.jl
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,9 @@ function select_columns(filename_sample_list::AbstractString, num_array::Array{I

selected_samples_num_array = Matrix(df_selected_samples_num_array)

return selected_samples_num_array,col_selectedcolumns
sample_names=permutedims(col_selectedcolumns)

return selected_samples_num_array,sample_names
end


Expand Down
2 changes: 1 addition & 1 deletion test/new_vcf_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ dp_num_array,dp_chromosome_labels=combined_all_read_depth_array_functions(sub)
dp_num_array=select_columns("test_files/select_samples_list.txt", dp_num_array, sample_names)
#println("select_columns dp_num_array type is $(typeof(dp_num_array))")
#println("select_columns dp_num_array size is $(size(dp_num_array,1))")
@test typeof(dp_num_array) == Tuple{Array{Int64,2},Array{Any,1}}
@test typeof(dp_num_array) == Tuple{Array{Int64,2},Array{Any,2}}
@test size(dp_num_array,1) == 2
end

Expand Down
9 changes: 7 additions & 2 deletions viva
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ if parsed_args["heatmap"] == "genotype"
sample_names)
sample_names = col_selectedcolumns



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.")

Expand Down Expand Up @@ -342,6 +344,8 @@ if parsed_args["heatmap"] == "read_depth"
println("Selecting samples listed in $(parsed_args["select_samples"])")
dp_num_array,col_selectedcolumns = select_columns(parsed_args["select_samples"], dp_num_array, sample_names)
sample_names=col_selectedcolumns


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.")
end
Expand Down Expand Up @@ -369,6 +373,8 @@ if parsed_args["heatmap"] == "read_depth"
println("Selecting samples listed in $(parsed_args["select_samples"])")

dp_num_array,col_selectedcolumns = select_columns(parsed_args["select_samples"], dp_num_array, sample_names)
sample_names=col_selectedcolumns


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.")
Expand Down Expand Up @@ -444,8 +450,7 @@ if parsed_args["heatmap"] == "genotype,read_depth" || parsed_args["heatmap"] ==
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.")

end

graphic = VariantVisualization.genotype_heatmap2(gt_num_array,title,chrom_label_info,sample_names,chr_pos_tuple_list,y_axis_label_option,x_axis_label_option)
graphic = VariantVisualization.genotype_heatmap2(gt_num_array,title,chrom_label_info,sample_names,chr_pos_tuple_list,y_axis_label_option,x_axis_label_option)
end

println("Saving genotype heatmap")
Expand Down

0 comments on commit 16d1d2f

Please sign in to comment.