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.
a = pysam.AlignedSegment()
...
a.tags = (("NM", 1),
("RG", "L1"))
my code:
r = pysam.AlignedSegment()
...
r.tags = (('MC', '10M'))
Type Checker says:
Cannot assign to attribute "tags" for class "AlignedSegment"
Attribute "tags" is unknown
and running the code gives the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/nfs/users/nfs_a/ab63/dev/core-hairpin-py/test_validate_read.py", line 17, in test_validate_read
r.tags = (('MC', '10M'))
^^^^^^
File "pysam/libcalignedsegment.pyx", line 2874, in pysam.libcalignedsegment.AlignedSegment.tags.__set__
File "pysam/libcalignedsegment.pyx", line 2678, in pysam.libcalignedsegment.AlignedSegment.set_tags
File "pysam/libcalignedsegment.pyx", line 411, in pysam.libcalignedsegment.pack_tags
KeyError: 77
from the doc:
my code:
Type Checker says:
and running the code gives the following error:
pysam==0.22.1
Thanks for any help, and for maintaining pysam!