library(bcbioRNASeq)

# Shared RMarkdown settings
prepareRNASeqTemplate()
if (file.exists("setup.R")) {
    source("setup.R")
}

# Directory paths
outputDir <- params$outputDir
dataDir <- file.path(outputDir, "data")
countsDir <- file.path(outputDir, "results", "counts")

# Load bcbio run
if (!file.exists(file.path(dataDir, "bcb.rda"))) {
    bcb <- loadRNASeqRun(
        params$uploadDir,
        interestingGroups = params$interestingGroups,
        params = params)
    saveData(bcb, dir = dataDir)
} else {
    load(file.path(dataDir, "bcb.rda"))
}
## Warning in .local(object, ...): rowData mismatch with assay
## slot: ENSMUSG00000029333, ENSMUSG00000042402, ENSMUSG00000045946,
## ENSMUSG00000050431, ENSMUSG00000050781, ENSMUSG00000051052 ... These gene
## IDs are missing in the current Ensembl release.

Overview


bcbio run data was imported from /home/travis/build/hbc/bcbio_rnaseq_output_example.

> metadataTable(bcb)
Sample metadata
sampleID sampleName group
group1_1 group1_1 ctrl
group1_2 group1_2 ctrl
group2_1 group2_1 ko
group2_2 group2_2 ko
> rawCounts <- counts(bcb, normalized = FALSE)
> normalizedCounts <- counts(bcb, normalized = TRUE)
> tpm <- tpm(bcb)
> saveData(rawCounts, normalizedCounts, tpm, dir = dataDir)
> writeCounts(rawCounts, normalizedCounts, tpm, dir = countsDir)

Read metrics

Total reads

> plotTotalReads(bcb)

Mapped reads

The number of mapped reads should correspond to the number of total reads.

> plotMappedReads(bcb)

Mapping rate

The genomic mapping rate represents the percentage of reads mapping to the reference genome. Low mapping rates are indicative of sample contamination, poor sequencing quality or other artifacts.

> plotMappingRate(bcb)

Number of genes detected

> plotGenesDetected(bcb)

Gene detection saturation

We should observe a linear trend in the number of genes detected with the number of mapped reads, which indicates that the sample input was not overloaded.

> plotGeneSaturation(bcb)