API Reference#

PyO3 bindings to lightmotif, a library for fast PWM motif scanning.

The API is similar to the Bio.motifs module from Biopython on purpose.

Note

Arbitrary alphabets cannot be configured, as lightmotif uses constant definitions of alphabets that cannot be changed at runtime. The different sequences are treated as nucleotide sequences. To use a protein sequence instead, most classes and functions have a protein keyword True:

>>> sequences = ["PILFFRLK", "KDMLKEYL", "PFRLTHKL"]
>>> lightmotif.create(sequences)
Traceback (most recent call last):
  ...
ValueError: Invalid symbol in sequence
>>> lightmotif.create(sequences, protein=True)
<lightmotif.lib.Motif object at ...>

Functions#

lightmotif.create

Create a new motif from an iterable of sequences.

lightmotif.stripe

Encode and stripe a text sequence.

lightmotif.scan

Scan a sequence using a fast scanner implementation to identify hits.

lightmotif.load

Load the motifs contained in a file.

Sequence#

lightmotif.EncodedSequence

A biological sequence encoded as digits.

lightmotif.StripedSequence

An encoded biological sequence stored in a column-major matrix.

Matrices#

lightmotif.CountMatrix

A matrix storing the count of a motif letters at each position.

lightmotif.WeightMatrix

A matrix storing position-specific odds-ratio for a motif.

lightmotif.ScoringMatrix

A matrix storing position-specific odds-ratio for a motif.

Motif#

lightmotif.Motif

A base object storing information about a motif.

lightmotif.TransfacMotif

A motif loaded from a TRANSFAC file.

lightmotif.JasparMotif

A motif loaded from a JASPAR or JASPAR16 file.

lightmotif.UniprobeMotif

A motif loaded from a UniPROBE file.

Scores#

lightmotif.StripedScores

A striped matrix storing scores obtained with a scoring matrix.

Scanner#

lightmotif.Scanner

A fast scanner for identifying high scoring positions in a sequence.

lightmotif.Hit

A hit found by a Scanner.

Loader#

lightmotif.Loader

An iterator for loading motifs from a file.