comparison ColRangeGenerator/ColRangeGenerator.pl @ 0:358c9e0b9154 draft default tip

Initial upload
author mir-bioinf
date Fri, 24 Apr 2015 10:56:37 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:358c9e0b9154
1 #! /usr/bin/perl -w
2
3 use strict;
4 use warnings;
5 use Text::ParseWords;
6
7 ##Args are col range and output file name ONLY. no spaces!!
8
9 die "Please check arguments, probably spaces in column range!\n" unless @ARGV == 2;
10
11 my $colrange = $ARGV[0];
12 my $outputfile = $ARGV[1];
13
14 my @cols = split(/-/,$colrange);
15 die "Improper range format: probably missing - (hyphen) or it's at the end.\n" unless exists($cols[1]);
16
17 my @start = split('C',uc($cols[0]),2);
18 my @stop = split('C',uc($cols[1]),2);
19 die "Improper column format: missing preceding C for col number.\n" unless (exists($start[1]) && exists($stop[1]));
20
21 my $begin = $start[1];
22 my $end = $stop[1];
23
24 my $fhOut;
25 open ($fhOut, "> $outputfile");
26 for (my $i=$begin; $i<$end; $i++) {
27 print $fhOut "c$i,";
28 }
29 print $fhOut "c$end\n";
30
31 close ($fhOut) or die "Cannot close output file\n";