Bio.motifs.transfac module

Parsing TRANSFAC files.

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

Bases: Bio.motifs.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', 'DR', 'DT', 'HC', 'HP', 'OV'}
reference_keys = {'RA', 'RL', 'RT', 'RX'}
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__(self)

Initialize the class.

__str__(self)

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.