Mercurial > repos > anmoljh > csv_to_rdata
changeset 0:6b9d382cb4a5 draft
planemo upload commit e713bcfa1b1690f9a21ad0bd796c2d385f646e66-dirty
author | anmoljh |
---|---|
date | Mon, 12 Jun 2017 09:25:48 -0400 |
parents | |
children | 4e55a218baa5 |
files | csv2rdata.R csv2rdata.xml tool_dependencies.xml |
diffstat | 3 files changed, 85 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/csv2rdata.R Mon Jun 12 09:25:48 2017 -0400 @@ -0,0 +1,28 @@ +args <- commandArgs(TRUE) + +csv2rdatatrain <- function(arg1,arg2) +{ + file <- read.csv(arg1,row.names =1, header=T) + col <- ncol(file) + stopifnot(is.null(file) | col > 2 ) + + #cat("the Outcome column is not a factor vector.\n",file=stderr()) + stopifnot(is.factor(file[,col])) + + if(levels(file[,col])[1] != ""){ + dataX <- file[,1:(col-1)] + dataY <- file[,col] + stopifnot(nrow(dataX) == length(dataY)) + save(dataX,dataY,file=arg2) + } + else{ + cat("the Outcome column has less number of entry than number of compounds.please check input file.\n",file=stderr()) + } + } + +csv2rdatatrain(args[1],args[2]) + + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/csv2rdata.xml Mon Jun 12 09:25:48 2017 -0400 @@ -0,0 +1,51 @@ +<tool id="csv2rdata" name="Prepare input file" version="1.0"> + <description> + This Tool Converts Input csv File into RData Which Is Further Used for Model Building + </description> + + <requirements> + <requirement type="package" version="3.2.0">R</requirement> + </requirements> + + <stdio> + <exit_code range="1:" /> + </stdio> + + <command interpreter="Rscript">csv2rdata.R $file1 $RData </command> + + <inputs> + <param name="file1" type="data" format="csv" label="Select file containing training data" help="CSV format" /> + </inputs> + + <outputs> + <data name="RData" format="data" label="Input.RData" /> + </outputs> + + <tests> + <test> + <param name="file1" value="non_redundant.csv" /> + <output name="RData" file="desc.RData" compare="sim_size" delta="50000" /> + </test> + </tests> + + <help> +.. class:: infomark + +**Input "csv file" format must be as given below :** + + +"",feature1,feaure2,feature3,..,activity + + +cpd1,623,0.4,3.4,..,Active + +cpd2,234,0.9,5.6,..,Inactive + +cpd3,567,0.5,3.14,..,Active + +cpd4,231,0.1,1.2,..,Inactive + +here "cpd" stands for name or id of a compound. It is rowname with no column header. + </help> + +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Mon Jun 12 09:25:48 2017 -0400 @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="R" version="3.2.1"> + <repository changeset_revision="77d439695328" name="package_r_3_2_1" owner="iuc" prior_installation_required="True" toolshed="https://testtoolshed.g2.bx.psu.edu/" /> + </package> +</tool_dependency>