deconstructSigs-mutation signature看一下你的数据是什么“气质”的?

本文首发于“生信补给站” 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

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

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

四 plotSignatures 可视化

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

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

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

参考资料:

https://github.com/raerose01/deconstructSigs

◆ ◆ ◆ ◆ ◆

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

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

deconstructSigs|探寻cosmic的独特“气质”-mutation signature !的更多相关文章

  1. 侣行APP

    本次要做的是团队共同完成一个项目.由队长组织,全体队员一起讨论分析并完成一款APP的需求调研,分析等工作. 1.团队介绍 队长:杨晓帅 队员                               ...

  2. 第5件事 做一个有taste的产品人

    1.taste的意思是品位,也就是说产品经理应该是一个有品位的产品人.什么叫品位呢?品位指的是对事物有分辨与鉴赏的能力.品位是形象的展示,品位是内在气质的复出,品位是人生价值的体验,品位是道德修养的内 ...

  3. Microbit蓝芽配对

    Microbit蓝芽配对 (Bluetooth Pairing) Microbit 可以像手机或平板与其他蓝芽装置一样,一旦做完第一次配对完就可以使用”蓝芽服务” paired with the mi ...

  4. CDN混战何去何从,史上最全分析

        近日,CDN市场风起云涌,十几年平稳的市场格局瞬时战火纷飞.一路从传统CDN即蓝汛.网宿为主的 "双雄争霸".演变为多家云CDN厂商阿里云.腾讯云.百度云等的降价大战.更有 ...

  5. 像艺术家一样思考 Think Like an Artist

    艺术家是如何获得灵感,如何找到自己的独特风格和主题的? 艺术家在绘画.写作.表演或歌唱前不会去征求谁的允许,而是随心而行 要想在数字时代获得满足感,我们需要变得有创造性 1.艺术家富有事业心 艺术家是 ...

  6. JavaScript 实现:输出斐波那契数列

    问渠那得清如许,为有源头活水来. 想要保持自己的技术活力,最有效的手段就是通过不断地输入来提供足够的养分.我们也不必刻意追求高深的或者新鲜的知识点,通过对一个基础问题的全方位多维度解析,同样也会收获不 ...

  7. Detailed Information for Outputted Files from Somatic Mutation Annotators(annovar 注释文件条目详细解释)

    CONTENTS *_annoTable.txt (ANNOVAR) *_annoTable.txt (SnpEff) *_genelist.txt (ANNOVAR & SnpEff) db ...

  8. somatic mutation体细胞变异检测文献分享--转载

    转载 :http://blog.sina.com.cn/s/blog_83f77c940102xuro.html Kalatskaya I, Trinh Q M, Spears M, et al. I ...

  9. 探寻 JavaScript 逻辑运算符(与、或)的真谛

    十二月已经过半,冬季是一个美妙的季节,寒冷的空气逼得人们不得不躲在安逸舒适的环境里生活.冬季会给人一种安静祥和的氛围,让人沉浸在其中,仿佛是一个旧的阶段的结束,同时也是一个新的阶段的开始.这么说来,西 ...

随机推荐

  1. Linux 命令记录

    记录Linux下使用过的命令: Linux端 1.测试当前系统支持语言(我这用的是xshell,如果出现乱码,则在file-properties-terminal-encoding中,设置为utf-8 ...

  2. 新闻实时分析系统-HBase分布式集群部署与设计

    HBase是一个高可靠.高性能.面向列.可伸缩的分布式存储系统,利用Hbase技术可在廉价PC Server上搭建 大规模结构化存储集群. HBase 是Google Bigtable 的开源实现,与 ...

  3. 【2018寒假集训Day 8】【并查集】并查集模板

    Luogu并查集模板题 #include<cstdio> using namespace std; int z,x,y,n,m,father[10001]; int getfather(i ...

  4. JAVA合并多个word文档根据文章标题生成目录

    此产品版本是免费版的,我也是在用免费,除了只能单次识别25张一下的word和生成pdf有限制,其他的功能都和正式版差不多. 如果你几十个文档,每个文档几页,输出出来超过25页,那没关系,依然可以使用. ...

  5. CCNA 之 十三 广域网概述

    广域网概述 为什么需要WAN ? 分区或分支机构的员工需要与总部通信并共享数据: 组织经常需要与其他组织远距离共享信息: 经常出差的员工需要访问公司网络信息: 什么事广域网链路? 用于连接LAN的.跨 ...

  6. 行内元素(inline标签)设置了行高为什么不生效,还是表现为父盒子的行高?行内元素行高问题终极解释

    最近在看张鑫旭大佬的<css世界>,读到5.2.4  内联元素 line-height 的“大值特性” ,产生了疑惑, 在开发中确实也遇到了同样的问题,深入探究后得出结果,先说结论吧,论证 ...

  7. js消除小游戏(极简版)

    js小游戏极简版 (1) 基础布局 <div class = "box"> <p></p> <div class="div&qu ...

  8. PHP和JavaScript中奖概率算法

    这是一个经典的概率算法. 现在有数组:[10, 20, 30, 40] . 假设对应中奖几率:特等奖10%,一等奖20%,二等奖30%,三等奖40%,总共100%. 算法开始时,从数组中选出一个值$v ...

  9. Netty学习——通过websocket编程实现基于长连接的双攻的通信

    Netty学习(一)基于长连接的双攻的通信,通过websocket编程实现 效果图,客户端和服务器端建立起长连接,客户端发送请求,服务器端响应 但是目前缺少心跳,如果两个建立起来的连接,一个断网之后, ...

  10. Qt之高DPI显示器(一) - 解决方案整理

    目录 DPI发展 1.PPI 2.DPI 一.Win自适应系统 二.Qt机制 1.Windows系统DWM缩放 2. Qt适配高DPI 3.适配DPI结论 三.Qt适配 四.自己适配 1.窗口大小 2 ...