-
Notifications
You must be signed in to change notification settings - Fork 3
Sequence API
Patrick Durand edited this page Apr 14, 2017
·
2 revisions
Sequence is the representation of a nucleotide sequence (e.g. a read).
You do not create Sequence directly. Instead, Bank is used to read Fasta or Fastq files. In turn, Bank enables you to iterate over Sequences, as illustrated in this short code snippet:
# We iterate over some sequences.
for i, seq in enumerate(bank):
# 'seq' is of type 'Sequence'.
# Accessing 'Sequence' internals is done as follows:
# sequence header : seq.comment
# sequence quality: seq.quality (Fastq only)
# sequence letters: seq.sequence
# sequence size : len(seq)
seqid=seq.comment.decode("utf-8").split(" ")[0]
if i<5:
print('%d: %s: %d letters' % (i, seqid, len(seq)))
(This code is taken from here).