Sequences#

class pyswrd.Sequences#

A list of sequences.

__init__(sequences=())#

Create a new database of sequences.

append(sequence)#

Append a single sequence at the end of the sequence list.

Parameters:

sequence (str or byte-like object) – The new sequence.

Hint

When inserting several sequences in the list, consider using the Sequences.extend method instead so that the internal buffers can reserve space just once for every new sequence.

Example

>>> db = pyswrd.Sequences(["ATGC", "TTCA"])
>>> db.append("AAAA")
>>> list(db)
['ATGC', 'TTCA', 'AAAA']
clear()#

Remove all sequences from the database.

extend(sequences)#

Extend the sequence list by adding sequences from an iterable.

Example

>>> db = pyswrd.Sequences(["ATGC"])
>>> db.extend(["TTCA", "AAAA", "GGTG"])
>>> list(db)
['ATGC', 'TTCA', 'AAAA', 'GGTG']