Skip to content

Commit aaa4797

Browse files
committed
more standardization
1 parent d004a61 commit aaa4797

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

src/GenoFreq.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
export genofreq, genofreq_expected, geno_count_observed, geno_count_expected
1+
export genofreq, genofreq_expected, genocount_observed, genocount_expected
22

33
"""
4-
geno_count_observed(locus::GenoArray)
4+
genocount_observed(locus::GenoArray)
55
Return a `Dict` of genotype counts of a single locus in a
66
`PopData` object.
77
"""
8-
@inline function geno_count_observed(locus::T) where T<:GenoArray
8+
@inline function genocount_observed(locus::T) where T<:GenoArray
99
# conditional testing if all genos are missing
1010
all(ismissing.(locus)) && return missing
1111
countmap(skipmissing(locus))
1212
end
1313

1414
"""
15-
geno_count_expected(locus::GenoArray)
15+
genocount_expected(locus::GenoArray)
1616
Return a `Dict` of the expected genotype counts of a single locus in a
1717
`PopData` object. Expected counts are calculated as the product of observed
1818
allele frequencies multiplied by the number of non-missing genotypes.
1919
"""
20-
function geno_count_expected(locus::T) where T<:GenoArray
20+
function genocount_expected(locus::T) where T<:GenoArray
2121
#count number of non-missing genotypes in the locus
2222
n = nonmissing(locus)
2323

src/Utils/GenotypeUtils.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export allelecount, alleles, unique_alleles
1+
export allelecount, alleles, uniquealleles
22
export locidataframe, locimatrix, phasedmatrix
33

44

@@ -42,10 +42,10 @@ end
4242

4343

4444
"""
45-
unique_alleles(locus::T) where T<:GenoArray
45+
uniquealleles(locus::T) where T<:GenoArray
4646
Return an array of all the unique non-missing alleles of a locus.
4747
"""
48-
@inline function unique_alleles(locus::GenoArray)
48+
@inline function uniquealleles(locus::GenoArray)
4949
unique(alleles(locus))
5050
end
5151

test/allelegenofreq.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,21 @@ end
9191

9292
@testset "Genotype Counts" begin
9393
@testset "Basic" begin
94-
@test geno_count_observed(g) isa Dict
95-
@test geno_count_observed([missing, missing]) === missing
96-
@test geno_count_expected(g) isa Dict
94+
@test genocount_observed(g) isa Dict
95+
@test genocount_observed([missing, missing]) === missing
96+
@test genocount_expected(g) isa Dict
9797
end
9898

9999
@testset "Nuanced" begin
100-
@test length(geno_count_observed(cats.genodata.genotype)) == 295
101-
@test typeof(geno_count_observed(cats.genodata.genotype)) <: Dict{<:Tuple,Int64}
102-
@test length(geno_count_expected(cats.genodata.genotype)) == 6241
103-
@test typeof(geno_count_expected(cats.genodata.genotype)) <: Dict{<:Tuple,Float64}
100+
@test length(genocount_observed(cats.genodata.genotype)) == 295
101+
@test typeof(genocount_observed(cats.genodata.genotype)) <: Dict{<:Tuple,Int64}
102+
@test length(genocount_expected(cats.genodata.genotype)) == 6241
103+
@test typeof(genocount_expected(cats.genodata.genotype)) <: Dict{<:Tuple,Float64}
104104

105-
@test length(geno_count_observed(sharks.genodata.genotype)) == 12
106-
@test typeof(geno_count_observed(sharks.genodata.genotype)) <: Dict{<:Tuple,Int64}
107-
@test length(geno_count_expected(sharks.genodata.genotype)) == 25
108-
@test typeof(geno_count_expected(sharks.genodata.genotype)) <: Dict{<:Tuple,Float64}
105+
@test length(genocount_observed(sharks.genodata.genotype)) == 12
106+
@test typeof(genocount_observed(sharks.genodata.genotype)) <: Dict{<:Tuple,Int64}
107+
@test length(genocount_expected(sharks.genodata.genotype)) == 25
108+
@test typeof(genocount_expected(sharks.genodata.genotype)) <: Dict{<:Tuple,Float64}
109109
end
110110
end
111111

test/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ x = @nancycats
2424
@test alleles([(1,2), (1,4)], false) == [1,2,1,4]
2525
@test alleles([(1,2), (1,4), missing], false) == [1,2,1,4]
2626
@test all(alleles([(1,2), (1,4), missing], true) .=== [1,2,1,4,missing])
27-
@test unique_alleles([(1,2), (1,4), missing]) == [1,2,4]
27+
@test uniquealleles([(1,2), (1,4), missing]) == [1,2,4]
2828
@test size(locidataframe(x)) == (9,237)
2929
@test size(locimatrix(x)) == (237,9)
3030
@test length(phasedmatrix(x)) == 2

0 commit comments

Comments
 (0)