The share of reads that RSEM explains as background noise
Source:R/rsem_model_qc.R
rsem_noise_qc.RdReads the *.theta file that rsem-calculate-expression writes (in
<name>.stat/<name>.theta) and returns the first value of the estimated
read-generating probabilities: the share of reads from the noise isoform that
RSEM adds to its model. The file has the number of values on its first
line, the probabilities before a correction on the second line, and after
it on the third line (the correction takes the reads of transcripts with an
effective length of 0 out); the third line is the one RSEM's simulator
uses as the noise share.
Value
A data frame with one row per sample: sample_id,
n_components (the number of values per line, the noise and the
transcripts), noise_fraction (third line) and noise_fraction_uncorrected
(second line).
Details
The noise share is not the share of unalignable reads of
rsem_mapping_qc(): in the toy data of this package, where the only
reads that align nowhere are the added ones, the second-line value equals
N0 / N_tot and the third-line value N0 / (N_tot - reads of the transcript with effective length 0), but in real data noise also takes alignable reads
that no transcript explains. It depends on the model and the reference, and
is for comparing samples of one data set, not a quality threshold.
Examples
f <- tempfile(fileext = ".theta")
writeLines(c("3", "0.1 0.5 0.4", "0.125 0.5 0.375"), f)
rsem_noise_qc(dirname(f), metadata = NULL)
#> rsem_noise_qc: found 1 files under '/tmp/RtmpgxnUiw' (sample ID from the file name):
#> file182d25e57fb1 <- file182d25e57fb1.theta
#> rsem_noise_qc: 1 samples; noise fraction 0.125 to 0.125
#> sample_id n_components noise_fraction noise_fraction_uncorrected
#> 1 file182d25e57fb1 3 0.125 0.1