The fragment length distribution and read start positions learned by RSEM
Source:R/rsem_model_qc.R
rsem_model_qc.RdReads the *.model file that rsem-calculate-expression writes (in
<name>.stat/<name>.model) for every sample, and returns what RSEM learned
about the library: the fragment length distribution (or the read length
distribution of single-end reads) and, when it was estimated, the read start
position distribution (RSPD), as numbers that can be compared between
samples. The plots of one sample are made by RSEM's own rsem-plot-model;
this function does not draw.
Value
A list of data frames:
sample_summary: per samplemodel_type,forward_prob,length_lowerandlength_upper(bounds of the distribution),length_mean,length_sdandlength_modeof the fragment (or read) lengths,rspd_estimatedandrspd_bins;length_distribution:sample_id,length,probability;rspd:sample_id,binandprobability, only for the samples in which it was estimated.
What is read
Following RSEM's model_file_description.txt: the model type (0 single-end
without quality scores, 1 single-end with, 2 paired-end without, 3
paired-end with), the probability of a read from the forward strand, the
fragment length distribution ((lower, upper], one probability per length),
the optional read length distribution of single-end models, and the read
start position distribution (bins of a transcript). The sections after
these (quality scores, sequencing error) are not read. In the files RSEM
1.3.3 wrote for the test data of this package, the number of bins and their
probabilities follow the flag only when the RSPD was estimated
(--estimate-rspd); without it the flag is followed by the next section.
forward_prob is the strand probability that the run was given (--strandedness,
or 0.5 for none), written into the model; it is not learned from the reads.
Without --estimate-rspd RSEM assumes that reads start uniformly along a
transcript, so a flat RSPD is not evidence that the library has no 3'
bias; rspd_estimated says which case it is. With single-end reads and no
--fragment-length-mean, the distribution is that of the reads, not of the
fragments.
Examples
f <- tempfile(fileext = ".model")
writeLines(c("0", "", "0.5", "", "9 13 4", "0.1 0.4 0.4 0.1", "", "0", "", "1", "2", "0.25 0.75"), f)
rsem_model_qc(dirname(f), metadata = NULL)$sample_summary
#> rsem_model_qc: found 1 files under '/tmp/RtmpgxnUiw' (sample ID from the file name):
#> file182d43a60999 <- file182d43a60999.model
#> rsem_model_qc: 1 samples; mean fragment length 11.5 to 11.5; read start positions estimated for 1
#> sample_id model_type forward_prob length_lower length_upper
#> 1 file182d43a60999 0 0.5 9 13
#> length_mean length_sd length_mode rspd_estimated rspd_bins
#> 1 11.5 0.8062258 11 TRUE 2