Skip to contents

Reads 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.

Usage

rsem_noise_qc(data = "data", metadata = NULL, sample_from = "filename")

Arguments

data

Directory that contains the RSEM files.

metadata

Path to the metadata CSV, or NULL to find the files in data (see Input).

sample_from

With metadata = NULL: "filename" (the default) or "parent_dir".

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