Metadata-Version: 2.4
Name: circyto
Version: 0.11.0
Summary: A Python CLI toolkit for single-cell circRNA detection, detector orchestration, matrix generation, and multimodal export.
Author: Yu-Chen Liu
License-Expression: MIT
Project-URL: Homepage, https://github.com/liuifrec/circyto
Project-URL: Issues, https://github.com/liuifrec/circyto/issues
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
Requires-Dist: typer<1.0,>=0.9
Requires-Dist: rich>=13.0
Requires-Dist: pandas>=2.0
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Requires-Dist: anndata>=0.10
Provides-Extra: loom
Requires-Dist: loompy>=3.0; extra == "loom"
Provides-Extra: mudata
Requires-Dist: mudata>=0.3; extra == "mudata"
Provides-Extra: scanpy
Requires-Dist: mudata>=0.3; extra == "scanpy"
Requires-Dist: scanpy>=1.10; extra == "scanpy"
Provides-Extra: bam
Requires-Dist: pysam>=0.22; extra == "bam"
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: setuptools>=77; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: mudata>=0.3; extra == "dev"
Dynamic: license-file

<p align="center">
  <img src="assets/circyto_logo.png" width="440" alt="circyto logo">
</p>

<p align="center">
  <a href="https://github.com/liuifrec/circyto/releases">
  <img alt="Release" src="https://img.shields.io/github/v/tag/liuifrec/circyto?sort=semver">
  </a>
  <a href="https://github.com/liuifrec/circyto/blob/main/LICENSE">
  <img alt="License" src="https://img.shields.io/github/license/liuifrec/circyto?cacheSeconds=3600&v=2">
  </a>
  <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-blue">
</p>

# circyto

> **Manuscript status (20 November 2026):** “circyto for integrated single-cell circRNA analysis in radiation research” (Yu-Chen Liu, Kengo Yoshida and Yoichiro Kusunoki) was **submitted** as a Full Length Article to *Computer Methods and Programs in Biomedicine* (CMPB). It has **not** been accepted or published; no journal DOI is available. See the [submitted-study scope and evidence](docs/cmpb_submission.md).

A CLI/scverse-compatible framework for single-cell circular RNA detection, annotation, and multimodal integration from full-length single-cell RNA-seq and full-length single-cell multi-omic data.

The main output is a circRNA-by-cell matrix, with `h5ad` export and optional RNA+circ MuData integration. Capability boundaries are intentionally narrow:

| Input mode | Current support |
| --- | --- |
| Short-read full-length single-cell RNA-seq | CircRNA detection, collection, annotation, QC, and scverse export; validated workflows use CIRI3 while the public CLI remains experimental. |
| Generic single-cell Nanopore cDNA | Experimental alignment, QC, and provenance interoperability only; it does not call or validate circRNAs. |
| CIRI-long RCRT/circRNA-enriched reads | Optional experimental `circyto ciri-long` adapter for chemistry-confirmed RCRT libraries; ordinary ONT cDNA is rejected. |

A minimal full-length workflow shape is:

```bash
circyto workflow full-length-circrna \
  --manifest manifest.tsv \
  --outdir work/full_length \
  --protocol ramda \
  --genome-fasta ref/genome.fa \
  --gtf ref/genes.gtf \
  --export-h5ad
```

Run `circyto doctor` and `circyto detectors` first to distinguish core package readiness from optional workflow-tool readiness.
For a real single-end run, first index the exact reference with
`bwa index ref/genome.fa`; the workflow does not build this index. The optional
[RamDA environment recipe](environment.ramda-se.yml) supplies tested external
runtimes. See the concise [reviewer guide](docs/reviewer_guide.md) for installation,
commands, outputs, and the distinction between software demonstrations and the submitted study.

Existing cell-resolved circRNA results can be imported without running a detector: see
[`circyto import-circ`](docs/import_circ.md) for validated AnnData/MuData export,
processing-status metadata and an offline QC report.

## Import native CIRI3 results without rerunning CIRI3

The current `main` source supports native **13-column single-sample** CIRI3 result files.
With the installed wheel on PATH, the included official output example runs without
Java, an aligner or raw sequencing data:

