Skip to contents

VisualizeDropout fits dropout model with QuantifyDropout, reports the fit results, and then generates a ggplot object showing the data used to infer the fit as well as the fitted nonlinear trend.

Usage

VisualizeDropout(obj, keep_data = FALSE, no_message = FALSE)

Arguments

obj

bakRFit or bakRFnFit object

keep_data

Logical; if TRUE, will return data used to make plots along with the plots themselves

no_message

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

Value

If keep_data is FALSE, then a list of ggplot objects are returned, one for each +s4U sample. The plots show the relationship between a feature's fraction new and the difference between its +s4U and -s4U read coverage. Nonlinear-least squares fit is plotted on top of points as a blue line. If keep_data is TRUE, then the data used to make the plots is returned in addition to the list of plots.

Examples

# \donttest{
# Simulate data for 500 genes and 2 replicates with 40% dropout
sim <- Simulate_relative_bakRData(500, 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.0501 0.000994
#> 2     1     2 0.0498 0.000994
#> 3     2     1 0.0496 0.000994
#> 4     2     2 0.0495 0.000994
#> 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
DO_plots <- VisualizeDropout(Fit)
#> Estimated rates of dropout are:
#>   Exp_ID Replicate       pdo
#> 1      1         1 0.3164471
#> 2      1         2 0.3421913
#> 3      2         1 0.1837127
#> 4      2         2 0.2020429

# }