Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- makelist<-function(list_text){
- if (list_text == "squared_median " || list_text == "squared_median_ranked"
- || list_text == "value_median " || list_text == "value_median_ranked")
- metric = "median"
- else
- metric = "avg"
- currfiles=allfiles[grepl(list_text,allfiles)]
- currfile=currfiles[1]
- currtable=read.table(currfile, header=T, sep='t',stringsAsFactors = F)
- a<-cbind(gene=currtable[,1],paste0(currfile)=currtable[,metric])
- #col.name(a[,ncol(a)])<-currfile
- #names(a)[ncol(a)]<-as.character(currfile)
- for(currfile in currfiles[2:length(currfiles)])
- {
- currtable=read.table(currfile, header=T, sep='t', stringsAsFactors=F)
- if (length(currtable[,metric]) > length(a[,1]))
- apply(a,2, function(x) length(x) = length(currtable[,metric]))
- a=cbind(a, "gene"=currtable[,1],currfile=currtable[,metric])
- #names(a)[ncol(a)]<-paste(currfile)
- }
- #names(a)=c("gene", currfiles[1], "gene", currfiles[2],"gene", currfiles[3],"gene", currfiles[4])
- write.table(a, paste(output_folder, list_text,".txt"),sep='t',quote=F,row.names=F)
- }
- names(a)=c("gene", currfiles[1], "gene", currfiles[2]...currfiles[n])
- #col.name(a[,ncol(a)])<-currfile
- #names(a)[ncol(a)]<-as.character(currfile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement