首页 > 其他 > 详细

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

时间:2019-12-26 17:52:51      阅读:90      评论:0      收藏:0      [点我收藏+]

本文首发于“生信补给站”,https://mp.weixin.qq.com/s/VNLIFzc9OysepGrE3lJrkw

更多关于R语言,ggplot2绘图,生信分析的内容,敬请关注小号。

 

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

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

技术分享图片

 

 

 

一 mutation signature分析

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

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数据的顺序要相同 !

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)
?

技术分享图片

#参数调整
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

 

◆ ◆ ◆ ◆ ◆

精心整理(含图版)|你要的全拿走!有备无患 (R统计,ggplot2绘图,生信图形可视化汇总)

【觉得不错,右下角点个“在看”,期待您的转发,谢谢!】

 

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

原文:https://www.cnblogs.com/Mao1518202/p/12102387.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!