params <- list(alignments = "/tmp/RtmpxMHZ83/Rinst6fbea3f558ec2/amplican/extdata/results/ align_events_filtered_shifted_normalize .csv", config_summary = "/tmp/RtmpxMHZ83/Rinst6fbea3f558ec2/amplican/extdata/results/config_summary.csv") ## ----加载数据,message=F, warning=FALSE,include=FALSE----------------------- library(amplican) library(ggplot2) alignments <- data.table::fread(params$alignments) data.table::setDF(alignments) config <- data.frame(data.table::fread(params$config_summary)) height <- plot_height(length(unique(config$Group))) ## ----plot_total_reads, echo=FALSE, fig.height=height, fig.width=14, message=F, warning=FALSE---- ggplot(data = config, aes(x = as.factor(Group), y = log10(Reads + 1), order = Group,fill = Group)) + geom_boxplot() + ylab('Number of reads + 1, log10 scaling ') + xlab('Group') + theme(图例。位置= 'none',轴。Text = element_text(size = 12), axis。幼圆title = element_text(大小= 14日“大胆”))+ coord_flip () ## ---- plot_F_per回声= FALSE, fig.height =身高、fig.width = 14日消息= F,警告= FALSE,配置F_percentage < -美元(配置PRIMER_DIMER +配置Low_Score美元)* 100 /配置读取配置F_percentage美元[is.nan(配置F_percentage美元)]< - 0 ggplot (data =配置,aes (x = as.factor(集团),y = F_percentage,订单=组,填补=集团))+ geom_boxplot () + xlab(“集团”)+ ylab(过滤读取的百分比)+主题(轴。Text = element_text(size=12), axis。Title = element_text(size=14, face = 'bold'),图例。位置= '没有')+ ylim (0, 100) + coord_flip () ## ---- 情节indel百分比,回声= FALSE, fig.height =身高、fig.width = 14日消息= F,警告= FALSE,配置edit_percentage < -配置Reads_Edited * 100美元/配置Reads_Filtered配置edit_percentage美元[is.nan(配置edit_percentage美元)]< - 0 ggplot (data =配置,aes (x = as.factor(集团),y = edit_percentage,订单=组,填补=集团))+ geom_boxplot () + xlab(“集团”)+ ylab(读取的百分比(不是过滤),编辑的)+主题(轴。Text = element_text(size=12), axis。Title = element_text(size=14, face = 'bold'),图例。position = 'None') + ylim(0,100) + coord_flip() ## ---- plot_framshifft_per, echo=FALSE, fig.height=height, fig.width=14, message=F, warning=FALSE---- config$ framshifft_percentage <- config$ reads_framshifft_percentage * 100/config$Reads_Filtered config$ framshifft_percentage [is.nan(config$ framshifft_percentage)] <- 0 ggplot(data = config, aes(x = as.factor(Group), y = framshifft_percentage, order = Group,fill = Group)) + geom_boxplot() + xlab('Group') + ylab('有移码的读取(未过滤)百分比')+ theme(轴。Text = element_text(size=12), axis。title = element_text(size=14,face = 'bold'), legend.position = 'None') + ylim(0, 100) + coord_flip() ## ----plot read heterogeneity, echo=FALSE, fig.height=height + 1, fig.width=14, message=F, warning=FALSE---- plot_heterogeneity(alignments, config, level = 'Group') ## ----del-Betty, echo = F, results = "asis", message=F, warning=F------------- amplican::metaplot_deletions(alignments, config, "Group", "Betty") ## ----ins-Betty, echo = F, results = "asis", message=F, warning=F------------- amplican::metaplot_insertions(alignments, config, "Group", "Betty") ## ----mis-Betty, echo = F, results = "asis", message=F, warning=F------------- amplican::plot_mismatches(alignments, config, "Group", "Betty") ## ----del-Tom, echo = F, results = "asis", message=F, warning=F--------------- amplican::metaplot_deletions(alignments, config, "Group", "Tom") ## ----ins-Tom, echo = F, results = "asis", message=F, warning=F--------------- amplican::metaplot_insertions(alignments, config, "Group", "Tom") ## ----mis-Tom, echo = F, results = "asis", message=F, warning=F--------------- amplican::plot_mismatches(alignments, config, "Group", "Tom") ## ----plot_alignments, results='asis', echo=F, message=F, warning=F------------ alignments <- alignments[alignments$consensus & alignments$overlaps, ] alignments$strand <- "+" # strand does not matter after consensus filtering src = sapply(unique(config$Group), function(i) { knitr::knit_expand(text = c( "## Group {{i}} \n", "### Deletions \n", paste('```{r del-{{i}}, echo = F, results = "asis", ', 'message=F, warning=F}', collapse = ''), 'amplican::metaplot_deletions(alignments, config, "Group", "{{i}}")', '```\n', "### Insertions", paste('```{r ins-{{i}}, echo = F, results = "asis", ', 'message=F, warning=F}', collapse = ''), 'amplican::metaplot_insertions(alignments, config, "Group", "{{i}}")', '```\n', "### Mismatches", paste('```{r mis-{{i}}, echo = F, results = "asis", ', 'message=F, warning=F}', collapse = ''), 'amplican::plot_mismatches(alignments, config, "Group", "{{i}}")', '```\n')) }) # knit the source res = knitr::knit_child(text = src, quiet = TRUE) cat(res, sep = '\n')