Skip to content

Commit

Permalink
Merge pull request #18 from MonashBioinformaticsPlatform/dev_for_R4.2.1
Browse files Browse the repository at this point in the history
Updated to R 4.2.1
  • Loading branch information
Hailey-Z committed Oct 21, 2022
2 parents 6bb3536 + 9f6e8ae commit b9753bc
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 171 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ RUN apt-get update && apt-get install -yq \

RUN Rscript -e 'install.packages(c("devtools", "tidyverse", "ggrepel", "httr", "rjson", "mvtnorm", "tmvtnorm","impute", \
"pcaMethods", "imputeLCMD", "plotly", "DT", "BiocManager","testthat", "RColorBrewer", "shiny","shinyalert","shinydashboard", \
"shinyjs", "svglite", "rhandsontable", "shinyBS", "shinyWidgets", "ggVennDiagram"), dependencies=TRUE)'
"shinyjs", "svglite", "rhandsontable", "shinyBS", "shinyWidgets", "ggVennDiagram", "shinycssloaders"), dependencies=TRUE)'

#FROM bioconductor/bioconductor_docker:RELEASE_3_15
RUN Rscript -e 'BiocManager::install(pkgs=c("DEP", "DT", "SummarizedExperiment", "limma", "ComplexHeatmap", ask=F))'
RUN Rscript -e 'BiocManager::install(pkgs=c("DEP", "DT", "SummarizedExperiment", "limma", "ComplexHeatmap", ask=F), dependencies=TRUE)'

COPY ./ /srv/shiny-server/lfq-analyst
COPY shiny-server.conf /etc/shiny-server/shiny-server.conf
Expand Down
15 changes: 8 additions & 7 deletions LFQ_report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,31 @@ Statistical analysis was performed using an in-house generated R script based on

#### MaxQuant result output contains `r nrow(params$data)` proteins groups of which _`r nrow(params$dep())`_ proteins were reproducibly quantified.

#### `r params$num_signif` proteins differ significantly between samples.
#### `r params$num_signif` proteins differ significantly between samples.

\pagebreak



## Exploratory Analysis (QC Plots)

#### Principle Component Analysis (PCA) plot


```{r pca_plot, echo=FALSE, fig.height= 4}
```{r pca_plot, echo=FALSE, fig.height= 4, fig.align='center', warning=FALSE}
print(params$pca_input())
```
\pagebreak

#### Sample Correlation matrix

```{r correlation_heatmap, echo=FALSE, fig.keep='first'}
```{r correlation_heatmap, echo=FALSE, fig.keep='first',fig.align='center'}
print(params$correlation_input())
```
\pagebreak

#### Sample Coefficient of variation (CVs)

```{r sample_cv, echo=FALSE, warning=FALSE }
```{r sample_cv, echo=FALSE, warning=FALSE, message=FALSE, fig.align='center'}
print(params$cvs_input())
```
\pagebreak
Expand Down Expand Up @@ -117,13 +116,15 @@ print(params$imputation_input())
A plot representing an overview of expression of all significant (differencially expressed) proteins (rows) in all samples (columns).


```{r heatmap_2, echo=FALSE, warning=FALSE, results='hide', fig.keep='all'}
```{r heatmap_2, echo=FALSE, warning=FALSE, results='hide', fig.keep='first',fig.align='center'}
print(params$heatmap_input())
```

\pagebreak

#### Volcano Plots

```{r volcano, echo=FALSE, warning=FALSE, comment=NA}
```{r volcano, echo=FALSE, warning=FALSE, comment=NA,fig.align='center'}
for(i in params$tested_contrasts){
# print(paste0('volcano_plot_',i,sep=""))
print(plot_volcano_new(params$dep(),contrast = i,label_size = 2, add_names = F))
Expand Down
13 changes: 9 additions & 4 deletions R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ get_cluster_heatmap <- function(dep, type = c("contrast", "centered"),
...)
# return (row_order(ht1))
# Return data.frame
draw(ht1, heatmap_legend_side = "top")
p <- draw(ht1, heatmap_legend_side = "top")
row_clusters<- row_order(ht1)
#mat<-as.matrix(df)

Expand All @@ -358,7 +358,8 @@ get_cluster_heatmap <- function(dep, type = c("contrast", "centered"),
# out <- cbind(out, clu)
# }
# }
return(row_clusters)
heatmap_list <- list(p, row_clusters)
return(heatmap_list)
}

# Internal function to get ComplexHeatmap::HeatmapAnnotation object
Expand Down Expand Up @@ -632,7 +633,7 @@ get_results_proteins <- function(dep) {

# Obtain average enrichments of conditions versus the control condition
ratio <- as.data.frame(row_data) %>%
tibble::column_to_rownames("name") %>%
# tibble::column_to_rownames("name") %>%
dplyr::select(dplyr::ends_with("diff")) %>%
signif(., digits = 3) %>%
tibble::rownames_to_column()
Expand All @@ -642,7 +643,7 @@ get_results_proteins <- function(dep) {

# Select the adjusted p-values and significance columns
pval <- as.data.frame(row_data) %>%
tibble::column_to_rownames("name") %>%
# tibble::column_to_rownames("name") %>%
dplyr::select(dplyr::ends_with("p.val"),
dplyr::ends_with("p.adj"),
dplyr::ends_with("significant")) %>%
Expand All @@ -665,7 +666,11 @@ get_results_proteins <- function(dep) {
table<-table %>% dplyr::arrange(desc(significant))
colnames(table)[1]<-c("Gene Name")
colnames(table)[2]<-c("Protein IDs")
<<<<<<< HEAD
table <- table %>% dplyr::relocate(Protein.names, .after = last_col())
=======
table <- table %>% dplyr::select(grep("[^Protein.names]",colnames(table)), "Protein.names")
>>>>>>> 6bb35366647de1666a48c9cef7053d813e3e756b
# table$Gene_name<-table$name
return(table)
}
Expand Down
4 changes: 2 additions & 2 deletions R/volcano_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ plot_protein<-function(dep, protein, type){
rownames_to_column() %>%
gather(ID, val, -rowname) %>%
left_join(., data.frame(colData(subset)), by = "ID")
df_reps$rowname <- parse_factor(df_reps$rowname, levels = protein)
df_reps$rowname <- parse_factor(as.character(df_reps$rowname), levels = protein)

df_CI<- df_reps %>%
group_by(condition, rowname) %>%
Expand All @@ -211,7 +211,7 @@ plot_protein<-function(dep, protein, type){
CI.L = mean - error,
CI.R = mean + error) %>%
as.data.frame()
df_CI$rowname <- parse_factor(df_CI$rowname, levels = protein)
df_CI$rowname <- parse_factor(as.character(df_CI$rowname), levels = protein)

if(type=="violin"){
p<-ggplot(df_reps, aes(condition, val))+
Expand Down
Binary file added data/.DS_Store
Binary file not shown.
Binary file modified data/demo_data.RData
Binary file not shown.
1 change: 1 addition & 0 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ library("ggrepel")
library("httr")
library("rjson")
library("svglite")
library("shinycssloaders") # new added
source("R/functions.R")
source("R/volcano_function.R")
source("R/tests.R")
Expand Down

0 comments on commit b9753bc

Please sign in to comment.