Skip to contents

This function creates a 2-component PCA plot using logit(fn) estimates. FnPCA has been deprecated in favor of FnPCA2. The latter accepts a full bakRFit as input and handles imbalanced replicates.

Usage

FnPCA(obj, log_kdeg = FALSE)

Arguments

obj

Object contained within output of bakRFit. So, either Fast_Fit (MLE implementation fit), Stan_Fit (MCMC implementation fit), or Hybrid_Fit (Hybrid implementation fit)

log_kdeg

Boolean; if TRUE, then log(kdeg) estimates used for PCA rather than logit(fn). Currently only compatible with Fast_Fit

Value

A ggplot object.

Examples

# \donttest{
# Simulate data for 500 genes and 2 replicates
sim <- Simulate_bakRData(500, nreps = 2)

# 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.0500 0.000995
#> 2     1     2 0.0500 0.000995
#> 3     2     1 0.0499 0.000995
#> 4     2     2 0.0499 0.000995
#> 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.

# Fn PCA
FnPCA2(Fit, Model = "MLE")


# log(kdeg) PCA
FnPCA2(Fit, Model = "MLE", log_kdeg = TRUE)


# }