forked from TencentAILabHealthcare/MLA-GNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWGCNA_gbmlgg.R
26 lines (20 loc) · 876 Bytes
/
WGCNA_gbmlgg.R
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
### For each split of the features, perform WGCNA and generate adjacency matrix.
data_folder = "./data/RNAseq_graph/RNAseq"
output_folder = "./data/RNAseq_graph/wgcna_output"
cancer = "GBMLGG"
data_file = paste(data_folder, cancer, "split15_train_320d_features_labels.csv", sep='/')
dir.create(paste(output_folder, cancer, sep='/'))
# WGCNA parameters
wgcna_power = 6
wgcna_minModuleSize = 10
wgcna_mergeCutHeight = 0.25
data = read.csv(data_file, header=F) # each row is a patient
geneExp = as.matrix(data[2:dim(data)[1], 83:322])
# gene as columns for WGCNA
# geneExp = t(geneExp)
dim(geneExp)
## imputate the NA by zero values.
geneExp[is.na(geneExp)]<-0
library(WGCNA)
adjacency = adjacency(geneExp, power = wgcna_power)
write.csv(adjacency,file=paste(output_folder, cancer, "split15_adjacency_matrix.csv", sep='/'),quote=F,row.names = F)