# HG changeset patch # User mnhn65mo # Date 1533723575 14400 # Node ID b735ac78702bb82203d09891064d36f7d933b122 Uploaded diff -r 000000000000 -r b735ac78702b csv2tab.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/csv2tab.R Wed Aug 08 06:19:35 2018 -0400 @@ -0,0 +1,14 @@ +#!/usr/bin/env Rscript +#Read csv - return tabular +#2 Options for now : sep an header + +args = commandArgs(trailingOnly=TRUE) + +if(args[3]=="TRUE"){ + csv<-read.csv(args[1],sep=args[2],header=TRUE) + write.table(csv,"out.tabular",sep="\t",row.names=FALSE) +}else{ + csv<-read.csv(args[1],sep=args[2],header=FALSE) + write.table(csv,"out.tabular",sep="\t",col.names=FALSE,row.names=FALSE) +} + diff -r 000000000000 -r b735ac78702b csv2tab.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/csv2tab.xml Wed Aug 08 06:19:35 2018 -0400 @@ -0,0 +1,73 @@ + + + R + + + + + + + + + + + + + + + + + + + + + + + + + + +**What it does** + +Convert a CSV file to a tabular. + +Transform the chosen separator to tab. It is important to specify if the file has a header line. + +If the field separator is a comma and there are commas inside text fields the tool will only modify the first category in tabs. + +------ + +**Example** + +Input CSV : + + "John","Smith","2 mySteet, myCity" + + "François","LeFrançais","1 rue du Général, Paris" + + "Other","Random","Stuff, stuff, stuff" + + + +Output tabular : + + "John" "Smith" "2 mySteet, myCity" + + "François" "LeFrançais" "1 rue du Général, Paris" + + "Other" "Random" "Stuff, stuff, stuff" + +------ + +**Arguments** + +Input : csv file. + +Separator : default is ",". + +Header : True/False. + + + +