Retrieving sequences¶
Complete sequence query¶
Complete sequence can be retrieved using only the required parameter checksum in
fetch_sequence
function or Fetcher.sequence
class method.
from reference_sequence_fetcher import fetcher
fetcher = Fetcher(<server_base_url>)
print(fetcher.fetch_sequence('<checksum>'))
print(Fetcher.sequence(<server_base_url>, <checksum>))
Sub-sequence query¶
User can also retrieve sub-sequences using start and end optional parameters
start and end used to retrieve sub-subsequence of specified bytes. Start is 0-start inclusive
and end is exclusive.
0 <= start < length of sequence ; 1 <= end <= length of sequence
For ex sequence A is given as ATGCATGCATGC
Length is 12
>>fetcher = Fetcher(<server_base_url>)
>>print(fetcher.fetch_sequence('<checksum>'), start=0, end=5)
>>ATGCA
If a server supports circular chromosomes, the client supports crossing the origin using the start and end parameters
>>fetcher = Fetcher(<server_base_url>)
>>print(fetcher.fetch_sequence('<checksum>'), start=5, end=2)
>>TGCATGCATG
so TGCATGC + ATG is the retrieved sequence.
Note
start and end can be used alone. If only start is given, end is assumed to be equal to length of the sequences. When only end is given start is assumed to be equal to 0.