Instructions to use RomanCohort/RNAQwen with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RomanCohort/RNAQwen with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("RomanCohort/RNAQwen", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,484 Bytes
85e2a66 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | """调试:单条 PMID 走完 pubmed → nuccore 的链路,看每一步拿到什么。"""
from __future__ import annotations
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "src"))
from rnaqwen.data.sources import Entrez, parse_fasta, parse_pubmed_xml # noqa: E402
def main() -> int:
pmid = sys.argv[1] if len(sys.argv) > 1 else "33087357"
ez = Entrez()
print("== 1. efetch pubmed ==")
xml = ez.efetch("pubmed", [pmid], retmode="xml")
lit = parse_pubmed_xml(xml)
print("parsed:", json.dumps({k: (v[:80] if isinstance(v, str) else v) for k, v in lit.get(pmid, {}).items()},
ensure_ascii=False, indent=2))
print("\n== 2. elink pubmed -> nuccore ==")
raw = ez._get("elink.fcgi", {"dbfrom": "pubmed", "db": "nuccore", "retmode": "json", "id": pmid})
print(raw[:800])
links = ez.elink("pubmed", "nuccore", [pmid])
print("parsed links:", links)
nt_ids = sorted({n for v in links.values() for n in v})
print("nt ids:", nt_ids[:20])
if nt_ids:
print("\n== 3. efetch nuccore fasta ==")
fasta = ez.efetch("nuccore", nt_ids[:5], retmode="text", rettype="fasta")
recs = parse_fasta(fasta)
for acc, defn, seq in recs:
print(f" {acc:20s} len={len(seq):7d} {defn[:90]}")
print(f" {seq[:70]}")
return 0
if __name__ == "__main__":
raise SystemExit(main())
|