Description: Fix write_fa_subset with pysam >= 0.24 pysam 0.24.x rewrote the samtools stdout redirection. As a result pysam.faidx(infile, region) no longer returns the fetched sequence as a string (it returns an empty string while the sequence is written to the process' real stdout), which made write_fa_subset write empty output files and broke ariba/tests/faidx_test.py::test_write_fa_subset. Fetch sequences via pysam.FastaFile instead, which works with all supported pysam versions. Forwarded: no Last-Update: 2026-09-21 --- a/ariba/faidx.py +++ b/ariba/faidx.py @@ -8,7 +8,10 @@ pysam.faidx(infile) f = pyfastaq.utils.open_file_write(outfile) - for name in seq_names: - print(pysam.faidx(infile, name), end='', file=f) + with pysam.FastaFile(infile) as fasta: + for name in seq_names: + seq = fasta.fetch(name) + print('>' + name, file=f) + print(seq, file=f) pyfastaq.utils.close(f)