```bash
circyto import-circ \
  --ciri3-manifest examples/native_ciri3/manifest.tsv \
  --cells examples/native_ciri3/cells.tsv \
  --detector CIRI3 --genome-build upstream_demo_chr1_unverified \
  --coordinate-convention 1-based-closed \
  --support-definition CIRI3_junction_reads --outdir /tmp/native-ciri3-import
```

This is an authentic upstream **demonstration sample**, not a validated biological
single cell: six candidates, 50 support, unknown processing status. The producing
version and assembly are explicitly unverified. For your data, supply an explicit
sample-to-cell mapping and actual genome build. Add `--rna matched.h5ad` with the
`mudata` extra for optional MuData. See the [native input contract](docs/native_ciri3_import.md)
and [acceptance evidence](docs/native_ciri3_validation.md), including version,
pooled-output and coordinate limitations. The example directory is distributed
in the source archive and can be copied outside the checkout.

## Offline QC report quick start

Offline HTML reporting is present in the current `main` source tree after the
November 20 integration merges, but it should not be conflated with the
historical manuscript software snapshots. From a current checkout this example
runs with synthetic documentation data, without reference downloads or external detectors:

```bash
python3 -m venv .venv
source .venv/bin/activate
python -m pip install .
circyto doctor
python examples/qc_report_demo.py --outdir work/qc_report_demo
circyto report --workdir work/qc_report_demo
```

Use a new demo directory if it already exists. The example creates **synthetic
documentation data**, not biological results: 12 QC cells, 6 circRNA candidates,
77 total support, 2 zero-count cells, and 4 candidates with recorded host genes.
Open `work/qc_report_demo/qc/report.html` directly in a browser; no web server,
JavaScript, or internet connection is needed to view or regenerate a report
after package installation. All values and source SHA-256 checksums are in
`work/qc_report_demo/qc/metrics.json`.

