comparison cutWrapper.pl @ 3:cec635fab700 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/cut_columns commit e3d5231ad1ca93ad49117e9804266f371d863e82
author devteam
date Fri, 05 Aug 2016 16:38:13 -0400
parents 34c29e183ef7
children
comparison
equal deleted inserted replaced
2:842fab69c940 3:cec635fab700
7 my $del = ""; 7 my $del = "";
8 my @in = (); 8 my @in = ();
9 my @out = (); 9 my @out = ();
10 my $command = ""; 10 my $command = "";
11 my $field = 0; 11 my $field = 0;
12 my $start = 0;
13 my $end = 0;
14 my $i = 0;
12 15
13 # a wrapper for cut for use in galaxy 16 # a wrapper for cut for use in galaxy
14 # cutWrapper.pl [filename] [columns] [delim] [output] 17 # cutWrapper.pl [filename] [columns] [delim] [output]
15 18
16 die "Check arguments\n" unless @ARGV == 4; 19 die "Check arguments\n" unless @ARGV == 4;
18 $ARGV[1] =~ s/\s+//g; 21 $ARGV[1] =~ s/\s+//g;
19 foreach ( split /,/, $ARGV[1] ) { 22 foreach ( split /,/, $ARGV[1] ) {
20 if (m/^c\d{1,}$/i) { 23 if (m/^c\d{1,}$/i) {
21 push (@columns, $_); 24 push (@columns, $_);
22 $columns[@columns-1] =~s/c//ig; 25 $columns[@columns-1] =~s/c//ig;
26 } elsif (m/^c\d{1,}-c\d{1,}$/i) {
27 ($start, $end) = split(/-/, $_);
28 $start =~ s/c//ig;
29 $end =~ s/c//ig;
30 for $i ($start .. $end) {
31 push (@columns, $i);
32 }
23 } 33 }
24 } 34 }
25 35
26 die "No columns specified, columns are not preceded with 'c', or commas are not used to separate column numbers: $ARGV[1]\n" if @columns == 0; 36 die "No columns specified, columns are not preceded with 'c', or commas are not used to separate column numbers: $ARGV[1]\n" if @columns == 0;
27 37