scientific-skills/Data Analysis/biopython-advanced/SKILL.md
Advanced Biopython modules for motifs, population genetics, sequence utilities, restriction analysis, clustering, and GenomeDiagram visualization; use when you need extended bioinformatics analysis beyond basic sequence I/O and alignment.
npx skillsauth add aipoch/medical-research-skills biopython-advancedInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Bio.motifs (counts, consensus, simple statistics).Bio.Restriction (enzyme lookup, cut site detection).Bio.SeqUtils (codon usage and related helpers).config/task_config.json as an intermediate artifact.python scripts/<task_name>.py.encoding="utf-8" for file I/O; JSON output uses ensure_ascii=False.Required:
Optional (for reporting/plotting):
The following examples are complete runnable scripts that follow the conventions:
config/task_config.jsonpython scripts/<task_name>.pyensure_ascii=False for JSON outputconfig/task_config.json
{
"task": "motif_stats",
"sequences": ["ATGCATGCATGC", "ATGCGTGCATGC", "ATGCATGTATGC"]
}
scripts/motif_stats.py
import json
from Bio import motifs
from Bio.Seq import Seq
def main():
with open("config/task_config.json", "r", encoding="utf-8") as f:
cfg = json.load(f)
seqs = [Seq(s) for s in cfg["sequences"]]
m = motifs.create(seqs)
result = {
"alphabet": str(m.alphabet),
"length": m.length,
"counts": {k: dict(v) for k, v in m.counts.items()},
"consensus": str(m.consensus),
"degenerate_consensus": str(m.degenerate_consensus),
}
with open("outputs/motif_stats.json", "w", encoding="utf-8") as f:
json.dump(result, f, ensure_ascii=False, indent=2)
if __name__ == "__main__":
main()
Run:
python scripts/motif_stats.py
config/task_config.json
{
"task": "restriction_sites",
"sequence": "GAATTCGCGGAATTC",
"enzymes": ["EcoRI", "BamHI"]
}
scripts/restriction_sites.py
import json
from Bio.Seq import Seq
from Bio.Restriction import RestrictionBatch
def main():
with open("config/task_config.json", "r", encoding="utf-8") as f:
cfg = json.load(f)
seq = Seq(cfg["sequence"])
batch = RestrictionBatch(cfg["enzymes"])
analysis = batch.search(seq)
# Convert enzyme keys to strings for JSON serialization
result = {str(enzyme): positions for enzyme, positions in analysis.items()}
with open("outputs/restriction_sites.json", "w", encoding="utf-8") as f:
json.dump(result, f, ensure_ascii=False, indent=2)
if __name__ == "__main__":
main()
Run:
python scripts/restriction_sites.py
config/task_config.json
{
"task": "codon_usage",
"cds": "ATGGCTGCTGCTGCTTAA"
}
scripts/codon_usage.py
import json
from collections import Counter
def main():
with open("config/task_config.json", "r", encoding="utf-8") as f:
cfg = json.load(f)
cds = cfg["cds"].upper().replace(" ", "").replace("\n", "")
codons = [cds[i:i+3] for i in range(0, len(cds) - (len(cds) % 3), 3)]
counts = Counter(codons)
total = sum(counts.values()) or 1
result = {
"total_codons": total,
"codon_counts": dict(sorted(counts.items())),
"codon_frequencies": {k: v / total for k, v in sorted(counts.items())},
"note": "This example computes raw codon frequencies from the provided CDS. Validate CDS frame and stop codons for your use case."
}
with open("outputs/codon_usage.json", "w", encoding="utf-8") as f:
json.dump(result, f, ensure_ascii=False, indent=2)
if __name__ == "__main__":
main()
Run:
python scripts/codon_usage.py
Configuration-first execution
config/task_config.json to keep CLI invocation stable and reproducible.outputs/*.json.Motif statistics (Bio.motifs)
counts: per-position nucleotide countsconsensus and degenerate_consensus: derived consensus sequencesRestriction analysis (Bio.Restriction)
RestrictionBatch(enzymes).search(seq) returns cut positions per enzyme.Codon usage
Bio.Data.CodonTable as needed.I/O requirements
encoding="utf-8".json.dump(..., ensure_ascii=False) to preserve non-ASCII characters in outputs.Further reference
references/advanced.md for additional notes and module coverage (motifs/PopGen/SeqUtils/Restriction/Cluster, GenomeDiagram, CodonTable/SeqFeature/IUPACData).tools
Generates complete conventional oncology bulk-transcriptome biomarker and hub-gene research designs from a user-provided cancer type and study direction. Always use this skill whenever a user wants to design, plan, or build a tumor bioinformatics study centered on differential expression, prognostic filtering or risk modeling, PPI-based hub-gene prioritization, diagnostic/prognostic evaluation, clinical association, immune infiltration context, methylation context, and optional tissue or cell validation. Covers five study patterns (signature-first prognostic workflow, hub-gene-first biomarker workflow, hybrid signature-to-hub workflow, immune-context biomarker workflow, translational validation workflow) and always outputs four workload configs (Lite / Standard / Advanced / Publication+) with recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, publication upgrade path...
development
Generates complete conventional non-oncology bioinformatics research designs from a user-provided disease context, process-related gene family or biological theme, and validation direction. Use when a study centers on multi-dataset bulk transcriptome integration, DEG analysis, process-gene intersection, enrichment analysis, GSEA, PPI hub-gene prioritization, TF/miRNA regulatory networks, ROC-based biomarker evaluation, and immune infiltration analysis. Covers five study patterns (process-DEG discovery, enrichment/GSEA interpretation, hub-gene prioritization, regulatory-network and immune interpretation, multi-layer public validation) and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.
tools
Plans confounder control, variable adjustment logic, and bias mitigation strategies at the protocol stage for clinical, epidemiologic, translational, observational, and biomarker studies. Always use this skill when a user needs to identify major confounders, decide which variables should or should not be adjusted for, compare matching/stratification/weighting approaches, anticipate selection or measurement bias, or pressure-test a study design before execution. Focus on bias sensing, causal structure awareness, variable-role classification, and critical design review rather than generic statistical advice.
testing
Generates complete comparative network-toxicology research designs from a user-provided exposure pair, shared toxic phenotype, and validation direction. Use when a study centers on two related exposures under one outcome and needs target collection, shared-vs-specific target decomposition, enrichment, PPI hub prioritization, docking, optional transcriptomic cross-checks, and conservative mechanistic synthesis. Covers five study patterns and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.