引言
如果直接是基于 bam 文件分析的,除了差异分析或者 boxplot 之类的图形展示基因的表达情况,还可以在基因组上进行展示,加入了基因不同 exon 的表达情况。这不需要将 bam 转 bigwig 文件,可以直接从 bam 文件读取,更加快速和简便。快速生成发表级图形。
安装
Install from GitHub
if (!requireNamespace(“devtools”, quietly = TRUE)) {
install.packages(“devtools”)
}
devtools::install_github(“junjunlab/omicScope”)
Or using pak (recommended)
if (!requireNamespace(“pak”, quietly = TRUE)) {
install.packages(“pak”)
}
pak::pak(“junjunlab/omicScope”)
示例
指定好 bam 文件和需要展示的基因名称,导入对应物种的注释文件:
library(omicScope)
library(ggplot2)
gtf <- rtracklayer::import(“../test-bam/Mus_musculus.GRCm38.102.gtf.gz”)
test
coverage_plot(bam_file <- c(“../test-bam/0a.sorted.bam”,
“../test-bam/0b.sorted.bam”,
“../test-bam/10a.sorted.bam”,
“../test-bam/10b.sorted.bam”),
sample_name <- c(“day0-rep1″,”day0-rep2″,”day10-rep1″,”day10-rep2”),
gtf_file = gtf,
target_gene = c(“Nanog”,”Actb”))
去除纵坐标范围,添加区间范围展示:
coverage_plot(bam_file <- c(“../test-bam/0a.sorted.bam”,
“../test-bam/0b.sorted.bam”,
“../test-bam/10a.sorted.bam”,
“../test-bam/10b.sorted.bam”),
sample_name <- c(“day0-rep1″,”day0-rep2″,”day10-rep1″,”day10-rep2”),
gtf_file = gtf,
target_gene = c(“Nanog”,”Actb”),
add_range_label = TRUE,
remove_labelY = TRUE)
修改基因和样本的顺序:
coverage_plot(bam_file <- c(“../test-bam/0a.sorted.bam”,
“../test-bam/0b.sorted.bam”,
“../test-bam/10a.sorted.bam”,
“../test-bam/10b.sorted.bam”),
sample_name <- c(“day0-rep1″,”day0-rep2″,”day10-rep1″,”day10-rep2”),
gtf_file = gtf,
target_gene = c(“Nanog”,”Actb”),
sample_order = c(“day0-rep1″,”day10-rep1″,”day0-rep2″,”day10-rep2”),
gene_order = c(“Actb”,”Nanog”))
合并生物学重复样本,这对于大量生物学重复样本展示时非常有用:
coverage_plot(bam_file <- c(“../test-bam/0a.sorted.bam”,
“../test-bam/0b.sorted.bam”,
“../test-bam/10a.sorted.bam”,
“../test-bam/10b.sorted.bam”),
sample_name <- c(“day0-rep1″,”day0-rep2″,”day10-rep1″,”day10-rep2”),
group_name = c(“Day-0″,”Day-0″,”Day-10″,”Day-10”),
gtf_file = gtf,
target_gene = c(“Nanog”,”Actb”),
merge_group = TRUE)
折叠转录本简化展示:
coverage_plot(bam_file <- c(“../test-bam/0a.sorted.bam”,
“../test-bam/0b.sorted.bam”,
“../test-bam/10a.sorted.bam”,
“../test-bam/10b.sorted.bam”),
sample_name <- c(“day0-rep1″,”day0-rep2″,”day10-rep1″,”day10-rep2”),
group_name = c(“Day-0″,”Day-0″,”Day-10″,”Day-10”),
gtf_file = gtf,
target_gene = c(“Nanog”,”Actb”),
merge_group = TRUE,
collapse_exon = TRUE,
exon_linewidth = 8)
调整 panel 高度:
coverage_plot(bam_file <- c(“../test-bam/0a.sorted.bam”,
“../test-bam/0b.sorted.bam”,
“../test-bam/10a.sorted.bam”,
“../test-bam/10b.sorted.bam”),
sample_name <- c(“day0-rep1″,”day0-rep2″,”day10-rep1″,”day10-rep2”),
group_name = c(“Day-0″,”Day-0″,”Day-10″,”Day-10”),
gtf_file = gtf,
target_gene = c(“Nanog”,”Actb”),
merge_group = TRUE,
collapse_exon = TRUE,
exon_linewidth = 8) +
theme_sub_panel(heights = unit(c(3,3,1),”cm”))
修改颜色:
coverage_plot(bam_file <- c(“../test-bam/0a.sorted.bam”,
“../test-bam/0b.sorted.bam”,
“../test-bam/10a.sorted.bam”,
“../test-bam/10b.sorted.bam”),
sample_name <- c(“day0-rep1″,”day0-rep2″,”day10-rep1″,”day10-rep2”),
group_name = c(“Day-0″,”Day-0″,”Day-10″,”Day-10”),
gtf_file = gtf,
target_gene = c(“Nanog”,”Actb”),
merge_group = TRUE,
exon_col = “#05339C”,arrow_col = “#05339C”) +
scale_fill_manual(values = c(Actb = “#FAB12F”,Nanog = “#696FC7”)) +
scale_color_manual(values = c(Actb = “#FAB12F”,Nanog = “#696FC7”))
多级展示:
coverage_plot(bam_file <- c(“../test-bam/0a.sorted.bam”,
“../test-bam/0b.sorted.bam”,
“../test-bam/10a.sorted.bam”,
“../test-bam/10b.sorted.bam”),
sample_name <- c(“day0-rep1″,”day0-rep2″,”day10-rep1″,”day10-rep2”),
gtf_file = gtf,
target_gene = c(“Nanog”,”Actb”,”Sox2″,”Myh6″),
exon_col = “#161179”,arrow_col = “#161179”)
结尾
路漫漫其修远兮,吾将上下而求索。
欢迎加入生信交流群。加我微信我也拉你进 微信群聊老俊俊生信交流群(微信交流群需收取 20 元入群费用,一旦交费,拒不退还!(防止骗子和便于管理)) 。
声明:来自老俊俊的生信笔记,仅代表创作者观点。链接:https://eyangzhen.com/3499.html