Skip to contents

QuantifyDropout estimates the percentage of 4-thiouridine containing RNA that was lost during library preparation (pdo).

Usage

QuantifyDropout(
  obj,
  scale_init = 1.05,
  pdo_init = 0.3,
  keep_data = FALSE,
  no_message = FALSE,
  ...
)

Arguments

obj

bakRFit object

scale_init

Numeric; initial estimate for -s4U/+s4U scale factor. This is the factor difference in RPM normalized read counts for completely unlabeled transcripts (i.e., highly stable transcript) between the +s4U and -s4U samples.

pdo_init

Numeric; initial estimtae for the dropout rate. This is the probability that an s4U labeled RNA molecule is lost during library prepartion.

keep_data

Logical; if TRUE, will return list with two elements. First element is the regular return (data frame with dropout quantified), and the second element will be the data frame that was used for fitting the dropout model. This is useful if wanting to visualize the fit. See Return documetation for more details

no_message

Logical; if TRUE, will not output message regarding estimated rates of dropout in each sample

...

Additional (optional) parameters to be passed to stats::nls()

Value

If keep_data is FALSE, then only a data frame with the dropout rate estimates (pdo) in each sample is returned. If keep_data is TRUE, then a list with two elements is returned. One element is the pdo data frame always returned, and the second is the data frame containing information passed to stats::nls for pdo estimation.

Examples

# \donttest{
# Simulate data for 500 genes and 2 replicates with 40% dropout
sim <- Simulate_relative_bakRData(500, depth = 100000,
                                  nreps = 2, p_do = 0.4)

# Fit data with fast implementation
Fit <- bakRFit(sim$bakRData)
#> Finding reliable Features
#> Filtering out unwanted or unreliable features
#> Processing data...
#> Estimating pnew with likelihood maximization
#> Estimating unlabeled mutation rate with -s4U data
#> Estimated pnews and polds for each sample are:
#> # A tibble: 4 × 4
#> # Groups:   mut [2]
#>     mut  reps   pnew     pold
#>   <int> <dbl>  <dbl>    <dbl>
#> 1     1     1 0.0505 0.000990
#> 2     1     2 0.0500 0.000990
#> 3     2     1 0.0496 0.000990
#> 4     2     2 0.0507 0.000990
#> Estimating fraction labeled
#> Estimating per replicate uncertainties
#> Estimating read count-variance relationship
#> Averaging replicate data and regularizing estimates
#> Assessing statistical significance
#> All done! Run QC_checks() on your bakRFit object to assess the 
#>             quality of your data and get recommendations for next steps.

# Quantify dropout
Fit <- QuantifyDropout(Fit)
#> Estimated rates of dropout are:
#>   Exp_ID Replicate       pdo
#> 1      1         1 0.4572838
#> 2      1         2 0.3851714
#> 3      2         1 0.3689490
#> 4      2         2 0.3842997

# }