API documentation

peasel Module

peasel

class peasel.EaselSequence

Wrapper for the Easel ESL_SQ object

__len__(self)

x.__len__() <==> len(x)

Length of the sequence

__getitem__(self, s)

Slice the sequence

Parameters:s (slice) – Slice to get, e.g. s[1:3]
Returns:EaselSequence sliced to the specified residues.
create(name, residues, accession, description)

Create a sequence

Parameters:
  • name (str) – Sequence name
  • seq (str) – Sequence residues
  • acc (str) – Sequence accession number
  • desc (str) – Sequence description
Returns:

A new EaselSequence

name

Sequence identifier

seq

Sequence

peasel.create_ssi(file_path, ssi_name=None, sq_format=SQFILE_UNKNOWN)

Create a Simple Sequence Index for a file.

Parameters:
  • file_path – Path to the sequence file
  • ssi_path – Path to the sequence SSI file. If not given, .ssi is appended to file_path.
  • sq_format – File format.
peasel.open_ssi(file_path, ssi_path=None, sq_format=SQFILE_UNKNOWN)

Open a simple sequence index for a file.

Parameters:
  • file_path (str) – Path to the sequence file
  • ssi_path (str) – Path to the sequence SSI file. If not given, .ssi is appended to file_path.
  • sq_format – File format.
peasel.read_fasta(path)

Read sequences in FASTA format from a file.

Parameters:path (str) – Path to file containing sequences in FASTA format.
Returns:A generator of EaselSequence objects.
peasel.read_seq_file(path, sq_format=SQFILE_UNKNOWN)

Read sequences from path. This is a generator function.

Parameters:path (str) – Path to sequence file
Returns:Generator of EaselSequence objects.
peasel.write_fasta(sequences, fp)

Writes sequences to the open file handle fp

Parameters:
  • sequences – Iterable of EaselSequence objects
  • fp – Open file-like object