You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python APIIssue is about the Python APIenhancementNew feature or requestfutureIssues that are closed as they are not planned in the medium-term, but which are still desirable.
# What is the reference base at position 12345?ts.reference_sequence[12345]
# What are the bases between position a and b?ts.reference_sequence[a:b]
etc. Assuming the slices are reasonably small, this can be done efficiently by implementing the __getitem__ method, and either accessing the data via numpy arrays, or just implementing in the Python C layer.
In the future, we can implement the data fetching methodology from URLs in the background to implement these queries.
In general, I guess what we want to to present a str-like API, so that we generally regard the ts.reference_sequence instance as a unicode string, with some extra methods that let us figure out where it came from, etc.
One odd thing then though would be that __str__ would not return the string itself, but a useful summary.
It would actually be very helpful not to return the string. At the moment, when I have a whole chromosome reference sequence, if I print it to screen it can stall my python REPL / notebook cell. It would be preferable to show a truncated string.
Python APIIssue is about the Python APIenhancementNew feature or requestfutureIssues that are closed as they are not planned in the medium-term, but which are still desirable.
Activity
jeromekelleher commentedon Dec 2, 2021
In general, I guess what we want to to present a
str-like API, so that we generally regard thets.reference_sequenceinstance as a unicode string, with some extra methods that let us figure out where it came from, etc.One odd thing then though would be that
__str__would not return the string itself, but a useful summary.hyanwong commentedon Mar 22, 2024
It would actually be very helpful not to return the string. At the moment, when I have a whole chromosome reference sequence, if I print it to screen it can stall my python REPL / notebook cell. It would be preferable to show a truncated string.