diff --git a/Project.toml b/Project.toml index 3c98ecf..0b1b225 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PopGenSims" uuid = "e670a858-c023-4621-870e-30d0f49b8322" authors = ["Pavel Dimens "] -version = "0.3.0" +version = "0.3.1" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" @@ -15,7 +15,7 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" DataFrames = "1.0, 1.1" InvertedIndices = "1.0" PooledArrays = "1.0, 1.1" -PopGenCore = "0.4, 0.5" +PopGenCore = "0.5" StaticArrays = "1.2" StatsBase = "0.33" julia = "1.5, 1.6" diff --git a/src/Cross.jl b/src/Cross.jl index f94e88f..953cddc 100644 --- a/src/Cross.jl +++ b/src/Cross.jl @@ -58,8 +58,8 @@ function cross(data::PopData, parent1::String, parent2::String; n::Int = 100, ge p2_ploidy isa AbstractVector && error("Parent $parent2 has mixed ploidy, which is unsupported") # get parental genotypes - p1 = get_genotypes(data, parent1) - p2 = get_genotypes(data, parent2) + p1 = genotypes(data, parent1) + p2 = genotypes(data, parent2) loci = data.locusinfo.locus @@ -133,8 +133,8 @@ function cross(parent_1::Pair, parent_2::Pair; n::Int = 100, generation::String p2_ploidy isa AbstractVector && error("Parent $parent2 has mixed ploidy, which is unsupported") # get parental genotypes - p1 = get_genotypes(parent_1_data, parent1) - p2 = get_genotypes(parent_2_data, parent2) + p1 = genotypes(parent_1_data, parent1) + p2 = genotypes(parent_2_data, parent2) # pre-allocate all output information out_loci_names = repeat(loci, outer = n) diff --git a/src/PopGenSims.jl b/src/PopGenSims.jl index b9710d0..b21b57c 100644 --- a/src/PopGenSims.jl +++ b/src/PopGenSims.jl @@ -26,11 +26,11 @@ using DataFrames, PooledArrays, StaticArrays using StatsBase: sample, Weights import PopGenCore: read, write using PopGenCore: - allele_freq, + allelefreq, copy, Genotype, GenoArray, - get_genotypes, + genotypes, PopData, sort diff --git a/src/Samples.jl b/src/Samples.jl index 74cbc6f..33cf25c 100644 --- a/src/Samples.jl +++ b/src/Samples.jl @@ -98,7 +98,7 @@ function simulate(data::PopData; n::Int = 100) gdf = groupby(data.genodata, [:population, :locus]) freqs = DataFrames.combine( gdf, - :genotype => allele_freq => :frq + :genotype => allelefreq => :frq ) # create new genotypes transform!(freqs, :frq => (i -> sample_locus.(i,n,ploidy)) => :frq) diff --git a/test/runtests.jl b/test/runtests.jl index b3edbe5..43fdae1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ fatalerrors = length(ARGS) > 0 && ARGS[1] == "-f" quiet = length(ARGS) > 0 && ARGS[1] == "-q" -anyerrors = false +anyerrors = 0 using PopGenCore using PopGenSims @@ -15,22 +15,22 @@ all_tests = [ println("Running tests:") -for a_test in all_tests - try - include(a_test) - println("\t\033[1m\033[32mPASSED\033[0m: $(a_test)") - catch e - global anyerrors = true - println("\t\033[1m\033[31mFAILED\033[0m: $(a_test)") - if fatalerrors - rethrow(e) - elseif !quiet - showerror(stdout, e, backtrace()) - println() +@testset "All Tests" begin + for a_test in all_tests + try + include(a_test) + println("\t\033[1m\033[32mPASSED\033[0m: $(a_test)") + catch e + global anyerrors += 1 + println("\t\033[1m\033[31mFAILED\033[0m: $(a_test)") + if fatalerrors + rethrow(e) + elseif !quiet + showerror(stdout, e, backtrace()) + println() + end end end end -if anyerrors - throw("Tests failed :(") -end \ No newline at end of file +anyerrors > 0 && throw("$anyerrors files of tests failed :(") \ No newline at end of file