| name | medgeclaw-guide |
| description | AI research assistant for biomedicine, RNA-seq, and drug discovery |
| metadata | {"openclaw":{"emoji":"💊","category":"domains","subcategory":"biomedical","keywords":["biomedicine","RNA-seq","drug discovery","clinical AI","medical NLP","bioinformatics"],"source":"wentor-research-plugins"}} |
MedgeClaw Guide
Overview
MedgeClaw is a conceptual framework for AI-powered biomedical research assistance, integrating natural language processing for medical literature, computational biology pipelines, and drug discovery workflows. The name reflects the integration of Medical knowledge Edge (cutting-edge biomedical AI) with the Claw agent pattern for autonomous research execution.
Biomedical research is uniquely suited for AI augmentation because it generates massive, heterogeneous data -- genomic sequences, clinical records, imaging data, molecular structures, and published literature -- that exceeds the capacity of individual researchers to synthesize. AI systems that can navigate across these data types, identify patterns, and suggest hypotheses accelerate the pace of discovery.
This guide covers the key computational methods in biomedical AI research: medical NLP for literature mining, RNA-seq analysis pipelines, drug discovery computational workflows, and the integration patterns that connect these components into coherent research workflows. The focus is on methods that are reproducible, validated, and suitable for publication in biomedical journals.
Medical NLP and Literature Mining
Biomedical Named Entity Recognition
import scispacy
import spacy
from scispacy.linking import EntityLinker
nlp = spacy.load("en_ner_bionlp13cg_md")
nlp.add_pipe("scispacy_linker", config={
"resolve_abbreviations": True,
"linker_name": "umls",
})
def extract_biomedical_entities(text: str) -> dict:
"""
Extract and normalize biomedical entities from text.
Returns genes, chemicals, diseases, and their UMLS mappings.
"""
doc = nlp(text)
entities = {
"genes": [],
"chemicals": [],
"diseases": [],
"other": [],
}
category_map = {
"GENE_OR_GENE_PRODUCT": "genes",
"SIMPLE_CHEMICAL": "chemicals",
"CANCER": "diseases",
"ORGAN": "other",
"CELL": "other",
}
for ent in doc.ents:
category = category_map.get(ent.label_, "other")
entity_info = {
"text": ent.text,
"label": ent.label_,
"start": ent.start_char,
"end": ent.end_char,
}
if hasattr(ent, "_") and hasattr(ent._, "kb_ents"):
if ent._.kb_ents:
top_link = ent._.kb_ents[0]
entity_info["umls_cui"] = top_link[0]
entity_info["confidence"] = round(top_link[1], 3)
entities[category].append(entity_info)
return entities
Systematic Literature Search Pipeline
from Bio import Entrez
import time
Entrez.email = "researcher@university.edu"
def systematic_pubmed_search(
query: str,
max_results: int = 1000,
date_range: tuple = ("2020/01/01", "2025/12/31"),
) -> list:
"""
Conduct a systematic PubMed search with structured result extraction.
Suitable for systematic reviews and meta-analyses.
"""
handle = Entrez.esearch(
db="pubmed",
term=query,
retmax=max_results,
datetype="pdat",
mindate=date_range[0],
maxdate=date_range[1],
sort="relevance",
)
results = Entrez.read(handle)
handle.close()
pmids = results["IdList"]
print(f"Found {results['Count']} results, retrieving {len(pmids)}")
articles = []
batch_size = 100
for i in range(0, len(pmids), batch_size):
batch = pmids[i:i + batch_size]
handle = Entrez.efetch(
db="pubmed", id=",".join(batch),
rettype="xml", retmode="xml"
)
records = Entrez.read(handle)
handle.close()
for article in records[]:
medline = article[]
art = medline[]
articles.append({
: (medline[]),
: art[],
: art.get(, {}).get(, [])[],
: art[][],
: art[][][].get(, ),
: [
d[]
d medline.get(, [])
] medline [],
})
time.sleep()
articles
RNA-seq Analysis
Complete DESeq2 Workflow
library(DESeq2)
library(ggplot2)
library(EnhancedVolcano)
library(clusterProfiler)
library(org.Hs.eg.db)
counts <- read.csv("raw_counts.csv", row.names = 1)
coldata <- read.csv("sample_info.csv", row.names = 1)
stopifnot(all(colnames(counts) == rownames(coldata)))
dds <- DESeqDataSetFromMatrix(
countData = counts,
colData = coldata,
design = ~ condition
)
keep rowSumscountsdds
dds ddskeep
dds DESeqdds
res resultsdds contrast
alpha
summaryres
res_shrunk lfcShrinkdds coef
type
sig_genes subsetres padj log2FoldChange
write.csvas.data.framesig_genes
Quality Control Metrics
| Metric | Expected Range | Concern If |
|---|
| Total reads | 20-50M per sample | < 10M |
| Mapping rate | > 80% | < 70% |
| rRNA contamination | < 5% | > 10% |
| GC content | ~42% (human) | Bimodal distribution |
| Duplication rate | < 30% (mRNA) | > 50% |
| Gene body coverage | Uniform 5' to 3' | Strong 3' bias |
| PCA | Samples cluster by condition | Outlier samples |
Drug Discovery Computational Methods
Virtual Screening Pipeline
from rdkit import Chem
from rdkit.Chem import AllChem, Descriptors, Lipinski
import subprocess
def prepare_ligands(smiles_list: list) -> list:
"""
Prepare ligands for virtual screening.
Apply Lipinski's Rule of Five and generate 3D conformers.
"""
prepared = []
for smiles in smiles_list:
mol = Chem.MolFromSmiles(smiles)
if mol is None:
continue
mw = Descriptors.MolWt(mol)
logp = Descriptors.MolLogP(mol)
hbd = Descriptors.NumHDonors(mol)
hba = Descriptors.NumHAcceptors(mol)
if mw > 500 or logp > 5 or hbd > 5 or hba > 10:
continue
mol_h = Chem.AddHs(mol)
AllChem.EmbedMolecule(mol_h, AllChem.ETKDG())
AllChem.MMFFOptimizeMolecule(mol_h)
prepared.append({
"smiles": smiles,
"mol": mol_h,
"mw": round(mw, 2),
"logp": round(logp, 2),
"hbd": hbd,
"hba": hba,
})
return prepared
def () -> :
{
: (Descriptors.TPSA(mol), ),
: Descriptors.NumRotatableBonds(mol),
: Descriptors.NumAromaticRings(mol),
: (Descriptors.FractionCSP3(mol), ),
: (Descriptors.qed(mol), ),
}
Target-Disease Association Analysis
def query_open_targets(target_id: str, disease_id: str) -> dict:
"""
Query Open Targets Platform for target-disease association evidence.
"""
import requests
query = """
query targetDiseaseAssociation($target: String!, $disease: String!) {
disease(efoId: $disease) {
name
associatedTargets(Bs: [$target]) {
rows {
target { approvedSymbol }
score
datatypeScores {
componentId: id
score
}
}
}
}
}
"""
response = requests.post(
"https://api.platform.opentargets.org/api/v4/graphql",
json={"query": query, "variables": {"target": target_id, "disease": disease_id}},
)
return response.json()
Clinical AI Applications
Clinical NLP Patterns
Common clinical NLP tasks for research:
1. CLINICAL TEXT DE-IDENTIFICATION
- Remove PHI (Protected Health Information)
- Tools: Philter, NLM Scrubber, custom regex + NER
- Validation: Must achieve >95% recall for PHI
2. CLINICAL CODING
- Assign ICD-10, CPT, SNOMED-CT codes to clinical notes
- Approaches: Rule-based, ML classification, LLM extraction
- Evaluation: Precision/recall per code family
3. RELATION EXTRACTION
- Drug-disease, drug-adverse event, gene-disease relationships
- From clinical notes, discharge summaries, pathology reports
- Output: Knowledge graphs for downstream analysis
4. TEMPORAL INFORMATION EXTRACTION
- Disease onset, treatment timeline, outcome timing
- Critical for longitudinal studies and survival analysis
- Tools: SUTime, HeidelTime, custom models
Best Practices
- Validate AI predictions experimentally. Computational predictions are hypotheses until confirmed in the lab.
- Use standard file formats. FASTQ for sequencing, SDF/MOL2 for molecules, FASTA for sequences, VCF for variants.
- Follow FAIR data principles. Findable, Accessible, Interoperable, Reusable data management.
- De-identify clinical data before any AI processing. HIPAA and GDPR compliance is non-negotiable.
- Report computational methods in full detail. Software versions, parameters, random seeds, and hardware specs.
- Pre-register clinical AI studies. Use SPIRIT-AI or CONSORT-AI reporting guidelines.
References
- DESeq2 -- Standard RNA-seq differential expression tool
- scispaCy -- Biomedical NLP models for spaCy
- Open Targets Platform -- Target-disease association evidence
- RDKit -- Cheminformatics toolkit
- Love, M. I., Huber, W., & Anders, S. (2014). Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. Genome Biology, 15, 550.