Install
openclaw skills install @destinqu/mirna-target-toolsEnd-to-end miRNA target analysis from miRNA sequences alone: whole-transcriptome target prediction across built-in species (human, mouse, rat, sheep, goat, cow, pig, chicken) or your own transcriptome/genome, with TargetScan-style seed sites, miRanda duplex confirmation and 3'UTR-restricted scanning; TargetScan and miRanda workflows, gene annotation, GO/KEGG enrichment with Benjamini-Hochberg FDR, seed-region conservation analysis, publication-quality R/ggplot2 figures, and Cytoscape network export. Fetches miRNA sequences from public databases itself (miRBase / RNAcentral), by name or for a whole species.
openclaw skills install @destinqu/mirna-target-toolsAn end-to-end toolkit for miRNA target analysis — from raw miRNA sequences to a Cytoscape-ready regulatory network:
.sif network plus node-attribute export for CytoscapeRun TargetScan to predict target genes for input miRNA sequences and output the target gene list with scores.
Script: scripts/targetscan_predict.py
Run miRanda for miRNA-mRNA binding prediction, with free-energy calculation and conservation analysis.
Script: scripts/miranda_predict.py
Merge predictions from multiple tools and take the intersection to raise confidence, producing a gene list.
Script: scripts/merge_targets.py
Functional annotation and enrichment analysis of high-confidence target genes:
Script: scripts/annotate_targets.py
Plot enrichment results as publication-grade dot plots (clusterProfiler style): terms ranked by significance, bubble size = genes in term, bubble colour = -log10(p) on a blue-to-red ramp, size legend + slim colour bar. 300 dpi PNG and (with --svg) an editable vector file.
Rendering engine: every figure in this skill is drawn with R + ggplot2 by default (script scripts/plot_enrichment.R). If R or the required packages are missing, install them with bash scripts/install_r_deps.sh; the scripts auto-detect that and fall back to a matplotlib implementation (--engine python forces it, --engine r requires R).
Script: scripts/plot_enrichment.py
Generate .sif network files and attribute files that can be imported directly into Cytoscape for regulatory network visualization.
Script: scripts/format_cytoscape.py
Multi-species conservation analysis of a target miRNA (publication grade):
Script: scripts/conservation_analysis.py
Predict every target site of user-supplied mature miRNA sequences across the entire mRNA set (transcriptome) of a species — no TargetScan database required.
--species human|mouse|rat|sheep|goat|cow|pig|chicken (aliases such as hsa/chi/oar work too; run --list-species)--mrna-fa my_transcripts.fa — your own mRNA/cDNA FASTA--genome-fa genome.fa --gtf annotation.gtf — your own genome + annotation (mRNA rebuilt by joining exons)--mirna-fa mirna.fa — your own FASTA of mature sequences--mirna miR-21-5p,chi-miR-504-5p — resolve name(s) from the database (species prefix optional)--mirna-species goat (or chi) — fetch every mature miRNA of that species from the databasescripts/fetch_mirnas.py: local --mature-fa > cache > miRBase download (several URLs) > RNAcentral name lookup. Everything is cached under ~/.cache/mirna-target-tools/, so later runs work offline. If the network is blocked, python scripts/fetch_mirnas.py --species goat --mature-fa /path/to/mature.fa still works from a local copy.--method):
seed — canonical TargetScan seed sites (8mer / 7mer-m8 / 7mer-A1 / 6mer, weights 4/3/2/1). This is TargetScan's site definition only, not context++: that model needs pre-computed multi-species UTR alignments and does not exist for sheep/goatmiranda — run miRanda (Enright et al. 2003) over every miRNA x transcript pair: full duplex alignment with score and dGhybrid — (recommended, and the default when miRanda is installed) seed sites are kept only when a miRanda alignment overlaps them, and each confirmed site carries its miRanda score and dG; this combines the precise seed definition with thermodynamic evidenceauto — hybrid when miRanda is available, otherwise seed--target-region): cdna (full spliced transcript) or utr (3'UTR only, sliced from the Ensembl GTF - miRNA targeting is 3'UTR-dominant, so this is the biologically faithful choice)--miranda-score (default 140), --miranda-energy (default -20 kcal/mol), --rnahybrid-energy (default -20 kcal/mol), --rnahybrid-dataset (p-value dataset; only fly/worm/human ship with the tool), --rnahybrid-max-target (default 10000 nt - RNAhybrid silently skips longer targets), --min-utr-length (default 30 nt), --jobsStrategy A - three-stage cascade (fast, recommended default)
# stage 1 seed scan (whole transcriptome, seconds) -> stage 2 miRanda confirmation
# -> stage 3 RNAhybrid exact-MFE refinement of the top N targets per miRNA
python predict_targets_genome.py --mirna-fa mirna.fa --species goat \
--target-region utr --method hybrid --refine-rnahybrid 200 \
--outdir results/genome --prefix goat_cascade
Cheap because RNAhybrid (by far the slowest engine) only ever sees a few hundred
transcripts; mfe_verified in *_targets.tsv marks whether the refined target
actually passed the MFE cutoff.
Strategy B - triple parallel + intersection (slow, most complete data)
# all three engines run over everything; only targets supported by ALL THREE survive
python predict_targets_genome.py --mirna-fa mirna.fa --species goat \
--target-region utr --method triple \
--outdir results/genome --prefix goat_triple
Every surviving row carries all three evidence types (seed site types + miRanda
score/dG + RNAhybrid MFE/p-value) in the evidence column
(seed+miranda+rnahybrid). This is the most complete and most conservative
result, but RNAhybrid over a whole transcriptome is ~60-100x slower than miRanda,
so expect hours per handful of miRNAs - run it on 3'UTRs, not full cDNAs, and use
--jobs. For a quick single-engine check use --method rnahybrid on a small
candidate set.
Script: scripts/predict_targets_genome.py
Prediction time depends on your machine and the engine you pick, not only on the dataset. Reference measurements on the development box (16 cores, WSL2; Ensembl goat cDNA = 34,136 transcripts):
| Step | Reference time | What it scales with |
|---|---|---|
| seed scan, 1 miRNA, full cDNA | ~5 s | single-threaded Python: CPU clock, total sequence length x miRNA count |
| seed scan, 1 miRNA, 3'UTR only | ~1-2 s | same, but 3'UTRs are far smaller than cDNAs |
| miRanda, 1 miRNA, full cDNA | ~48 s (parallel with --jobs) | C code, scales roughly linearly with cores |
| RNAhybrid, 1 miRNA, full cDNA | 60-100x slower than miRanda | exact MFE dynamic programming; cost grows with target length |
| Ensembl download (first run per species) | goat: cDNA 20 MB + GTF 13 MB | your network speed; cached afterwards |
Practical notes:
--jobs parallelises miRanda/RNAhybrid across miRNAs; use min(cores, #miRNAs).--target-region utr and the cheaper engines first, then refine the top hits.~/.cache/mirna-target-tools/.Standard miRNA target prediction + annotation + regulatory network workflow:
predict_targets_genome.py.sif)Run scripts/check_env.py before use to check whether the tools are installed:
python3 ~/.openclaw/skills/mirna-target-tools/scripts/check_env.py
If a tool is missing, the script prints installation steps.
.txt file: one miRNA name per line (e.g. hsa-miR-21-5p) — for TargetScan/miRanda.fa file: FASTA-format miRNA sequence file — usable by every script, including predict_targets_genome.pyTarget prediction stage:
{sample}_targetscan_results.txt - raw TargetScan output{sample}_miranda_results.txt - raw miRanda output{sample}_merged_high_confidence.txt - merged high-confidence target gene listWhole-transcriptome prediction stage (predict_targets_genome.py):
{prefix}_sites.tsv - one row per predicted site (miRNA, transcript, gene, position, site type, weight, site sequence){prefix}_targets.tsv - one row per (miRNA, transcript) ranked by total score, with site_density_per_kb / score_per_kb for a length-fair comparison (--sort-by density) and miRanda hit counts{prefix}_miranda.tsv - raw miRanda hits (query/target ranges, score, dG) when the miranda or hybrid engine is used{prefix}_run_info.tsv - run metadata (source, counts, parameters, site weights)Annotation stage (output of annotate_targets.py):
{sample}_gene_annotation.tsv - gene annotation table (symbol -> Entrez/Ensembl ID + description){sample}_enrichment_all.tsv - every tested term with raw p-value, BH-FDR q_value, significant flag (GO:BP/CC/MF + KEGG){sample}_GO_BP.tsv / {sample}_GO_CC.tsv / {sample}_GO_MF.tsv / {sample}_KEGG.tsv - per-source results filtered to significant terms{sample}_enrichment_dotplot.png (+ .svg with --svg) - enrichment dot plot (output of plot_enrichment.py)Conservation stage (output of conservation_analysis.py):
{prefix}_aligned.fa - multiple sequence alignment (with gaps){prefix}_conservation.tsv - per-position conservation statistics (identity %, bits, base counts, coverage){prefix}_summary.tsv - summary statistics (seed/core region conservation, mean pairwise identity){prefix}_sequence_logo.png/.svg - information-content sequence logo{prefix}_alignment.png/.svg - multiple sequence alignment figureNetwork construction stage:
{sample}_mirna_target_network.sif - Cytoscape network file{sample}_node_attributes.txt - node attribute file (importable into Cytoscape)python targetscan_predict.py --input mirna.txt --output results/targetscan.txt
python miranda_predict.py --mirna mirna.fa --mrna 3utr.fa --output results/miranda.txt
python merge_targets.py --targetscan targetscan.txt --miranda miranda.txt --output merged.txt
# Built-in species (Ensembl cDNA auto-download + cache) - sheep example
python predict_targets_genome.py --mirna-fa mirna.fa --species sheep \
--outdir results/genome --prefix sheep_targets
# Which species are built in?
python predict_targets_genome.py --list-species
# Your own transcriptome FASTA (any species / assembly)
python predict_targets_genome.py --mirna-fa mirna.fa \
--mrna-fa my_transcripts.fa --outdir results/genome --prefix my_targets
# Your own genome + GTF annotation (mRNA rebuilt from exons)
python predict_targets_genome.py --mirna-fa mirna.fa \
--genome-fa genome.fa --gtf annotation.gtf \
--outdir results/genome --prefix custom_targets
# Quick smoke test: first 2,000 transcripts only, keep top 20 targets per miRNA
python predict_targets_genome.py --mirna-fa mirna.fa --species goat \
--max-transcripts 2000 --top 20 --outdir results/genome --prefix quick
# Extract targets from the merged result, then annotate + run GO/KEGG enrichment (goat example)
python annotate_targets.py --input merged.txt --gene-col TargetGene \
--species goat --output-dir results/annotation
# Visualize enrichment results (dot plot, 300 dpi PNG + editable SVG)
python plot_enrichment.py --input results/annotation/merged_enrichment_all.tsv \
--output results/annotation/merged_dotplot.png --source KEGG --top 15 --svg
# Other useful knobs: --sort size, --wrap, --figsize "9,7", --title "...", --dpi 600
# Auto-extract multi-species homologs of miR-21-5p from miRBase, then run conservation analysis
python conservation_analysis.py --mirna miR-21-5p \
--reference-species hsa --outdir results/conservation --prefix miR-21
# Or supply your own multiple sequence FASTA
python conservation_analysis.py --input-fa homologs.fa \
--reference-species hsa --outdir results/conservation
# Restrict to a species allow-list + custom seed region
python conservation_analysis.py --mirna miR-21-5p \
--species hsa,mmu,rno,bta,ssc --seed-start 2 --seed-end 8
python format_cytoscape.py --input merged.txt --output network.sif --attr-output node_attributes.txt
R + ggplot2 (default plotting engine):
bash scripts/install_r_deps.sh # R itself + ggplot2, dplyr, stringr, scales (+ optional svglite, ggrepel, patchwork, ggsci, forcats)
bash scripts/install_r_deps.sh --minimal # required packages only
The installer puts R packages in the user library (~/R/library), so it needs no root; if R itself is missing it tries conda/mamba first and otherwise prints the apt/brew command to run. scripts/check_env.py reports whether the R engine is ready.
Python:
bash scripts/install_dependencies.sh # Ubuntu/Debian and macOS
pandas, numpy (required for the TargetScan/miRanda merge scripts and enrichment FDR)mygene (optional; only needed for gene annotation - GO/KEGG enrichment is pure standard library with zero extra dependencies)matplotlib (optional; fallback only - used when R is unavailable)predict_targets_genome.py and the conservation core are pure standard library. Built-in species mRNA sets are downloaded on demand from Ensembl and cached under ~/.cache/mirna-target-tools/genomes/ (tens of MB compressed each; human ~ 70 MB), so they are not bundled with the skill — the first run for a species needs network access.