# # - eval = FALSE ------------------------------------------------------------ # 库(气管)#数据(气管)# se =气道#库(DESeq2) # dds = DESeqDataSet (se、设计= ~敏捷)#保持= rowSums(计数(dds)) > = 10 # dds dds [,] = # # dds敏捷= relevel美元(dds敏捷美元,ref =“untrt”)# # dds = DESeq (dds) # res (dds) # res = =结果as.data.frame (res ) ## ---- eval = FALSE ------------------------------------------------------------ # 图书馆(InteractiveComplexHeatmap) #库(ComplexHeatmap) #库(circlize) #库(GetoptLong) # # env = new.env () # # make_heatmap =函数(罗斯福= 0.01,base_mean = 0, log2fc = 0) {# l =美元res padj < =罗斯福& res美元baseMean > = base_mean & # abs (res log2FoldChange美元)> = log2fc;l [is.na (l)] = FALSE # #如果(sum (l) = = 0)返回(NULL) # # m =计数(dds,规范化= TRUE) # m = m [l] # # env $ row_index = (l) # # ht =热图(t (t (m))(规模)、name =“z分数”,# top_annotation = HeatmapAnnotation(#敏捷= colData (dds)敏捷美元,# sizeFactor = anno_points (colData (dds) sizeFactor美元)#),# show_row_names = FALSE, show_column_names = FALSE, row_km = 2, # column_title = paste0(和(l),“与罗斯福<重要基因”,罗斯福),# show_row_dend = FALSE) + #热图(log10 (res baseMean美元[l] + 1), show_row_names = FALSE,宽度=单位(5毫米),# name =“log10 (baseMean + 1)”,show_column_names = FALSE) + #热图(res log2FoldChange美元[l], show_row_names = FALSE,宽度=单位(5毫米),# name =“log2FoldChange show_column_names = FALSE, #坳= colorRamp2 (c (2 0 2), c(“绿色”、“白”、“红”)))# ht =画(ht merge_legend = TRUE) # ht # } # # # 使MA-plot # make_maplot =函数(强调一些基因,突出#坳= = NULL){代表(“# 00000020”,nrow (res)) # cex =代表(0.5,nrow (res)) #名称(col) = rownames (res) #名称(cex) = rownames (res) #如果(! is.null(突出)){#坳(突出)=“红色”# cex(突出)= 1 #}# x = res baseMean # y = res log2FoldChange #美元[y > 2] = 2 # y (y < 2) = 2 #坳坳= =“红色”& y < 0] =“暗绿色”# par (mar = c (4 4 1 1) # # suppressWarnings(#地块(x, y =上校,上校# pch = ifelse (res log2FoldChange美元> 2 | res $ log2FoldChange < 2 1、16)# cex = cex,日志= " x " # xlab =“baseMean ylab = " log2褶皱变化 ") # ) # } # # # 使火山情节和一些基因highlited # make_volcano = function (res,突出= NULL){#坳=代表(“# 00000020”,nrow (res)) # cex =代表(0.5,nrow (res)) #名称(col) = rownames (res) #名称(cex) = rownames (res) #如果(! is.null(突出)){#坳(突出)=“红色”# cex(突出)= 1 #}# x = res log2FoldChange #美元y = log10 (res padj美元)#坳坳= =“红色”& x < 0] =“暗绿色”# par (mar = c (4 4 11) # # suppressWarnings(#地块(x, y =上校,上校pch = 16 #, # cex = cex # xlab =“log2褶皱变化”,ylab = " log10(罗斯福 )") # ) # } ## ---- eval = FALSE ------------------------------------------------------------ # 库(亮)#库(shinydashboard) #身体= dashboardBody (# fluidRow(#列(宽度= 4,#箱(title =“差热图”,宽度= NULL, solidHeader = TRUE,状态=“主”,# originalHeatmapOutput(“ht”,身高= 800,遏制= TRUE ) # ) # ), # 列(宽度= 4,# id =“column2”,#箱(title =“Sub-heatmap”,宽度= NULL, solidHeader = TRUE,状态=“主”,# subHeatmapOutput(“ht”,标题= NULL,遏制= TRUE) #), #箱(title =“输出”,宽度= NULL, solidHeader = TRUE,状态=“主”,# HeatmapInfoOutput(“ht”,标题= NULL) #), #箱(title =“注意”,宽度= NULL, solidHeader = TRUE,状态=“主”,# htmlOutput(“注意 ") # ), # ), # 列(宽度= 4,#箱(title =“MA-plot”,宽度= NULL, solidHeader = TRUE,状态=“主”,# plotOutput("ma_plot") #), # box(title = "Volcanno plot", width = NULL, solidHeader = TRUE, status = "primary", # plotOutput("volcanno_plot") #), # box(title = "所选基因的结果表",width = NULL, solidHeader = TRUE, status = "primary", # DTOutput("res_table") #) #), # tags$style(" # .content-wrapper, .right side {# overflow-x: auto;#} # .content {# min-width:1500px; # } # ") # ) # ) ## ---- eval = FALSE------------------------------------------------------------ # library(DT) # library(GetoptLong) # for qq() function # brush_action = function(df, input, output, session) { # # row_index = unique(unlist(df$row_index)) # selected = env$row_index[row_index] # # output[["ma_plot"]] = renderPlot({ # make_maplot(res, selected) # }) # # output[["volcanno_plot"]] = renderPlot({ # make_volcano(res, selected) # }) # # output[["res_table"]] = renderDT( # formatRound(datatable(res[selected, c("baseMean", "log2FoldChange", "padj")], rownames = TRUE), columns = 1:3, digits = 3) # ) # # output[["note"]] = renderUI({ # if(!is.null(df)) { # HTML(qq("

中捕获的行索引输出只对应于差异基因的矩阵。要获取原始矩阵中的行索引,需要执行:

# l = res$padj <= @{input$fdr} & # res$baseMean >= @{input$base_mean} & # abs(res$log2FoldChange) >= @{input$log2fc} # l[is.na(l)] = FALSE # which(l)[row_index] #

在哪里res是DESeq2分析的完整数据帧row_indexrow_index中的代码捕获的列输出

")) # } # }) # } ## ---- eval = FALSE ------------------------------------------------------------ # ui = dashboardPage (# dashboardHeader (title =“DESeq2结果”),# dashboardSidebar (# selectInput(“罗斯福”标签=“罗斯福截止:c(“0.001”= 0.001,= 0.01“0.01”,“0.05”= 0.05)),# numericInput(“base_mean”标签=“最小的基本意思是:”,值= 0),# numericInput(“log2fc”标签=“最小的abs (log2褶皱变化):”,值= 0),# actionButton(“过滤器”,标签=“生成的热图”)#),#身体 # ) ## ---- eval = FALSE ------------------------------------------------------------ # 服务器= function(输入、输出、会话){# observeEvent(输入滤波器美元,{# ht = make_heatmap(罗斯福= as.numeric(输入罗斯福美元),base_mean =输入base_mean美元,log2fc =输入log2fc美元)#如果(! is.null (ht)) {# makeInteractiveComplexHeatmap(输入、输出、会话、ht“ht”,# brush_action = brush_action) #}其他{# #的ID的热图情节@ {heatmap_id} _heatmap编码,因此,这里ht_heatmap。# output$ht_heatmap = renderPlot({# grid.newpage()文本(“不存在行后过滤 .") # }) # } # }, ignoreNULL = FALSE ) # } ## ---- eval = FALSE ------------------------------------------------------------ # shinyApp (ui、服务器 ) ## ---- eval = FALSE ------------------------------------------------------------ # 图书馆(DESeq2) #库(气管)#数据(气管)# # dds = DESeqDataSet(气道设计= ~敏捷)# dds = DESeq (dds) # # interactivate (dds)