Skip to content

Add bespoke classes for accessing SEQ and QUAL#1347

Draft
jmarshall wants to merge 1 commit intopysam-developers:masterfrom
jmarshall:seq-access
Draft

Add bespoke classes for accessing SEQ and QUAL#1347
jmarshall wants to merge 1 commit intopysam-developers:masterfrom
jmarshall:seq-access

Conversation

@jmarshall
Copy link
Member

Inspired by the request in #1346, “Faster Single-Base Access for Long Reads”:—

Instead of accessing SEQ (and eventually QUAL) via a str property, add classes that implement __getitem__, __str__, etc directly from the internal BAM representation. These classes can then be used to access subsequences and do other useful things that you would do with a str:

aln.query_bases[4]
aln.query_bases[3:12]
print(f"Sequence is {aln.query_bases}")
…etc…

without decoding the unrequested parts of the sequence data.

This demonstrates the idea. We will likely rename this and position it to become the principal way to access SEQ, deprecating query_sequence, and similarly for base qualities.

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