# Cibersort Immune Infiltration Analysis

Use when estimating relative immune cell infiltration from a bulk expression matrix...

- Repository: https://github.com/aipoch/medical-research-skills (2020 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-09-17
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add aipoch/medical-research-skills --skill cibersort-immune-infiltration-analysis -g -a claude-code -y`
Codex: `npx skills add aipoch/medical-research-skills --skill cibersort-immune-infiltration-analysis -g -a codex -y`
Cursor: `npx skills add aipoch/medical-research-skills --skill cibersort-immune-infiltration-analysis -g -a cursor -y`
Gemini CLI: `npx skills add aipoch/medical-research-skills --skill cibersort-immune-infiltration-analysis -g -a gemini-cli -y`

## Description

Use when estimating relative immune cell infiltration from a bulk expression matrix with a CIBERSORT-style nu-SVR deconvolution workflow based on an LM22 signature matrix, comparing one case group against one control group, and generating structured tables plus immune-fraction plots. NOT for single-cell RNA-seq, spatial data, clinical diagnosis, or workflows that require the original hosted CIBERSORT web service.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)

# CIBERSORT Immune Infiltration Analysis

## When to Use

- Estimate relative immune cell fractions from a bulk expression matrix.
- Compare one case group against one control group after deconvolution.
- Generate structured tables, a serialized result object, and optional PDF plots.

## When Not to Use

- Single-cell RNA-seq, spatial transcriptomics, or clustering tasks.
- Absolute clinical interpretation or treatment recommendation.
- Workflows that require the original online CIBERSORT service instead of a local R implementation.

## Workflow

1. Confirm that the expression matrix, group file, and signature matrix are available.
2. Run `scripts/main.R` with the case and control groups.
3. Review the full result table, derived summary tables, and optional plots.
4. Inspect `run_record.txt` and `output_manifest.txt` after each run, including failed validation attempts.

## When to Read External Files

| Situation | File to Read | Purpose |
|-----------|--------------|---------|
| Need to run the analysis | `scripts/main.R` | CLI entry point |
| Need algorithm details | `references/algorithm.md` | HQ reference workflow and result interpretation |
| Encounter an error | `references/troubleshooting.md` | Error codes and environment fixes |
| Need CLI examples or the baseline record | `references/cli-guide.md` | Example commands and validation notes |
| Need packaged test inputs | `tests/data/` | Demo expression matrix, group file, and LM22 file |

## Usage

```bash
Rscript scripts/main.R \
  --input_file ./expression_matrix.csv \
  --group_file ./group_info.csv \
  --signature_file ./LM22.txt \
  --case_group treatment \
  --control_group control \
  --output_dir ./output \
  --qn false \
  --seed 42
```

## Arguments

The rest: https://github.com/aipoch/medical-research-skills/blob/HEAD/awesome-med-research-skills/Data Analysis/cibersort-immune-infiltration-analysis/SKILL.md
