Package: python3-pysam
Version: 0.22.1+ds-2
Severity: important

Greetings,

Experimental pseudo-excuses reported an autpkgtest regression in
python-pysam following htslib upgrade to version 1.21.  The full
log[1] describes the set of test errors better than I would, but
here are a few failures which seemed representative:

        160s ________________________ TestHeaderWriteRead.test_CRAM 
_________________________
        160s 
        160s self = <AlignmentFileHeader_test.TestHeaderWriteRead 
testMethod=test_CRAM>
        160s 
        160s     def test_CRAM(self):
        160s         header = copy.copy(self.header)
        160s         if "PG" in header:
        160s             # for CRAM, \t needs to be quoted:
        160s             header['PG'][1]['CL'] = re.sub(r"\t", r"\\\\t", 
header['PG'][1]['CL'])
        160s >       self.check_read_write("wc", header)
        160s 
        160s tests/AlignmentFileHeader_test.py:320:
        160s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ 
        160s tests/AlignmentFileHeader_test.py:290: in check_read_write
        160s     with pysam.AlignmentFile(
        160s pysam/libcalignmentfile.pyx:1755: in 
pysam.libcalignmentfile.AlignmentFile.__exit__
        160s     self.close()
        160s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ 
        160s 
        160s >   raise IOError(errno, force_str(strerror(errno)))
        160s E   FileNotFoundError: [Errno 2] No such file or directory
        160s 
        160s pysam/libcalignmentfile.pyx:1687: FileNotFoundError

        160s _________________ TestIndexFormatsVCF.test_bcf_with_csi_index 
__________________
        160s 
        160s self = <VariantFile_test.TestIndexFormatsVCF 
testMethod=test_bcf_with_csi_index>
        160s 
        160s     def test_bcf_with_csi_index(self):
        160s         with get_temp_context("tmp_fn.bcf") as fn:
        160s             shutil.copyfile(self.bcf_filename, fn)
        160s     
        160s             pysam.tabix_index(fn, preset="vcf", force=True, 
csi=True)
        160s     
        160s             self.assertTrue(os.path.exists(fn + ".csi"))
        160s             self.assertEqual(read_index_header(fn + ".csi"), 
b"CSI\1")
        160s             self.assertFalse(os.path.exists(fn + ".tbi"))
        160s     
        160s             with pysam.VariantFile(fn) as inf:
        160s >               self.assertEqual(len(list(inf.fetch("20"))), 3)
        160s 
        160s tests/VariantFile_test.py:257: 
        160s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ 
        160s pysam/libcbcf.pyx:4466: in pysam.libcbcf.VariantFile.fetch
        160s     _, tid, start, stop = self.parse_region(contig, start, stop, 
region,
        160s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ 
        160s 
        160s >   raise ValueError('invalid contig `%s`' % contig)
        160s E   ValueError: invalid contig `20`
        160s 
        160s pysam/libchtslib.pyx:683: ValueError

        160s ______________________ test_ascii_annotation_can_be_added 
______________________
        160s 
        160s vcf_header = <pysam.libcbcf.VariantHeader object at 0x7fbf5b496130>
        160s 
        160s     def test_ascii_annotation_can_be_added(vcf_header):
        160s         vcf_header.formats.add("AN", 1, "String", "An annotation")
        160s >       record = vcf_header.new_record(
        160s             contig="1",
        160s             start=12,
        160s             stop=13,
        160s             samples=[
        160s                 {"AN": "anno1"},
        160s                 {"AN": "anno2"}])
        160s 
        160s tests/VariantRecord_test.py:22: 
        160s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ 
        160s pysam/libcbcf.pyx:2093: in pysam.libcbcf.VariantHeader.new_record
        160s     rec.contig  = contig
        160s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ 
        160s 
        160s >   raise ValueError('Invalid chromosome/contig')
        160s E   ValueError: Invalid chromosome/contig
        160s 
        160s pysam/libcbcf.pyx:3096: ValueError

[1]: https://ci.debian.net/packages/p/python-pysam/unstable/amd64/54272356/

I would have had a look upstream to check whether there is a new
version, but it seems this is not the case yet, so this may be a
good candidate of bug to forward upstream.

Note: when I checked whether that was a regression or not, I hit
another issue of failure to load the module pysam with Python
3.13, that was newly introduced as supported interpreter version
lately, but this is fixable with a rebuild of the pysam package.
For information when trying to reproduce the main issue…

Have a nice day,  :)
-- 
  .''`.  Étienne Mollier <emoll...@debian.org>
 : :' :  pgp: 8f91 b227 c7d6 f2b1 948c  8236 793c f67e 8f0d 11da
 `. `'   sent from /dev/pts/4, please excuse my verbosity
   `-    on air: Cyan - Tomorrow's Here Today

Attachment: signature.asc
Description: PGP signature

Reply via email to