This uses the output of bakR and a differential expression analysis software to construct a dataframe that can be passed to pheatmap::pheatmap(). This heatmap will display the result of a steady-state quasi-independent analysis of NR-seq data.
Usage
NSSHeat(
bakRFit,
DE_df,
bakRModel = c("MLE", "Hybrid", "MCMC"),
DE_cutoff = 0.05,
bakR_cutoff = 0.05,
Exp_ID = 2,
lid = 4
)
Arguments
- bakRFit
bakRFit object
- DE_df
dataframe of required format with differential expression analysis results. See Further-Analyses vignette for details on what this dataframe should look like
- bakRModel
Model fit from which bakR implementation should be used? Options are MLE, Hybrid, or MCMC
- DE_cutoff
padj cutoff for calling a gene differentially expressed
- bakR_cutoff
padj cutoff for calling a fraction new significantly changed
- Exp_ID
Exp_ID of experimental sample whose comparison to the reference sample you want to use. Only one reference vs. experimental sample comparison can be used at a time
- lid
Maximum absolute value for standardized score present in output. This is for improving aesthetics of any heatmap generated with the output.
Examples
# \donttest{
# Simulate small dataset
sim <- Simulate_bakRData(100, nreps = 2)
# Analyze data with bakRFit
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.00103
#> 2 1 2 0.0496 0.00103
#> 3 2 1 0.0499 0.00103
#> 4 2 2 0.0500 0.00103
#> 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.
# Number of features that made it past filtering
NF <- nrow(Fit$Fast_Fit$Effects_df)
# Simulate mock differential expression data frame
DE_df <- data.frame(XF = as.character(1:NF),
L2FC_RNA = stats::rnorm(NF, 0, 2))
DE_df$DE_score <- DE_df$L2FC_RNA/0.5
DE_df$DE_se <- 0.5
DE_df$DE_pval <- 2*stats::dnorm(-abs(DE_df$DE_score))
DE_df$DE_padj <- 2*stats::p.adjust(DE_df$DE_pval, method = "BH")
# perform NSS analysis
NSS_analysis <- DissectMechanism(bakRFit = Fit,
DE_df = DE_df,
bakRModel = "MLE")
#> Combining bakR and DE analyses
#> Calculating mechanism p-value. This could take several minutes...
#> Assessing differential synthesis
#> Constructing Heatmap_df
# }