Skip to main content

Rosetta logo

🪨 rosetta

Python interface to R/Bioconductor — pandas in, pandas out, .report() when you're done.

PyPI License: MIT Tests DOI

pip install rosetta-bioc

30-second demo

import rosetta as rb

# DESeq2 differential expression — one call, pandas out
results = rb.deseq2(counts_df, metadata_df, design="~ condition")
results.report()
DESeq2 Results Summary
──────────────────────────────
Total genes tested:      12,000
Significant (padj<0.05): 843 (7.0%)
  ↑ Upregulated:         428
  ↓ Downregulated:       415
LFC range:               [-4.71, 3.50]

That's it. No R code. No rpy2 boilerplate. No type conversion. Just results.

Three-Tier API

Tier Style Functions Use case
1 — Quick quick_*() quick_deseq2, quick_edger, quick_seurat, quick_phyloseq One-liners for notebooks
2 — Class-based Class() Seurat(), Phyloseq() Stateful, chainable workflows
3 — Functional func() run_deseq2() + get_results(), edger(), limma_voom(), ORA, GSEA Full control
# Tier 1 — quick: one call, done
results = rb.quick_deseq2(counts_df, metadata_df, design="~ condition")

# Tier 2 — class-based: build up state, chain methods
seu = rb.Seurat(matrix).normalize().find_clusters().umap()

# Tier 3 — functional: explicit steps, full access
dds = rb.wrappers.deseq2.run_deseq2(counts, meta, design="~ batch + condition")
res = rb.wrappers.deseq2.get_results(dds, lfc_threshold=1.0)

Complete example — copy, paste, run

import pandas as pd
import numpy as np
from rosetta import deseq2

# Simulate RNA-seq counts: 1000 genes, 6 samples (3 control, 3 treated)
np.random.seed(42)
counts = pd.DataFrame(
    np.random.negative_binomial(5, 0.1, size=(1000, 6)),
    index=[f"gene_{i}" for i in range(1000)],
    columns=["ctrl_1", "ctrl_2", "ctrl_3", "treat_1", "treat_2", "treat_3"],
)

metadata = pd.DataFrame(
    {"condition": ["control"] * 3 + ["treated"] * 3},
    index=counts.columns,
)

results = deseq2(counts=counts, metadata=metadata, design="~ condition")
print(results.sort_values("padj").head(10))

Requires: Python 3.9+, R 4.0+, and Bioconductor's DESeq2 (BiocManager::install("DESeq2")).

What it wraps

R Package Quick API Class / Functional What it does
DESeq2 rb.quick_deseq2() run_deseq2() + get_results() Differential expression (negative binomial)
edgeR rb.quick_edger() rb.edger() Quasi-likelihood differential expression
limma rb.limma_voom() Linear models + TREAT significance
clusterProfiler rb.enrich_go(), GSEA GO/KEGG/Reactome pathway enrichment
phyloseq rb.quick_phyloseq() Phyloseq() Microbiome diversity analysis
Seurat rb.quick_seurat() Seurat() Single-cell RNA-seq

All functions return a RosettaDataFrame (pandas DataFrame subclass) with a .report() method.

Not a toy — full design support

  • Multi-factor designs: design="~ batch + condition", interaction terms, blocking factors
  • LFC thresholds: proper hypothesis testing via lfcThreshold (not post-hoc filtering)
  • Shrinkage: apeglm, ashr, normal — via lfc_shrink()
  • Contrasts: contrast=["genotype", "mutant", "wildtype"]
  • QC/normalization/outliers: DESeq2's size factors, Cook's distance, independent filtering all run normally — Rosetta doesn't hide the fitted object
  • Weights, correlations: limma-voom with duplicateCorrelation, sample weights — everything the R function accepts, Rosetta passes through

Show me the R code

Don't trust a black box? Turn on codegen to see exactly what's running:

import rosetta as rb
rb.codegen.enable()

