-
Notifications
You must be signed in to change notification settings - Fork 1
/
piano_intersect.R
67 lines (65 loc) · 3.19 KB
/
piano_intersect.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
kidney <- list.files(path = "C:/Users/xNesTea/python/project_sem_3/new_dir/data/liver/piano/")
liver <- list.files(path = "C:/Users/xNesTea/python/project_sem_3/new_dir/data/kidney/piano/")
fnames <- intersect(kidney, liver)
#fnames <- gsub("_piano.txt", "", fnames)
for(name in fnames){
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/kidney/piano/")
drug1 <- read.delim(paste(name))
drug1[is.na(drug1)] <- 1
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/liver/piano/")
drug2 <- read.delim(paste(name))
drug2[is.na(drug2)] <- 1
drug1$p.adj..dist.dir.up.[drug1$p.adj..dist.dir.up.>0.05] <- NaN
drug2$p.adj..dist.dir.up.[drug2$p.adj..dist.dir.up.>0.05] <- NaN
df <- merge(drug1, drug2, by = "Name")
df <- df[complete.cases(df),]
n <- gsub("_piano.txt", "", name)
#df <- df[sign(df$logFC.x)==sign(df$logFC.y),]
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/5padj/UP_gse/")
write.table(df, file = paste(n, ".txt", sep = ""), sep = "\t",col.names = NA)
print(dim(df))
}
kidney <- list.files(path = "C:/Users/xNesTea/python/project_sem_3/For_Uppmax/liver/")
metadata <- read.delim("")
kidney <- list.files(path = "C:/Users/xNesTea/python/project_sem_3/new_dir/data/liver/piano/")
liver <- list.files(path = "C:/Users/xNesTea/python/project_sem_3/new_dir/data/kidney/piano/")
fnames <- intersect(kidney, liver)
#fnames <- gsub("_piano.txt", "", fnames)
for(name in fnames){
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/kidney/piano/")
drug1 <- read.delim(paste(name))
drug1[is.na(drug1)] <- 1
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/liver/piano/")
drug2 <- read.delim(paste(name))
drug2[is.na(drug2)] <- 1
drug1$p.adj..non.dir..[drug1$p.adj..non.dir..>0.05] <- NaN
drug2$p.adj..non.dir..[drug2$p.adj..non.dir..>0.05] <- NaN
df <- merge(drug1, drug2, by = "Name")
df <- df[complete.cases(df),]
n <- gsub("_piano.txt", "", name)
#df <- df[sign(df$logFC.x)==sign(df$logFC.y),]
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/5padj/NDIR_gse/")
write.table(df, file = paste(n, ".txt", sep = ""), sep = "\t",col.names = NA)
print(dim(df))
}
kidney <- list.files(path = "C:/Users/xNesTea/python/project_sem_3/new_dir/data/liver/piano/")
liver <- list.files(path = "C:/Users/xNesTea/python/project_sem_3/new_dir/data/kidney/piano/")
fnames <- intersect(kidney, liver)
#fnames <- gsub("_piano.txt", "", fnames)
for(name in fnames){
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/kidney/piano/")
drug1 <- read.delim(paste(name))
drug1[is.na(drug1)] <- 1
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/liver/piano/")
drug2 <- read.delim(paste(name))
drug2[is.na(drug2)] <- 1
drug1$p.adj..dist.dir.dn.[drug1$p.adj..dist.dir.dn.>0.05] <- NaN
drug2$p.adj..dist.dir.dn.[drug2$p.adj..dist.dir.dn.>0.05] <- NaN
df <- merge(drug1, drug2, by = "Name")
df <- df[complete.cases(df),]
n <- gsub("_piano.txt", "", name)
#df <- df[sign(df$logFC.x)==sign(df$logFC.y),]
setwd("C:/Users/xNesTea/python/project_sem_3/new_dir/data/5padj/DOWN_gse/")
write.table(df, file = paste(n, ".txt", sep = ""), sep = "\t",col.names = NA)
print(dim(df))
}