comparison csv2rdatatrain.R @ 0:874a905405db draft

Uploaded
author deepakjadmin
date Fri, 22 Jan 2016 03:19:46 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:874a905405db
1 args <- commandArgs(TRUE)
2 ####source("/home/galaxy/galaxy-dist/tools/mpdstools/tool1/csv2rdatatrain2.R")
3
4 csv2rdatatrain <- function(arg1,arg2)
5 {
6 file <- read.csv(arg1,row.names =1, header=T)
7 col <- ncol(file)
8 stopifnot(is.null(file) | col > 2 )
9
10 #cat("the Outcome column is not a factor vector.\n",file=stderr())
11 stopifnot(is.factor(file[,col]))
12
13 if(levels(file[,col])[1] != ""){
14 dataX <- file[,1:(col-1)]
15 dataY <- file[,col]
16 stopifnot(nrow(dataX) == length(dataY))
17 save(dataX,dataY,file=arg2)
18 }
19 else{
20 cat("the Outcome column has less number of entry than number of compounds.please check input file.\n",file=stderr())
21 }
22 }
23
24 csv2rdatatrain(args[1],args[2])
25
26
27
28
29