新的一年开始了,今天给大家介绍一款用于发现、预测和探索突变特征的综合分析工具包musicatk。此包主要基于COSMIC突变数据中的最新数据进行肿瘤突变模式的探索。我们首先看下包的安装:
代码语言:javascript复制BiocManager::install("musicatk")
1. 数据源的导入
代码语言:javascript复制##TCGA数据库的MAF文件
lusc_maf <- system.file("extdata", "public_TCGA.LUSC.maf", package = "musicatk")
lusc.variants <- extract_variants_from_maf_file(maf_file = lusc_maf)
代码语言:javascript复制##VCF文件读入
luad_vcf <- system.file("extdata", "public_LUAD_TCGA-97-7938.vcf", package = "musicatk")
luad.variants <- extract_variants_from_vcf_file(vcf_file = luad_vcf)
代码语言:javascript复制##多个文件数据的导入
melanoma_vcfs <- list.files(system.file("extdata", package = "musicatk"), pattern = glob2rx("*SKCM*vcf"), full.names = TRUE)
variants <- extract_variants(c(lusc_maf, luad_vcf, melanoma_vcfs))
2. 参考基因组的选择
代码语言:javascript复制g <- select_genome("hg38")
3. 项目操作
代码语言:javascript复制##创建项目。check_ref_bases参数默认进行参考突变筛选;check_ref_chromosomes进行染色体筛选。
musica <- create_musica(x = variants, genome = g)
代码语言:javascript复制##载入突变基序数据。突变基序包括单碱基替换(SBS)、双碱基替换(DBS)、插入(INS)和删除(DEL)。
build_standard_table(musica, g = g, table_name = "SBS96")
代码语言:javascript复制##通过数据库批量载入突变基序数据。
build_standard_table(dbs_musica, g, "SBS96", overwrite = TRUE)
代码语言:javascript复制##对SBS突变进行转录本的注释
annotate_transcript_strand(musica, "38", build_table = FALSE)
代码语言:javascript复制##检测突变signature。在这里有两个方法进行获取:隐含狄利克雷分布(lda)和加速版本非负矩阵分解(nmf)
result <- discover_signatures(musica = musica, table_name = "SBS96", num_signatures = 3, algorithm = "nmf", nstart = 10)
代码语言:javascript复制##基于COSMIC进行signature和exposure的预测
# Load COSMIC V2 data
data("cosmic_v2_sigs")
# Predict pre-existing exposures using the "lda" method
pred_cosmic <- predict_exposure(musica = musica, table_name = "SBS96",
signature_res = cosmic_v2_sigs,
signatures_to_use = c(1, 4, 7, 13),
algorithm = "lda")
4. 可视化结果
代码语言:javascript复制##可视化signature
plot_signatures(result)
代码语言:javascript复制##绘制单个样本的signature
samples <- sample_names(musica)
plot_sample_counts(musica, sample_names = samples[c(3,4,5)], table_name = "SBS96")
代码语言:javascript复制##对比下COSMIC数据库中的signature
compare_cosmic_v2(result, threshold = 0.75)
代码语言:javascript复制##查看样本exposure
plot_exposures(result, plot_type = "bar")
代码语言:javascript复制##比例型绘制bar图
plot_exposures(result, plot_type = "bar", proportional = TRUE)
代码语言:javascript复制##添加样本注释
annot <- read.table(system.file("extdata", "sample_annotations.txt",
package = "musicatk"), sep = "t", header=TRUE)
samp_annot(result, "Tumor_Subtypes") <- annot$Tumor_Subtypes
plot_exposures(result, plot_type = "bar", group_by = "annotation",
annotation = "Tumor_Subtypes")
代码语言:javascript复制##绘制箱线图
plot_exposures(result, plot_type = "box", group_by = "annotation", annotation = "Tumor_Subtypes")
代码语言:javascript复制##基于signature分组的箱线图绘制
plot_exposures(result, plot_type = "box", group_by = "signature",
color_by = "annotation", annotation = "Tumor_Subtypes")
当然此包还支持plotly的交互可视化,如果对shiny感兴趣可以进行引入研究。在这里就不进行展开了。欢迎大家学习交流!