dds = rb.wrappers.deseq2.run_deseq2(counts, meta, design="~ batch + condition")
res = rb.wrappers.deseq2.get_results(dds, lfc_threshold=1.0)
  R> library(DESeq2)
  R> dds <- DESeqDataSetFromMatrix(countData=counts, colData=metadata, design=~ batch + condition)
  R> dds <- DESeq(dds)
  R> res <- results(dds, alpha=0.1, lfcThreshold=1.0)

rb.codegen.last() returns it as a string — paste into R to reproduce independently.

Modular DESeq2 API

For more control, use the step-by-step interface:

from rosetta.wrappers.deseq2 import run_deseq2, get_results, lfc_shrink

dds = run_deseq2(counts_df, metadata_df, design="~ condition")
res = get_results(dds, contrast=["condition", "treated", "control"], alpha=0.05)
shrunk = lfc_shrink(dds, coef="condition_treated_vs_control", type="apeglm")

res.report()
shrunk.report()

Enrichment analysis

import rosetta as rb

# Over-representation analysis
go_results = rb.enrich_go(gene_list, org_db="org.Hs.eg.db", ont="BP")
go_results.report()

# KEGG pathways
kegg = rb.enrich_kegg(gene_list, organism="hsa")
kegg.report()

Setup

Python side:

pip install rosetta-bioc

R side (one-time):

Rscript install.R

Or manually:

BiocManager::install(c("DESeq2", "edgeR", "limma", "clusterProfiler"))

Posit Cloud: See docs/posit-cloud.md for zero-config setup.

Requirements

  • Python 3.9+
  • R 4.0+ with Bioconductor
  • rpy2 ≥ 3.5

Philosophy

  1. Rosetta calls R — it doesn't reimplement it. All statistics run in the original, validated R packages.
  2. Pandas in, pandas out. No R objects leak into your Python workflow.
  3. Fail early, fail clearly. Input validation happens in Python before crossing the R boundary.
  4. .report() everything. Results should be immediately interpretable without manual inspection.
  5. Show your work. codegen prints the equivalent R code so you can verify, reproduce, or learn.

Contributing

See CONTRIBUTING.md. Good first issues are labeled — start with Issue #1: report() enhancements.

Contributors

  • Catherine Chi Chung — GSoC 2026 contributor
  • Matias Salibian Barrera — GSoC co-mentor, UBC Statistics

Acknowledgments

Built on rpy2 and the extraordinary R/Bioconductor ecosystem. All credit for the statistical methods goes to the original R package authors.

Supported by:

  • Google Summer of Code 2026 — funding Catherine's development work
  • JPMorgan Chase — startup banking and advisory through their Innovation Economy program
  • AWS — quantum computing infrastructure via Amazon Braket
  • Nodes Bio, Inc. — project lead, CI/hosting, and engineering

GSoC 2026 · MIT License · Nodes Bio

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rosetta_bioc-0.3.1.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rosetta_bioc-0.3.1-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file rosetta_bioc-0.3.1.tar.gz.

File metadata

  • Download URL: rosetta_bioc-0.3.1.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for rosetta_bioc-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c6cf8e6f71c790e7a016f36ba1edf745865a000ef00d6b353d97cc2a288fbf2b
MD5 55803ece1fb0fa1d35e3917be279b425
BLAKE2b-256 416c8fa117e6bb31834aa184630ad41a970f1ab4698e1fa6de69007ea03bdb10

See more details on using hashes here.

Provenance

The following attestation bundles were made for rosetta_bioc-0.3.1.tar.gz:

Publisher: publish.yml on rosetta-bioc/rosetta

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rosetta_bioc-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: rosetta_bioc-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for rosetta_bioc-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a28afe35e5384d1d492f202ced4e16fb60a3c15186bb2d8e6bb0bb7a696f4fe3
MD5 0ff21e0ddfc35a102ee51e93d5779cf1
BLAKE2b-256 2d81e3974507e90072a3044cbec593a56c93356c8d7637b67dca84b1d0095ac1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rosetta_bioc-0.3.1-py3-none-any.whl:

Publisher: publish.yml on rosetta-bioc/rosetta

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page