For a wheel-only installation, `examples/qc_report_demo.py` is supplied in the
matching source archive, not installed as a CLI command. The
[outside-repository example](docs/reviewer_guide.md#reviewer-quick-guide) shows
how to use these distributed materials without an editable checkout.

Download the [sample HTML](docs/examples/qc_report/qc/report.html) to open it
locally, or inspect its [metrics](docs/examples/qc_report/qc/metrics.json) and
[source QC tables](docs/examples/qc_report/qc/).

![Synthetic offline QC report](docs/images/qc_report.png)

For a real analysis, prepare a per-cell manifest and matching reference files,
run `circyto doctor` and check its CIRI3 readiness entries, then use the established workflow
shown above. Both `workflow full-length-circrna` and `workflow smartseq3-ciri3`
automatically generate the report after writing their outputs. Use `--no-report`
to opt out, or run `circyto report --workdir YOUR_RESULTS_DIRECTORY` later.
The existing `circyto run` remains the legacy CIRI-full command.

| Result | Where to find it | Interpretation |
| --- | --- | --- |
| Counts | `matrix/circ_counts.mtx` | circRNA candidate rows × cell columns; support counts |
| Matrix identities | `matrix/circ_index.txt`, `matrix/cell_index.txt` | Row and column order; use these indices with the matrix |
| AnnData | `anndata/circ_counts.h5ad` | Cells × candidates, when export is enabled |
| Source QC | `qc/cell_qc.tsv`, `qc/circ_qc.tsv` | Selected-cell and candidate QC, including zero-count cells |
| Human-readable report | `qc/report.html` | Completion, detector evidence, QC, warnings, and provenance |
| Report data | `qc/metrics.json` | Exact counts, definitions, fractions, consistency checks, and checksums |

Workflow completion does not validate a circRNA candidate biologically. A failed
cell is not a negative detection, and missing values appear as “Not available.”
See the [report and workflow guide](docs/qc_reporting.md) for an executable
planning example, manifest requirements, metric definitions, failure handling,
and screenshot reproduction.

An **optional single-cell explorer** adds searchable genes and circRNA aliases,
paired RNA-UMAP plots, processing-state-aware detection frequencies, evidence
links, and SVG/PNG/TSV exports. It reuses saved coordinates and bounded feature
subsets; it never runs alignment, counting, calling, or clustering. The default
QC report above is unchanged. The explorer uses embedded JavaScript and works
offline without a server or CDN.

```bash
circyto report --explorer circ_counts.h5ad --rna processed_rna.h5ad \
  --output-dir explorer_report --gene MAN1A2 --circ 'chr1:117402186|117420649' \
  --expression-unit 'log1p CP10K'
```

Choose the expression label to match the actual stored matrix; the command does
not normalize it. Open `explorer_report/report.html`. See the
[explorer guide](docs/single_cell_explorer.md),
[synthetic example](docs/examples/explorer/synthetic/report.html),
[181-cell KYSE180 replay](docs/examples/explorer/kyse180/report.html), and
[validation record](docs/single_cell_explorer_validation.md).

## Status

**Release preparation:** the source-tree package version is **`0.11.0`**, distinct from the historical annotated `v0.10.0` tag and the frozen manuscript analysis. A version number in source is not proof that PyPI or a GitHub Release has been published. Check [GitHub Releases](https://github.com/liuifrec/circyto/releases) and [the PyPI project](https://pypi.org/project/circyto/) for actual release availability. New releases exclude third-party Java JARs; callers still require external detector installation.

- The validated pooled SMART-Seq3 end-to-end path is FASTQs -> demux -> manifest selection -> STAR alignment -> BWA rescue for CIRI3 STAR tuple mode -> CIRI3 detection -> matrix collection -> QC -> `h5ad` export -> circRNA annotation.
- The validated single-end full-length RamDA/scRR path is FASTQ -> BWA-MEM -> CIRI3 direct SAM -> matrix -> `h5ad`.
- The validated paired-end full-length RamDA/scRR path is FASTQ pair -> STAR -> CIRI3 STAR tuple mode -> matrix -> `h5ad`, with `--allow-paired-ramda` required for explicit opt-in. `--experimental-paired-ramda` remains accepted as a deprecated alias.
- The validated scRR integration path now includes processed GEO CNV import, GSM-to-biological-cell mapping, and IMR90 23-cell tri-modal RNA+circ+CNV MuData.
- The HAP1 scRR DNA replication timing/state branch has a lightweight `rt` importer and RNA+circ+RT merge path; real processed-file validation is pending local availability of the GSE278952 HAP1 DNA tables.
- SComatic interoperability has been validated as a technical path for RNA-derived candidate variant signals on HAP1 batch10, but it remains exploratory and is not the primary scRR DNA modality.
- The experimental SMART-Seq3 workflow has been validated end to end on real E-MTAB-8735 diySpike data.
- Generic Nanopore cDNA support is experimental interoperability only (alignment/QC/provenance, never circRNA validation); CIRI-long support is a separate optional RCRT/circRNA-enriched workflow.
- Core detector integrations remain heterogeneous and should still be treated as experimental interfaces rather than a frozen `v1.0` contract.
- Default CI is now a clean Python 3.12 `pytest -q .` run; external detector integrations are gated and skipped by default.

A concise benchmark-oriented summary of validated and exploratory workflow tiers is available in [`docs/validated_workflows_summary.md`](docs/validated_workflows_summary.md).

The [CMPB submission record](docs/cmpb_submission.md) describes what the November 2026 paper actually evaluates. Earlier [manuscript workspace](manuscript/) and [manuscript reproducibility plans](docs/manuscript_reproducibility.md) cover a broader, historical genome-state/multimodal proposal and should not be cited as the submitted CMPB study's methods. General data contracts remain documented in [modality schema](docs/modality_schema.md), [MuData schema](docs/mudata_schema.md), and [host-gene provenance](docs/host_gene_provenance.md).

### Current Capability Table

| Modality | Current status | Notes |
| --- | --- | --- |
| `rna` | validated | RNA profile import and MuData RNA modality for completed full-length workflows |
| `circ` | validated | CIRI3-backed circRNA matrices, QC, `h5ad`, and MuData circ modality |
| `cnv` | validated for processed scRR GEO summaries | `import-scrr-cnv` writes `cnv.h5ad`; IMR90 full23 tri-modal MuData validated at 50 kb |
| `rt` | implemented for processed scRR replication timing/state summaries | `import-scrr-rt` writes `rt.h5ad`; intended for HAP1 GSE278952 processed DNA RT/state tables |
| `candidate_snv` | exploratory / optional | `merge-scomatic` exports RNA-derived candidate variant signals only; not orthogonally confirmed DNA variant calls |

| Dataset / run | Current validation state |
| --- | --- |
| IMR90 full23 | RNA + circ + CNV tri-modal MuData validated |
| HAP1 batch10 | RNA + circ workflow validated; SComatic BaseCellCounter, Step1, Step2, and normalization technical smoke validated |
| HAP1 processed RT | `rt` importer and RNA+circ+RT merge implemented with synthetic tests; real GSE278952 processed-file import pending |
| HAP1 full | pending full FASTQ download and full workflow run |

## Installation

### Install the released package (once available on PyPI)

```bash
python -m pip install "circyto[mudata]==0.11.0"
circyto --version
circyto doctor
```

**Not yet published:** this command becomes usable only after the owner completes the tagged release and its separately approved PyPI Trusted Publisher upload. A tag or a merged PR alone does not publish to PyPI. `circyto doctor` also reports optional external tools such as Java/CIRI3; they are not installed by pip.

### Source install (available now)

```bash
git clone https://github.com/liuifrec/circyto
cd circyto

conda env create -f environment.yml
conda activate circyto
python -m pip install -e .
```

The repo-root [environment.yml](environment.yml) is the supported baseline for source installs. It provides the Python scientific stack and CLI dependencies, but it intentionally does not install external detector executables.

The optional [environment.ramda-se.yml](environment.ramda-se.yml) was separately
tested for Linux x86_64 installation, BWA/SAMtools/Java runtime discovery and a
single-end planning run. Its validation does not rerun the public-data analysis.
The Python wheel works independently for reporting and other commands that do
not need these tools.

### External tools

CIRI3 and CIRI-full JARs are now externally installed and excluded from wheels
and sdists. Packaged Perl detectors retain their upstream licenses; circyto's MIT license does not cover them. [Third-party notices](THIRD_PARTY_NOTICES.md) record attribution,
packaged contents and unresolved CIRI-full/CIRI3 distribution questions.
Use [CITATION.cff](CITATION.cff) to cite circyto and also cite the detector used.

Install only the external tools needed for the workflow you plan to run:

- `STAR` for STAR-based alignment preparation
- `bwa` for CIRI3 rescue alignment and BWA-based workflows
- `samtools` for alignment handling
- `java` >= 12 for the reviewed external CIRI3 jar; Java 17 recommended
- detector-specific tools such as `bowtie2` or `find-circ3` only when using those detector paths

For externally installed CIRI3 direct mode, supported environment variables include:

- `CIRCYTO_CIRI3_HOME`
- `CIRCYTO_CIRI3_JAR`
- `CIRCYTO_CIRI3_JAVA`
- `CIRCYTO_CIRI3_EXTRA_ARGS`
- `CIRCYTO_CIRI3_CMD_TEMPLATE`

Wheel installations automatically find the retained shell adapters and licensed
Perl sources in `circyto/resources/tools/`. Install Java detectors separately
using the [exact external installation instructions](docs/external_detectors.md).
Native import/export/reporting remain detector-independent. `circyto doctor`
prints the resolved locations and distinguishes missing optional detectors from
core Python readiness.
The corresponding source-checkout layout is:

```text
tools/
  CIRI3/
    CIRI3_Java_*.jar
```

## Quick checks

After installation, verify the package and runtime detection:

```bash
circyto --version
circyto doctor
circyto detectors
```

What these checks mean:

- `circyto --version` should match the version of the installed source or distribution (currently `0.11.0` on this release-preparation branch).
- `circyto doctor` checks Python/runtime setup and external dependencies.
- `circyto detectors` reports detector readiness and required external tools.

## Core workflows

### Current CLI map

Recommended user-facing entry points:

| Command | Purpose | Main use case | Status |
| --- | --- | --- | --- |
| `circyto workflow smartseq3-ciri3` | One-command SMART-Seq3 workflow | pooled Smart-seq3 / E-MTAB-8735-style runs | validated workflow, still versioned as experimental CLI |
| `circyto workflow full-length-circrna` | One-command full-length circRNA workflow | RamDA, Shin-RamDA, human scRR per-cell FASTQs | validated single-end and paired-end routes, still versioned as experimental CLI |
| `circyto prepare-public-dataset` | Reproducible planning artifacts for benchmark datasets | benchmark planning without downloading large files | planning utility |

Advanced / lower-level entry points:

| Command | Purpose | Main use case | Status |
| --- | --- | --- | --- |
| `circyto run-ciri3` | Protocol-aware alignment-first CIRI3 runner | advanced manual RamDA / Shin-RamDA / SMART-Seq3 CIRI3 execution | advanced |
| `circyto prepare-alignment-cache` | Build reusable STAR/BWA alignment artifacts | alignment-first multi-step runs | advanced |
| `circyto run-detector-from-alignments` | Run detector from prepared alignment manifest | manual alignment-first runs | advanced |
| `circyto collect-matrix` | Build circRNA matrix from per-cell outputs | manual collection / detector comparisons | advanced |
| `circyto add-rna-profile` | Add a lightweight post-hoc RNA profile to a completed workflow folder | completed workflow reuse without rerunning alignment or detection | advanced |
| `circyto cleanup-workflow` | Remove regenerable workflow-owned intermediates from a completed workflow folder | post-run disk reclamation with integrity checks | advanced |
| `circyto import-scrr-cnv` | Import processed scRR GEO CNV state and mappability-normalized summaries | scRR DNA CNV modality construction | validated for processed GEO summaries |
| `circyto import-scrr-rt` | Import processed scRR replication timing/state summaries | HAP1 scRR DNA RT modality construction | implemented with synthetic tests |
| `circyto build-scrr-cell-map` | Build GSM -> RNA/DNA title -> canonical biological-cell map from GEO SOFT metadata | scRR RNA/DNA cell pairing | validated on GSE278958 metadata |
| `circyto remap-scrr-mudata-obs` | Remap RNA/circ MuData obs IDs from GSM to canonical scRR cell IDs | preparing RNA/circ MuData for CNV merge | validated on IMR90 full23 |
| `circyto merge-scrr-cnv` | Merge remapped RNA/circ MuData with `cnv.h5ad` | tri-modal RNA+circ+CNV MuData | validated on IMR90 full23 |
| `circyto merge-scrr-rt` | Merge remapped RNA/circ MuData with `rt.h5ad` | tri-modal RNA+circ+RT MuData | implemented with synthetic tests |
| `circyto prepare-scomatic-input` | Prepare full-length RNA alignments and SComatic cell annotations | Smart-seq2/3, RamDA, ShinRamDA, scRR RNA SComatic interoperability | RNA-derived candidate variant signals interoperability |
| `circyto run-scomatic` | Write and optionally execute external SComatic command plans | BaseCellCounter plus optional Step1/Step2 | exploratory; external execution requires explicit `--execute` |
| `circyto import-scomatic` | Import SComatic Step1/Step2 or candidate tables | normalized `scomatic_candidate_summary.tsv` | RNA-derived candidate variant signals interoperability |
| `circyto merge-scomatic` | Merge normalized candidates as `candidate_snv` | RNA+circ+candidate_snv MuData | exploratory / optional |
| `circyto export-scomatic-inputs` | Emit interoperability tables for external SComatic runs | exploratory circRNA/SNV interoperability | exploratory |
| `circyto join-circ-snv-summary` | Join circ summaries with exploratory SComatic candidate tables | exploratory circRNA/SNV summaries | exploratory |

SComatic-related functionality remains exploratory. Use conservative terms such as `RNA-derived candidate variant signals`, and see [`docs/scomatic_circrna_study_design.md`](docs/scomatic_circrna_study_design.md) for the future integrated study design.

### Examples

Smart-seq3 one-command workflow:

```bash
circyto workflow smartseq3-ciri3 \
  --read1 raw/Smartseq3.diySpike.R1.fastq.gz \
  --read2 raw/Smartseq3.diySpike.R2.fastq.gz \
  --index1 raw/Smartseq3.diySpike.I1.fastq.gz \
  --index2 raw/Smartseq3.diySpike.I2.fastq.gz \
  --annotation metadata/Smartseq3.diySpike.sample_annotation.normalized.tsv \
  --cell-id-column cell_id \
  --index1-column index1 \
  --index2-column index2 \
  --ref-fa /path/to/hg38.fa \
  --star-index /path/to/star_index \
  --outdir work/diySpike_workflow_all192 \
  --threads 24 \
  --resume \
  --export-h5ad
```

Single-end RamDA/scRR full-length workflow:

```bash
circyto workflow full-length-circrna \
  --manifest manifest_single.tsv \
  --outdir work/full_length_single \
  --protocol ramda \
  --genome-fasta /path/to/hg38.fa \
  --gtf /path/to/gencode.v38.annotation.gtf \
  --export-h5ad
```

Paired-end scRR workflow:

```bash
circyto workflow full-length-circrna \
  --manifest manifest_paired.tsv \
  --outdir work/full_length_paired \
  --protocol ramda \
  --genome-fasta /path/to/hg38.fa \
  --gtf /path/to/gencode.v38.annotation.gtf \
  --star-index /path/to/star_index \
  --allow-paired-ramda \
  --export-h5ad
```

Public dataset planning:

```bash
circyto prepare-public-dataset \
  --dataset-id E-MTAB-8735 \
  --protocol smartseq3 \
  --download-method ena \
  --max-runs 2 \
  --dry-run \
  --outdir work/public_emtab8735_plan
```

### 1. SMART-Seq3 to CIRI3 end-to-end workflow

This is the main pooled SMART-Seq3 workflow. The command below is a realistic example shape for a real dataset run; the paths are examples and should be replaced with your own files.

```bash
circyto workflow smartseq3-ciri3 \
  --read1 raw/Smartseq3.diySpike.R1.fastq.gz \
  --read2 raw/Smartseq3.diySpike.R2.fastq.gz \
  --index1 raw/Smartseq3.diySpike.I1.fastq.gz \
  --index2 raw/Smartseq3.diySpike.I2.fastq.gz \
  --annotation metadata/Smartseq3.diySpike.sample_annotation.normalized.tsv \
  --cell-id-column cell_id \
  --index1-column index1 \
  --index2-column index2 \
  --ref-fa /path/to/hg38.fa \
  --star-index /path/to/star_index \
  --outdir work/diySpike_workflow_all192 \
  --threads 24 \
  --parallel 1 \
  --chunk-size 1 \
  --resume \
  --export-h5ad
```

What it does:

- demultiplexes pooled SMART-Seq3 reads with `circyto demux smartseq3`
- writes selected manifests under `OUTDIR/manifests/`
- prepares STAR+CIRI3 hybrid alignment artifacts
- runs CIRI3 from the alignment manifest
- collects a circRNA matrix with QC tables
- exports `OUTDIR/anndata/circ_counts.h5ad`
- writes `workflow_summary.json`

Main outputs:

- `demux/`
- `manifests/`
- `align/`
- `ciri3/`
- `matrix/`
- `qc/`
- `anndata/`
- `mudata/` when `--export-mudata` is enabled
- `workflow_summary.json`

### 2. Low-level alignment-first CIRI3 workflow

Use this path when you want explicit control over alignment preparation, detector execution, and matrix collection. The commands below are example command shapes; replace paths and references with your own files.

```bash
circyto prepare-alignment-cache \
  --manifest manifest.tsv \
  --aligner star \
  --detector ciri3 \
  --ref-fa /path/to/hg38.fa \
  --outdir work/alignment_cache \
  --extra-flags "--genomeDir /path/to/star_index --readFilesCommand zcat"

circyto run-detector-from-alignments \
  --detector ciri3 \
  --manifest work/alignment_cache/alignment_manifest.tsv \
  --outdir work/ciri3_run \
  --ref-fa /path/to/hg38.fa

circyto collect-matrix \
  --detector ciri3 \
  --indir work/ciri3_run \
  --outdir work/ciri3_matrix
```

Notes:

- `prepare-alignment-cache --aligner star --detector ciri3` uses the official STAR + BWA rescue hybrid contract implemented for CIRI3.
- For CIRI3 STAR tuple mode, the alignment manifest must carry STAR outputs plus `bwa_sam`.
- `collect-matrix` is the current unified matrix collector; older `collect` examples are not the recommended public interface.

### 3. Full-length RamDA / Shin-RamDA / scRR workflow

Use `circyto workflow full-length-circrna` for per-cell full-length total RNA manifests.

Route selection:

- single-end RamDA / Shin-RamDA / scRR rows use `BWA-MEM -> direct SAM -> CIRI3`
- paired-end RamDA / Shin-RamDA / scRR rows use `STAR -> CIRI3 STAR tuple mode`
- paired-end real execution requires `--allow-paired-ramda`
- `--experimental-paired-ramda` still works as a deprecated alias

See [`docs/full_length_workflow.md`](docs/full_length_workflow.md) for the full manifest contract and workflow behavior.

### 4. CircRNA annotation

Annotate the workflow `circ_qc.tsv` against known circRNA databases. The command shape below is current and verified; the database paths are examples.

```bash
circyto annotate-circs \
  --circ-table work/diySpike_workflow_all192/qc/circ_qc.tsv \
  --annotation-db "name=circatlas;path=path/to/circAtlas_v3.tsv;chrom=seqnames;start=donor;end=acceptor;strand=bsj_strand;id=atlas_id;host_gene=gene_symbol;extra=tissue" \
  --annotation-db "name=circsc;path=path/to/circSC_normalized.tsv;chrom=chromosome;start=start_1based;end=end_1based;id=circsc_id;host_gene=gene_label;extra=celltype" \
  --out work/diySpike_workflow_all192/qc/circ_qc.annotated.tsv \
  --summary-out work/diySpike_workflow_all192/qc/annotation_summary.json \
  --update-h5ad work/diySpike_workflow_all192/anndata/circ_counts.h5ad
```

Annotation semantics:

- exact BSJ matches are reported as `known_exact_bsj`
- near-BSJ matches can be enabled with `--max-bsj-distance`
- unmatched entries remain `novel`
- annotation columns are added without changing matrix semantics
- host-gene annotation is non-fatal; novel or intergenic circRNAs may keep an empty `host_gene`

Host-gene priority in circRNA feature metadata:

1. GTF/GFF coordinate overlap (`host_gene_from_gtf`) when a GTF/GFF is supplied. Same-strand gene overlap is preferred when circRNA strand is known; multiple overlapping genes are joined with `;`.
2. circAtlas table host-gene fields (`host_gene_from_circatlas`) when an annotation database provides them.
3. circAtlas ID parsing (`host_gene_from_circatlas_id`) for IDs such as `hsa-UBAP2_0052`, which yields `UBAP2`.

The final `host_gene` column stores the best available value. `host_gene_source` is one of `gtf`, `circatlas`, `circatlas_id`, or empty when no supported source is available.

Repair existing h5ad or h5mu outputs without rerunning the pipeline:

```bash
circyto repair-host-genes \
  --input work/diySpike_workflow_all192/anndata/circ_counts.h5ad \
  --output work/diySpike_workflow_all192/anndata/circ_counts.hostgene_fixed.h5ad

circyto repair-host-genes \
  --input work/full_length/mudata/full_length.h5mu \
  --output work/full_length/mudata/full_length.hostgene_fixed.h5mu \
  --circ-mod circ
```

If a GTF/GFF is available, add `--gtf path/to/annotation.gtf` so coordinate overlap is applied before circAtlas-derived fallbacks.

### 5. AnnData downstream summary

```bash
circyto analyze summarize-h5ad \
  --input work/diySpike_workflow_all192/anndata/circ_counts.h5ad \
  --outdir work/diySpike_workflow_all192/anndata_summary
```

### 6. Optional MuData export

If you also have a gene-count matrix, the workflow can export MuData:

```bash
circyto workflow smartseq3-ciri3 \
  --read1 raw/Smartseq3.diySpike.R1.fastq.gz \
  --read2 raw/Smartseq3.diySpike.R2.fastq.gz \
  --index1 raw/Smartseq3.diySpike.I1.fastq.gz \
  --index2 raw/Smartseq3.diySpike.I2.fastq.gz \
  --annotation metadata/Smartseq3.diySpike.sample_annotation.normalized.tsv \
  --cell-id-column cell_id \
  --index1-column index1 \
  --index2-column index2 \
  --ref-fa /path/to/hg38.fa \
  --star-index /path/to/star_index \
  --outdir work/diySpike_workflow_all192 \
  --gene-counts path/to/gene_counts.tsv \
  --gene-counts-format tsv \
  --export-h5ad \
  --export-mudata
```

## Outputs and data model

Key output directories from the SMART-Seq3 workflow:

- `matrix/` contains `circ_counts.mtx`, `circ_index.txt`, `cell_index.txt`, and `circ_feature_table.tsv`
- `qc/` contains `cell_qc.tsv` and `circ_qc.tsv`
- `anndata/` contains `circ_counts.h5ad`
- `mudata/` contains `circyto_multimodal.h5mu` when enabled

Data model:

- MatrixMarket output represents circRNA counts indexed by the accompanying circ and cell index files.
- In `circ_counts.h5ad`, `adata.X` is `cells x circRNAs`.
- `adata.obs` contains cell-level QC indexed by `cell_id`.
- `adata.var` contains circRNA QC and, after annotation, circRNA database labels indexed by `circ_id`.
- `adata.var["host_gene_source"]` records whether final host genes came from GTF/GFF overlap, circAtlas host-gene tables, circAtlas ID parsing, or no supported source.
- `adata.uns["circyto"]` stores workflow provenance and related metadata.

## Validated benchmark result

Validated real-data result for E-MTAB-8735 diySpike `all192`:

- total reads: `75,015,128`
- assigned reads: `68,649,627`
- assignment rate: `~91.5%`
- detected cells: `192`
- aligned cells: `192`
- final `h5ad`: `192` cells, `2503` circRNAs, `2659` nonzero entries
- biologically non-empty cells: `191`
- empty cells: `1`
- circAtlas v3 exact matches: `518`
- novel count: `1985`
- recurrent known circRNAs: `51`
- recurrent novel circRNAs: `26`

This **historical software workflow benchmark** documents a validated run, not the submitted CMPB analysis. In particular, its 2,503 circRNA features must not be substituted for the manuscript's **2,991 Smart-seq3 candidate BSJs**, which come from the manuscript-specific analysis described in the [CMPB submission record](docs/cmpb_submission.md).

## Testing

Run the default test suite with:

```bash
pytest -q .
```

Notes:

- This is the same default path used by the cleaned-up CI workflow.
- External detector integration tests are gated and skipped by default in CI.
- Heavy detector/runtime validation should be treated as explicit opt-in work rather than part of every routine push.

## Documentation

Additional references:

- **Getting started guide**: [docs/getting_started.md](docs/getting_started.md)
- **Detector catalog**: [docs/detectors.md](docs/detectors.md)
- **Alignment-first execution details**: [docs/alignment_first_execution.md](docs/alignment_first_execution.md)
- **CLI contract notes**: [docs/cli_policy.md](docs/cli_policy.md)
- **Roadmap and milestone status**: [ROADMAP.md](ROADMAP.md)
- **Version/tag/PyPI release instructions**: [docs/release_process.md](docs/release_process.md)

Legacy commands such as `circyto collect`, `circyto convert`, and old CIRI-full-only shell-style examples are not part of the recommended current experimental public path and are intentionally omitted from this README.

## Citation

The methods manuscript, **“circyto for integrated single-cell circRNA analysis in radiation research,”**
by Yu-Chen Liu, Kengo Yoshida and Yoichiro Kusunoki was **submitted** to
*Computer Methods and Programs in Biomedicine* on **20 November 2026**. It is
**not yet an accepted or published article** and does not have a journal DOI.
Do not present a submission as a published citation.

For now, cite the software as **Yu-Chen Liu, circyto, GitHub repository**
([`CITATION.cff`](CITATION.cff)), recording the exact version **and Git commit**
used. Cite the upstream circRNA caller(s) separately. When the manuscript is
published, a verified bibliographic citation can be added.

## Distribution and review status

The repository is publicly accessible and contains merged code for import and
offline reporting, but an up-to-date tagged distribution is **not** implied.
External-detector redistribution/notice checks and independent biological
acceptance tests remain distinct from source availability. See the
[release-readiness matrix](docs/pre_release_readiness.md) and
[external CIRI3 acceptance checklist](docs/external_ciri3_acceptance.md).
The current software feature set must not be equated with the frozen
analysis provenance for the submitted manuscript.
