Mercurial > repos > dsobral > flip_columns_on_condition
changeset 1:a0e05808610a default tip
Uploaded
author | dsobral |
---|---|
date | Thu, 15 Mar 2012 11:47:53 -0400 |
parents | 633ca40ded01 |
children | |
files | reorient_coordinates.pl |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/reorient_coordinates.pl Thu Mar 15 11:47:53 2012 -0400 @@ -0,0 +1,19 @@ +open(FILE,"<", $ARGV[0]) or die "cannot open for reading ".$ARGV[0].": $!"; +open(FO,">", $ARGV[1]) or die "cannot open for writing ".$ARGV[1].": $!"; +while(<FILE>){ + chomp; + my @cols = split(/\t/); + print FO $cols[0]; + if($cols[1]>$cols[2]){ + print FO "\t".$cols[2]."\t".$cols[1]; + } else { + print FO "\t".$cols[1]."\t".$cols[2]; + } + #Can only take coordinates + #for($i=3;$i<scalar(@cols);$i++){ + # print "\t".$cols[$i]; + #} + print FO "\n"; +} +close FILE; +close FO; \ No newline at end of file