-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8.usePMTs.tg.R
45 lines (36 loc) · 1.46 KB
/
8.usePMTs.tg.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# function to print out which PMTs to include in the final processing
usePMTs <- function(inputPath = ".") {
alldirs <- basename(list.dirs(path = inputPath, recursive = F))
gpr.dirs <- alldirs[grepl("_gpr$",alldirs)]
# list all gpr files
gpr.files <- list.files(gpr.dirs, pattern = ".gpr$", recursive = T, include.dirs = F)
# extract unique pmts from all gprs files
all.pmts <- unique(sapply(gpr.files, function(x){
strsplit(strsplit(x[1],"/")[[1]][2], "_")[[1]][3]
}))
# extract total protein gpr files
protein.gprs <- gpr.files[grepl("protein", gpr.files, ignore.case = T)]
# extract unique pmts from all total protein gpr files
protein.pmts <- unique(sapply(protein.gprs, function(x){
strsplit(strsplit(x[1],"/")[[1]][2], "_")[[1]][3]
}))
# exclude PMTs only used for total proteins in the final processing
# saving the PMTs to be included
keep.pmts <- setdiff(all.pmts, protein.pmts)
# printing out full list of PMTs
cat("#### FULL LIST OF PMTS ####\n")
for (i in seq_along(all.pmts)) {
cat(all.pmts[i],"\n")
}
# printing out PMTs only used for total proteins, to be excluded in the final processing
cat("#### PMTs ONLY USED FOR TOTAL PROTEIN ####\n")
for (j in seq_along(protein.pmts)) {
cat(protein.pmts[j],"\n")
}
# printing out PMTs to be used in the normalization
cat("#### PMTs TO USE IN NORMALIZATION ####\n")
for (k in seq_along(keep.pmts)) {
cat(keep.pmts[k],"\n")
}
}
usePMTs()