"X" Matrix Transpose (XMT)
This format is a variation on the Gene Matrix Transpose (GMT) serialization format for gene set libraries. The serialization format is effectively a sparse matrix serialization.
This library provides a helper for parsing GMTs (.gmt) AND XMTs (.xmt)
In addition to the sparse matrix serialization, XMT extends the format with optional "frontmatter" (in the same way markdown frontmatter works). This frontmatter contains versioned yaml metadata helping to describe what the XMT contains.
Example XMT
---
# the xmt file format version
version: "1.0"
# a description of what the terms/set label represent
term: "anatomy"
# a description of what the entities represent, preferrably a well known IRI which could be prefixed to find the entity
# e.g. {this_field}:{the_actual_entity} so hgnc.symbol:ACE2 which can be resolved with https://identifiers.org/hgnc.symbol:ACE2
entity: "hgnc.symbol"
# if `true` the ordering of the entities in the row is from most significant to least significant
ordered: false
# a template that can be used to construct a human readable assertion about
# the relationship between the term and the entity being captured in this XMT
# NOTE: {entity} and {term} are used literally, not as a substitution
label: "{entity} is upregulated in {term}"
# a link to a repository/source/description of how this was generated
source: "https://github.com/… or https://doi.org/…"
# all lines after the close fence (---) are of the form:
# term description list of entities separated by tabs
---
adipose (UBERON:0001013) FAH LIFR H2AFJ NAGLU ACE2
whole blood (UBERON:0001012) FAH LIFR STAT2 STAT3
Using this library
Installation
pip install 'cfde-xmt[pandas]'
Usage
import xmt
data = xmt.from_file('example/simple.xmt')
#data = xmt.from_file('example/legacy.gmt') # also works with .gmt
# load the xmt as a sparse pandas dataframe
data.to_pandas()
# by default, XMTs are lazy loaded, to_dense loads it into memory for faster manipulation
data = data.to_dense()
# also possible to create a new XMT
new_data = xmt.DenseXMT(xmt.Frontmatter(
term='perturbation',
entity='hgnc.symbol',
source='https://maayanlab.cloud/sigcom-lincs/#/Download'
))
new_data.append(term, description, entity_list)
new_data.to_file('output.xmt')
Using the CLI
Installation
pip install 'cfde-xmt[pandas,cli]'
Usage
# initial convertion of gmt to xmt (should still update frontmatter)
xmt convert -i example/legacy.gmt -o output.xmt
# convert to other formats for ease of access in other programming languages
uv run xmt convert -i example/simple.xmt -o output.json
uv run xmt convert -i example/simple.xmt -o output.tsv
Metadata
Release files for cfde-xmt 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cfde_xmt-0.1.1.tar.gz | 5.8 kB | Without provenance | Details for cfde_xmt-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cfde_xmt-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for cfde_xmt-0.1.1-py3-none-any.whl |
Total release size: 12.4 kB
Release files / cfde_xmt-0.1.1.tar.gz
| Download URL | cfde_xmt-0.1.1.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
779ff21283de093c137b3b8825dfa20bf665280de0f93a7ed8280e46976692ff
|
|
BLAKE2b-256 checksum How to use checksums |
bb7620cc13782d6d8d9b4e1f3a7e03188c6c7a9435c99992146f04db83e5ad7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cfde_xmt-0.1.1-py3-none-any.whl
| Download URL | cfde_xmt-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bafe6b818a5ad0e8c55472d19504d56a893a2810d1edfc250f22fac7ada2fc64
|
|
BLAKE2b-256 checksum How to use checksums |
f14b760aa84cecb4a12b866b929decf7952d2f1b1a2101934a24207c1742ed23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for cfde-xmt 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.