PYPI PACKAGE AUDIT v0.1.0 Healthy Package

factorem

Continuous heterogeneity analysis of cryo-EM particles

PyPkgScore factorem
Methodology & Criteria ♥ Donate
720 / 1000
Quick Install
pip install factorem
1. Governance
50/200
2. PEP Metadata
200/200
3. Security
200/200
4. Docs & SEO
105/200
5. CI Engineering
165/200
📣 Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
97
Last 30 days
97
Total (180 days)
97
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) — PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) ✓ Verified OIDC PyPI Integrity / Sigstore
Django Packages — djangopackages.org
PyTech / PyPkgScore 720 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community50 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✕ 0 pts
CONTRIBUTING.md✕ 0 pts
CODE_OF_CONDUCT.md✕ 0 pts
2. PEP Metadata & Packaging200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Security & Supply Chain200 / 200 ▾
Zero CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✓ 50 pts
Snyk / Audit Link✓ 40 pts
HTTPS Repository✓ 50 pts
4. Documentation, SEO & Ecosystem105 / 200 ▾
Structured README✓ 60 pts
Read the Docs✕ 0 pts
Django Packages✕ 0 pts
Website / Technical Articles✓ 45 pts
5. Engineering, CI & Quality165 / 200 ▾
Automated Tests✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✕ 0 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide — factorem

PyPI Metadata v0.1.0
Show full original documentation (English README) ▾

factorem

Conformational and compositional heterogeneity of cryo-EM single particles, from independent analyses of each projection direction that are then synchronized.

factorem takes the particles of a consensus refinement and gives each one a few coordinates that describe its state. It never reconstructs a volume. Particles that view the molecule from about the same direction differ in their state and in little else, so each direction is analysed on its own, as a set of 2D images. Every direction ends up with coordinates in a frame of its own, and a synchronization finds the orthogonal transform of each that brings them all to a common one: by default, the transforms that make the eigenimages of the directions agree along their common lines.

Analysing each projection direction by itself and relating the directions afterwards is the idea of ManifoldEM (Dashti et al., 2014, 2020 and Ojha et al. 2025), which factorem follows. It differs in how: each direction is embedded linearly, by a probabilistic PCA with the CTF in its model, and the directions are related all at once and in all their coordinates, by an orthogonal synchronization.

Installation

pip install factorem

For an NVIDIA GPU, ask for the cuda13 or the cuda12 extra, which bring the matching build of JAX:

pip install 'factorem[cuda13]'

It needs Python 3.10 or later. Images are read with vitrio and everything is computed with JAX.

Usage

factorem analyze particles.star embedded.star --diameter 180

particles.star is a RELION STAR file of the particles, with their alignment and CTF. The output is the same file with two columns more: factoremEmbedding, the coordinates of the particle as a list such as [1.2e-01, -3.4e-01, ...], and factoremGroupCount, how many projection directions it was analysed with.

Option Default
--diameter required Diameter of the particle [Å].
--resolution 16 Resolution of the analysis [Å].
--components 6 Coordinates to give each particle.
--embedding ppca How the particles of each direction are embedded: ppca, by a probabilistic PCA with the CTF in its model, or mahalanobis-mds, by the multidimensional scaling of the Mahalanobis distances between the images.
--synchronization common-lines How the directions are brought to a common frame: common-lines, by the common lines of their eigenimages, or burer-monteiro, by the particles they share.
--root working directory Directory that the images named in the STAR file are relative to.
--device first GPU, else CPU Such as cpu or gpu:1.
--scratch none Directory to keep the working images in, instead of in memory.
-v Report the progress.

The same from Python:

import factorem

dataset = factorem.StarDataset.read('particles.star')
embedding = factorem.analyze(
    dataset.particles,
    diameter=180.0,
    embedder=factorem.ProbabilisticPCA(),  # The default.
    synchronizer=factorem.CommonLineSynchronizer(),  # The default.
)
dataset.write('embedded.star', embedding.coordinates, embedding.group_count)

factorem.MahalanobisMDS() is the other embedder, with the distances of Bhamre, Zhao and Singer (2017), and factorem.BurerMonteiroSynchronizer() the other synchronization. The stages that analyze chains are public as well, and examples/stages.py calls them one by one.

Annotation

pip install 'factorem[annotate]'
factorem annotate embedded.star annotated.star

factorem annotate opens a window with the density of the embedded particles on a plane, to sort them into classes there. The output is the same file with one column more, factoremClass: the class of each particle, from one on, and zero for the particles that the analysis left out. With --label rlnClassNumber the classes go where RELION looks for them.

The classes are the Gaussians of a mixture, and each particle is of the one that most likely gave it.

Control
x, y The coordinate along each axis of the plane.
Lay out by UMAP Show the plane that UMAP lays all the coordinates out on instead. It needs the umap extra.
full, tied, diag, spherical What the covariances of the fitted Gaussians may be: any, one for all of them, aligned with the axes, or round.
Fit K classes Fit a mixture of K Gaussians.
Fit as many as the BIC asks Fit the mixture of least Bayesian information criterion, among those of up to 20 Gaussians.
Fit from the seeds Fit a mixture of a Gaussian for each seed, starting from them. The classes keep the order of the seeds.
Take the seeds as they are Make a round Gaussian of each seed, without fitting anything.
Save and close Write the output. Nothing is written if the window is closed in any other way.

A click on the plane places a seed, dragging a seed moves it, the wheel over it changes its size and a right click removes it. The zoom and the pan of the toolbar take the clicks while they are on, and the density is counted again for what they leave in sight. The classes and the seeds belong to the plane they were made on, so changing it drops them.

Development

pip install -e '.[dev]'
pytest
ruff check . && ruff format --check .
mypy

License

GPL-3.0. See LICENSE.