본문으로 건너뛰기
cccskills
무료GitHub에 공개

consensus-clustering-analysis

Use when identifying stable sample subtypes from bulk expression matrices with ConsensusClusterPlus, including PAC-based model selection and consensus matrix/CDF visualization. NOT for: differential expression analysis, single-cell clustering workflows, or non-expression tables.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(20)

  • SKILL.md7.7 KB
  • DESCRIPTION549 B
  • eval_report_consensus-clustering-analysis_result.json14.5 KB
  • references/algorithm.md2.2 KB
  • references/cli-guide.md11.1 KB
  • references/troubleshooting.md2.9 KB
  • scripts/functions_analysis.R5.6 KB
  • scripts/io_utils.R2.0 KB
  • scripts/main.R5.1 KB
  • scripts/run_analysis.R5.8 KB
  • scripts/utils.R3.6 KB
  • scripts/visualization.R2.8 KB
  • tests/data/expression_matrix.csv47.0 KB
  • tests/data/genes.csv267 B
  • tests/data/groups.csv674 B
  • tests/run_tests.R773 B
  • tests/testthat.R889 B
  • tests/testthat/setup.R251 B
  • tests/testthat/test-cli-smoke.R5.5 KB
  • tests/testthat/test-functions.R2.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Source: https://github.com/aipoch/medical-research-skills

Consensus Clustering Analysis

When to Use

Use this skill when you need to identify stable sample subtypes from a bulk expression matrix with ConsensusClusterPlus, compare candidate clustering settings with PAC, and export consensus matrix/CDF visualizations.

Do not use this skill for differential expression analysis, single-cell clustering, or non-expression tabular data.

When to Read External Files

SituationFile to ReadPurpose
Need algorithm detailsreferences/algorithm.mdConsensus clustering, PAC scoring, and preprocessing assumptions
Need to run analysisscripts/main.RExecute: Rscript scripts/main.R --input_file ... --group_file ...
Encounter errorsreferences/troubleshooting.mdCommon errors and solutions
Need CLI examplesreferences/cli-guide.mdDetailed CLI usage examples with verified local runs

Usage

Rscript scripts/main.R \
  --input_file ./expression_matrix.csv \
  --group_file ./groups.csv \
  --disease_group case \
  --max_k 4 \
  --output_dir ./output/ \
  --gene_selection highly_variable \
  --top_n 5000 \
  --reps 1000 \
  --p_item 0.8 \
  --p_feature 1.0 \
  --timeout_seconds 3600 \
  --seed 42

Arguments

ShortLongTypeDefaultDescription
-i--input_filecharacterrequiredExpression matrix file (genes as rows, samples as columns)
-g--group_filecharacterrequiredGroup information file (sample ID + group columns)
-d--disease_groupcharactercaseGroup label retained for clustering
-k--max_kinteger4Maximum cluster count to evaluate
-o--output_dircharacter./output/Output directory
-m--gene_selectioncharacterhighly_variableGene selection mode: highly_variable or custom
-n--top_ninteger5000Number of top variable genes to keep
-l--gene_listcharacterNULLCustom gene list file when gene_selection=custom
-c--center_datalogicalTRUEMedian-center each gene before clustering
-r--repsinteger1000Consensus resampling repetitions
--p_itemdouble0.8Sample resampling proportion
--p_featuredouble1.0Feature resampling proportion
-t--timeout_secondsinteger3600Elapsed timeout in seconds
-s--seedinteger42Random seed for reproducibility

Input Format

Expression Matrix (input_file)

Genes as rows, samples as columns, CSV/TSV/TXT format with gene ID in the first column.

,Sample01,Sample02,Sample03
TSPAN6,1.8479,1.8318,3.8276
TNMD,0.0349,0.0533,1.3889

Group File (group_file)

Delimited text file with sample ID and group columns.

sample,group
Sample01,case
Sample02,control
Sample03,case

Gene List (gene_list)

Optional plain text or single-column CSV file with one gene symbol per line.

TNMD
DPM1
SCYL3

Output Files

FileDescription
Cluster_res.csvPAC summary for each distance/algorithm combination with is_best marking the selected model
genes_for_clustering.csvSelected genes and gene selection mode
samples_for_clustering.csvSamples retained after disease-group filtering
result_<distance>_<algorithm>/Method-specific consensus outputs and PAC_scores.csv
Consensus Matrix Plot.pdfConsensus matrix heatmap for the optimal model
CDF curve Plot.pdfCDF curves for the optimal method
session_info.txtR session and package version info

Workflow

Step 1: Validate Input

  • Check file existence
  • Detect sample and group columns in the group file
  • Validate sample matching between expression matrix and group file

