literature
Load when extracting GEO accessions, dataset metadata, and downloadable references from a scientific paper (PDF / URL / DOI / PubMed ID / raw text) for downstream omics analysis. Skip when the dataset is already in hand; the paper names no dataset to fetch.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 161
- Forks
- 27
01 前言 Front Matter
- name
- literature
- tags
- [ "literature", "pdf", "doi", "pubmed", "geo", "metadata" ]
- trigger
- parse paper, literature, GEO accession, download dataset, PDF extract, PubMed, DOI
- description
- Load when extracting GEO accessions, dataset metadata, and downloadable references from a scientific paper (PDF / URL / DOI / PubMed ID / raw text) for downstream omics analysis. Skip when the dataset is already in hand; the paper names no dataset to fetch.
02 资源文件 18
- 脚本_api.py5.2 KB
- 脚本_lib/__init__.py44 B
- 脚本_lib/extractor.py10.7 KB
- 脚本_lib/input_kind.py615 B
- 脚本core/__init__.py39 B
- 脚本core/downloader.py5.0 KB
- 脚本core/extractor.py270 B
- 脚本core/parser.py3.6 KB
- 脚本examples/example_step.py656 B
- 参考文档index.json677 B
- 参考文档INDEX.md927 B
- 脚本literature_parse.py9.2 KB
- 参考文档references/methodology.md685 B
- 参考文档references/output_contract.md391 B
- 参考文档references/parameters.md487 B
- 参考文档requirements.txt53 B
- 脚本tests/test_api.py1.4 KB
- 脚本tests/test_cli.py930 B
03 SKILL.md 正文
literature
When to use
Extract GEO accessions and heuristic study metadata from paper text. Read local papers explicitly with read_document or fetch remote papers with fetch_text. Skip when the dataset is already in hand.
Use from a step
import pandas as pd
from skills._sdk.notebook import load_skill, read_input, write_output
library = load_skill('literature')
text = read_input('paper.txt', reader=library.read_document)
result = library.extract(text)
write_output(result, 'tables/result.csv')
examples/example_step.py runs offline and supports fresh-kernel replay. Pure computations return objects; CLI and steps own writes.
API
<!-- api:begin generated from _api.py; regenerate with run.py api <skill dir> --write -->
extract(data)
Extract GEO accessions and heuristic study metadata from text.
:param data: Local paper text; URLs and paths are treated as text, never fetched. :returns: A DataFrame of kind/accession pairs, with metadata in attrs['run_info']. :raises ValueError: data is empty or not a string.
methodology(data)
Extract stated numeric method parameters with exact source spans.
:param data: Paper text containing supported parameter names and numeric values. :returns: A DataFrame with param, operator, value, quote, start and end columns. :raises TypeError: data is not text.
read_document(data)
Read a local PDF or UTF-8 text file; use as reader= in read_input.
:param data: Local Path or path string; no network requests are made. :returns: Extracted text with empty PDF pages omitted. :raises ImportError: Install pypdf with install_skill_deps for PDFs. :raises OSError: The file cannot be read.
fetch_text(data, *, input_type='url')
Fetch article text explicitly from a URL, DOI or PubMed reference.
:param data: Reference sent to the remote service; results may change between requests. :param input_type: Default url; doi and pubmed resolve their respective endpoints. :returns: HTML/XML with tags removed and whitespace collapsed, as in the CLI. :raises ImportError: Install requests with install_skill_deps if unavailable. :raises ValueError: The reference type or URL scheme is unsupported. :raises Exception: HTTP and network errors propagate instead of becoming article text.
run_info(data, *, keep=True)
Read heuristic metadata and the accession lists extracted from text.
:param data: Accession table returned by extract. :param keep: Default True; use False to remove metadata from the table. :returns: An independent metadata dictionary. :raises KeyError: The table has no extraction diagnostics.
accession_figure(data)
Plot accession counts by GEO accession kind.
:param data: Accession table returned by extract. :returns: A matplotlib Figure, including zero counts for missing kinds. :raises KeyError: kind is absent.
<!-- api:end -->
Methods and parameters
extract performs local regex/keyword extraction only. methodology returns exact quotes and character spans for stated numeric parameters. read_document reads UTF-8 text or PDF, and fetch_text explicitly requests URL/DOI/PubMed text. Neither function downloads datasets; the CLI retains its optional GEO download workflow.
Gotchas
extractreturns uppercase, deduplicated and sorted GEO identifiers.methodologynever fills absent parameter defaults.read_documentraises when pypdf is missing or input cannot be read.fetch_textpropagates failures rather than treating an error message as paper text. Metadata labels remain heuristics, not validated study annotations.
Inputs and outputs
extracted_metadata.json, source.txt, report.md and result.json at the output root. The CLI creates data/ and optionally downloads into per-GSE directories; --data-dir chooses another destination. The original source.txt write remains best-effort. The function library writes no files.
CLI
python skills/literature/literature_parse.py --demo --output /tmp/literature
See also
Dependencies
pandas, matplotlib, pypdf, requests
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).