J. Taroni 2018
In this notebook, we work with microdissected glomeruli data from patients with nephrotic syndrome, patients with ANCA-associated vasculitis, and living donors.
First, we’ll apply the recount2 PLIER model and then we will test those LVs for differential expression between the three groups.
`%>%` <- dplyr::`%>%`
source(file.path("util", "test_LV_differences.R"))
source(file.path("util", "plier_util.R"))
# plot and result directory setup for this notebook
plot.dir <- file.path("plots", "20")
dir.create(plot.dir, recursive = TRUE, showWarnings = FALSE)
results.dir <- file.path("results", "20")
dir.create(results.dir, recursive = TRUE, showWarnings = FALSE)
ercb.file <- file.path("data", "expression_data",
"ERCB_Glom_CustCDF19_forVCRC.txt")
exprs.df <- readr::read_tsv(ercb.file)
Parsed with column specification:
cols(
.default = col_double(),
EntrezGeneID = col_integer(),
GeneSymbol = col_character()
)
See spec(...) for full column specifications.
|============== | 8% 1 MB
|================ | 9% 1 MB
|================= | 10% 1 MB
|================== | 11% 1 MB
|=================== | 11% 1 MB
|===================== | 12% 1 MB
|====================== | 13% 2 MB
|======================= | 14% 2 MB
|======================== | 14% 2 MB
|========================== | 15% 2 MB
|=========================== | 16% 2 MB
|============================ | 17% 2 MB
|============================= | 17% 2 MB
|=============================== | 18% 2 MB
|================================ | 19% 2 MB
|================================= | 20% 3 MB
|================================== | 20% 3 MB
|=================================== | 21% 3 MB
|===================================== | 22% 3 MB
|====================================== | 23% 3 MB
|======================================= | 23% 3 MB
|======================================== | 24% 3 MB
|========================================== | 25% 3 MB
|=========================================== | 26% 3 MB
|============================================ | 26% 4 MB
|============================================= | 27% 4 MB
|=============================================== | 28% 4 MB
|================================================ | 29% 4 MB
|================================================= | 29% 4 MB
|================================================== | 30% 4 MB
|==================================================== | 31% 4 MB
|===================================================== | 32% 4 MB
|====================================================== | 32% 4 MB
|======================================================= | 33% 5 MB
|========================================================= | 34% 5 MB
|========================================================== | 35% 5 MB
|=========================================================== | 35% 5 MB
|============================================================ | 36% 5 MB
|============================================================== | 37% 5 MB
|=============================================================== | 38% 5 MB
|================================================================ | 38% 5 MB
|================================================================= | 39% 5 MB
|=================================================================== | 40% 6 MB
|==================================================================== | 41% 6 MB
|===================================================================== | 41% 6 MB
|====================================================================== | 42% 6 MB
|======================================================================= | 43% 6 MB
|========================================================================= | 44% 6 MB
|========================================================================== | 44% 6 MB
|=========================================================================== | 45% 6 MB
|============================================================================ | 46% 6 MB
|============================================================================== | 47% 7 MB
|=============================================================================== | 47% 7 MB
|================================================================================ | 48% 7 MB
|================================================================================= | 49% 7 MB
|=================================================================================== | 50% 7 MB
|==================================================================================== | 50% 7 MB
|===================================================================================== | 51% 7 MB
|====================================================================================== | 52% 7 MB
|======================================================================================== | 53% 7 MB
|========================================================================================= | 53% 8 MB
|========================================================================================== | 54% 8 MB
|=========================================================================================== | 55% 8 MB
|============================================================================================= | 56% 8 MB
|============================================================================================== | 56% 8 MB
|=============================================================================================== | 57% 8 MB
|================================================================================================ | 58% 8 MB
|================================================================================================== | 59% 8 MB
|=================================================================================================== | 59% 8 MB
|==================================================================================================== | 60% 9 MB
|===================================================================================================== | 61% 9 MB
|====================================================================================================== | 62% 9 MB
|======================================================================================================== | 62% 9 MB
|========================================================================================================= | 63% 9 MB
|========================================================================================================== | 64% 9 MB
|=========================================================================================================== | 65% 9 MB
|============================================================================================================= | 65% 9 MB
|============================================================================================================== | 66% 10 MB
|=============================================================================================================== | 67% 10 MB
|================================================================================================================ | 68% 10 MB
|================================================================================================================== | 68% 10 MB
|=================================================================================================================== | 69% 10 MB
|==================================================================================================================== | 70% 10 MB
|===================================================================================================================== | 71% 10 MB
|======================================================================================================================= | 71% 10 MB
|======================================================================================================================== | 72% 10 MB
|========================================================================================================================= | 73% 11 MB
|========================================================================================================================== | 74% 11 MB
|============================================================================================================================ | 74% 11 MB
|============================================================================================================================= | 75% 11 MB
|============================================================================================================================== | 76% 11 MB
|=============================================================================================================================== | 76% 11 MB
|================================================================================================================================= | 77% 11 MB
|================================================================================================================================== | 78% 11 MB
|=================================================================================================================================== | 79% 11 MB
|==================================================================================================================================== | 79% 12 MB
|====================================================================================================================================== | 80% 12 MB
|======================================================================================================================================= | 81% 12 MB
|======================================================================================================================================== | 82% 12 MB
|========================================================================================================================================= | 82% 12 MB
|========================================================================================================================================== | 83% 12 MB
|============================================================================================================================================ | 84% 12 MB
|============================================================================================================================================= | 85% 12 MB
|============================================================================================================================================== | 85% 12 MB
|=============================================================================================================================================== | 86% 13 MB
|================================================================================================================================================= | 87% 13 MB
|================================================================================================================================================== | 88% 13 MB
|=================================================================================================================================================== | 88% 13 MB
|==================================================================================================================================================== | 89% 13 MB
|====================================================================================================================================================== | 90% 13 MB
|======================================================================================================================================================= | 91% 13 MB
|======================================================================================================================================================== | 91% 13 MB
|========================================================================================================================================================= | 92% 13 MB
|=========================================================================================================================================================== | 93% 14 MB
|============================================================================================================================================================ | 94% 14 MB
|============================================================================================================================================================= | 94% 14 MB
|============================================================================================================================================================== | 95% 14 MB
|================================================================================================================================================================ | 96% 14 MB
|================================================================================================================================================================= | 97% 14 MB
|================================================================================================================================================================== | 97% 14 MB
|=================================================================================================================================================================== | 98% 14 MB
|=====================================================================================================================================================================| 99% 14 MB
|======================================================================================================================================================================| 100% 15 MB
exprs.df <- dplyr::select(exprs.df, -EntrezGeneID)
colnames(exprs.df)[1] <- "Gene"
agg.exprs.df <- PrepExpressionDF(exprs.df)
# any genes that don't have a gene symbol need to be dropped
agg.exprs.df <- dplyr::filter(agg.exprs.df, !(is.na(Gene)))
readr::write_tsv(agg.exprs.df, path = file.path("data", "expression_data",
"ERCB_Glom_mean_agg.pcl"))
# as a matrix for use with PLIER
exprs.mat <- as.matrix(dplyr::select(agg.exprs.df, -Gene))
rownames(exprs.mat) <- agg.exprs.df$Gene
clinical.file <- file.path("data", "sample_info", "ERCB_glom_diagnosis.tsv")
diagnosis.df <- readr::read_tsv(clinical.file)
Parsed with column specification:
cols(
Sample = col_character(),
Diagnosis = col_character()
)
# load model itself
recount.plier <- readRDS(file.path("data", "recount2_PLIER_data",
"recount_PLIER_model.RDS"))
# project
recount.b <- GetNewDataB(exprs.mat = as.matrix(exprs.mat),
plier.model = recount.plier)
Loading required package: PLIER
Loading required package: RColorBrewer
Loading required package: gplots
Attaching package: ‘gplots’
The following object is masked from ‘package:stats’:
lowess
Loading required package: pheatmap
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-13
Loading required package: knitr
Loading required package: rsvd
Loading required package: qvalue
# save B matrix to file
b.file <- file.path(results.dir, "ERCB_glom_recount2_B.RDS")
saveRDS(recount.b, file = b.file)
LVTestWrapper(b.matrix = recount.b,
sample.info.df = diagnosis.df,
phenotype.col = "Diagnosis",
file.lead = "ERCB_glom_recount2_model",
plot.dir = plot.dir,
results.dir = results.dir)
Column `Sample` joining factor and character vector, coercing into character vector
$limma
$b.df
NA