Skip to content

Commit

Permalink
Qc heatmap (#390)
Browse files Browse the repository at this point in the history
* dna rna heatmap added

* dna rna heatmap added

* x label heatmap fixed

* x label heatmap fixed

* results display simplified

* fix no results scenario in overview

* results display simplified

* results display simplified

Co-authored-by: Vicente <yepez@in.tum.de>
Co-authored-by: nickhsmith <smithnickh@gmail.com>
  • Loading branch information
3 people committed Nov 12, 2022
1 parent 4d79fef commit 6da22cb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
34 changes: 17 additions & 17 deletions drop/modules/aberrant-expression-pipeline/OUTRIDER/Summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ ggplot(bcv_dt, aes(when, BCV)) +
#' ## Results
res <- fread(snakemake@input$results)

#' Total number of expression outliers: `r nrow(res)`
#' Total number of expression outliers: `r nrow(res)`
#' Samples with at least one outlier gene: `r res[, uniqueN(sampleID)]`

#'
#' ### Aberrant samples
#' An aberrant sample is one that has more than 0.1% of the expressed genes called as outliers.
#'
#' An aberrant sample is one that has more than 0.1% of the total genes called as outliers.
if (nrow(res) > 0) {
ab_table <- res[AberrantBySample > nrow(ods)/1000, .("Outlier genes" = .N), by = .(sampleID)] %>% unique
if (nrow(ab_table) > 0) {
Expand All @@ -125,25 +126,24 @@ if (nrow(res) > 0) {
} else {
print("no aberrant samples")
}
} else {
print('no results')
}
} else print("no aberrant samples")


#' ### Results table
#' ## Results table

## Save the results table in the html folder and provide link to download
## Save results table in the html folder and provide link to download
file <- snakemake@output$res_html
fwrite(res, file, sep = '\t', quote = F)
#+ echo=FALSE, results='asis'
cat(paste0("<a href='./", basename(file), "'>Download OUTRIDER results table</a>"))

res[, pValue := format(pValue, scientific = T, digits = 3)]
res[, padjust := format(padjust, scientific = T, digits = 3)]

DT::datatable(
head(res, 1000),
caption = 'OUTRIDER results (up to 1,000 rows shown)',
options=list(scrollX=TRUE),
filter = 'top'
)
if(nrow(res) > 0){
res[, pValue := format(pValue, scientific = T, digits = 3)]
res[, padjust := format(padjust, scientific = T, digits = 3)]

DT::datatable(head(res, 1000), caption = 'OUTRIDER results (up to 1,000 rows shown)',
options=list(scrollX=TRUE), filter = 'top')

} else print("no significant results")

#+ echo=FALSE, results='asis'
cat(paste0("<a href='./", basename(file), "'>Download OUTRIDER results table</a>"))
4 changes: 2 additions & 2 deletions drop/modules/mae-pipeline/QC/DNA_RNA_matrix_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ ann_colors[['status']] <- ann_colors[['status']][unique(c(dna_df$status, rna_df$

#+ Heatmap, fig.height=6, fig.width=8
pheatmap(qc_mat, color = color, cluster_rows = FALSE, cluster_cols = FALSE,
annotation_row = dna_df, annotation_col = rna_df, annotation_colors = ann_colors,
labels_row = 'DNA samples', labels_col = 'RNA samples')
annotation_row = dna_df, annotation_col = rna_df, annotation_colors = ann_colors,
labels_row = 'DNA samples', labels_col = 'RNA samples', angle_col = 0)


#' ## Identify matching samples
Expand Down
4 changes: 2 additions & 2 deletions drop/template/Scripts/AberrantExpression/Overview.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ DT::datatable(res, filter = 'top')

#' Choose a random gene and sample to plot. Outliers are in red.
#+ echo=TRUE
gene <- res[1, geneID]
sample <- res[1, sampleID]
gene <- ifelse(nrow(res)>1, res[1, geneID], rownames(ods)[1])
sample <- ifelse(nrow(res)>1, res[1, sampleID], colnames(ods)[1])

#' ### Volcano plot
#' setting basePlot = FALSE creates an interactive plot
Expand Down
2 changes: 1 addition & 1 deletion drop/template/Scripts/AberrantSplicing/Overview.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ DT::datatable(res, filter = 'top')

#' Get a splice site and sample of interest. Outliers are in red.
#+ echo=TRUE
sample <- res[1, sampleID]
sample <- ifelse(nrow(res)>1, res[1, sampleID], colnames(fds)[1])
siteIndex <- 4

#' ### Volcano plot
Expand Down

0 comments on commit 6da22cb

Please sign in to comment.