Package Bio :: Package motifs :: Package jaspar :: Module db :: Class JASPAR5
[hide private]
[frames] | no frames]

Class JASPAR5

source code

object --+
         |
        JASPAR5


Class representing a JASPAR5 DB. The methods within are loosely based
on the perl TFBS::DB::JASPAR5 module.

Note: We will only implement reading of JASPAR motifs from the DB.
Unlike the perl module, we will not attempt to implement any methods to
store JASPAR motifs or create a new DB at this time.

Instance Methods [hide private]
 
__init__(self, host=None, name=None, user=None, password=None)
Construct a JASPAR5 instance and connect to specified DB
source code
 
__str__(self)
Return a string represention of the JASPAR5 DB connection.
source code
 
fetch_motif_by_id(self, id)
Fetch a single JASPAR motif from the DB by it's JASPAR matrix ID (e.g.
source code
 
fetch_motifs_by_name(self, name)
Fetch a list of JASPAR motifs from a JASPAR DB by the given TF name(s).
source code
 
fetch_motifs(self, collection='CORE', tf_name=None, tf_class=None, tf_family=None, matrix_id=None, tax_group=None, species=None, pazar_id=None, data_type=None, medline=None, min_ic=0, min_length=0, min_sites=0, all=False, all_versions=False)
Fetch a jaspar.Record (list) of motifs based on the provided selection criteria.
source code
 
_fetch_latest_version(self, base_id)
Get the latest version number for the given base_id,
source code
 
_fetch_internal_id(self, base_id, version)
Fetch the internal id for a base id + version.
source code
 
_fetch_motif_by_internal_id(self, int_id) source code
 
_fetch_counts_matrix(self, int_id)
Fetch the counts matrix from the JASPAR DB by the internal ID
source code
 
_fetch_internal_id_list(self, collection='CORE', tf_name=None, tf_class=None, tf_family=None, matrix_id=None, tax_group=None, species=None, pazar_id=None, data_type=None, medline=None, all=False, all_versions=False)
Fetch a list of internal JASPAR motif IDs based on various passed parameters which may then be used to fetch the rest of the motif data.
source code
 
_is_latest_version(self, int_id)
Does this internal ID represened the latest version of the JASPAR...
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, host=None, name=None, user=None, password=None)
(Constructor)

source code 

Construct a JASPAR5 instance and connect to specified DB

Arguments:
host - host name of the the JASPAR DB server
name - name of the JASPAR database
user - user name to connect to the JASPAR DB
password - JASPAR DB password

Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Return a string represention of the JASPAR5 DB connection.

Overrides: object.__str__

fetch_motif_by_id(self, id)

source code 

Fetch a single JASPAR motif from the DB by it's JASPAR matrix ID
(e.g. 'MA0001.1').

Arguments:
id - JASPAR matrix ID. This may be a fully specified ID including the
     version number (e.g. MA0049.2) or just the base ID (e.g. MA0049).
     If only a base ID is provided, the latest version is returned.
Returns:
A Bio.motifs.jaspar.Motif object

NOTE: The perl TFBS module allows you to specify the type of matrix to
return (PFM, PWM, ICM) but matrices are always stored in JASAPR as
PFMs so this does not really belong here. Once a PFM is fetched the
pwm() and pssm() methods can be called to return the normalized and
log-odds matrices.

fetch_motifs_by_name(self, name)

source code 

Fetch a list of JASPAR motifs from a JASPAR DB by the given TF name(s).

Arguments:
name - a single name or list of names
Returns:
A list of Bio.motifs.Motif.japar objects
 
Notes:
Names are not guaranteed to be unique. There may be more than one
motif with the same name. Therefore even if name specifies a single
name, a list of motifs is returned. This just calls
self.fetch_motifs(collection = None, tf_name = name).

This behaviour is different from the TFBS perl module's
get_Matrix_by_name() method which always returns a single matrix,
issuing a warning message and returning the first matrix retrieved
in the case where multiple matrices have the same name.

