agentsclimarketplace

Cell cell communication

Skill BioTender-max/awesome-bio-agent-skills/skills/omicsclaw/cell-cell-communication

A curated collection of AI agent skills for biomedical research, covering genomics, proteomics, single-cell analysis, clinical AI, and protein design.

Install
npx -y skills add BioTender-max/awesome-bio-agent-skills --skill cell-cell-communication

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

11.3 KB, ~2.8k tokens by cl100k_base, as published. Nobody here has run it

Cell-Cell Communication Analysis (CellChat v2)

When to Use This Skill

Use when:

  • You have an annotated scRNA-seq dataset (Seurat object with cell type labels)
  • You want to identify ligand-receptor interactions between cell types
  • You want to visualize communication networks (chord diagrams, bubble plots)
  • You want to find dominant sender/receiver cell populations
  • Chains from scrnaseq-seurat-core-analysis output (seurat_processed.rds)

Don't use when:

  • Data is not annotated (run scrnaseq-seurat-core-analysis first)
  • You need spatial cell-cell communication (CellChat v2 supports this but requires spatial coordinates)
  • You want gene regulatory networks (use grn-pyscenic instead)
  • You have bulk RNA-seq data

Installation

PackageVersionLicenseCommercial UseInstallation
CellChat≥2.0.0GPL-3✅ Permitteddevtools::install_github("jinworks/CellChat")
Seurat≥5.0.0MIT✅ Permittedinstall.packages('Seurat')
SeuratData≥0.2.1GPL-3✅ Permitteddevtools::install_github('satijalab/seurat-data')
NMF≥0.23.0GPL-2+✅ Permittedinstall.packages('NMF')
circlize≥0.4.12MIT✅ Permittedinstall.packages('circlize')
ComplexHeatmap≥2.12.0MIT✅ PermittedBiocManager::install('ComplexHeatmap')
ggprism≥1.0.3GPL-3✅ Permittedinstall.packages('ggprism')
presto≥1.0.0GPL-3✅ Permittedremotes::install_github('immunogenomics/presto')
ggalluvial≥0.12.0GPL-2✅ Permittedinstall.packages('ggalluvial')
rmarkdown≥2.20GPL-3✅ Permittedinstall.packages('rmarkdown')

⚠️ CellChat must be installed from GitHub (not CRAN). Use the jinworks repository (active), not sqjin (archived).

Inputs

Required:

  • Seurat object (.rds) with:
    • Normalized expression data (@assays$RNA@data)
    • Cell type annotations in metadata (e.g., celltype column)
    • Minimum 3 cell types, ≥10 cells per type recommended

Accepted sources:

  • seurat_processed.rds from scrnaseq-seurat-core-analysis (chains directly)
  • Any annotated Seurat v5 object
  • Example PBMC data (auto-loaded if no file provided)

Outputs

CSV tables:

  • significant_interactions.csv — All significant L-R pairs with source, target, pathway, probability
  • pathway_summary.csv — Pathway-level communication summary
  • interaction_count_matrix.csv — Cell type × cell type interaction counts
  • interaction_strength_matrix.csv — Cell type × cell type communication weights
  • signaling_roles.csv — Centrality scores (sender, receiver, mediator, influencer per pathway)
  • top_interactions.csv — Top 20 interactions ranked by probability

Visualizations (PNG + SVG):

  • interaction_count_network — Circle plot of interaction counts
  • interaction_strength_network — Circle plot of communication strength
  • chord_aggregated — Chord diagram of the full communication network
  • bubble_ligand_receptor — Bubble plot of L-R pairs by cell type pairs
  • signaling_outgoing_heatmap — Outgoing signaling patterns by cell type
  • signaling_incoming_heatmap — Incoming signaling patterns by cell type
  • signaling_role_scatter — Dominant senders vs receivers scatter

Analysis objects (RDS):

  • cellchat_object.rds — Complete CellChat object for downstream use
    • Load with: cellchat <- readRDS('cellchat_object.rds')
    • Required for: multi-condition comparison, pathway-specific deep dives

Reports:

  • analysis_report.md — Markdown report (always generated)
  • analysis_report.pdf — PDF report (requires rmarkdown + LaTeX)

Clarification Questions

🚨 ALWAYS ask Question 1 FIRST. Do not proceed before the user answers.

1. Input Files (ASK THIS FIRST):

  • Do you have an annotated Seurat object (.rds) from scRNA-seq analysis?
    • If yes: provide the path to the .rds file
    • Expected: Seurat v5 object with cell type labels in metadata
  • Or use example data? — PBMC 3k dataset (human immune cells, 2,638 cells, 8 cell types)
    • Uses source("scripts/load_data.R"); seurat_obj <- load_example_pbmc()

🚨 IF EXAMPLE DATA SELECTED: Parameters are pre-defined. Skip to Question 4 (or proceed directly to Step 1). Do NOT ask questions 2-3.

2. Species (own data only):

  • a) Human (CellChatDB.human) — default
  • b) Mouse (CellChatDB.mouse)

3. Cell Type Column (own data only):

  • Which metadata column contains cell type annotations?
    • Common: celltype, singler_labels, cell_type, predicted.celltype.l2
    • Check with: colnames([email protected])

4. Analysis Scope (structured — works for demo and own data):

  • a) All signaling types (Secreted + ECM-Receptor + Cell-Cell Contact) — ✅ recommended
  • b) Secreted signaling only
  • c) Cell-Cell Contact only

Standard Workflow

Note: Run from the OmicsClaw root directory and add the workflow scripts to sys.path:

import sys; import os; sys.path.insert(0, os.path.abspath('knowledge_base/scripts/cell-cell-communication'))

🚨 MANDATORY: USE SCRIPTS EXACTLY AS SHOWN — DO NOT WRITE INLINE CODE 🚨

Step 1 — Load data:

source("scripts/load_data.R")
seurat_obj <- load_cellchat_data()  # example PBMC data
# OR: seurat_obj <- load_cellchat_data("path/to/seurat_processed.rds")

Step 2 — Run CellChat analysis:

source("scripts/run_cellchat.R")
cellchat <- run_cellchat_analysis(seurat_obj, species = "human", group.by = "celltype")

DO NOT write inline CellChat code. Just source the script and call the function.

Step 3 — Generate visualizations:

source("scripts/cellchat_plots.R")
generate_all_plots(cellchat, output_dir = "results")

🚨 DO NOT write inline plotting code. Just use the script. 🚨

Step 4 — Export results:

source("scripts/export_results.R")
export_all(cellchat, seurat_obj = seurat_obj, output_dir = "results")

DO NOT write custom export code. Use export_all().

✅ VERIFICATION — You should see:

  • After Step 1: "✓ Data loaded successfully! [N] cells, [M] cell types"
  • After Step 2: "✓ CellChat analysis completed! [N] significant interactions across [M] pathways"
  • After Step 3: "✓ All plots generated successfully! [6] visualizations saved"
  • After Step 4: "=== Export Complete ==="

❌ IF YOU DON'T SEE THESE: You wrote inline code. Stop and use source().

⚠️ CRITICAL — DO NOT:

  • Write inline CellChat codeSTOP: Use source("scripts/run_cellchat.R")
  • Write inline plotting codeSTOP: Use generate_all_plots()
  • Write custom export codeSTOP: Use export_all()
  • Try to install system-level dependencies → CellChat handles its own deps

⚠️ IF SCRIPTS FAIL — Script Failure Hierarchy:

  1. Fix and Retry (90%) — Install missing package, re-run script
  2. Modify Script (5%) — Edit the script file itself, document changes
  3. Use as Reference (4%) — Read script, adapt approach, cite source
  4. Write from Scratch (1%) — Only if genuinely impossible, explain why

NEVER skip directly to writing inline code without trying the script first.

Common Issues

IssueCauseSolution
CellChat not foundNot installed from GitHubdevtools::install_github("jinworks/CellChat") — must use jinworks repo (not sqjin)
"presto" required for Wilcoxon testMissing presto packageremotes::install_github('immunogenomics/presto') — script falls back to standard test if unavailable
No significant interactionsToo few cells per type or stringent filteringLower min.cells parameter or merge rare cell types
Memory error on large datasets>50k cells uses substantial RAMSubsample or increase memory; see references/cellchat-guide.md
Chord diagram errorMissing circlize packageinstall.packages('circlize')
SVG export error "svglite required"Missing optional dependencyUse generate_all_plots() — it handles fallback automatically. DO NOT try to install svglite manually.
svglite dependency conflictSystem library version mismatchNormal — generate_all_plots() falls back to base R svg() device automatically. Both PNG and SVG will be created.
"group.by not found"Wrong column name for cell typesCheck: colnames([email protected])
Seurat v5 slot error ("no slot of name images")Old Seurat object from v3/v4Script handles this — UpdateSeuratObject() is called automatically
NMF not availableNMF package not installedinstall.packages('NMF')
PDF report skippedNo LaTeX installationinstall.packages('tinytex'); tinytex::install_tinytex() — markdown report still available

Suggested Next Steps

After cell-cell communication analysis, consider:

  1. Multi-condition comparison — Compare communication between disease vs healthy, treated vs untreated
  2. Pathway deep dive — Examine specific pathways (e.g., TNF, MHC-II) with hierarchy plots
  3. Gene regulatory networks — Use grn-pyscenic to find transcription factors driving the communication
  4. Functional enrichment — Run pathway analysis on sender/receiver gene sets

Related Skills

SkillRelationship
scrnaseq-seurat-core-analysisUpstream — produces the annotated Seurat object input
scrnaseq-scanpy-core-analysisAlternative upstream (Python-based, convert to Seurat for CellChat)
grn-pyscenicComplementary — gene regulatory networks from same scRNA-seq data

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.