-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathassemble.r
66 lines (49 loc) · 1.76 KB
/
assemble.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
#!/usr/bin/env Rscript
rm(list = ls())
args<-commandArgs(TRUE)
number<-as.numeric(args[1])
geneRatio<-as.numeric(args[2])
name<-as.character(args[3])
date<-as.character(args[4])
out_file_1<-paste(date,'_out_file_1.tmp',sep='')
outSummary_all<-read.table(out_file_1,header = TRUE,sep = '\t')
cat("read 1")
p_file_name<-paste(date,'_1_p.tmp',sep='')
pvalues<-read.table(p_file_name,header=F,sep='\t',col.names=c('p','p_adj'))
cat("read 2")
out_with_p<-data.frame(outSummary_all,pvalues)
out_with_p<-out_with_p[1,]
if(number==1){
for(f in 1:number){
out_fi <- paste("_out_file_",f,sep = "")
out_file <- paste(out_fi,'.tmp',sep="")
out_file_date<-paste(date,out_file,sep='')
file<-read.table(out_file_date,header = TRUE,sep = '\t')
cat(f)
p_file<-paste(date,f,sep='_')
p_file_name<-paste(p_file,'_p.tmp',sep='')
pfile<-read.table(p_file_name,header=F,sep='\t',col.names=c('p','p_adj'))
out_with_p_loop<-data.frame(file,pfile)
out_with_p<-rbind(out_with_p,out_with_p_loop)
}
out_with_p<-out_with_p[-1,]
write.table(out_with_p[order(out_with_p$p),],name,row.names=F,quote=F,sep='\t')
}
if(number>1){
for(f in 1:number){
out_fi <- paste("_out_file_",f,sep = "")
out_file <- paste(out_fi,'.tmp',sep="")
out_file_date<-paste(date,out_file,sep='')
file<-read.table(out_file_date,header = TRUE,sep = '\t')
cat(f)
p_file<-paste(date,f,sep='_')
p_file_name<-paste(p_file,'_p.tmp',sep='')
pfile<-read.table(p_file_name,header=F,sep='\t',col.names=c('p','p_adj'))
out_with_p_loop<-data.frame(file,pfile)
out_with_p_every<-rbind(out_with_p,out_with_p_loop)
out_with_p_every<-out_with_p_every[-1,]
name<-as.character(args[3])
name<-paste(f,name,sep="_")
write.table(out_with_p_every[order(out_with_p_every$p),],name,row.names=F,quote=F,sep='\t')
}
}