CAST-genomics/haptools

loosen requirements for pysam

Closed this issue · 0 comments

we currently require the latest version of pysam, which can only be installed with a very recent version of pip

we should loosen this requirement to make it easier to install our tool. The only feature that the newer version of pysam has is an add_samples() function that substantially reduces the time required to write VCFs (see pysam-developers/pysam#1104). So if we want to loosen the version requirement, we'll only need to change this line to use add_sample() if add_samples() isn't available, like we do here:

try:
vcf.header.add_samples(self.samples)
except AttributeError:
self.log.warning(
"Upgrade to pysam >=0.19.1 to reduce the time required to create "
"VCFs. See https://github.com/pysam-developers/pysam/issues/1104"
)
for sample in self.samples:
vcf.header.add_sample(sample)

That way, instead of erroring out, we'll just automatically use the older, slower method if a version of pysam < 0.19.1 is installed.