bulkrna-read-alignment
Load when summarising STAR / HISAT2 / Salmon alignment-rate logs in bulk RNA-seq. Skip when data is raw FASTQ (use bulkrna-read-qc); already counted (use bulkrna-qc); genome-DNA alignment (use genomics-alignment).
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 161
- Forks
- 27
01 前言 Front Matter
- name
- bulkrna-read-alignment
- tags
- [ "bulkrna", "alignment", "STAR", "HISAT2", "Salmon", "mapping-rate", "strandedness" ]
- trigger
- RNA-seq alignment, STAR, HISAT2, Salmon, mapping rate, read alignment, alignment QC
- description
- Load when summarising STAR / HISAT2 / Salmon alignment-rate logs in bulk RNA-seq. Skip when data is raw FASTQ (use bulkrna-read-qc); already counted (use bulkrna-qc); genome-DNA alignment (use genomics-alignment).
02 资源文件 23
- 脚本_api.py7.7 KB
- 脚本bulkrna_read_alignment.py5.5 KB
- 脚本examples/example_step.py544 B
- 参考文档references/dev-server-astro.md1.8 KB
- 参考文档references/dev-server-detection.md2.8 KB
- 参考文档references/dev-server-next.md1.8 KB
- 参考文档references/dev-server-nuxt.md1.7 KB
- 参考文档references/dev-server-procfile.md2.3 KB
- 参考文档references/dev-server-rails.md1.9 KB
- 参考文档references/dev-server-remix.md2.0 KB
- 参考文档references/dev-server-sveltekit.md2.0 KB
- 参考文档references/dev-server-vite.md2.2 KB
- 参考文档references/ide-detection.md2.6 KB
- 参考文档references/launch-json-schema.md4.4 KB
- 参考文档references/methodology.md711 B
- 参考文档references/output_contract.md312 B
- 参考文档references/parameters.md365 B
- 脚本scripts/detect-project-type.sh7.9 KB
- 脚本scripts/read-launch-json.sh2.8 KB
- 脚本scripts/resolve-package-manager.sh2.6 KB
- 脚本scripts/resolve-port.sh10.1 KB
- 脚本tests/test_api.py932 B
- 脚本tests/test_cli.py815 B
03 SKILL.md 正文
bulkrna-read-alignment
When to use
Summarize existing STAR, paired-end HISAT2 or Salmon logs. This does not run
an aligner. Use bulkrna-read-qc for FASTQ and bulkrna-qc for counts.
Use from a step
from skills._sdk.notebook import load_skill, write_output
library = load_skill('bulkrna-read-alignment')
data = library.demo_data(random_state=42)
result = library.summarize(data)
write_output(result, 'tables/alignment_stats.csv')
For real files, pass read_fastq, read_log or read_reference as appropriate
to read_input(..., reader=...). examples/example_step.py is executable.
API
<!-- api:begin generated from _api.py; regenerate with run.py api <skill dir> --write -->
read_log(path: str | Path) -> str
Read log text; pass this function as reader= to read_input.
:param path: STAR, HISAT2 or Salmon text/JSON log. :returns: File contents without interpreting its filename. :raises OSError: The file cannot be read.
summarize(data: str | pd.DataFrame, *, method: str='star') -> pd.DataFrame
Parse alignment counts and return a new mapping summary.
:param data: Log text or a one-row parsed table, including demo_data output. :param method: CLI default star; select hisat2 for paired-end summaries or salmon for meta_info JSON. :returns: Mapping counts/rates with quality heuristics in run_info; Salmon reports total mapped, not unique mapped. :raises ValueError: Required counts are missing, inconsistent or the method is unsupported.
run_info(result: pd.DataFrame, *, keep: bool=True) -> dict
Read mapping assessment and unavailable-evidence diagnostics.
:param result: Output of summarize. :param keep: True preserves attrs; False removes diagnostics before serialization. :returns: A separate quality/provenance dictionary. :raises TypeError: The result is not a DataFrame.
mapping_figure(result: pd.DataFrame)
Plot observed mapping counts as percentages.
:param result: Output of summarize. :returns: A matplotlib Figure without writing files. :raises KeyError: Mapping counts are absent.
composition_figure(result: pd.DataFrame)
Plot observed mapping composition.
:param result: Output of summarize. :returns: A matplotlib Figure without writing files. :raises KeyError: Mapping counts are absent.
coverage_figure(coverage: pd.DataFrame)
Plot an explicitly supplied gene-body coverage profile.
:param coverage: position and coverage columns; alignment logs cannot supply these observations. :returns: A matplotlib Figure without synthesizing missing measurements. :raises KeyError: Coverage columns are absent.
demo_data(*, random_state: int=42) -> pd.DataFrame
Generate the synthetic STAR summary used by the CLI demo.
:param random_state: CLI seed 42; change for another simulation. :returns: One simulated alignment summary row. :raises ValueError: The seed is invalid.
demo_coverage(*, random_state: int=42) -> pd.DataFrame
Generate an illustrative coverage profile, not inferred from an alignment log.
:param random_state: CLI demo seed 42; change for another simulation. :returns: One hundred simulated percentile/coverage rows. :raises ValueError: The seed is invalid.
<!-- api:end -->
Methods and parameters
summarize defaults to STAR, matching the CLI. Choose hisat2 or salmon
explicitly; filenames do not override that choice. STAR/HISAT2 include unique
and multimapped counts. Salmon meta_info reports total mapped counts only.
Gotchas
summarizerejects absent or inconsistent read counts.run_infostates that logs provide neither gene-body coverage nor inferred strandedness.coverage_figureneeds an explicit measured profile.demo_coverageis synthetic and is only used by--demo.mapped_ratefor Salmon does not mean uniquely mapped rate.- HISAT2
unmappedis the residual after concordant pairs and includes discordant/unpaired mappings;run_inforecords this limitation.
Inputs and outputs
The CLI writes these artifacts; functions return DataFrames and Figures without writing them:
tables/alignment_stats.csvfigures/mapping_summary.pngfigures/alignment_composition.pngfigures/gene_body_coverage.png (demo only)report.mdresult.jsonreproducibility/commands.sh
CLI
python skills/bulkrna/bulkrna-read-alignment/bulkrna_read_alignment.py --demo --output /tmp/bulkrna_read_alignment
For real files use --input <file>; trajectory placement also needs --reference <file>.
See also
references/methodology.mdreferences/parameters.mdreferences/output_contract.md
Dependencies
matplotlib, numpy, pandas
04 同仓库更多 Skills
demo-skill
A fixture skill for the skill environment tests. Use it for nothing else.
fake-domains
Test fixture for the golden deployment in tests/entry. Load never; it has no script.
replace-me-skill
Load when copying this directory to bootstrap a new OmicsClaw skill. Skip when an existing skill already covers the request.
spatial-velocity
Load when estimating RNA velocity on a spatial AnnData with `layers["spliced"]` + `layers["unspliced"]` via scVelo (stochastic / deterministic / dynamical) or veloVI (deep generative). Skip when input lacks the spliced/unspliced layers (must be quantified upstream by velocyto / kb-python / STARsolo); non-spatial scRNA velocity (use sc-velocity).
spatial-trajectory
Load when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state + fate-probability), or Palantir (waypoint branch probabilities). Skip when the data has spliced/unspliced layers and you want velocity-driven dynamics (use spatial-velocity); non-spatial scRNA pseudotime (use sc-pseudotime).
spatial-statistics
Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy. Skip when ranking spatially variable genes (use spatial-genes); tissue domain detection (use spatial-domains).