Skip to content

Commit

Permalink
feat(FixTestsToAccomodateNewFunctionNames.): renamed functions in viv…
Browse files Browse the repository at this point in the history
…a executable, src files, and tests

makes terminology consistent with paper
  • Loading branch information
gtollefson committed Mar 19, 2019
1 parent e3231d3 commit 959b2b0
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 890 deletions.
10 changes: 1 addition & 9 deletions src/VIVA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ using Test

#end #module

#=
const g_white = "400" #homo reference 0/0
const g_red = "800" #homo variant 1/1 1/2 2/2 1/3 2/3 3/3 4/4 5/5 6/6 etc
const g_pink = "600" #hetero variant 0/1 1/0 0/2 2/0 etc
const g_blue = "0" #no call ./.
=#

export
format_reader,
load_vcf,
Expand Down Expand Up @@ -80,8 +73,7 @@ export
add_pheno_matrix_to_dp_data_for_plotting,
generate_hover_text_array,
generate_hover_text_array_grouped,
save_graphic,
alias
save_graphic

#include("vcf_utils.jl")
include("vcf_utils_complete.jl")
Expand Down
10 changes: 6 additions & 4 deletions src/vcf_utils_complete.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end

"""
clean_column1_siglist!(siglist)
replaces "X","Y","M" with 23,24,25 {Int}
Replaces strings "X","Y","M" with 23,24,25 {Int} in array generated in load_siglist()
use in load_siglist() because X and Y need to be replaced with Int
"""
function clean_column1_siglist!(siglist)
Expand Down Expand Up @@ -1476,13 +1476,15 @@ return(hover_text_array)
end

"""
save_graphic(graphic,output_directory,save_ext,title)
save_graphic(graphic,output_directory,save_ext,title,remote_option)
Save plot in either html or static image formats incuding eps, png, svg, and pdf
"""
function save_graphic(graphic,output_directory,save_ext,title)
function save_graphic(graphic,output_directory,save_ext,title,remote_option)

if save_ext=="html"
if save_ext=="html" && remote_option == true
PlotlyJS.savehtml(graphic, joinpath("$(output_directory)" ,"$title.$(save_ext)"), :remote)
elseif save_ext=="html" && remote_option != true
PlotlyJS.savehtml(graphic, joinpath("$(output_directory)" ,"$title.$(save_ext)"))
elseif save_ext != "html"
PlotlyJS.savefig(graphic, joinpath("$(output_directory)" ,"$title.$(save_ext)"))
end
Expand Down
Binary file modified test/.DS_Store
Binary file not shown.
30 changes: 15 additions & 15 deletions test/new_vcf_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ julia> Pkg.test(pkg_for"VIVA")
@testset "VCFUtils" begin

vcf_filename = "test_files/test_4X_191.vcf"
vcf_filename_with_chr = "test_files/test_with_chr.vcf"
#vcf_filename_with_chr = "test_files/test_with_chr.vcf"

reader = VCF.Reader(open(vcf_filename, "r"))
reader_with_chr = VCF.Reader(open(vcf_filename_with_chr, "r"))
#reader_with_chr = VCF.Reader(open(vcf_filename_with_chr, "r"))
sample_names = get_sample_names(reader)

dp_limit = 50
Expand All @@ -30,23 +30,23 @@ end

#functions for variant filters

@testset "io_chromosome_range_vcf_filter" begin
sub = io_chromosome_range_vcf_filter("chr4:0-400000000",vcf_filename)
@testset "io_genomic_range_vcf_filter" begin
sub = io_genomic_range_vcf_filter("chr4:0-400000000",vcf_filename)
@test typeof(sub) == Array{Any,1}
@test size(sub,1) == 1012
#println("io_chromosome_range_vcf_filter type is $(typeof(sub))")
#println("io_chromosome_range_vcf_filter size is $(size(sub,1))")
#println("io_genomic_range_vcf_filter type is $(typeof(sub))")
#println("io_genomic_range_vcf_filter size is $(size(sub,1))")
end


@testset "filters_with_siglist" begin

@testset "load_siglist" begin
sig_list=load_siglist("test_files/sig_list_for_test.csv")
sig_list=load_siglist("test_files/positions_list.csv")

@testset "pass_chrrange_siglist_filter" begin
sig_list=load_siglist("test_files/sig_list_for_test.csv")
sub = pass_chrrange_siglist_filter(vcf_filename,sig_list,"chr4:0-5000000000")
@testset "pass_genomic_range_siglist_filter" begin
sig_list=load_siglist("test_files/positions_list.csv")
sub = pass_genomic_range_siglist_filter(vcf_filename,sig_list,"chr4:0-5000000000")

@test (typeof(sub[1])) == GeneticVariation.VCF.Record
@test (length(sub)) == 5
Expand All @@ -66,8 +66,8 @@ end
@test (length(sub)) == 10
end

@testset "chrrange_siglist_filter" begin
sub = chrrange_siglist_filter(vcf_filename,sig_list,"chr4:0-400000000")
@testset "genomic_range_siglist_filter" begin
sub = genomic_range_siglist_filter(vcf_filename,sig_list,"chr4:0-400000000")
@test (typeof(sub[1])) == GeneticVariation.VCF.Record
@test (length(sub)) == 5
end
Expand All @@ -82,9 +82,9 @@ end
@test (length(sub)) == 1164
end

@testset "pass_chrrange_filter" begin
@testset "pass_genomic_range_filter" begin
reader = VCF.Reader(open(vcf_filename, "r"))
sub = pass_chrrange_filter(reader,"chr4:0-400000000",vcf_filename)
sub = pass_genomic_range_filter(reader,"chr4:0-400000000",vcf_filename)
@test (typeof(sub[1])) == GeneticVariation.VCF.Record
@test (length(sub)) == 856
end
Expand Down Expand Up @@ -220,7 +220,7 @@ dp_num_array,dp_chromosome_labels=combined_all_read_depth_array_functions(sub)
end

@testset "sortcols_by_phenotype_matrix" begin
vcf,group_label_pack=sortcols_by_phenotype_matrix("test_files/fixed_pheno_matrix_test.csv","case,control", dp_num_array, sample_names)
vcf,group_label_pack=sortcols_by_phenotype_matrix("test_files/sample_metadata_matrix.csv","case,control", dp_num_array, sample_names)
#println("sortcols_by_phenotype_matrix vcf type is $(typeof(vcf))")
#println("sortcols_by_phenotype_matrix vcf size is $(size(vcf,1))")
#println("sortcols_by_phenotype_matrix group_label_pack type is $(typeof(group_label_pack))")
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions test/test_files/pheno_matrix_chr.csv

This file was deleted.

File renamed without changes.
16 changes: 0 additions & 16 deletions test/test_files/positions_list_test_4X_191.csv

This file was deleted.

File renamed without changes.
1 change: 0 additions & 1 deletion test/test_files/sample_order_list_fortest.txt

This file was deleted.

4 changes: 0 additions & 4 deletions test/test_files/sample_phenotype_matrix.csv

This file was deleted.

2 changes: 1 addition & 1 deletion test/test_files/select_samples_list.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cas1001 cas1003 cas1005 cas1010 cas1012
cas1001 cas1003 cas1005 cas1010 cas1012
Loading

0 comments on commit 959b2b0

Please sign in to comment.