knitr::opts_chunk$set( fig.path = "man/figures/")

The input data set is a tidy representation of a differential gene transcript abundance analysis

library(dplyr)
library(ggplot2)
library(ppcseq)
library(dplyr)
library(magrittr)

To install:

Before install, for linux systems, in order to exploit multi-threading, from R write (without changing anything of the code):

dir.create(file.path("~/", ".R"), showWarnings = FALSE)
fileConn<-file("~/.R/Makevars")
writeLines(c( "CXX14FLAGS += -O3","CXX14FLAGS += -DSTAN_THREADS", "CXX14FLAGS += -pthread"), fileConn)
close(fileConn)

Then, install with

devtools::install_github("stemangiola/ppcseq")

You can get the test dataset with

data("counts")
counts 

You can identify anrtefactual calls from your differential transcribt anundance analysis, due to outliers.

# Import libraries


counts.ppc = 
    counts |>
    mutate(is_significant = FDR < 0.01) |>
    identify_outliers(
        formula = ~ Label,
        .sample = sample, 
        .transcript = symbol,
        .abundance = value,
        .significance = PValue,
        .do_check = is_significant,
        percent_false_positive_genes = 5
    )

The new posterior predictive check has been added to the original data frame

counts.ppc 

The new data frame contains plots for each gene

We can visualise the top five differentially transcribed genes

counts.ppc_plots = 
    counts.ppc |> 
    plot_credible_intervals() 
counts.ppc_plots |>
    pull(plot) |> 
    head(2)


stemangiola/ppcSeq documentation built on Sept. 19, 2023, 6:30 p.m.