annotate fixedValueColumn.pl @ 1:4c6ec423baae draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 4066016ffafd7918ba9826db4f3c6fb41315e942
author devteam
date Fri, 29 Sep 2023 15:06:25 +0000
parents 787fa5c2c738
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
1 #! /usr/bin/perl -w
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
2
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
3 use strict;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
4 use warnings;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
5
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
6 # fixedValueColumn.pl $input $out_file1 "expression" "iterate [yes|no]"
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
7
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
8 my ($input, $out_file1, $expression, $iterate) = @ARGV;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
9 my $i = 0;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
10 my $numeric = 0;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
11
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
12 die "Check arguments\n" unless @ARGV == 4;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
13
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
14 open (DATA, "<$input") or die "Cannot open $input:$!\n";
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
15 open (OUT, ">$out_file1") or die "Cannot create $out_file1:$!\n";
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
16
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
17 if ($expression =~ m/^\d+$/) {
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
18 $numeric = 1;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
19 $i = $expression;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
20 }
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
21
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
22 while (<DATA>) {
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
23 chop;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
24 if ($iterate eq "no") {
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
25 print OUT "$_\t$expression\n";
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
26 } else {
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
27 print OUT "$_\t$i\n" if $numeric == 1;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
28 print OUT "$_\t$expression-$i\n" if $numeric == 0;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
29 ++$i;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
30 }
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
31 }
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
32
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
33 close DATA;
787fa5c2c738 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/add_value commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff changeset
34 close OUT;