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

uv tool install 'cfde-xmt[cli,pandas]'

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
xmt convert -i example/simple.xmt -o output.json
xmt convert -i example/simple.xmt -o output.tsv

Metadata

Release files for cfde-xmt 0.2.1

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.1
File Size Uploaded Provenance Actions
cfde_xmt-0.2.1.tar.gz 6.5 kB Without provenance Details for cfde_xmt-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 13.8 kB

Release files / cfde_xmt-0.2.1.tar.gz

Download URL cfde_xmt-0.2.1.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c74bead94fb93b2cbcd6f952267f8dc75b052113887e48e9025b0784d853c1e0
BLAKE2b-256 checksum
How to use checksums
c3dac5506772f292eabf9d792498c1ba1634d41f790e6914d143419f56712677
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.1-py3-none-any.whl

Download URL cfde_xmt-0.2.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac52185884786d96eff18ba9f777735e299e1e9e29433af6469d73f5b0fb2757
BLAKE2b-256 checksum
How to use checksums
5bbb276aca0db531ea5a13a201af6c2be1eb2c90f42ada84bd4b529e7236db90
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.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.

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