CNV拷贝数变异分析(GISTIC、maftools)

CNV拷贝数变异分析是什么?贴一段TCGA官网的介绍

"The copy number variation (CNV) pipeline uses Affymetrix SNP 6.0 array data to identify genomic regions that are repeated and infer the copy number of these repeats. This pipeline is built onto the existing TCGA level 2 data generated by Birdsuite and uses the DNAcopy R-package to perform a circular binary segmentation (CBS) analysis. CBS translates noisy intensity measurements into chromosomal regions of equal copy number. The final output files are segmented into genomic regions with the estimated copy number for each region. The GDC further transforms these copy number values into segment mean values, which are equal to log2(copy-number/ 2). Diploid regions will have a segment mean of zero, amplified regions will have positive values, and deletions will have negative values."

0. 目录

  • 一. segment file数据下载和处理

  • 1.1 从TCGA下载数据

  • 1.2 数据处理

  • 二. marker file数据下载和处理

  • 2.1 从TCGA下载数据

  • 2.2 提取freqcnv=FALSE数据,并且整理成标准格式

  • 三. GenePattern GISTIC_2.0在线分析

  • 四. maftools可视化GISTIC结果

1. segment file数据下载和处理

1.1 从TCGA下载数据

下载文件类型:
Copy Number Segment:A table that associates contiguous chromosomal segments with genomic coordinates, mean array intensity, and the number of probes that bind to each segment.

Masked Copy Number Segment:A table with the same information as the Copy Number Segment except that segments with probes known to contain germline mutations are removed

这里我用Masked Copy Number Segment做示范

rm(list = ls())
options(stringsAsFactors = F)
options(scipen = 200)

library(SummarizedExperiment)
library(TCGAbiolinks)

query <- GDCquery(project = "TCGA-BLCA",
                  data.category = "Copy Number Variation",
                  data.type = "Masked Copy Number Segment")
GDCdownload(query,method = "api")
BLCA_CNV_download <- GDCprepare(query = query, save = TRUE, save.filename = "BLCA_CNV_download.rda")

1.2数据处理

#读取rda文件
A=load("C:/Users/Meredith/Desktop/BLCA_CNV_download.rda")
tumorCNV <- eval(parse(text = A))

#改名
tumorCNV=tumorCNV[,2:7]
tumorCNV=tumorCNV[,c('Sample','Chromosome','Start','End','Num_Probes','Segment_Mean')]
write.table(tumorCNV,file = 'BLCA_CNV.txt',sep = '\t',quote = F,row.names = F)
BLCA_CNV.txt
#提取01A结尾的样本(这里我用了python,小伙伴们可以用R来做)
filename = 'BLCA_CNV.txt'
finalResultName = 'segment_file.txt'

read_file = open(filename)
out_file = open(finalResultName,"r+")
for line in read_file.readlines():
    data = line.split()
    x = data[0][13:16]
    if x == '01A':
        out_file.write(data[0])
        out_file.write('\t')
        out_file.write(data[1])
        out_file.write('\t')
        out_file.write(data[2])
        out_file.write('\t')
        out_file.write(data[3])
        out_file.write('\t')
        out_file.write(data[4])
        out_file.write('\t')
        out_file.write(data[5])
        out_file.write('\t')
        out_file.write('\n')
segment_file

2.marker file数据下载和处理

2.1从TCGA下载数据

TCGA现在的参考基因组版本是hg38,需要从官网下载marker file。下载地址:GDC Reference File Website,选择最新版本的“SNP6 GRCh38 Remapped Probeset File for Copy Number Variation Analysis”文件,并注意“If you are using Masked Copy Number Segment for GISTIC analysis, please only keep probesets with freqcnv =FALSE

官网下载marker file

2.2提取freqcnv=FALSE数据,并且整理成标准格式

#这里我也是用的python(因为我电脑太菜用R要跑很久)
filename = "snp6.na35.remap.hg38.subset.txt"
finalResultName = "marker_file.txt"

read_file = open(filename)
out_file = open(finalResultName,"r+")
for line in read_file.readlines():
    data = line.split()
    if data[5]=='FALSE':
        out_file.write(data[0])
        out_file.write('\t')
        out_file.write(data[1])
        out_file.write('\t')
        out_file.write(data[2])
        out_file.write('\t')
        out_file.write('\n')
marker_file

3.GenePattern GISTIC_2.0在线分析

GenePattern

GISTIC_2.0

refgene file小伙伴们根据需要选择,这里我用的是TCGA下载的数据,所以选择hg38。将segment_file跟marker_file分别拖到seg file跟markers file区域。置信区间系统默认0.9,可以根据需要调整。点击RUN。
要等半个小时左右。
GISTIC_2.0输出结果

我们来看下其中两个文件


amp_qplot
del_qplot

4.maftools可视化GISTIC结果

rm(list = ls())
options(stringsAsFactors = F)

BiocManager::install("PoisonAlien/maftools") #建议下载github最新版本的maftools包
library(maftools)

#读入GISTIC文件
laml.gistic = readGistic(gisticAllLesionsFile = 'C:/Users/Meredith/Desktop/maftools/all_lesions.conf_99.txt',
                         gisticAmpGenesFile = 'C:/Users/Meredith/Desktop/maftools/amp_genes.conf_99.txt', 
                         gisticDelGenesFile = 'C:/Users/Meredith/Desktop/maftools/del_genes.conf_99.txt', 
                         gisticScoresFile = 'C:/Users/Meredith/Desktop/maftools/scores.gistic', 
                         isTCGA = T)

readGistic里isTCGA=T作者给出的解释:please note that setting isTCGA=TRUE truncates sample names to first twelve characters - meaning primary samples and their metastatic counterparts (or from other sources) will all be collapsed into one single sample type. 所以在准备GISTIC输入文件时要将正常样品跟肿瘤样品分开。

##绘图
#genome plot
gisticChromPlot(gistic = laml.gistic, ref.build = 'hg38')
A

A. G-scores assigned by GISTIC for every cytoband plotted along the chromosome.

#Bubble plot
gisticBubblePlot(gistic = laml.gistic)
B

B. GISTIC results plotted as function of altered cytobands, mutated samples, and genes involved within the cytoband. Size of each bubble is according to -log10 transformed q values.

#oncoplot
gisticOncoPlot(gistic = laml.gistic, 
               sortByAnnotation = TRUE, top = 10)
C

C. Oncoplot displays most frequently altered (amplifications or deletions) copy number events ordered according to the frequency. Each columns represents a sample and each row represent a CNV segment.

#Visualizing CBS segments
plotCBSsegments(cbsFile = 'C:/Users/Meredith/Desktop/maftools/segment.file.txt', #这里的segment file的sample name只保留前12位
                tsb = 'ALL', #如果想指定某个样本,就输样本的名字,比如:tsb = 'TCGA-C4-A0F7'
                ref.build = 'hg38')
D

D. Plots segmented copy number data.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
禁止转载,如需转载请通过简信或评论联系作者。
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 160,108评论 4 364
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,699评论 1 296
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,812评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,236评论 0 213
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,583评论 3 288
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,739评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,957评论 2 315
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,704评论 0 204
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,447评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,643评论 2 249
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,133评论 1 261
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,486评论 3 256
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,151评论 3 238
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,108评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,889评论 0 197
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,782评论 2 277
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,681评论 2 272