Open qingjian1991 opened 2 years ago
我对plotCNA的代码进行了修改,增加了3个函数参数。
对应的修改后的脚本在这个文件中。 plotCNA.txt
Type.name:指定用于绘图的列 Type.colors:指定对应的颜色 rect.patients.size:按照病人加一个长方形的框区分病人
我们在绘制CNV时,可能想自己定义CNV的类型和对应的颜色表示
# read data segFile <- system.file("extdata", "CRC_HZ.seg.txt", package = "MesKit") seg <- readSegment(segFile = segFile) # define the new columns # 0-6 copy numbers, add cnLOH, LOH >=2 copys Copy_cutoff = function(seg){ seg %>% mutate(CopyNumber1 = ifelse(CopyNumber >5, 6, CopyNumber) ) %>% mutate(CopyNumber1 = ifelse(CopyNumber == 2 & Minor_CN == 0, "cnLOH", CopyNumber1)) } seg1 = lapply(seg, Copy_cutoff)
用原始的程序绘图
#original plot plotCNA(seg1, showRownames = FALSE)
重新定于拷贝数的情况及其颜色
plotCNA(seg1, Type.name = "CopyNumber1", Type.colors = setNames( c("#7D8BCD", "#B1B9E7", "#F6F7F7", "#E4A8B5", "#CB7185","#B03D5E","#99143C", "#91BAA7"), nm = c(seq(0,6), "cnLOH") ), showRownames = FALSE, rect.patients.size = 0 )
绘制minor-copy的情况
#Plot Minor_CNVs plotCNA(seg1, Type.name = "Minor_CN", Type.colors = setNames( c("#7D8BCD", "#F6F7F7", "#E4A8B5", "#CB7185","#B03D5E"), nm = 0:4 ), showRownames = FALSE, rect.patients.size = 0 )
绘制minor-copy的情况并对每一个病人加一个长方形的框表示病人
#Plot Minor_CNVs and add a rectangle to indicate the patients plotCNA(seg1, Type.name = "Minor_CN", Type.colors = setNames( c("#7D8BCD", "#F6F7F7", "#E4A8B5", "#CB7185","#B03D5E"), nm = 0:4 ), showRownames = FALSE, rect.patients.size = 0.3 )
@Niinleslie update the code accordingly, Many thanks for your improvement to our code @qingjian1991
我对plotCNA的代码进行了修改,增加了3个函数参数。
对应的修改后的脚本在这个文件中。 plotCNA.txt
Type.name:指定用于绘图的列 Type.colors:指定对应的颜色 rect.patients.size:按照病人加一个长方形的框区分病人
我们在绘制CNV时,可能想自己定义CNV的类型和对应的颜色表示
用原始的程序绘图
重新定于拷贝数的情况及其颜色
绘制minor-copy的情况
绘制minor-copy的情况并对每一个病人加一个长方形的框表示病人