Check if DBA status and genotype are confounded by maturation stage using CIBERSORT.

Run essentially the code implemented by cibersort (https://cibersort.stanford.edu). Small differences incldue that we are using log2 normalized data and do not scale to mean=0, sd=1 prior to running SVR.

# Read in signature matrix and mixture
# sigMat_In Defines a set of features / referent cell type
# used to classify in unknown samples, which are encoded in mix_In
sigMat_In <- read_tsv("../processed/combined_SCAN_BN_SIG_GSE22552.txt")
mix_In <- readRDS("../processed/combined_SCAN_BN.rds")

# Reformat data.frames including gene subsetting
#mix_In <- data.frame(mix_In[,-1], row.names = as.character(mix_In[[1]]))
sigMat <- data.frame(sigMat_In[,-1], row.names = as.character(sigMat_In[[1]]))
mix <- mix_In[rownames(sigMat), ]

# Run CIBERSORT on input mixture (mix) using signature matrix (sigMat)
resmat <- sapply(1:dim(mix)[2], modelSample, mix, sigMat)
colnames(resmat) <- colnames(mix)
resdf <- data.frame(row.names = colnames(sigMat), resmat)
CIBERSORT.SCAN.BN.sigGSE22552 <- t(resdf)

# Annotation with sample information
samples <- read.table("../data/Samples.txt",sep="\t",stringsAsFactors=F)
names(samples) <- c("GSM","name","GSE","stage","group1","group2")
CIBERSORT.SCAN.BN.sigGSE22552 <- merge(CIBERSORT.SCAN.BN.sigGSE22552,samples,by.x="row.names",by.y="name")
CIBERSORT.SCAN.BN.sigGSE22552$group2 <- as.factor(CIBERSORT.SCAN.BN.sigGSE22552$group2)
CIBERSORT.GSE22552 <- CIBERSORT.SCAN.BN.sigGSE22552 #for convenience

# Read in signature matrix and mixture
# sigMat_In Defines a set of features / referent cell type
# used to classify in unknown samples, which are encoded in mix_In
sigMat_In <- read_tsv("../processed/combined_SCAN_BN_SIG_GSE24759.txt")
mix_In <- readRDS("../processed/combined_SCAN_BN.rds")

# Reformat data.frames including gene subsetting
#mix_In <- data.frame(mix_In[,-1], row.names = as.character(mix_In[[1]]))
sigMat <- data.frame(sigMat_In[,-1], row.names = as.character(sigMat_In[[1]]))
mix <- mix_In[rownames(sigMat), ]

# Run CIBERSORT on input mixture (mix) using signature matrix (sigMat)
resmat <- sapply(1:dim(mix)[2], modelSample, mix, sigMat)
colnames(resmat) <- colnames(mix)
resdf <- data.frame(row.names = colnames(sigMat), resmat)
CIBERSORT.SCAN.BN.sigGSE24759 <- t(resdf)

# Annotation with sample information
samples <- read.table("../data/Samples.txt",sep="\t",stringsAsFactors=F)
names(samples) <- c("GSM","name","GSE","stage","group1","group2")
CIBERSORT.SCAN.BN.sigGSE24759 <- merge(CIBERSORT.SCAN.BN.sigGSE24759,samples,by.x="row.names",by.y="name")
CIBERSORT.SCAN.BN.sigGSE24759$group2 <- as.factor(CIBERSORT.SCAN.BN.sigGSE24759$group2)
CIBERSORT.GSE24759 <- CIBERSORT.SCAN.BN.sigGSE24759 #for convenience

Deconvolved mixtures of reference set GSE22552 using GSE22552 cell types

Deconvolved mixtures of reference set GSE247599 using GSE22552 cell types

Deconvolved mixtures of reference set GSE24759 using GSE24759 cell types

Deconvolved mixtures of reference set GSE22552 using GSE24759 cell types

Deconvolved mixtures of O’Brien et al. CD235a+/CD235a- mixtures using GSE22552 cell types

Deconvolved mixtures of O’Brien et al. CD235a- DBA genotype mixtures using GSE22552 cell types

Deconvolved mixtures of O’Brien et al. CD235a+ DBA genotype mixtures using GSE22552 cell types

Deconvolved mixtures of O’Brien et al. CD235a+/CD235a- mixtures using GSE24759 cell types

Deconvolved mixtures of O’Brien et al. CD235a- DBA genotype mixtures using GSE24759 cell types

Deconvolved mixtures of O’Brien et al. CD235a+ DBA genotype mixtures using GSE24759 cell types

Save deconvolved mixtures of O’Brien et al. CD235a- DBA genotype mixtures using GSE22552 cell types for synthetic normals.