Skip to main content

"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 (add additional `-s k=v` arguments to specify)
xmt convert \
  -i example/legacy.gmt \
  -o output.xmt \
  -s 'version="1.0"' \
  -s 'entity="hgnc.symbol:"' \
  -s 'term="UBERON organ"' \
  -s 'ordered=false' \
  -s 'label="{entity} is highly expressed in {term}"' \
  -s 'source="some source"'

# 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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cfde-xmt 0.2.0
File Size Uploaded Provenance Actions
cfde_xmt-0.2.0.tar.gz 6.4 kB Without provenance Details for cfde_xmt-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cfde-xmt 0.2.0
File Interpreter ABI Platform Actions
cfde_xmt-0.2.0-py3-none-any.whl Python 3 none any Details for cfde_xmt-0.2.0-py3-none-any.whl

Total release size: 13.7 kB

Release files / cfde_xmt-0.2.0.tar.gz

Download URL cfde_xmt-0.2.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
690a6dbaaa53230168d0372abfe81c4924c8e7e46fc8b89dcb2fc5909ecba059
BLAKE2b-256 checksum
How to use checksums
4d091fc4591da5de4e2341dfc42f52dbc62ba7f180a59dbaa1947ad7bc173f59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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.2.0-py3-none-any.whl

Download URL cfde_xmt-0.2.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c495d76232bc7ed537b0ac91a150eb738bea78bea9407ebd35b5569bf00166c6
BLAKE2b-256 checksum
How to use checksums
9bfc2191ef6445e6cb9d53e3cb45c06cf93374d578eefba498e002a1f86deb26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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.2.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page