[8e0848]: / Statistical_analysis_correlations_Reddy.R

Download this file

61 lines (42 with data), 2.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
GIT_HOME="/research/users/ppolonen/git_home/ImmunogenomicLandscape-BloodCancers/"
source(file.path(GIT_HOME, "common_scripts/statistics/functions_statistics.R"))
source(file.path(GIT_HOME, "common_scripts/featurematrix/compute.pairwise.R"))
source(file.path(GIT_HOME, "common_scripts/featurematrix/functions_generate_fm.R"))
library(data.table)
library(parallel)
setwd("/research/groups/sysgen/PROJECTS/HEMAP_IMMUNOLOGY/petri_work/HEMAP_IMMUNOLOGY/Published_data_figures")
fm=get(load("REDDY_DLBCL_fm.Rdata"))
name=""
# fm=fm[,fm["B:CLIN:ABC_GCB_RNAseq_GCB",]==1]
# name="_GCB"
#
# fm=fm[,fm["B:CLIN:ABC_GCB_RNAseq_ABC",]==1]
# name="_ABC"
genelist=gsub(".:SAMP:", "", grep("Score", rownames(fm), value=T))
fm.rm=fm[grepl("CNVR", rownames(fm)),]
filt=rowSums(fm.rm>0.7|fm.rm<(-0.7), na.rm = T)<dim(fm.rm)[2]*0.025
extrafeatures=c(grep("CLIN|GNAB|SAMP:", rownames(fm), value=T), rownames(fm.rm)[filt])
extrafeatures=extrafeatures[!(grepl("Score",extrafeatures)&grepl("B:", extrafeatures))]
extrafeatures=extrafeatures[!grepl("CGA|Cytolytic|pos_Cells|neg_Cells",extrafeatures)]
# HLA Score associations:
l.regulon.gene=regulon.feats(fm, genelist)
results=pairwise.correlation(l.regulon.gene[grep("HLA", names(l.regulon.gene))], fm, extrafeatures,filter.val = 5, cores=10, adjust.method = "BH", fisher.alternative = "greater")
results2=filter.pairwise.res(results)
#***********************************************************************
fwrite(results2, paste0("TableS4_Reddy_DLBCL_HLA_correlations", name, ".tsv"), sep ="\t")
#***********************************************************************
# Cytolytic Score associations:
results=pairwise.correlation(l.regulon.gene[grep("CytolyticScore", names(l.regulon.gene))], fm, extrafeatures,filter.val = 5, cores=10, adjust.method = "BH", fisher.alternative = "greater", use.wilcox = T)
results2=filter.pairwise.res(results)
#***********************************************************************
fwrite(results2, paste0("TableS3_Reddy_DLBCL_CytScore_correlations", name, ".tsv"), sep ="\t")
#***********************************************************************
# Immunomodulatory associations:
d=fread("costim_ligands_final.txt", data.table = F)
genelist=unique(d[,1])
l.regulon.gene=regulon.feats(fm, genelist, filtertypes = "B:GEXP")
results=pairwise.correlation(l.regulon.gene = l.regulon.gene, fm, extrafeatures, filter.val = 5, cores=10, adjust.method = "BH", fisher.alternative = "greater")
results2=filter.pairwise.res(results)
#***********************************************************************
fwrite(results2, paste0("TableS5_Reddy_DLBCL_costim_correlations", name, ".tsv"), sep ="\t")
#***********************************************************************