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

Add AlignedSegment.__repr__ #1267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcelm
Copy link
Contributor

@marcelm marcelm commented Feb 13, 2024

Before:

<pysam.libcalignedsegment.AlignedSegment object at 0x7fd74c3ae2c0>

After:

<AlignedSegment('name', flags=16, ref='chr1', pos=1170070, mapq=255, cigar='50M', ...)>

I’ve used pysam with this patch for a while and find it very valuable when looking at AlignedSegments in a debugger or the REPL.

I’ve chosen to include only the (from my perspective) most important attributes so that the output doesn’t become too long, in particular when there’s a list with AlignedSegments.

The angle brackets are supposed to convey that the string cannot be passed to eval() to recreate the object. I’d be fine with removing them.

Example:
<AlignedSegment('name', flags=16, ref='chr1', pos=1170070, mapq=255, cigar='50M', ...)>
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

Successfully merging this pull request may close these issues.

1 participant