Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. makelist<-function(list_text){
  2. if (list_text == "squared_median " || list_text == "squared_median_ranked"
  3. || list_text == "value_median " || list_text == "value_median_ranked")
  4. metric = "median"
  5. else
  6. metric = "avg"
  7. currfiles=allfiles[grepl(list_text,allfiles)]
  8. currfile=currfiles[1]
  9. currtable=read.table(currfile, header=T, sep='t',stringsAsFactors = F)
  10. a<-cbind(gene=currtable[,1],paste0(currfile)=currtable[,metric])
  11. #col.name(a[,ncol(a)])<-currfile
  12. #names(a)[ncol(a)]<-as.character(currfile)
  13. for(currfile in currfiles[2:length(currfiles)])
  14. {
  15. currtable=read.table(currfile, header=T, sep='t', stringsAsFactors=F)
  16. if (length(currtable[,metric]) > length(a[,1]))
  17. apply(a,2, function(x) length(x) = length(currtable[,metric]))
  18.  
  19. a=cbind(a, "gene"=currtable[,1],currfile=currtable[,metric])
  20. #names(a)[ncol(a)]<-paste(currfile)
  21. }
  22. #names(a)=c("gene", currfiles[1], "gene", currfiles[2],"gene", currfiles[3],"gene", currfiles[4])
  23. write.table(a, paste(output_folder, list_text,".txt"),sep='t',quote=F,row.names=F)
  24. }
  25.  
  26. names(a)=c("gene", currfiles[1], "gene", currfiles[2]...currfiles[n])
  27.  
  28. #col.name(a[,ncol(a)])<-currfile
  29. #names(a)[ncol(a)]<-as.character(currfile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement