Pyteomics documentation v4.7.4

unimod - interface to the Unimod database

«  mass - molecular masses and isotope distributions   ::   Contents   ::   achrom - additive model of polypeptide chromatography  »

unimod - interface to the Unimod database

This module provides an interface to the relational Unimod database. The main class is Unimod, which provides an identical interface to that of the in-memory implementation of the same name in pyteomics.mass.

Dependencies

This module requires lxml and sqlalchemy.

Primary Interface

class pyteomics.mass.unimod.Unimod(path=None)[source]

Bases: object

Main class representing the relational Unimod database.

Examples

If you just wish to get a new copy of the data and store it in a temporary in-memory database, invoking the type without parameters works without issue.

>>> new_db = Unimod()

If you want to persist a snapshot of the Unimod database to disk and query it from there, or to re-use a previously downloaded database copy, pass a database driver prefixed path:

>>> reused_db = Unimod("sqlite:///path/to/unimod.db")

If the path did not previously exist, a new copy of Unimod will be downloaded and stored there on the first use, but be immediately available on subsequent uses.

__init__(path=None)[source]

Initialize the object from a database file.

Parameters:

path (str or None, optional) – If str, should point to a database. Use a dialect-specific prefix, like 'sqlite://'. If None (default), a relational XML file will be downloaded from default location.

by_name(identifier, strict=True)

Get a modification matching identifier. Replaces both by_name and by_title methods in the old class.

Parameters:
  • identifier (str)

  • strict (bool, optional) – Defaults to True.

Returns:

out

Return type:

Modification

by_title(identifier, strict=True)

Get a modification matching identifier. Replaces both by_name and by_title methods in the old class.

Parameters:
  • identifier (str)

  • strict (bool, optional) – Defaults to True.

Returns:

out

Return type:

Modification

execute(*args, **kwargs)[source]

Execute an SQLAlchemy statement or a SQL string against the database, returning the resulting database cursor.

See sqlalchemy’s Session documentation for more details.

get(identifier, strict=True)[source]

Get a modification matching identifier. Replaces both by_name and by_title methods in the old class.

Parameters:
  • identifier (str)

  • strict (bool, optional) – Defaults to True.

Returns:

out

Return type:

Modification

query(*args)[source]

Compose an SQL query using SQLAlchemy’s ORM interface.

See sqlalchemy’s Session documentation for more details.

Relational Entities

There are many tables that are described as object-relationally mapped (ORM) types in this module. The most important two are shown here.

class pyteomics.mass.unimod.Modification[source]

A single modification record from Unimod, having an id, full_name, code_name, and ex_code_name as identifiers, and monoisotopic_mass, average_mass, and composition as mass-describing properties.

Additional relationships may be loaded through specificities (see Specificity), alternative_names, fragments, and notes.

class pyteomics.mass.unimod.Specificity[source]

Describes the relationship between a Modification and an amino acid/position rule, along with the chemical process type that gives rise to that modification event.

Other ORM Types

The following ORM types may be useful when composing a more detailed query. Additional types may be found in the source.

class pyteomics.mass.unimod.AminoAcid[source]
class pyteomics.mass.unimod.Position[source]
class pyteomics.mass.unimod.Classification[source]
class pyteomics.mass.unimod.Fragment[source]
class pyteomics.mass.unimod.AlternativeName[source]
class pyteomics.mass.unimod.Crossreference[source]

«  mass - molecular masses and isotope distributions   ::   Contents   ::   achrom - additive model of polypeptide chromatography  »