fetch_motifs(self, collection='CORE', tf_name=None, tf_class=None, tf_family=None, matrix_id=None, tax_group=None, species=None, pazar_id=None, data_type=None, medline=None, min_ic=0, min_length=0, min_sites=0, all=False, all_versions=False)

source code 

Fetch a jaspar.Record (list) of motifs based on the provided selection
criteria.

Arguments:
Except where obvious, all selection criteria arguments may be specified
as a single value or a list of values. Motifs must meet ALL the
specified selection criteria to be returned with the precedent
exceptions noted below.

all         - Takes precedent of all other selection criteria.
              Every motif is returned. If 'all_versions' is also
              specified, all versions of every motif are returned,
              otherwise just the latest version of every motif is
              returned.
matrix_id   - Takes precedence over all other selection criteria except
              'all'.  Only motifs with the given JASPAR matrix ID(s)
              are returned. A matrix ID may be specified as just a base
              ID or full JASPAR IDs including version number. If only a
              base ID is provided for specific motif(s), then just the
              latest version of those motif(s) are returned unless
              'all_versions' is also specified.
collection  - Only motifs from the specified JASPAR collection(s)
              are returned. NOTE - if not specified, the collection
              defaults to CORE for all other selection criteria except
              'all' and 'matrix_id'. To apply the other selection
              criteria across all JASPAR collections, explicitly set
              collection=None.
tf_name     - Only motifs with the given name(s) are returned.
tf_class    - Only motifs of the given TF class(es) are returned.
tf_family   - Only motifs from the given TF families are returned.
tax_group   - Only motifs belonging to the given taxonomic supergroups
              are returned (e.g. 'vertebrates', 'insects', 'nematodes'
              etc.)
species     - Only motifs derived from the given species are returned.
              Species are specified as taxonomy IDs.
data_type   - Only motifs generated with the given data type (e.g.
              ('ChIP-seq', 'PBM', 'SELEX' etc.) are returned. NOTE -
              must match exactly as stored in the database.
pazar_id    - Only motifs with the given PAZAR TF ID are returned.
medline     - Only motifs with the given medline (PubmMed IDs) are 
              returned.
min_ic      - Only motifs whose profile matrices have at least this
              information content (specificty) are returned.
min_length  - Only motifs whose profiles are of at least this length
              are returned.
min_sites   - Only motifs compiled from at least these many binding
              sites are returned.
all_versions- Unless specified, just the latest version of motifs
              determined by the other selection criteria are returned
              otherwise all versions of the selected motifs are
              returned.

Returns:
A Bio.motifs.jaspar.Record (list) of motifs.

_fetch_internal_id(self, base_id, version)

source code 

Fetch the internal id for a base id + version. Also checks if this
combo exists or not

_fetch_counts_matrix(self, int_id)

source code 

Fetch the counts matrix from the JASPAR DB by the internal ID

Returns a Bio.motifs.matrix.GenericPositionMatrix

_fetch_internal_id_list(self, collection='CORE', tf_name=None, tf_class=None, tf_family=None, matrix_id=None, tax_group=None, species=None, pazar_id=None, data_type=None, medline=None, all=False, all_versions=False)

source code 

Fetch a list of internal JASPAR motif IDs based on various passed
parameters which may then be used to fetch the rest of the motif data.

Caller:
    fetch_motifs()

Arguments:
    See arguments sections of fetch_motifs()

Returns:
    A list of internal JASPAR motif IDs which match the given
    selection criteria arguments.


Build an SQL query based on the selection arguments provided.

1: First add table joins and sub-clauses for criteria corresponding to
   named fields from the MATRIX and MATRIX_SPECIES tables such as
   collection, matrix ID, name, species etc.

2: Then add joins/sub-clauses for tag/value parameters from the
   MATRIX_ANNOTATION table.

For the surviving matrices, the responsibility to do matrix-based
feature filtering such as ic, number of sites etc, fall on the
calling fetch_motifs() method.

_is_latest_version(self, int_id)

source code 

Does this internal ID represened the latest version of the JASPAR
matrix (collapse on base ids)