Skip to content

Commit

Permalink
Merge pull request #18 from LUMC/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tomkuipers1402 committed Feb 26, 2021
2 parents a40f0cc + 5d9f711 commit 250333b
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 34 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ Changelog
<!--
Newest changes should be on top.
-->
version 1.4.3
---------------------------
+ Add prior count to CPM calculation
+ Add FDR sort again to markdown files
+ Fix filenames when downloading
+ Add check reload to barcodeplot to update add genes list
+ Change gProfiler correction to gSCS

version 1.4.2
---------------------------
+ Remove ordering based on FDR in deTab
+ Add Changelog file
+ Add Changelog file
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: dgeAnalysis
Type: Package
Title: dgeAnalysis
Version: 1.4.2
Version: 1.4.3
Author@R:
person("Tom", "Kuipers", email = "t.b.kuipers@outlook.com", role = c("aut", "cre"))
Description:
Expand Down
Binary file modified MANUAL.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dgeAnalysis

This R package contains the R-Shiny application v1.4.2 developed to perform differential gene expression analysis.
This R package contains the R-Shiny application v1.4.3 developed to perform differential gene expression analysis.
* dgeAnalysis manual: https://github.com/LUMC/dgeAnalysis/blob/master/MANUAL.pdf

## Installing
Expand Down
15 changes: 5 additions & 10 deletions inst/src/markdown/analysisDESeq2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ dge <- DGEList(counts = assay(se),
dge <- dge[rowSums(abs(dge$counts)) > 1,]
tempDge <- dge
tempDge$counts <- cpm(dge, log = TRUE)
tempDge$counts <- cpm(dge, log = TRUE, prior.count = 1)
countDistributionLinePlot(tempDge)
dge <- DGEList(counts = assay(se), samples = colData(se))
Expand All @@ -137,7 +137,7 @@ analysis <- DESeqDataSet(se, design = design)
analysis <- analysis[rowSums(abs(assay(analysis))) > 1,]
# FILTER IF NESSECARY
counts <- cpm(counts(analysis), log = TRUE)
counts <- cpm(counts(analysis), log = TRUE, prior.count = 1)
selectedFeatures <- rownames(analysis)[apply(counts, 1, function(v)
sum(v >= cpm_value)) >= 1 / 4 * ncol(counts)]
analysis <- analysis[selectedFeatures, ]
Expand All @@ -161,10 +161,8 @@ Extract the normalized data from the analysis results.
# GET NORMALIZED COUNTS
getSize <- estimateSizeFactors(analysis)
normCounts <- cpm(data.frame(counts(getSize, normalized = TRUE)))
normDge <- DGEList(counts = normCounts, samples = dge$samples)
normDge$counts <- log2(normDge$counts)
normDge$counts[is.infinite(normDge$counts)] <- 0
normDge <- DGEList(counts = data.frame(counts(getSize, normalized = TRUE)), samples = dge$samples)
normDge$counts <- cpm(normDge, log = TRUE, prior.count = 1)
countDistributionLinePlot(normDge)
samplePca2dPlot(normDge, design_base, "PC1", "PC2")
Expand Down Expand Up @@ -217,10 +215,6 @@ if (!is.null(data_annotation)) {
deTab$Row.names <- NULL
}
# MAKE BOTH TABLES EQUAL
deTab <- deTab[intersect(rownames(deTab), rownames(normDge$counts)), ]
normDge$counts <- normDge$counts[intersect(rownames(deTab), rownames(normDge$counts)), ]
#ORDER deTab TABLE
deTab <- rename(deTab, "FDR" = "adj.P.Val")
deOrder <- c("avgLog2CPM", "avgLog2FC", "P.Value", "FDR", "DE")
Expand Down Expand Up @@ -264,6 +258,7 @@ Results are saved, so they can be retrieved by the application.
```{r save}
# SAVE ANALYSIS
deTab <- deTab[order(deTab$FDR),]
save(deTab, normDge, file = "analysis.RData")
```
Expand Down
9 changes: 5 additions & 4 deletions inst/src/markdown/analysisEdgeR.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ row.names(dge$genes) <- row.names(dge$counts)
dge <- dge[rowSums(abs(dge$counts)) > 1,]
tempDge <- dge
tempDge$counts <- cpm(dge, log = TRUE)
tempDge$counts <- cpm(dge, log = TRUE, prior.count = 1)
countDistributionLinePlot(tempDge)
```
Expand All @@ -134,7 +134,7 @@ The raw data is filtered based on the input values provided.
# GET SELECTED FEATURES
edger <- calcNormFactors(dge, method = "TMM")
counts <- cpm(edger, log = TRUE)
counts <- cpm(edger, log = TRUE, prior.count = 1)
selectedFeatures <- rownames(edger)[apply(counts, 1, function(v)
sum(v >= cpm_value)) >= 1 / 4 * ncol(counts)]
Expand All @@ -157,7 +157,7 @@ The filtered data is normalized using TMM.
normDge <- calcNormFactors(highExprDge, method = "TMM")
tempDge <- normDge
tempDge$counts <- cpm(normDge, log = TRUE)
tempDge$counts <- cpm(normDge, log = TRUE, prior.count = 1)
countDistributionLinePlot(tempDge)
samplePca2dPlot(tempDge, design_base, "PC1", "PC2")
Expand Down Expand Up @@ -255,7 +255,8 @@ Results are saved, so they can be retrieved by the application.
```{r save}
# SAVE ANALYSIS
normDge$counts <- cpm(normDge, log = TRUE)
deTab <- deTab[order(deTab$FDR),]
normDge$counts <- cpm(normDge, log = TRUE, prior.count = 1)
save(deTab, normDge, file = "analysis.RData")
```
Expand Down
9 changes: 5 additions & 4 deletions inst/src/markdown/analysisLimma.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ row.names(dge$genes) <- row.names(dge$counts)
dge <- dge[rowSums(abs(dge$counts)) > 1,]
tempDge <- dge
tempDge$counts <- cpm(dge, log = TRUE)
tempDge$counts <- cpm(dge, log = TRUE, prior.count = 1)
countDistributionLinePlot(tempDge)
```
Expand All @@ -134,7 +134,7 @@ The raw data is filtered based on the input values provided.
# GET SELECTED FEATURES
limmaV <- calcNormFactors(dge, method = "TMM")
counts <- cpm(limmaV, log = TRUE)
counts <- cpm(limmaV, log = TRUE, prior.count = 1)
selectedFeatures <- rownames(limmaV)[apply(counts, 1, function(v)
sum(v >= cpm_value)) >= 1 / 4 * ncol(counts)]
Expand All @@ -157,7 +157,7 @@ The filtered data is normalized using TMM.
normDge <- calcNormFactors(highExprDge, method = "TMM")
tempDge <- normDge
tempDge$counts <- cpm(normDge, log = TRUE)
tempDge$counts <- cpm(normDge, log = TRUE, prior.count = 1)
countDistributionLinePlot(tempDge)
samplePca2dPlot(tempDge, design_base, "PC1", "PC2")
Expand Down Expand Up @@ -257,7 +257,8 @@ Results are saved, so they can be retrieved by the application.
```{r save}
# SAVE ANALYSIS
normDge$counts <- cpm(normDge, log = TRUE)
deTab <- deTab[order(deTab$FDR),]
normDge$counts <- cpm(normDge, log = TRUE, prior.count = 1)
save(deTab, normDge, file = "analysis.RData")
```
Expand Down
2 changes: 1 addition & 1 deletion inst/src/markdown/enrichmentGProfiler2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ enrich <- gost(
ordered_query = FALSE,
significant = significant,
user_threshold = alfa,
correction_method = "bonferroni",
correction_method = "gSCS",
domain_scope = "annotated",
sources = database,
evcodes = TRUE
Expand Down
1 change: 1 addition & 0 deletions inst/src/tabs/analysis/svr_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ output[["group_analysis_bar"]] <- renderUI({
## Add specific gene to barplot
observe({
tryCatch({
checkReload()
updateSelectizeInput(
session = session,
inputId = 'selected_analysis_bar',
Expand Down
19 changes: 8 additions & 11 deletions inst/src/tabs/export/svr_export.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ datasetInput <- reactive({
## create filename and save data as CSV
output$downloadCSV <- downloadHandler(
filename = function() {
paste("shiny_analysis_", gsub(" ", "_", tolower(input$dataset_select)), ".csv", sep = "")
paste0("shiny_analysis_", gsub(" ", "_", tolower(input$dataset_select)), ".csv")
},
content = function(file) {
write.table(
Expand All @@ -62,7 +62,7 @@ output$downloadCSV <- downloadHandler(
## create filename and save data as TSV
output$downloadTSV <- downloadHandler(
filename = function() {
paste("shiny_analysis_", gsub(" ", "_", tolower(input$dataset_select)), ".tsv", sep = "")
paste0("shiny_analysis_", gsub(" ", "_", tolower(input$dataset_select)), ".tsv")
},
content = function(file) {
write.table(
Expand All @@ -77,22 +77,19 @@ output$downloadTSV <- downloadHandler(

## Download markdown HTML report DGE
output[["downloadDGE_HTML"]] <- downloadHandler(
filename = paste(input$analysis_method,
'_',
gsub('-', '', Sys.Date()),
'.html',
sep = ''),
filename = function() {
paste0(input$analysis_method, '_', gsub('-', '', Sys.Date()),'.html')
},
content <- function(file) {
file.copy(paste0('markdown/', input$analysis_method, '.html'), file)
}
)

## Download markdown HTML report Enrichment
output[["downloadENRICH_HTML"]] <- downloadHandler(
filename = paste('gprofiler_',
gsub('-', '', Sys.Date()),
'.html',
sep = ''),
filename = function() {
paste0('gprofiler_', gsub('-', '', Sys.Date()), '.html')
},
content <- function(file) {
file.copy(paste0('markdown/enrichmentGProfiler2.html'), file)
}
Expand Down
2 changes: 1 addition & 1 deletion inst/src/tabs/upload/svr_upload.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ get_raw_dge <- reactive({
samples = colData(se),
genes = rowData(se))
dge <- dge[rowSums(abs(dge$counts)) > 1,]
dge$counts <- cpm(dge, log = TRUE)
dge$counts <- cpm(dge, log = TRUE, prior.count = 1)
dge
})

Expand Down

0 comments on commit 250333b

Please sign in to comment.