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 cfde_xmt as 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.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.1.0
File Size Uploaded Provenance Actions
cfde_xmt-0.1.0.tar.gz 5.8 kB Without provenance Details for cfde_xmt-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 12.4 kB

Release files / cfde_xmt-0.1.0.tar.gz

Download URL cfde_xmt-0.1.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d8e143025e2fcded9cb085972263b1f5cfc2d3285f412456219559bd971d9f3c
BLAKE2b-256 checksum
How to use checksums
40a07626a20e09a3b4829a63cd1995f3cc419c8fd73ba1a153ff53e95d85ce53
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.0-py3-none-any.whl

Download URL cfde_xmt-0.1.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b94705b9af081acf8f4721bda2a508bf04a33a1e37bc9c40fdf6601f4e1df5eb
BLAKE2b-256 checksum
How to use checksums
9acebde74590675fe3f59f9ac2d50d6f3a58e9334d00fd1a98516620953fb6d4
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.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