Step 2: Prepare Clustering Matrix

  • Filter samples by the requested disease group
  • Select genes using highly_variable or custom
  • Median-center genes if requested

Step 3: Run Consensus Clustering

  • Evaluate supported distance and clustering algorithm combinations
  • Compute PAC scores across candidate K values
  • Select the optimal model by minimum PAC

Step 4: Generate Outputs

  • Save result tables
  • Generate consensus matrix and CDF plots
  • Record session information for reproducibility

Methods

ConsensusClusterPlus

Repeated subsampling is used to estimate cluster stability across candidate K values and clustering settings.

PAC Score

The proportion of ambiguous clustering is computed as CDF(0.9) - CDF(0.1) from lower-triangle consensus values. Lower PAC indicates more stable clustering.

Gene Selection

  • highly_variable: rank genes by median absolute deviation
  • custom: use the intersection of the provided gene list and matrix row names

Examples

Basic Usage

Rscript scripts/main.R \
  -i expression_matrix.csv \
  -g groups.csv \
  -d case \
  -k 3 \
  -r 20 \
  -o output/example_basic \
  -t 120

With a Custom Gene List

Rscript scripts/main.R \
  -i expression_matrix.csv \
  -g groups.csv \
  -d case \
  -m custom \
  -l genes.csv \
  -k 4 \
  -r 20 \
  -o output/example_custom \
  -t 120

Without Median Centering

Rscript scripts/main.R \
  -i expression_matrix.csv \
  -g groups.csv \
  -d case \
  -c FALSE \
  -k 3 \
  -r 20 \
  -o output/example_rawscale \
  -t 120

Error Handling

Common Errors

ErrorCauseSolution
SKILL_FILE_NOT_FOUNDInput file does not existCheck file path and permissions
SKILL_MISSING_COLUMNSGroup file lacks sample/group columnsVerify column names in the group file
SKILL_SAMPLE_MISMATCHSample names do not matchEnsure group file sample IDs match matrix columns
SKILL_INVALID_PARAMETERCLI value is invalidCheck allowed options and numeric ranges
SKILL_INVALID_DATAToo few samples/genes remain after filteringLower max_k or review the input data
SKILL_TIMEOUTRun exceeded the configured timeoutIncrease timeout_seconds or reduce reps
SKILL_DEPENDENCY_MISSINGRequired R package is not installedInstall missing packages before rerunning

IF error persists, READ: references/troubleshooting.md


Testing

Smoke Check

# Check help
Rscript scripts/main.R --help

# Run analysis
Rscript scripts/main.R \
  -i tests/data/expression_matrix.csv \
  -g tests/data/groups.csv \
  -d case \
  -k 3 \
  -r 20 \
  -o output/example_basic \
  -t 120

Validation Commands

# Inspect selected model
cat output/example_basic/Cluster_res.csv

# Check output plots exist
ls -la output/example_basic

Implementation Checklist

  • CLI parsing with optparse
  • set.seed() for reproducibility
  • requireNamespace() dependency checks
  • Session info recording
  • data.table::fread() input reading
  • File reading instructions in SKILL.md
  • Modular script structure (<150 lines per file)
  • Test data provided
  • Error handling with SKILL_* codes
  • Scripts in scripts/ directory
  • References in references/ directory

Last updated: 2026-04-17 | Version: 1.0.0

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Transform lengthy academic papers into concise, structured 250-word abstracts.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aipoch/medical-research-skills2천2026년 9월 17일 업데이트

Precision editing tool that reduces abstract word count through intelligent compression techniques, maintaining scientific rigor while meeting strict journal and conference requirements.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aipoch/medical-research-skills2천2026년 9월 17일 업데이트

Refines long medical academic texts into SCI-style unstructured Chinese and English abstracts; use when you need to condense drafts/reports/summaries into bilingual abstracts and generate Summary_Report.md.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aipoch/medical-research-skills2천2026년 9월 17일 업데이트

Generates submission-ready Elsevier/SCI Highlights from manuscript text or extracted PDF/DOCX/TXT content. Use when a user needs 3-5 concise, evidence-grounded highlight bullets for a research paper, review, meta-analysis, case report, or bioinformatics manuscript.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aipoch/medical-research-skills2천2026년 9월 17일 업데이트

Generates complete FAERS pharmacovigilance study designs for multi-drug or class-level safety comparison inside one predefined SOC or AE family using active comparators, disproportionality analysis, subgroup characterization, and reviewer-facing evidence control.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aipoch/medical-research-skills2천2026년 9월 17일 업데이트

Analyze data with `adme-property-predictor` using a reproducible workflow, explicit validation, and structured outputs for review-ready interpretation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aipoch/medical-research-skills2천2026년 9월 17일 업데이트

aipoch의 스킬 모두 보기

이 스킬의 문제 신고