{"data":{"slug":"github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-cerna-analysis-7df31f81bade","title":"Build ceRNA Regulatory Network from Gene List","summary":"Construct a ceRNA regulatory network from a key gene list using bundled miRNA-mRNA and miRNA-lncRNA databases, with CSV and PDF outputs. The workflow requires a gene list and supports multiple miRNA dataset modes and lncRNA strictness settings.","url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-cerna-analysis-7df31f81bade","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-cerna-analysis-7df31f81bade","markdown_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-cerna-analysis-7df31f81bade.md","download_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-cerna-analysis-7df31f81bade\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Install `igraph` before running any command. Use `references\/troubleshooting.md` for installation guidance. Ensure the key gene list is provided as a plain-text file or comma-separated string. At least one valid gene is required for the analysis.","instructions":"---\nname: cerna-analysis\ndescription: \"Use when building a ceRNA regulatory network from a key gene list by combining bundled miRNA-mRNA and miRNA-lncRNA database files, with flat-file CSV exports and PDF visualization in a single output directory. NOT for: differential expression, single-cell analysis, enrichment analysis, or workflows without a key gene list.\"\nlicense: MIT\nskill-author: Codex\n---\n\n# ceRNA Analysis\n\n## When to Use\n\nUse this skill when you need to construct a ceRNA regulatory network from a known key-gene list using the bundled miRNA-mRNA and miRNA-lncRNA reference tables.\n\nUse it for:\n\n- Building a ceRNA network from one gene list and exporting flat CSV plus PDF outputs\n- Comparing supported miRNA source modes such as `combined`, `starbase`, or pairwise overlaps\n- Re-running the same local workflow with different lncRNA strictness, layout, or plotting parameters\n\nDo not use it for:\n\n- Differential expression, single-cell, enrichment, or survival analysis\n- Workflows that do not start from a key gene list\n- Cases where you want a miRNA-mRNA-only graph without a retained lncRNA ceRNA layer\n\n## Input Validation\n\nThis skill accepts:\n\n- A key gene list as a plain-text file (one gene symbol per line) or as a comma-separated string on the CLI\n- Optional parameter overrides for dataset mode, lncRNA strictness, layout, colors, and timeout\n\nIf the user's request does not involve building a ceRNA regulatory network from a key gene list \u2014 for example, asking to run differential expression, enrichment analysis, single-cell workflows, or survival analysis \u2014 do not proceed with the workflow. Instead respond:\n\n> \"ceRNA Analysis is designed to construct a ceRNA regulatory network from a key gene list using bundled miRNA-mRNA and miRNA-lncRNA reference databases. Your request appears to be outside this scope. Please provide a key gene list and specify a supported miRNA dataset mode, or use a more appropriate skill for differential expression, enrichment analysis, or single-cell workflows.\"\n\n## When to Read External Files\n\n| Situation | File to Read | Purpose |\n|-----------|--------------|---------|\n| **Need algorithm details** | `references\/algorithm.md` | ceRNA construction logic, dataset combinations, filtering rules. Includes worked examples of pairwise intersection network size vs combined mode. |\n| **Need to run analysis** | `scripts\/main.R` | Execute: `Rscript scripts\/main.R --key_genes ... --output_dir ...`. Note: `--help` requires igraph to be installed. |\n| **Encounter errors** | `references\/troubleshooting.md` | Common errors and solutions |\n| **Need CLI examples** | `references\/cli-guide.md` | Detailed local run examples with measured outputs |\n| **Need test data** | `tests\/data\/` | Sample key-gene input for testing |\n\n## Usage\n\n```bash\nRscript scripts\/main.R \\\n  --key_genes tests\/data\/gene.txt \\\n  --output_dir .\/output\/ \\\n  --mirna_dataset combined \\\n  --lncrna_strictness High \\\n  --lncrna_freq_thresh 0 \\\n  --timeout_seconds 600 \\\n  --seed 42\n```\n\n> **Dependency note:** `--help` and all analysis modes require `igraph` to be installed. Install igraph before running any command. Use `references\/troubleshooting.md` for installation guidance.\n\n## Arguments\n\n### Main Analysis: `scripts\/main.R`\n\n| Short | Long | Type | Default | Description |\n|-------|------|------|---------|-------------|\n| `-i` | `--key_genes` | character | **required** | Key gene file path or comma-separated gene names |\n| `-o` | `--output_dir` | character | `.\/output\/` | Output directory |\n| `-m` | `--mirna_dataset` | character | `combined` | Dataset: `combined`, `starbase`, `mirdb`, `mirtarbase`, `starbase+mirdb`, `starbase+mirtarbase`, `mirdb+mirtarbase` |\n| `-l` | `--lncrna_strictness` | character | `High` | lncRNA interaction strictness: `Low`, `Median`, `High` |\n| `-f` | `--lncrna_freq_thresh` | integer | `0` | Minimum retained lncRNA frequency |\n| `-r` | `--reference_dir` | character | `file.path(script_dir, \"..\", \"references\", \"database\")` | Database directory |\n|  | `--plot_width` | double | `12` | PDF width in inches |\n|  | `--plot_height` | double | `8` | PDF height in inches |\n|  | `--layout_type` | character | `kk` | Layout: `kk`, `fr`, `nicely`, `circle`, `grid`, `randomly` |\n|  | `--mrna_color` | character | `#D16BA5` | mRNA node color |\n|  | `--lncrna_color` | character | `#008dcd` | lncRNA node color |\n|  | `--mirna_color` | character | `#00c9a7` | miRNA node color |\n|  | `--node_size_base` | double | `15` | Base node size |\n|  | `--label_size` | double | `0.8` | Node label size |\n|  | `--show_legend` | logical | `TRUE` | Show legend in the PDF |\n| `-t` | `--timeout_seconds` | integer | `3600` | Elapsed timeout limit |\n| `-s` | `--seed` | integer | `42` | Random seed for reproducibility |\n\n## Input Format\n\n### Key Genes (`key_genes`)\n\nPlain-text input with one gene symbol per line, or a comma-separated string passed directly on the CLI.\n\n```text\nTP53\nBRCA1\nMYC\n```\n\nRules:\n\n- Blank lines are ignored\n- Lines starting with `#` are ignored\n- Duplicate genes are removed\n- At least one valid gene is required\n\n### Database Directory (`reference_dir`)\n\nThe bundled database directory is `references\/database\/`. Required files depend on the selected `mirna_dataset` plus the selected lncRNA strictness file.\n\n- `combined`: `miRNA_mRNA.csv`\n- `starbase`: `starbase_miRNA_mRNA.csv`\n- `mirdb`: `miRDB_miRNA_mRNA.csv`\n- `mirtarbase`: `miRTarbase_miRNA_mRNA.csv`\n- `starbase+mirdb`: `starbase_miRNA_mRNA.csv` and `miRDB_miRNA_mRNA.csv`\n- `starbase+mirtarbase`: `starbase_miRNA_mRNA.csv` and `miRTarbase_miRNA_mRNA.csv`\n- `mirdb+mirtarbase`: `miRDB_miRNA_mRNA.csv` and `miRTarbase_miRNA_mRNA.csv`\n- lncRNA file: one of `starbase_miRNA_lncRNA_High.csv`, `starbase_miRNA_lncRNA_Median.csv`, or `starbase_miRNA_lncRNA_Low.csv`\n\n## Output Files\n\n| File | Description |\n|------|-------------|\n| `ceRNA_network_edges.csv` | Edge table with `node1,node2` columns |\n| `ceRNA_network_nodes.csv` | Node table with `node,type,degree` columns |\n| `ceRNA_network.pdf` | ceRNA network visualization |\n| `session_info.txt` | R session details and loaded package versions |\n\n## Workflow\n\n### Step 1: Validate Input\n- Check key-gene input existence or parse comma-separated genes\n- Validate parameter choices, numeric limits, timeout, and colors\n- Verify the database directory and required files\n\n### Step 2: Load Interaction Data\n- Load the selected miRNA-mRNA dataset\n- Load the selected miRNA-lncRNA dataset by strictness level\n- Recompute pairwise intersections when requested\n\n### Step 3: Filter the Network\n- Retain miRNA-mRNA pairs linked to the provided key genes\n- Retain miRNA-lncRNA pairs connected to the retained miRNAs\n- Apply the lncRNA frequency threshold\n- Stop with `SKILL_INVALID_DATA` if no lncRNA interactions remain after filtering, because the ceRNA layer has collapsed\n\n### Step 4: Build Outputs\n- Construct edge and node tables\n- Save CSV, PDF, and session information in the output directory root\n\n## Methods\n\n### `combined`\nUses the bundled precomputed overlap across three miRNA-mRNA resources for higher-confidence interactions.\n\n### Pairwise Intersections\n`starbase+mirdb`, `starbase+mirtarbase`, and `mirdb+mirtarbase` recompute the overlap between two bundled databases. Pairwise intersections typically yield 20\u201340% fewer edges than `combined` mode because only interactions present in both selected databases are retained. Use pairwise modes when you need higher-confidence edges at the cost of reduced network coverage.\n\n### lncRNA Strictness\n`High`, `Median`, and `Low` select different bundled starBase evidence levels for miRNA-lncRNA interactions.\n\n## Examples\n\n### Basic Combined Analysis\n\n```bash\nRscript scripts\/main.R \\\n  -i .\/key_genes.txt \\\n  -o .\/output \\\n  -m combined\n```\n\n### Single Database Analysis\n\n```bash\nRscript scripts\/main.R \\\n  -i .\/key_genes.txt \\\n  -o .\/output_starbase \\\n  -m starbase \\\n  -l Median \\\n  -f 1\n```\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| `SKILL_FILE_NOT_FOUND` | Input file or database file is missing | Check the file path or bundled database directory |\n| `SKILL_EMPTY_FILE` | A required file exists but has no content | Replace or regenerate the file |\n| `SKILL_EMPTY_DATA` | A required reference table has no usable rows | Verify the input content and regenerate the file if needed |\n| `SKILL_MISSING_COLUMNS` | An input table lacks required columns | Verify the expected schema |\n| `SKILL_INVALID_PARAMETER` | An invalid CLI value was provided | Use one of the documented parameter values |\n| `SKILL_INVALID_DATA` | The input data cannot build a valid ceRNA network, or lncRNA filtering removes the ceRNA layer entirely | Verify the key genes and database files, then lower `--lncrna_freq_thresh` or choose a different dataset \/ strictness |\n| `SKILL_DEPENDENCY_MISSING` | A required package is not installed (igraph required for all modes including `--help`) | Install the missing package before running any command |\n| `SKILL_TIMEOUT` | The run exceeded the timeout limit | Increase `--timeout_seconds` |\n| `SKILL_RUNTIME_ERROR` | An unexpected runtime failure occurred | Re-run after checking the console error message |\n\n**IF error persists**, READ: `references\/troubleshooting.md`\n\n## Testing\n\n### Test with Sample Data\n\n```bash\n# Run with sample data (igraph must be installed first)\nRscript scripts\/main.R \\\n  -i tests\/data\/gene.txt \\\n  -o tests\/output\/\n```\n\n### Validation Commands\n\n```bash\n# Inspect edge output\nwc -l tests\/output\/ceRNA_network_edges.csv\n\n# Check plot exists\nls -la tests\/output\/ceRNA_network.pdf\n```\n","use_cases":["Build a ceRNA network from a gene list and export CSV and PDF outputs","Compare different miRNA dataset modes like combined, starbase, or mirdb","Re-run the same workflow with different lncRNA strictness or layout parameters"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/aipoch\/medical-research-skills\/blob\/686e09dfdb45d9fa1a08664f06bb93769b3c9d91\/awesome-med-research-skills\/Data%20Analysis\/cerna-analysis\/SKILL.md","source_commit":"686e09dfdb45d9fa1a08664f06bb93769b3c9d91","license":"MIT","version":null,"listing_approved_at":"2026-11-24","created_at":"2026-11-23T06:54:54.000000Z","updated_at":"2026-11-24T07:13:04.000000Z","seo_title":"Build ceRNA Network from Gene List","seo_description":"Construct a ceRNA regulatory network from a key gene list using bundled miRNA-mRNA and miRNA-lncRNA databases. Export CSV and PDF outputs.","seo_keywords":["ceRNA network construction","gene list to ceRNA network","miRNA-mRNA interaction analysis","lncRNA strictness settings","ceRNA regulatory network export"]}}