|
30 | 30 | - [1. Docker-based installation](#1-docker-based-installation)
|
31 | 31 | - [2. R-based installation](#2-r-based-installation)
|
32 | 32 | - [How to use](#how-to-use)
|
| 33 | +- [How to extend](#how-to-extend) |
33 | 34 | - [Detail of R package "PhosMap"](#detail-of-r-package-phosmap)
|
34 | 35 | - [Friendly suggestion](#friendly-suggestion)
|
35 | 36 | - [Reporting issues](#reporting-issues)
|
@@ -123,6 +124,100 @@ You can find comprehensive documentation and an in-depth video tutorial on this
|
123 | 124 |
|
124 | 125 | <p id="rpackage"></p>
|
125 | 126 |
|
| 127 | +## How to extend |
| 128 | +Due to its clear design and reliance solely on the _R_ language, PhosMap allows for easy customization of user-defined features. Basic knowledge of _R_ is sufficient, without the need to understand the shiny framework. We provide a step-by-step tutorial available here. |
| 129 | + |
| 130 | +1. Follow the instructions in `How to install --> R-based installation` for installation. Additionally, install the packages required for your customized functionalities. |
| 131 | +2. Open the `ui.R` file inside the PhosMap folder and search for the term '**Customization**.' You will then see a template with detailed annotations. You only need to **selectively** modify **the lines with annotations** according to the instructions. These codes determine the display of the graphical interface. |
| 132 | + ```R |
| 133 | + # If you want to expand the software's functionality, |
| 134 | + # please uncomment the code below. |
| 135 | + # Tip: You can use the Ctrl+Shift+C shortcut to uncomment or comment the selectedcode. |
| 136 | + tabPanel( |
| 137 | + "Customization", |
| 138 | + h2("User-defined Tool", class = "tooltitle"), |
| 139 | + h4("This module is designed for implementing user-defined functionalities. |
| 140 | + If you have any questions, please submit an issue on Github.", class = "toolsubtitle"), |
| 141 | + fluidRow( |
| 142 | + column( |
| 143 | + 4, |
| 144 | + panel( |
| 145 | + "", |
| 146 | + heading = "Parameters Setting", |
| 147 | + numericInput( |
| 148 | + inputId = "user_num1", # id to be used in server.R, must be unique, is not recommended to change. |
| 149 | + label = "user_num1", # label to show that can be changed. |
| 150 | + value = 1, # default number that can be changed. |
| 151 | + ), |
| 152 | + numericInput( |
| 153 | + inputId = "user_num2", # id to be used in server.R, must be unique, is not recommended to change. |
| 154 | + label = "user_num2", # label to show that can be changed. |
| 155 | + value = 1, # default number that can be changed. |
| 156 | + ), |
| 157 | + actionButton( |
| 158 | + inputId = "user_button", # id to be used in server.R, must be unique, is not recommended to change. |
| 159 | + label = "Run", # label to show that can be changed. |
| 160 | + ) |
| 161 | + ) |
| 162 | + ), |
| 163 | + column( |
| 164 | + 8, |
| 165 | + h4("Result--Table:"), # instruction, not recommended to change. |
| 166 | + dataTableOutput( |
| 167 | + outputId = "user_table", # id to be used in server.R, must be unique, is not recommended to change. |
| 168 | + ), |
| 169 | + h4("Result--Plot:"), # instruction, not recommended to change. |
| 170 | + plotOutput( |
| 171 | + outputId = "user_plot", # id to be used in server.R, must be unique, is not recommended to change. |
| 172 | + ) |
| 173 | + ) |
| 174 | + ) |
| 175 | + ) |
| 176 | + ``` |
| 177 | +3. Open the `server.R` file inside the PhosMap folder and search for the term '**Customization**.' You will then see a template with detailed annotations. We demonstrate the **data retrieval** and utilization, along with the computational core code that you can modify as desired, and how to ultimately **display data frames and images** in the UI interface. These codes determine how the calculations are performed. |
| 178 | + ```R |
| 179 | + # If you want to expand the software's functionality, |
| 180 | + # please uncomment the code below. |
| 181 | + # Tip: You can use the Ctrl+Shift+C shortcut to uncomment or comment the selected code. |
| 182 | + observeEvent( |
| 183 | + input$user_button, { |
| 184 | + # you can directly work with the data on the data upload interface, whether it is "pipeline data" or "your data". |
| 185 | + # a total of four datasets are as follows: |
| 186 | + # (To facilitate user understanding of the data, we have defined the functionality to display different data based on the input in the 'define operation logic' section) |
| 187 | + ## fileset()[[1]]: experimental design dataframe |
| 188 | + ## fileset()[[2]]: expression dataframe, the partial of PhosMap matrix |
| 189 | + ## fileset()[[3]]: dataframe including peptide sequences, the partial of PhosMap matrix |
| 190 | + ## fileset()[[4]]: clinical dataframe |
| 191 | + |
| 192 | + # define operation logic |
| 193 | + ## load dependency |
| 194 | + library(ggplot2) |
| 195 | + ## retrieve input data |
| 196 | + user_num1 = input$user_num1 # retrieve the value of the corresponding input box with id using input$id |
| 197 | + user_num2 = input$user_num2 |
| 198 | + ## write core code to perform any operation that can be tested in advance in a normal R environment |
| 199 | + inter_value = user_num2 + 1 - 1 |
| 200 | + plot_data <- data.frame( |
| 201 | + x = c(1, 2, 3, 4, 5), |
| 202 | + y = c(2, 4, 6, 8, 10) |
| 203 | + ) |
| 204 | + |
| 205 | + if(user_num1 == 1){ |
| 206 | + # output a table to UI |
| 207 | + output$user_table <- renderDataTable(fileset()[[1]]) # show data |
| 208 | + } else{ |
| 209 | + output$user_table <- renderDataTable(fileset()[[inter_value]]) # show data |
| 210 | + |
| 211 | + p <- ggplot(plot_data, aes(x, y)) + |
| 212 | + geom_point() |
| 213 | + # output a plot to UI |
| 214 | + output$user_plot <- renderPlot(p) # show plot |
| 215 | + } |
| 216 | + } |
| 217 | + ) |
| 218 | + ``` |
| 219 | +It's straightforward, give it a try. Feel free to submit any questions as issues or contribute interesting features through pull requests. :) |
| 220 | + |
126 | 221 | ## Detail of R package "PhosMap"
|
127 | 222 | https://github.com/ecnuzdd/PhosMap
|
128 | 223 |
|
|
0 commit comments