federicomarini / ideal
Showing 2 of 4 files from the diff.
Other files ignored by Codecov

@@ -1164,7 +1164,9 @@
Loading
1164 1164
                actionButton("updatepreview_button", "Update report", class = "btn btn-primary"), p()
1165 1165
              ),
1166 1166
              column(3, downloadButton("saveRmd", "Generate & Save", class = "btn btn-success")),
1167 -
              column(3, uiOutput("ui_iSEEexport"))
1167 +
              column(3, 
1168 +
                     uiOutput("ui_iSEEexport"),
1169 +
                     uiOutput("ui_GeneTonicexport"))
1168 1170
            ),
1169 1171
1170 1172
            tabBox(
@@ -4756,6 +4758,7 @@
Loading
4756 4758
      }
4757 4759
    )
4758 4760
4761 +
    # iSEE export ------------------------------------------------------------
4759 4762
    output$ui_iSEEexport <- renderUI({
4760 4763
      validate(
4761 4764
        need(((!is.null(values$dds_obj)) & (!is.null(values$res_obj))),
@@ -4787,6 +4790,68 @@
Loading
4787 4790
        saveRDS(se, file = file)
4788 4791
      }
4789 4792
    )
4793 +
    
4794 +
    # GeneTonic export -------------------------------------------------------
4795 +
    output$ui_GeneTonicexport <- renderUI({
4796 +
      validate(
4797 +
        need(((!is.null(values$dds_obj)) & (!is.null(values$res_obj))),
4798 +
             message = "Please build and compute the dds and res object to export as 
4799 +
             a list for use in GeneTonic"
4800 +
        ),
4801 +
        need(!is.null(values$annotation_obj),
4802 +
             message = "Please provide or obtain an annotation object")
4803 +
      )
4804 +
      
4805 +
      go_tbls_available <- c("topgo_updown",
4806 +
                             "topgo_down",
4807 +
                             "topgo_up")
4808 +
      
4809 +
      return(
4810 +
        tagList(
4811 +
          textInput(
4812 +
            "gtl_exportgt_name",
4813 +
            label = "Choose a filename for the serialized .rds object",
4814 +
            value = "gtl_ideal_toGeneTonic.rds"
4815 +
          ),
4816 +
          selectInput(
4817 +
            "gotbl_forgt",
4818 +
            label = "Select which GO table to export (topGO output supported)",
4819 +
            choices = go_tbls_available[
4820 +
              unlist(lapply(go_tbls_available, function(arg) {
4821 +
                !is.null(values[[arg]])
4822 +
              }))
4823 +
            ]
4824 +
          ),
4825 +
          downloadButton(
4826 +
            "button_GeneTonicexport",
4827 +
            label = "Export as serialized list for GeneTonic"
4828 +
          )
4829 +
        )
4830 +
      )
4831 +
    })
4832 +
    
4833 +
    output$button_GeneTonicexport <- downloadHandler(
4834 +
      filename = function() {
4835 +
        input$gtl_exportgt_name
4836 +
      }, content = function(file) {
4837 +
        
4838 +
        dds_obj <- values$dds_obj
4839 +
        
4840 +
        res_obj <- values$res_obj
4841 +
        res_obj$SYMBOL <- res_obj$symbol
4842 +
        
4843 +
        res_enrich <- shake_topGOtableResult(values[[input$gotbl_forgt]])
4844 +
        
4845 +
        anno_df <- values$annotation_obj
4846 +
        
4847 +
        gtl <- list(dds = dds_obj,
4848 +
                    res_de = res_obj,
4849 +
                    res_enrich = res_enrich,
4850 +
                    annotation_obj = anno_df)
4851 +
        
4852 +
        saveRDS(gtl, file = file)
4853 +
      }
4854 +
    )
4790 4855
4791 4856
    # server state saving --------------------------------------------------------
4792 4857
    ### to environment

@@ -75,6 +75,47 @@
Loading
75 75
76 76
77 77
78 +
shake_topGOtableResult <- function(obj,
79 +
                                   p_value_column = "p.value_elim") {
80 +
  
81 +
  if(!all(c("GO.ID", "Term", "Annotated", "Significant", "Expected", "p.value_classic") %in%
82 +
          colnames(obj))) {
83 +
    stop("The provided object must be of in the format specified by the `pcaExplorer::topGOtable` function")
84 +
  }
85 +
  
86 +
  if(!p_value_column %in% colnames(obj)) {
87 +
    stop("You specified a column for the p-value which is not contained in the provided object. \n",
88 +
         "Please check the colnames of your object in advance.")
89 +
  }
90 +
  
91 +
  if(!"genes" %in% colnames(obj)) {
92 +
    stop("The column `genes` is not present in the provided object and is required for properly running GeneTonic.",
93 +
         "\nMaybe you did set `addGeneToTerms` to FALSE in the call to `pcaExplorer::topGOtable`?")
94 +
  }
95 +
  
96 +
  # Thought: store somewhere the ontology if possible - in an extra column?
97 +
  message("Found ", nrow(obj), " gene sets in `topGOtableResult` object.")
98 +
  message("Converting for usage in GeneTonic...")
99 +
  
100 +
  fullresults <- obj
101 +
  
102 +
  mydf <- data.frame(
103 +
    gs_id = fullresults$GO.ID,
104 +
    gs_description = fullresults$Term,
105 +
    gs_pvalue = fullresults[[p_value_column]],
106 +
    gs_genes = fullresults$genes,
107 +
    gs_de_count = fullresults$Significant,
108 +
    gs_bg_count = fullresults$Annotated,
109 +
    Expected = fullresults$Expected,
110 +
    stringsAsFactors = FALSE
111 +
  )
112 +
  
113 +
  rownames(mydf) <- mydf$gs_id
114 +
  
115 +
  return(mydf)
116 +
}
117 +
118 +
78 119
79 120
80 121
# combineTogether <- function(normCounts,resuTable,anns) {
Files Coverage
R 78.59%
Project Totals (12 files) 78.59%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading