美文网首页数据分析R 数据可视化
deconstructSigs|探寻cosmic的独特“气质”-

deconstructSigs|探寻cosmic的独特“气质”-

作者: 生信补给站 | 来源:发表于2019-12-20 11:59 被阅读0次

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

还有其他 R统计 绘图 生信的干货,也许有需要的呢?

Mutational Signatures 首次出现在2013年的nature文章Signatures of mutational processes in human cancer中(https://www.nature.com/articles/nature12477)。**将mutation位置加上前后一个碱基,构成三碱基模式,然后统计96(6 * 4 * 4)种突变组合的情况。

好奇为什么是96种的,可以查一下文献。

本文介绍如何利用deconstructSigs-R包进行mutation signature分析。

一 准备R包,数据

#install.packages("deconstructSigs") 
library(deconstructSigs)
#读入数据
head(sample.mut.ref)
 Sample  chr      pos ref alt
1      1 chr1   905907   A   T
2      1 chr1  1192480   C   A
3      1 chr1  1854885   G   C
4      1 chr1  9713992   G   A
5      1 chr1 12908093   C   A
6      1 chr1 17257855   C   T

class(sample.mut.ref)
## [1] "data.frame"

只需要将自己的数据整理成以上五列(ID,chr,pos,ref,alt )信息即可,如果是TCGA中的MAF文件也是很好提取的。

二 mut.to.sigs.input构建输入文件

使用 mut.to.sigs.input 函数,构建计算signature的输入文件,得到每个样本的96种三碱基类型。

# 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")

注:这一步也许会提示没有XX包,按照要求下载指定R包即可(也许是数据库,耐心安装)。

#查看结果信息
dim(sigs.input)
#[1]  2 96  
head(t(sigs.input)) #只有两个sample:“1”和“2”
         1 2
A[C>A]A  9 1
A[C>A]C  7 1
A[C>A]G  5 0
A[C>A]T  7 0
C[C>A]A 10 3
C[C>A]C 18 2

以上就得到了sample.mut.ref文件中的每一个sample的96种三碱基类型的结果了。

三 推断signature的组成

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

其中:

tumor.ref:每个sample的96种三碱基突变序列
signatures.ref:已知的signatures参考文件,可选signatures.nature2013和signatures.cosmic
sample.id:对应tumor.ref文件中的样本名
contexts.needed :是否需要突变上下文
tri.counts.method:三核酸序列标准化方式,默认“default” 不进行标准化 ;或者选择exome,genome,exome2genome,genome2exome 来限定区域。

3.2 查看返回结果

#查看结果
class(sample_1)
#查看权重结果
sample_1$weights

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

#三碱基序列百分比 * 权重
sample_1$product
img img

whichSignatures会输出5个元素的list文件:

  • weights -- data frame containing the weights assigned to each of the k signatures of the input signatures matrix

  • tumor -- matrix of the trinucleotide contexts for the tumor sample used as input

  • product -- matrix obtained when the tumor matrix is **multiplied by the assigned weights **

  • diff -- matrix representing the difference between the tumor matrix and product matrix

  • unknown -- numeric weight not assigned to any of the input signatures

3.3 指定signature权重

通过associated参数指定参与计算的signature

sample_1.associate = whichSignatures(tumor.ref = sigs.input, 
                           signatures.ref = signatures.cosmic, 
                           sample.id = 1, 
                           associated = c("Signature.1","Signature.22"),
                           contexts.needed = TRUE,
                           tri.counts.method = 'default')
sample_1.associate$weights
img

3.4 设定signature的阈值

通过signature.cutoff设定阈值,小于此值的为0

sample_1.cutoff = whichSignatures(tumor.ref = sigs.input, 
                           signatures.ref = signatures.cosmic, 
                           sample.id = 1, 
                           contexts.needed = TRUE,
                           signature.cutoff = 0.08 ,
                           tri.counts.method = 'default')

sample_1.cutoff$weights
img

plotSignatures 可视化

# Plot example
plot_example <- whichSignatures(tumor.ref = sigs.input,
                      signatures.ref = signatures.cosmic,
                      sample.id = 1)

# Plot output
plotSignatures(plot_example, sub = 'example')
img

查看sample1的signature的组成情况,就是上面plot_exampleweight , plot_exampletumor , plot_example$product 的结果可视化。

参考资料:

https://github.com/raerose01/deconstructSigs

◆ ◆ ◆ ◆ ◆

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

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

img

相关文章

  • deconstructSigs|探寻cosmic的独特“气质”-

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

  • 探寻孩子的独特世界

    我们很多父母、教师很缺乏这样的训练:通过观察孩子的行为深入探究背后的想法、感受和需求。 就像这幅冰山图,水面以上的...

  • 女孩子的香味

    Cosmic mansion韩小众香氛品牌 衣物香薰喷雾:cosmic mansion linen&musk Co...

  • 气质——女人独特的味道

    ——《跟巴黎名媛学气质》观感 美丽的皮囊易逝,但气质会随岁月沉淀,在或快乐或悲伤的日子里,气质就是一种...

  • 享受孩子独特的气质

    最近在看樊登老师的《走进孩子的心》,里面谈到要尊重孩子,尊重孩子的发展。其中有篇介绍兰妮博士的《内向孩...

  • 寻找你独特的气质

    「自己」 每个人都有那个独特的闪光点,闪闪发光的气质。也许是自己都不知道的,但你的人站在那儿,就是你。 不同的...

  • [数据库] 肿瘤分析相关数据库

    肿瘤研究相关数据库: 最经典的Cosmic数据库COSMIC 全称:Catalogue of somatic mu...

  • 气质独特(冷笑话)

    #冷笑话#林业大学的科研经费分配严重不均,搞动物的教授拿到大量的经费,植物老师拿到很少,自觉委屈,于是找到领导,领...

  • test_xia9:匹配vcf多列信息,进行注释

    1、文件1:样本突变文件out.csv 2、cosmic注释文件: hg19_cosmic89_somatic...

  • 卫生间的独特气质

    在居室装修过程中,许多人愿意成为时尚家居的弄潮儿。作为占装修款较大分量的卫浴间,越来越受到时尚追逐者的倾力打造。人...

网友评论

    本文标题:deconstructSigs|探寻cosmic的独特“气质”-

    本文链接:https://www.haomeiwen.com/subject/nrnbnctx.html