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://'
. IfNone
(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
andby_title
methods in the old class.
Parameters: Returns: out
Return type:
by_title
(identifier, strict=True)¶Get a modification matching identifier. Replaces both
by_name
andby_title
methods in the old class.
Parameters: Returns: out
Return type:
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.
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
, andex_code_name
as identifiers, andmonoisotopic_mass
,average_mass
, andcomposition
as mass-describing properties.Additional relationships may be loaded through
specificities
(seeSpecificity
),alternative_names
,fragments
, andnotes
.
- 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.