Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to add tags to an insilico AlignedSegment results in error #1304

Open
blex-max opened this issue Aug 22, 2024 · 1 comment
Open

Trying to add tags to an insilico AlignedSegment results in error #1304

blex-max opened this issue Aug 22, 2024 · 1 comment

Comments

@blex-max
Copy link

from the doc:

    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

pysam==0.22.1

Thanks for any help, and for maintaining pysam!

@blex-max
Copy link
Author

r.set_tag(...) works, but it's unfortunate that the documented method does not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant