tcga-bulk-data-preprocessing-with-omicverse
Guide Claude through ingesting TCGA sample sheets, expression archives, and clinical carts into omicverse, initialising survival metadata, and exporting annotated AnnData files.
Install
mkdir -p .claude/skills/tcga-bulk-data-preprocessing-with-omicverse && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5511" && unzip -o skill.zip -d .claude/skills/tcga-bulk-data-preprocessing-with-omicverse && rm skill.zipInstalls to .claude/skills/tcga-bulk-data-preprocessing-with-omicverse
About this skill
TCGA Bulk Data Preprocessing with OmicVerse
Overview
Use this skill for loading TCGA data from GDC downloads, building normalised expression matrices, attaching clinical metadata, and running survival analyses through ov.bulk.pyTCGA.
Instructions
1. Gather required downloads
Confirm the user has three items from the GDC Data Portal:
gdc_sample_sheet.<date>.tsv— the sample sheet export- Decompressed
gdc_download_xxxxx/directory with expression archives clinical.cart.<date>/directory with clinical XML/JSON files
2. Initialise the TCGA helper
import omicverse as ov
import scanpy as sc
ov.plot_set()
aml_tcga = ov.bulk.pyTCGA(sample_sheet_path, download_dir, clinical_dir)
aml_tcga.adata_init() # Builds AnnData with raw counts, FPKM, and TPM layers
3. Persist and reload
aml_tcga.adata.write_h5ad('data/ov_tcga_raw.h5ad', compression='gzip')
# To reload later:
new_tcga = ov.bulk.pyTCGA(sample_sheet_path, download_dir, clinical_dir)
new_tcga.adata_read('data/ov_tcga_raw.h5ad')
4. Initialise metadata and survival
aml_tcga.adata_meta_init() # Gene ID → symbol mapping, patient info
aml_tcga.survial_init() # NOTE: "survial" spelling — see Critical API Reference below
5. Run survival analysis
# Single gene
aml_tcga.survival_analysis('MYC', layer='deseq_normalize', plot=True)
# All genes (can take minutes for large gene sets)
aml_tcga.survial_analysis_all() # NOTE: "survial" spelling
6. Export results
aml_tcga.adata.write_h5ad('data/ov_tcga_survival.h5ad', compression='gzip')
Critical API Reference
IMPORTANT: Method Name Spelling Inconsistency
The pyTCGA API has an intentional spelling inconsistency. Two methods use "survial" (missing the 'v') while one uses the correct "survival":
| Method | Spelling | Purpose |
|---|---|---|
survial_init() | survial (no 'v') | Initialize survival metadata columns |
survival_analysis(gene, layer, plot) | survival (correct) | Single-gene Kaplan-Meier curve |
survial_analysis_all() | survial (no 'v') | Sweep all genes for survival significance |
# CORRECT — use the exact method names as documented
aml_tcga.survial_init() # "survial" — no 'v'
aml_tcga.survival_analysis('MYC', layer='deseq_normalize', plot=True) # "survival" — correct
aml_tcga.survial_analysis_all() # "survial" — no 'v'
# WRONG — these will raise AttributeError
# aml_tcga.survival_init() # AttributeError! Use survial_init()
# aml_tcga.survival_analysis_all() # AttributeError! Use survial_analysis_all()
Survival Analysis Methodology
survival_analysis() performs Kaplan-Meier analysis:
- Splits patients into high/low expression groups using the median as cutoff
- Computes a log-rank test p-value to assess significance
- If
plot=True, renders survival curves with confidence intervals
Layer selection matters: Use layer='deseq_normalize' (recommended) because DESeq2 normalization accounts for library size and composition bias, making expression comparable across samples. Alternative: layer='tpm' for TPM-normalized values.
Defensive Validation Patterns
import os
# Before pyTCGA init: verify all paths exist
for name, path in [('sample_sheet', sample_sheet_path),
('downloads', download_dir),
('clinical', clinical_dir)]:
if not os.path.exists(path):
raise FileNotFoundError(f"TCGA {name} path not found: {path}")
# After adata_init(): verify expected layers were created
expected_layers = ['counts', 'fpkm', 'tpm']
for layer in expected_layers:
if layer not in aml_tcga.adata.layers:
print(f"WARNING: Missing layer '{layer}' — check if TCGA archives are fully extracted")
# Before survival analysis: verify metadata is initialized
if 'survial_init' not in dir(aml_tcga) or aml_tcga.adata.obs.shape[1] < 5:
print("WARNING: Run adata_meta_init() and survial_init() before survival analysis")
Troubleshooting
AttributeError: 'pyTCGA' object has no attribute 'survival_init': Use the misspelled namesurvial_init()(missing 'v'). Same forsurvial_analysis_all(). See Critical API Reference above.KeyErrorduringadata_meta_init(): Gene IDs in the expression matrix don't match expected format. TCGA uses ENSG IDs; the method maps them to symbols internally. Ensure archives are from the same GDC download.- Empty survival plot or NaN p-values: Clinical XML files are missing date fields (days_to_death, days_to_last_follow_up). Check that the
clinical.cart.*directory contains complete XML files, not just metadata JSONs. survial_analysis_all()runs very slowly: This tests every gene individually. For a genome with ~20,000 genes, expect 5-15 minutes. Consider filtering to genes of interest first.- Sample sheet column mismatch: Verify the TSV uses tab separators and the header row matches GDC's expected format. Re-download from GDC if column names differ.
- Missing
deseq_normalizelayer: This layer is created duringadata_meta_init(). If absent, re-run the metadata initialization step.
Examples
- "Read my TCGA OV download, initialise metadata, and plot MYC survival curves using DESeq-normalised counts."
- "Reload a saved AnnData file, attach survival annotations, and export the updated
.h5ad." - "Run survival analysis for all genes and store the enriched dataset."
References
- Tutorial notebook:
t_tcga.ipynb - Quick copy/paste commands:
reference.md
More by Starlitnightly
View all skills by Starlitnightly →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversRaindrop: AI DevOps to convert Claude Code into an infrastructure-as-code full-stack deployment platform, automating app
Boost productivity with Task Master: an AI-powered tool for project management and agile development workflows, integrat
Connect Blender to Claude AI for seamless 3D modeling. Use AI 3D model generator tools for faster, intuitive, interactiv
Send and receive WhatsApp messages directly from Claude and other AI assistants. Search conversations, manage contacts,
Use iOS Simulator for testing with tools like UI interaction and device info retrieval. Perfect as an iPhone emulator fo
Control any ROS1 or ROS2 robot with natural language using ROS MCP Server—AI-powered, code-free, real-time monitoring an
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.