bio-copy-number-cnv-visualization
БесплатноЗапускает вложенные скриптыНе проверенVisualize copy number profiles, segments, allele-specific tracks, and cohort patterns from CNVkit, GATK, ASCAT, FACETS, Sequenza, and other callers. Covers…
от gabrielmoreira★ 23 звезды на GitHubОб этом скилле
Version Compatibility
Reference examples tested with: matplotlib 3.8+, pandas 2.2+, numpy 1.26+, seaborn 0.13+, CNVkit 0.9.10+, GATK 4.5+; R 4.3+ with ggplot2 3.5+.
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show matplotlib pandasthenhelp(function)for signatures - R:
packageVersion('ggplot2')then?function_name - CLI:
cnvkit.py version,gatk --version
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example rather than retrying.
CNV Visualization
"Plot my copy number profile" -> A CNV figure is an argument, not a picture. The plot type, the y-axis quantity, and where the diploid baseline sits all determine what the reader can conclude. The single most important rule: a depth-only log2 plot cannot show loss of heterozygosity, cannot show tumor purity, and silently misleads if the diploid baseline is centered on a non-diploid mode.
- CLI:
cnvkit.py scatter/diagram/heatmap;gatk PlotModeledSegments - Python:
matplotlibfor custom genome-wide and allele-specific tracks - R:
ggplot2,karyoploteRfor publication ideograms
Plot Selection — What Each View Reveals and Hides
| Plot | Answers | Reveals | Cannot show |
|---|---|---|---|
| Genome-wide log2 scatter + segments | Where are the gains/losses? | Focal vs broad events, noise level | LOH, purity, allele-specific state |
| Per-chromosome scatter | Is this focal event real and where are its boundaries? | Breakpoints, bin support, weight | Absolute CN without purity |
| BAF / minor-allele-fraction track | Is there allelic imbalance / LOH? | CN-neutral LOH, mirrored imbalance | Total copy number alone |
| Combined log2 + BAF (two-panel) | What is the allele-specific state? | Gains vs CN-LOH vs balanced | — (this is the complete view) |
| Cohort heatmap | What is recurrent across samples? | Shared arm/focal events | Per-sample breakpoint detail |
| Ideogram / diagram | Where do events sit relative to cytobands/genes? | Gene-level context | Quantitative amplitude |
| Circos | Genome-wide CNV + SV breakpoints together | CNV-SV co-localization | Fine amplitude detail |
| Caller-native (GATK/ASCAT/FACETS) | Did the caller fit correctly? | Model fit, segment confidence | — (diagnostic, not publication) |
The decision rule: if the biological question involves LOH, allele-specific gain, or whole-genome doubling, a log2-only plot is insufficient — pair it with a BAF track.
CNVkit Built-in Plots
cnvkit.py scatter sample.cnr -s sample.cns -o scatter.png # genome-wide
cnvkit.py scatter sample.cnr -s sample.cns -c chr17 -o chr17.png # one chromosome
cnvkit.py scatter sample.cnr -s sample.cns -v sample.vcf.gz -o baf.png # with BAF panel
cnvkit.py diagram sample.cnr -s sample.cns -o diagram.pdf # ideogram
cnvkit.py heatmap cohort/*.cns -d -o cohort_heatmap.pdf # cohort, desaturated
Passing -v with a VCF adds a B-allele-frequency panel — use it whenever LOH matters.
Genome-Wide log2 Profile with Segments
Goal: Render a publication genome-wide CNV profile with colored segments.
Approach: Map per-bin log2 to cumulative genomic coordinates, plot bins as faint points, overlay segment medians as colored horizontal lines, mark chromosome boundaries.
import pandas as pd
import matplotlib.pyplot as plt
def plot_genome_profile(cnr_file, cns_file, output=None, gain=0.3, loss=-0.3):
'''Genome-wide log2 scatter with segment overlay.'''
cnr = pd.read_csv(cnr_file, sep='\t')
cns = pd.read_csv(cns_file, sep='\t')
chroms = [f'chr{i}' for i in range(1, 23)] + ['chrX', 'chrY']
offsets, cum = {}, 0
for c in chroms:
sub = cnr[cnr['chromosome'] == c]
if sub.empty:
continue
offsets[c] = cum
cum += sub['end'].max()
cnr = cnr[cnr['chromosome'].isin(offsets)].copy()
cnr['x'] = cnr.apply(lambda r: offsets[r['chromosome']] + r['start'], axis=1)
fig, ax = plt.subplots(figsize=(16, 4))
ax.scatter(cnr['x'], cnr['log2'], s=1, c='0.7', alpha=0.5, rasterized=True)
for _, seg in cns.iterrows():
if seg['chromosome'] not in offsets:
continue
x0 = offsets[seg['chromosome']] + seg['start']
x1 = offsets[seg['chromosome']] + seg['end']
color = 'red' if seg['log2'] > gain else 'blue' if seg['log2'] < loss else '0.3'
ax.hlines(seg['log2'], x0, x1, colors=color, linewidth=2.5)
for c, x in offsets.items():
ax.axvline(x, color='0.9', linewidth=0.5)
ax.axhline(0, color='black', linewidth=0.6)
ax.set_ylim(-2, 2)
ax.set_ylabel('log2 copy ratio')
ax.set_xlabel('genomic position')
fig.tight_layout()
if output:
fig.savefig(output, dpi=200)
return fig, ax
Combined log2 + B-Allele-Frequency Panel
Goal: Show total copy number and allelic imbalance together so CN-
Установить bio-copy-number-cnv-visualization в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл bio-copy-number-cnv-visualization?
Visualize copy number profiles, segments, allele-specific tracks, and cohort patterns from CNVkit, GATK, ASCAT, FACETS, Sequenza, and other callers. Covers genome-wide and per-chromosome log2 scatter plots, B-allele-frequency/minor-allele-fraction tracks, ideograms, cohort heatmaps, circos views, and caller-native plots. Use when creating publication CNV figures, choosing which plot answers a given question, diagnosing a wrong diploid baseline visually, displaying loss of heterozygosity, or deciding what depth-only plots cannot reveal.
Как установить скилл bio-copy-number-cnv-visualization?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bio-copy-number-cnv-visualization запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic