Number of samples: 100
Number of expressed genes: 17278

Visualize

Encoding dimension

plotEncDimSearch(ods) +
  labs(title = dataset_title) +
  theme_cowplot() +
  background_grid() +
  scale_color_brewer(palette="Dark2")

Aberrantly expressed genes per sample

plotAberrantPerSample(ods, main = dataset_title, 
                      padjCutoff = snakemake@params$padjCutoff,
                      zScoreCutoff = snakemake@params$zScoreCutoff)

Batch correction

plotCountCorHeatmap(ods, normalized = FALSE, colGroups = "isExternal", colColSet = "Dark2",
                    main = paste0('Raw Counts (', dataset_title, ')'))

plotCountCorHeatmap(ods, normalized = TRUE, colGroups = "isExternal", colColSet = "Dark2",
                    main = paste0('Normalized Counts (', dataset_title, ')'))

Expression by gene per sample

plotCountGeneSampleHeatmap(ods, normalized = FALSE, nGenes = 50, colGroups = "isExternal", colColSet = "Dark2",
                           main = paste0('Raw Counts (', dataset_title, ')'),
                           bcvQuantile = .95, show_names = 'row')

plotCountGeneSampleHeatmap(ods, normalized = TRUE, nGenes = 50, colGroups = "isExternal", colColSet = "Dark2",
                           main = paste0('Normalized Counts (',dataset_title,')'),
                           bcvQuantile = .95, show_names = 'row')

BCV - Biological coefficient of variation

# function to calculate BCV before autoencoder
estimateThetaWithoutAutoCorrect <- function(ods){
  
  ods1 <- OutriderDataSet(countData=counts(ods), colData=colData(ods))
  # use rowMeans as expected means
  normalizationFactors(ods1) <- matrix(rowMeans(counts(ods1)), 
                                       ncol=ncol(ods1), nrow=nrow(ods1))
  ods1 <- fit(ods1)
  theta(ods1)
  
  return(theta(ods1))
}

before <- data.table(when = "Before",
                     BCV = 1/sqrt(estimateThetaWithoutAutoCorrect(ods)))
after <- data.table(when = "After", BCV = 1/sqrt( theta( ods )))
bcv_dt <- rbind(before, after)

# boxplot of BCV Before and After Autoencoder
ggplot(bcv_dt, aes(when, BCV)) +
  geom_boxplot() +
  theme_bw(base_size = 14) +
  labs(x = "Autoencoder correction", y = "Biological coefficient \nof variation",
       title = dataset_title)

Results

res <- fread(snakemake@input$results)

Total number of expression outliers: 279
Samples with at least one outlier gene: 73

Aberrant samples

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) {
    setorder(ab_table, "Outlier genes") 
    DT::datatable(ab_table)
  } else {
    print("no aberrant samples")
  }
} else print("no aberrant samples")

Results table

## Save results table in the html folder and provide link to download
file <- snakemake@output$res_html
fwrite(res, file, sep = '\t', quote = F)


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")

Download OUTRIDER results table

IyctLS0KIycgdGl0bGU6ICJPVVRSSURFUiBTdW1tYXJ5OiBgciBwYXN0ZShzbmFrZW1ha2VAd2lsZGNhcmRzJGRhdGFzZXQsIHNuYWtlbWFrZUB3aWxkY2FyZHMkYW5ub3RhdGlvbiwgc2VwID0gJy0tJylgIgojJyBhdXRob3I6IG11bWljaGFlLCB2eWVwZXoKIycgd2I6CiMnICBsb2c6CiMnICAgLSBzbmFrZW1ha2U6ICdgc20gc3RyKHRtcF9kaXIgLyAiQUUiIC8gInthbm5vdGF0aW9ufSIgLyAie2RhdGFzZXR9IiAvICJPVVRSSURFUl9zdW1tYXJ5LlJkcyIpYCcKIycgIHBhcmFtczoKIycgICAtIHBhZGpDdXRvZmY6ICdgc20gY2ZnLkFFLmdldCgicGFkakN1dG9mZiIpYCcKIycgICAtIHpTY29yZUN1dG9mZjogJ2BzbSBjZmcuQUUuZ2V0KCJ6U2NvcmVDdXRvZmYiKWAnCiMnICBpbnB1dDoKIycgICAtIG9kczogJ2BzbSBjZmcuZ2V0UHJvY2Vzc2VkUmVzdWx0c0RpcigpICsKIycgICAgICAgICAgICIvYWJlcnJhbnRfZXhwc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