Bio.motifs.transfac module

Parsing TRANSFAC files.

class Bio.motifs.transfac.Motif(alphabet='ACGT', alignment=None, counts=None, instances=None)

Bases: Motif, dict

Store the information for one TRANSFAC motif.

This class inherits from the Bio.motifs.Motif base class, as well as from a Python dictionary. All motif information found by the parser is stored as attributes of the base class when possible; see the Bio.motifs.Motif base class for a description of these attributes. All other information associated with the motif is stored as (key, value) pairs in the dictionary, where the key is the two-letter fields as found in the TRANSFAC file. References are an exception: These are stored in the .references attribute.

These fields are commonly found in TRANSFAC files:

AC:    Accession number
AS:    Accession numbers, secondary
BA:    Statistical basis
BF:    Binding factors
BS:    Factor binding sites underlying the matrix
       [sequence; SITE accession number; start position for matrix
       sequence; length of sequence used; number of gaps inserted;
       strand orientation.]
CC:    Comments
CO:    Copyright notice
DE:    Short factor description
DR:    External databases
       [database name: database accession number]
DT:    Date created/updated
HC:    Subfamilies
HP:    Superfamilies
ID:    Identifier
NA:    Name of the binding factor
OC:    Taxonomic classification
OS:    Species/Taxon
OV:    Older version
PV:    Preferred version
TY:    Type
XX:    Empty line; these are not stored in the Record.

References are stored in an .references attribute, which is a list of dictionaries with the following keys:

RN:    Reference number
RA:    Reference authors
RL:    Reference data
RT:    Reference title
RX:    PubMed ID

For more information, see the TRANSFAC documentation.

multiple_value_keys = {'BF', 'BS', 'CC', 'DR', 'DT', 'HC', 'HP', 'OV'}
reference_keys = {'RA', 'RL', 'RT', 'RX'}
__getitem__(key)

Return a new Motif object for the positions included in key.

>>> from Bio import motifs
>>> motif = motifs.create(["AACGCCA", "ACCGCCC", "AACTCCG"])
>>> print(motif)
AACGCCA
ACCGCCC
AACTCCG
>>> print(motif[:-1])
AACGCC
ACCGCC
AACTCC
class Bio.motifs.transfac.Record

Bases: list

Store the information in a TRANSFAC matrix table.

The record inherits from a list containing the individual motifs.

Attributes:
  • version - The version number, corresponding to the ‘VV’ field in the TRANSFAC file;

__init__()

Initialize the class.

__str__()

Turn the TRANSFAC matrix into a string.

Bio.motifs.transfac.read(handle, strict=True)

Parse a transfac format handle into a Record object.

Bio.motifs.transfac.write(motifs)

Write the representation of a motif in TRANSFAC format.