首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

barplot3d|圣诞节送你一个mutation signature搭建的“乐高”

上次通过deconstructSigs|探寻cosmic的独特“气质”-mutation signature !学会了如何利用deconstructSigs-R包进行mutation signature分析。

在文章最后利用每个样本的96种三碱基类型在最后绘制了柱形图,本文利用同样的数据绘制乐高图,下图为文献插图

一 mutation signature分析

快速实现mutation signature分析,得到每个样本的三碱基序列结果,详细参数详见deconstructSigs|探寻cosmic的独特“气质”-mutation signature !

代码语言:javascript
复制
library(deconstructSigs)
#查看数据
head(sample.mut.ref)
# Convert to deconstructSigs input
sigs.input <- mut.to.sigs.input(mut.ref = sample.mut.ref,
                               sample.id = "Sample",
                               chr = "chr",
                               pos = "pos",
                               ref = "ref",
                               alt = "alt")

# Determine the signatures contributing to the example sample1
sample_1 = whichSignatures(tumor.ref = sigs.input,
                          signatures.ref = signatures.cosmic,
                          sample.id = 1,
                          contexts.needed = TRUE,
                          tri.counts.method = 'default')

#输出tumor的三碱基序列百分比
sample_1$tumor

二 搭“乐高”

利用上部分得到的三碱基序列比例进行绘制:

需要注意的自己的数据与COSMIC数据的顺序要相同 !

代码语言:javascript
复制
library(barplot3d)
# Read in COSMIC signature probabilities
x=system.file("extdata", "signature_probabilities.txt", package = "barplot3d")
sigdata=read.table(x,header=TRUE,stringsAsFactors = FALSE)
# 输入文件的顺序必须与此一致
cat(sigdata$Somatic_mutation_type,sep="\n")

#使用自己的数据绘制乐高图
legoplot3d(contextdata=sample_1$tumor,labels=FALSE,scalexy=0.03)
代码语言:javascript
复制
#参数调整
legoplot3d(contextdata=sample_1$tumor,labels=FALSE,scalexy=0.01,sixcolors="broad",alpha=0.4)

scalexy:适当调整获得适当缩放的图像;

alpha:柱子的透明度;

sixcolors:默认颜色与Sanger的signature一致,可以设置为原始的Broad Institute颜色,也可以其他6种颜色。

对了,图是3D的,可以自己转,,,

参考资料:

A mutational signature associated with alcohol consumption and prognostically significantly mutated driver genes in esophageal squamous cell carcinoma

https://cran.r-project.org/web/packages/barplot3d/vignettes/barplot3d.html

下一篇
举报
领券