biorxiv-database について
このスキルは、研究者や文献モニタリングのワークフロー向けに、bioRxivとmedRxivのプレプリントへプログラムからアクセスする方法を説明します。REST APIでDOIや期間を指定してメタデータと版を取得し、公開済みかどうかも確認できます。
主な機能
- 01DOIまたは期間によるプレプリント検索
- 02メタデータ、要旨、版の取得
- 03研究カテゴリーのモニタリング
- 04査読付き論文としての公開状況確認
- 05API結果のページ取得
活用シーン
- 01カテゴリー別の週次プレプリント一覧の作成
- 02複数DOIの要旨スクリーニング
- 03プレプリントの更新と版の追跡
- 04公開済みプレプリントの確認
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ jaechang-hits/ sciagent-skills --skill biorxiv-databaseインストール後、Claude Code で/biorxiv-databaseを入力して読み込まれたか確認します。
詳細
bioRxiv / medRxiv プレプリントデータベース
概要
bioRxiv(生物学)と medRxiv(健康科学)は、査読前または査読と並行して、それぞれ 200,000 件以上、50,000 件以上の原稿を公開している無料のプレプリントサーバーです。統合 REST API を使うと、認証なしでプレプリントのメタデータ(タイトル、要旨、著者、カテゴリー、DOI、バージョン履歴)にプログラムからアクセスできます。プレプリントは PDF で公開されており、DOI、日付範囲、またはカテゴリーで取得できます。
使用する場面
- 査読前に、動きの速い分野の最新の研究を見つける場合(例:感染症の流行中の研究)
- 特定の分野のカテゴリー(例:バイオインフォマティクス、ゲノミクス、神経科学)における毎週のプレプリント投稿を監視する場合
- 文献スクリーニングのため、bioRxiv の DOI 一覧からメタデータと要旨を取得する場合
- プレプリントから出版までの流れを追跡するため、プレプリントのコーパスを構築する場合
- 特定のプレプリントが更新されたか、査読付きジャーナルに掲載されたかを確認する場合
- 査読済みの生物医学文献には
pubmed-databaseを、全分野の文献にはopenalex-databaseを使用してください
前提条件
- Python パッケージ:
requests、pandas - データ要件:bioRxiv/medRxiv の DOI、日付範囲、またはカテゴリー名
- 環境:インターネット接続。API キーや認証は不要です
- レート制限:明示された厳格な上限はありません。一括クエリでは適度な間隔を空けてください
pip install requests pandas
クイックスタート
import requests
BASE = "https://api.biorxiv.org"
# Retrieve recent bioinformatics preprints
r = requests.get(f"{BASE}/details/biorxiv/2024-01-01/2024-01-07/0",
params={"category": "bioinformatics"})
r.raise_for_status()
data = r.json()
print(f"Total preprints: {int(data['messages'][0]['total'])}") # API returns total as a string
for article in data["collection"][:3]:
print(f"\n{article['title'][:80]}")
print(f" Authors : {article['authors'][:60]}")
print(f" DOI : {article['doi']}")
print(f" Category: {article['category']}")
コア API
クエリ 1:日付範囲によるプレプリント一覧
任意でカテゴリーを指定して、指定した日付範囲内に投稿されたすべてのプレプリントを取得します。
import requests, pandas as pd
BASE = "https://api.biorxiv.org"
def get_preprints(server, date_from, date_to, cursor=0, category=None):
"""
server: 'biorxiv' or 'medrxiv'
date_from, date_to: 'YYYY-MM-DD' strings
cursor: page offset (increments of 100)
"""
url = f"{BASE}/details/{server}/{date_from}/{date_to}/{cursor}"
r = requests.get(url)
r.raise_for_status()
return r.json()
data = get_preprints("biorxiv", "2024-01-01", "2024-01-03")
total = int(data["messages"][0]["total"]) # API returns total as a string — cast for arithmetic
print(f"bioRxiv preprints Jan 1-3, 2024: {total}")
rows = []
for article in data["collection"][:10]:
rows.append({
"doi": article["doi"],
"title": article["title"],
"authors": article["authors"][:80],
"category": article["category"],
"date": article["date"],
"version": article["version"],
})
df = pd.DataFrame(rows)
print(df[["title", "category", "date"]].head())
# Paginate through all results for a date range
def get_all_preprints(server, date_from, date_to, max_results=500):
all_articles = []
cursor = 0
while len(all_articles) < max_results:
data = get_preprints(server, date_from, date_to, cursor)
collection = data["collection"]
if not collection:
break
all_articles.extend(collection)
total = int(data["messages"][0]["total"]) # cast: API returns total as string
cursor += 100
if cursor >= total:
break
return all_articles[:max_results]
articles = get_all_preprints("biorxiv", "2024-01-01", "2024-01-07")
print(f"Retrieved {len(articles)} preprints from first week of 2024")
クエリ 2:DOI によるプレプリントの詳細
DOI を指定して、特定のプレプリントの詳細なメタデータとバージョン履歴を取得します。
import requests
BASE = "https://api.biorxiv.org"
# Retrieve specific preprint by DOI
doi = "10.1101/2024.01.01.000001" # Replace with real DOI
def get_by_doi(server, doi):
r = requests.get(f"{BASE}/details/{server}/{doi}")
r.raise_for_status()
return r.json()
# Generic example using bioRxiv DOI pattern
r = requests.get(f"{BASE}/details/biorxiv/10.1101/2024.05.28.596311")
if r.ok:
data = r.json()
articles = data.get("collection", [])
if articles:
art = articles[-1] # Latest version
print(f"Title : {art['title']}")
print(f"Authors : {art['authors'][:100]}")
print(f"Category: {art['category']}")
print(f"Date : {art['date']}")
print(f"Version : {art['version']}")
print(f"DOI : {art['doi']}")
print(f"Abstract (first 300): {art['abstract'][:300]}")
クエリ 3:出版済みプレプリントの検索
プレプリントが査読付きジャーナルに掲載されたかを確認します。
import requests
BASE = "https://api.biorxiv.org"
def check_published(server, doi):
"""Check if a preprint DOI has a corresponding published article."""
r = requests.get(f"{BASE}/publisher/{server}/{doi}")
r.raise_for_status()
data = r.json()
return data.get("collection", [])
# Check one known preprint
doi = "10.1101/2024.05.28.596311"
published = check_published("biorxiv", doi)
if published:
pub = published[0]
print(f"Published in: {pub.get('published_journal')}")
print(f"Published DOI: {pub.get('published_doi')}")
else:
print(f"Preprint {doi} has not been published yet (or not tracked)")
クエリ 4:カテゴリー別のモニタリング
特定の研究カテゴリーのプレプリントを監視します。
import requests, pandas as pd
from datetime import date, timedelta
BASE = "https://api.biorxiv.org"
# bioRxiv categories include: bioinformatics, genomics, neuroscience,
# immunology, cell-biology, biochemistry, microbiology, etc.
def weekly_category_digest(category, days_back=7):
"""Get preprints from last N days for a specific category."""
today = date.today()
date_from = (today - timedelta(days=days_back)).strftime("%Y-%m-%d")
date_to = today.strftime("%Y-%m-%d")
all_articles = []
cursor = 0
while True:
r = requests.get(f"{BASE}/details/biorxiv/{date_from}/{date_to}/{cursor}")
data = r.json()
batch = [a for a in data["collection"] if category.lower() in a["category"].lower()]
all_articles.extend(batch)
if len(data["collection"]) < 100:
break
cursor += 100
return pd.DataFrame(all_articles)[["doi", "title", "authors", "date"]] if all_articles else pd.DataFrame()
df = weekly_category_digest("genomics", days_back=3)
print(f"Recent genomics preprints: {len(df)}")
print(df[["title", "date"]].head())
クエリ 5:medRxiv の臨床・健康研究
medRxiv で健康科学および臨床科学のプレプリントを検索します。
import requests, pandas as pd
BASE = "https://api.biorxiv.org"
# medRxiv categories: infectious diseases, epidemiology, oncology,
# cardiology, neurology, psychiatry, public and global health, etc.
r = requests.get(f"{BASE}/details/medrxiv/2024-01-01/2024-01-07/0")
r.raise_for_status()
data = r.json()
total = int(data["messages"][0]["total"]) # cast: API returns total as string
print(f"medRxiv preprints Jan 1-7, 2024: {total}")
# Group by category
from collections import Counter
category_counts = Counter(a["category"] for a in data["collection"])
print("\nTop categories:")
for cat, count in category_counts.most_common(5):
print(f" {cat}: {count}")
クエリ 6:複数 DOI の解決と要旨の抽出
bioRxiv の DOI 一覧から要旨を取得します。
import requests, time, pandas as pd
BASE = "https://api.biorxiv.org"
dois = [
"10.1101/2024.05.28.596311",
"10.1101/2023.11.28.569048",
"10.1101/2023.03.07.531523",
]
rows = []
for doi in dois:
r = requests.get(f"{BASE}/details/biorxiv/{doi}")
if r.ok:
collection = r.json().get("collection", [])
if collection:
art = collection[-1] # Latest version
rows.append({
"doi": doi,
"title": art.get("title"),
"category": art.get("category"),
"date": art.get("date"),
"abstract": art.get("abstract", "")[:300],
})
time.sleep(0.2)
df = pd.DataFrame(rows)
if not df.empty:
df.to_csv("preprint_abstracts.csv", index=False)
print(df[["doi", "title", "category"]].to_string(index=False))
else:
print("No valid preprints found for provided DOIs")
主要な概念
API エンドポイントの構造
bioRxiv API は次の形式に従います:https://api.biorxiv.org/details/{server}/{interval}/{cursor}
server:biorxivまたはmedrxivinterval:単一レコードの場合は DOI、日付範囲の場合はdate_from/date_tocursor:ページネーションのオフセット(0、100、200…)
バージョンの追跡
プレプリントは更新されることがあり、更新のたびに新しいバージョン(v1、v2、v3…)が作成されます。API はすべてのバージョンを時系列順に返します。collection の最後の項目が常に最新です。
よくあるワークフロー
ワークフロー 1:週次プレプリントダイジェストのパイプライン
目標:対象カテゴリーの先週のプレプリントを自動で収集し、レビュー用にエクスポートします。
import requests, time, pandas as pd
from datetime import date, timedelta
BASE = "https://api.biorxiv.org"
TARGET_CATEGORIES = ["bioinformatics", "genomics", "systems biology"]
DAYS_BACK = 7
today = date.today()
date_from = (today - timedelta(days=DAYS_BACK)).strftime("%Y-%m-%d")
date_to = today.strftime("%Y-%m-%d")
print(f"Fetching bioRxiv preprints from {date_from} to {date_to}")
all_articles = []
cursor = 0
while True:
r = requests.get(f"{BASE}/details/biorxiv/{date_from}/{date_to}/{cursor}")
r.raise_for_status()
data = r.json()
batch = data["collection"]
if not batch:
break
all_articles.extend(batch)
total = int(data["messages"][0]["total"]) # cast: API returns total as string
cursor += 100
if cursor >= total:
break
time.sleep(0.1)
# Filter by target categories
filtered = [a for a in all_articles
if any(cat in a.get("category", "").lower() for cat in TARGET_CATEGORIES)]
df = pd.DataFrame(filtered)[["doi", "title", "authors", "category", "date"]]
df = df.drop_duplicates(subset="doi") # Remove duplicate versions
output_file = f"biorxiv_digest_{date_to}.csv"
df.to_csv(output_file, index=False)
print(f"\nSaved {len(df)} preprints across {len(TARGET_CATEGORIES)} categories → {output_file}")
print(df[["title", "category", "date"]].head(5).to_string(index=False))
ワークフロー 2:プレプリントから出版までの追跡
目標:プレプリントの DOI 一覧について、出版済みのものを確認し、出版情報を取得します。
import requests, time, pandas as pd
BASE = "https://api.biorxiv.org"
preprint_dois = [
"10.1101/2024.05.28.596311",
"10.1101/2023.11.28.569048",
]
results = []
for doi in preprint_dois:
# Get preprint metadata
r_meta = requests.get(f"{BASE}/details/biorxiv/{doi}")
meta = {}
if r_meta.ok and r_meta.json().get("collection"):
art = r_meta.json()["collection"][-1]
meta = {"title": art["title"], "category": art["category"],
"preprint_date": art["date"]}
# Check publication status
r_pub = requests.get(f"{BASE}/publisher/biorxiv/{doi}")
published = {}
if r_pub.ok and r_pub.json().get("collection"):
pub = r_pub.json()["collection"][0]
published = {"journal": pub.get("published_journal"),
"pub_doi": pub.get("published_doi")}
results.append({"preprint_doi": doi, **meta, **published})
time.sleep(0.25)
df = pd.DataFrame(results)
print(df.to_string(index=False))
df.to_csv("preprint_publication_status.csv", index=False)
主要なパラメーター
| パラメーター | モジュール | デフォルト | 範囲 / 選択肢 | 効果 |
|---|---|---|---|---|
server | URL パス | 必須 | "biorxiv"、"medrxiv" | プレプリントサーバーを選択します |
date_from | URL パス | 必須 | "YYYY-MM-DD" | 日付範囲の開始日 |
date_to | URL パス | 必須 | "YYYY-MM-DD" | 日付範囲の終了日 |
cursor | URL パス | 0 | 0、100、200… | ページネーションのオフセット(1 ページあたり 100 件) |
category | フィルター | — | 例:"bioinformatics" | カテゴリー名の部分一致(取得後のフィルタリング) |
version | — | すべてのバージョン | — | API はすべてのバージョンを返します。最新のものには [-1] を使用してください |
ベストプラクティス
-
最新バージョンには常に最後の要素を使用してください:
collection配列は、古いバージョンから新しいバージョンの順に並んでいます。プレプリントの最新バージョンを取得するには、collection[-1]を使用してください。 -
カテゴリーで後処理フィルターをかけてください:API はカテゴリーによるフィルタリングにネイティブ対応していません。指定した期間のプレプリントをすべて取得し、クライアント側で
if category in article["category"].lower()を使って絞り込んでください。 -
サーバーのリソースを尊重してください:個々の DOI を照会する間に
time.sleep(0.2)を追加し、API に一括で過剰なリクエストを送らないでください。 -
PubMed と照合してください:
publisherエンドポイントで、プレプリントがいつ出版されたかを確認できます。pubmed-databaseを使用して、査読済み論文のメタデータ全体を取得してください。 -
抄録の欠落に対処してください:
abstractフィールドが空のプレプリントもあります。常にart.get("abstract", "") or "No abstract available"でガードしてください。
よく使うレシピ
レシピ:プレプリント PDF のダウンロード(Cloudflare 対応)
使用する場面:bioRxiv のプレプリントの全文 PDF を取得します。注意点:2026 年時点で、www.biorxiv.org は Cloudflare のボット対策チャレンジの背後にあります。requests.get(..., headers={"User-Agent": "Mozilla/5.0"}) による直接アクセスは、Session とランディングページへの事前アクセスを使っても、常に HTTP 403(「Just a moment...」)を返します。以下の方法では、実際のブラウザーに近いヘッダーで可能な範囲のダウンロードを試み、ブロックされた場合はメタデータ取得先を EuropePMC に切り替えます。
import requests
def download_biorxiv_pdf(doi, out_path=None):
"""Best-effort PDF download. If Cloudflare blocks, return False so the caller
can fall back to EuropePMC metadata or open the landing page in a browser."""
pdf_url = f"https://www.biorxiv.org/content/{doi}.full.pdf"
s = requests.Session()
s.headers.update({
"User-Agent": ("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"),
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,application/pdf,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
})
# Warm up the landing page first (sometimes lets Cloudflare's "trust" cookie set)
s.get(f"https://www.biorxiv.org/content/{doi}v1", timeout=30)
r = s.get(pdf_url, timeout=60)
if r.ok and r.content.startswith(b"%PDF"):
out = out_path or f"{doi.replace('/', '_')}.pdf"
with open(out, "wb") as f:
f.write(r.content)
print(f"Downloaded {out} ({len(r.content)//1024} KB)")
return True
print(f"PDF blocked (HTTP {r.status_code}); falling back to metadata-only via EuropePMC")
return False
def europepmc_metadata(doi):
"""Fetch preprint metadata via EuropePMC when bioRxiv PDF is blocked.
EuropePMC indexes bioRxiv as source 'PPR' and exposes a stable landing URL."""
r = requests.get("https://www.ebi.ac.uk/europepmc/webservices/rest/search",
params={"query": f"DOI:{doi}", "format": "json"}, timeout=30)
r.raise_for_status()
hits = r.json().get("resultList", {}).get("result", [])
if not hits:
return None
h = hits[0]
return {
"source": h.get("source"), # 'PPR' for preprints
"epmc_id": h.get("id"), # e.g. 'PPR860608'
"title": h.get("title"),
"landing_url": f"https://europepmc.org/article/{h.get('source')}/{h.get('id')}",
}
doi = "10.1101/2024.05.28.596311"
if not download_biorxiv_pdf(doi):
meta = europepmc_metadata(doi)
print(f" EuropePMC landing: {meta['landing_url']}")
print(f" Title: {meta['title'][:80]}")
レシピ:カテゴリー別のプレプリント数をカウント
使用する場面:一定期間内における、bioRxiv のカテゴリー別プレプリントの分布を分析します。
import requests, pandas as pd
from collections import Counter
r = requests.get("https://api.biorxiv.org/details/biorxiv/2024-01-01/2024-01-07/0")
data = r.json()
total = int(data["messages"][0]["total"]) # cast: API returns total as a string
# Fetch all pages
all_articles = data["collection"]
for cursor in range(100, min(total, 1000), 100):
r2 = requests.get(f"https://api.biorxiv.org/details/biorxiv/2024-01-01/2024-01-07/{cursor}")
all_articles.extend(r2.json()["collection"])
counts = Counter(a["category"] for a in all_articles)
df = pd.DataFrame(counts.most_common(), columns=["category", "count"])
print(df.head(10).to_string(index=False))
レシピ:プレプリントが出版済みかどうかを確認
使用する場面:単一のプレプリントについて、出版状況を手早く確認します。
import requests
doi = "10.1101/2024.05.28.596311"
r = requests.get(f"https://api.biorxiv.org/publisher/biorxiv/{doi}")
collection = r.json().get("collection", [])
if collection:
print(f"Published: {collection[0]['published_journal']} | DOI: {collection[0]['published_doi']}")
else:
print("Not published or not tracked")
トラブルシューティング
| 問題 | 原因 | 解決策 |
|---|---|---|
collection が空 | DOI が見つからない、または期間内に結果がない | DOI の形式(10.1101/ で始まること)を確認し、期間を確認してください |
| 結果に重複したプレプリントがある | 複数のバージョンが返されている | DOI で重複を除去してください:df.drop_duplicates(subset='doi', keep='last') |
| 抄録フィールドが欠落している | 構造化抄録がないプレプリントもあります | art.get("abstract", "") or "N/A" でガードしてください |
total の件数と取得件数が一致しない | ページネーション中に新しいプレプリントが追加された | おおよその件数として扱ってください。プレプリントは継続的に追加されます |
| PDF のダウンロードがブロックされる(HTTP 403「Just a moment...」) | www.biorxiv.org/.../*.full.pdf に対する Cloudflare のボット対策(Mozilla/5.0 UA だけでは回避できず、Session とランディングページへの事前アクセスでも回避できません) | Session と事前アクセスを使うレシピを試してください。それでもブロックされる場合は、メタデータ取得先を EuropePMC(source=PPR)に切り替えるか、ブラウザーで bioRxiv のランディングページにアクセスして PDF を手動で取得してください |
cursor >= total が成立せず、ループが無限に続く | data['messages'][0]['total'] が文字列(例:'1119')で返されるため、int_cursor >= str_total で TypeError が発生するか、文字列として比較されます | すべてのページネーションループで int(data["messages"][0]["total"]) を使って明示的に整数に変換してください |
特定の DOI で collection が空 | DOI が実在するプレプリントに解決されなかった(例:2023.01.01.000001 のような架空のプレースホルダー、または古い DOI/撤回済み DOI) | まず https://www.biorxiv.org/content/{doi}v1 で DOI を確認してください。期間指定のリストから取得した最近の DOI が最も確実な例です |
| 広い期間を指定するとページネーションが遅い | プレプリントの件数が多い | 件数の多い期間では、期間を狭めて(3~7 日)ください |
関連スキル
pubmed-database— プレプリントの出版済みバージョンを確認するための査読済み生物医学文献openalex-database— インデックス反映の遅延後に bioRxiv のコンテンツも収録する、より広範な学術インデックスliterature-review— システマティックレビューにプレプリントを組み込むためのガイドscientific-brainstorming— 仮説生成の入力としてプレプリントアラートを活用
参考資料
- bioRxiv API ドキュメント — 公式 API エンドポイントとレスポンス形式
- bioRxiv の概要ページ — サーバーの概要、投稿ガイドライン
- medRxiv の概要ページ — ヘルスサイエンス分野のプレプリントサーバーの詳細
- プレプリントガイドラインのレビュー(Fraser et al. 2021) — 研究におけるプレプリントの引用と活用に関するベストプラクティス