Skip to content

Commit

Permalink
V0.2 (#12)
Browse files Browse the repository at this point in the history
* GeneticVariationBase interface

* bump minor version

* variable header lines for psam and pvar
  • Loading branch information
kose-y authored Jan 4, 2024
1 parent 3749b3b commit 22eedcc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/structs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ Creates an instance of `Pgen` from `filename`. `no_mmap` chooses whether to use
"""
function Pgen(filename::String; no_mmap::Bool=false,
psam_filename=filename[1:end-5] * ".psam",
pvar_filename=filename[1:end-5] * ".pvar")
pvar_filename=filename[1:end-5] * ".pvar",
psam_header_lines=1,
pvar_header_lines=1)
io = open(filename)
if !no_mmap
data = mmap(io)
Expand All @@ -71,8 +73,8 @@ function Pgen(filename::String; no_mmap::Bool=false,
Pgen{ST}(io, data, header, variant_record_cache, genotypes_prev, genotypes_cache,
genotypes_raw_cache,
dosage_cache, difflist_cache, difflist_cache_incr,
CSV.read(psam_filename, DataFrame),
CSV.read(pvar_filename, DataFrame))
CSV.read(psam_filename, DataFrame; header=psam_header_lines),
CSV.read(pvar_filename, DataFrame; header=pvar_header_lines))
end

@inline n_variants(p::Pgen) = p.header.n_variants
Expand Down

0 comments on commit 22eedcc

Please sign in to comment.