Pysam is a Python package for reading, manipulating, and writing genomics data such as SAM/BAM/CRAM and VCF/BCF files. It's a lightweight wrapper of the HTSlib API, the same one that powers samtools, bcftools, and tabix.
Replace bcf_get_genotypes in bcf_genotype_count with implementation that does not require reading GT data for all samples. Code for computing the ploidy is based on the bcf_format_get_allele_indices function for getting the values in GT field but it just counts instead of reading the values.
This is an attempt at addressing #1280, but feel free to decline the PR if there is a better way to address this issue. Also not sure if I am allowed to add the benchmark tests since others are mostly comparisons with other implementations.
Replace
bcf_get_genotypes
inbcf_genotype_count
with implementation that does not require reading GT data for all samples. Code for computing the ploidy is based on thebcf_format_get_allele_indices
function for getting the values in GT field but it just counts instead of reading the values.This is an attempt at addressing #1280, but feel free to decline the PR if there is a better way to address this issue. Also not sure if I am allowed to add the benchmark
tests
since others are mostly comparisons with other implementations.Before:
After: