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.

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

Score

lightmotif.StripedScores

A striped matrix storing scores obtained with a scoring matrix.

Functions

lightmotif.create(sequences)

Create a new motif from an iterable of sequences.

All sequences must have the same length, and must contain only valid DNA symbols (A, T, G, C, or N as a wildcard).

Example

>>> sequences = ["TATAAT", "TATAAA", "TATATT", "TATAAT"]
>>> motif = lightmotif.create(sequences)
Returns:

Motif – The motif corresponding to the given sequences.

lightmotif.stripe(sequence)

Encode and stripe a text sequence.