-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoct-06-calcZLFC.R
More file actions
16 lines (13 loc) · 1001 Bytes
/
noct-06-calcZLFC.R
File metadata and controls
16 lines (13 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env Rscript
# # calculate the z-scores of log2 fold changes from DESeq2 to use as a more robust
# # iPAGE input
dataPath<- '~/data/noct/humanOE/revision/z-iPAGE/'
deseqResFilename <- paste(dataPath, '20191220-noct-patched.newDESeq2Shrinkage.csv', sep = '')
deseqResTbl <- read.table(deseqResFilename, header = TRUE, sep = ',', quote = '"', stringsAsFactors = FALSE)
# print(head(deseqResTbl))
modTbl <- deseqResTbl # modified table
modTbl[, 'stat_shrunken'] <- modTbl[, 'log2FoldChange'] / modTbl[, 'lfcSE']
# print(head(modTbl[, c(1:5, 8, 6:7)]))
source('~/projects/styles/R/general.R')
write.table(modTbl[, c(1:5, 8, 6:7)], getOutFilename(saveTo = dataPath, proj = 'noct', name = 'z_shrunken_full', suffix = '.csv'), sep = ',', row.names = FALSE, col.names = TRUE, quote = TRUE)
write.table(modTbl[, c('X', 'stat_shrunken')], getOutFilename(saveTo = dataPath, proj = 'noct', name = 'z_shrunken_input', suffix = '.tsv'), sep = '\t', row.names = FALSE, col.names = FALSE, quote = FALSE)