Skip to content

Commit 7d75fa4

Browse files
committed
GVBase 0.1.2
1 parent b1aa0f8 commit 7d75fa4

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BGEN"
22
uuid = "6db4b851-9beb-4b83-9d64-eb1cfb37721d"
33
authors = ["Seyoon Ko <kos@ucla.edu> and contributors"]
4-
version = "0.2.0"
4+
version = "0.2.1"
55

66
[deps]
77
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
@@ -18,7 +18,7 @@ TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
1818
[compat]
1919
CodecZlib = "0.6, 0.7"
2020
CodecZstd = "0.6, 0.7, 0.8"
21-
GeneticVariantBase = "0.1"
21+
GeneticVariantBase = "0.1.2"
2222
SIMD = "3"
2323
SQLite = "1"
2424
SpecialFunctions = "1, 2"

src/BGEN.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import SpecialFunctions: gamma_inc
77
import TranscodingStreams: initialize, finalize, buffermem, process, Buffer, Error
88
import GeneticVariantBase: GeneticData, Variant, VariantIterator, iterator
99
import GeneticVariantBase: chrom, pos, rsid, alleles, alt_allele, ref_allele
10-
import GeneticVariantBase: maf, hwepval, infoscore, load_values!
10+
import GeneticVariantBase: maf, hwepval, infoscore, alt_dosages!
1111
export Bgen, Samples, Variant, Genotypes, Index
1212
export io, fsize, samples, n_samples, n_variants, compression
1313
export varid, rsid, chrom, pos, n_alleles, alleles, minor_allele, major_allele
@@ -17,7 +17,7 @@ export first_allele_dosage!, clear!, hardcall, hardcall!
1717
export select_region, variant_by_rsid, variant_by_pos, variant_by_index
1818
export rsids, chroms, positions
1919
export hwe, maf, info_score, counts!
20-
export VariantIteratorFromStart, VariantIteratorFromOffsets
20+
export BgenVariantIteratorFromStart, BgenVariantIteratorFromOffsets
2121
using CodecZlib, CodecZstd, SQLite, SIMD
2222
include("structs.jl")
2323
include("iterator.jl")

src/genotypes.jl

+6
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,12 @@ function alt_allele_dosage!(b::Bgen, v::BgenVariant;
640640
data
641641
end
642642

643+
function alt_dosages!(arr::AbstractArray{T}, b::Bgen, v::BgenVariant;
644+
mean_impute=false, clear_decompressed=false,
645+
decompressed=nothing, is_decompressed=false) where T <: Real
646+
alt_allele_dosage!(b, v; T=T, mean_impute=mean_impute, clear_decompressed=clear_decompressed, data=arr, decompressed=decompressed, is_decompressed=is_decompressed)
647+
end
648+
643649
"""
644650
minor_allele_dosage!(b::Bgen, v::BgenVariant; T=Float32,
645651
mean_impute=false, clear_decompressed=false)

test/test_minor_allele_dosage.jl

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ clear!(v)
8484
clear!(v)
8585
@test isapprox(mean(BGEN.ref_allele_dosage!(b, v)), 0.48411763f0)
8686
@test isapprox(mean(BGEN.alt_allele_dosage!(b, v)), 2 - 0.48411763f0)
87+
clear!(v)
88+
@test isapprox(mean(GeneticVariantBase.alt_dosages!(Vector{Float32}(undef, n_samples(b)), b, v)), 2 - 0.48411763f0)
8789
end
8890

8991
@testset "mean_impute" begin

0 commit comments

Comments
 (0)