Extract Columns

This software extract columns of tables in CSV. The criteria to select columns is based on the name of the column and/or the index of the column (see also Select columns in table). This software is complementary to Remove columns.

Manual :

1- if not already installed, install Perl free programming language

2- unzip the software

3- copy your data csv (TAB separator by default) tables in the “table” directory. (unlimited number of tables).

4- Edit the file criteria.pl to match your criteria. The number of criteria is unlimited.

name : regular expression matching the name of the column

condition : can be ">", "<", "=", "<>" or '' (no condition)

index : column number

This software uses regular expression in the name pattern

. Match any character (except newline)

* Match 0 or more times

+ Match 1 or more times

? Match 1 or 0 times

\ Quote the next metacharacter

\t tab (HT, TAB)

\n newline (LF, NL)

\s space

\r return

\. dot

Example :

Important : column index start at 0 (not 1). To select column 10, index = 9

my @include_criteria = (

# match columns named exactly "Peptide" with index > 3

{ "name" => '^Peptide$',


"condition" => ">",


"index" => "3",


},

# match columns containing "RT" with index < 5

{ "name" => 'RT',


"condition" => "<",


"index" => "5",


},

# match all columns with index < 10

{ "name" => '.*',


"condition" => "<",


"index" => "10",


},

# match all columns with index = 10

{ "name" => '.*',


"condition" => "=",


"index" => "10",


},

# match all columns with 7 < index < 10,

# ie columns indexes [8-10] and number [9-11]

{ "name" => '.*',

"condition" => "<>",

"index" => "7;11",

}

) ;

5- execute the software by the command : perl software_name or double click on the .pl file

The program select in the table, the lines which begin by the same string than in the list.

6- processed files are in the “results” directory.

NAME

remove_col.pl

DESCRIPTION

This software remove some columns in tables in CSV or TXT (separator TAB by default).

AUTHOR

Frederic PONT (c) 2015

OPTIONS

-s separator

Specify the separator of the table. If the separator is omitted, tabulation

will be used by default.

-h

Give syntax. This argument must be the first.

-help

Give detailed help (print this message). This argument

must be the first.


include Criteria : edit the file criterial.pl

EXAMPLE

perl remove_col.pl -s ';' # separator ";"

perl remove_col.pl -s ',' # separator ","