Skip to content

Commit

Permalink
update for core 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimens committed Oct 27, 2021
1 parent 715ac66 commit e93b39c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PopGenSims"
uuid = "e670a858-c023-4621-870e-30d0f49b8322"
authors = ["Pavel Dimens <[email protected]>"]
version = "0.3.0"
version = "0.3.1"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/Cross.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/PopGenSims.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/Samples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
32 changes: 16 additions & 16 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
anyerrors > 0 && throw("$anyerrors files of tests failed :(")

0 comments on commit e93b39c

Please sign in to comment.