Skip to content

Commit

Permalink
resolve #26
Browse files Browse the repository at this point in the history
  • Loading branch information
biona001 committed Jun 28, 2024
1 parent a3640ff commit 40fa8e3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/make_hdf5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function get_block(

# save record info
prev_pos = pos_i
push!(df, [join(VCF.id(record), ','), alt_freq, chr_i, pos_i,
push!(df, [get_record_id(record), alt_freq, chr_i, pos_i,
VCF.ref(record), alt_i[1]])
end
close(reader)
Expand All @@ -123,6 +123,11 @@ function get_block(
return Matrix(X), df
end

# return "." if id is missing
function get_record_id(record)
return isempty(record.id) ? "." : join(VCF.id(record), ',')
end

function validate(record, chr_i, pos_i, prev_pos, alt_i, gtkey)
if gtkey === nothing
error("chr $chr_i at pos $pos_i has no GT field!")
Expand All @@ -142,7 +147,7 @@ function validate(record, chr_i, pos_i, prev_pos, alt_i, gtkey)
end
end

# function to rearrange the SNP orders to that resulting S/D actually block diagonal
# function to rearrange the SNP orders so that groups are contiguous
function rearrange_snps!(groups, group_reps, Sigma, Sigma_info)
perm = sortperm(groups)
iperm = invperm(perm)
Expand Down

0 comments on commit 40fa8e3

Please sign in to comment.