[Bio] / FigKernelScripts / svr_function_of.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/svr_function_of.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10, Mon Apr 18 00:33:41 2011 UTC revision 1.11, Tue May 31 20:39:41 2011 UTC
# Line 56  Line 56 
56  use SAPserver;  use SAPserver;
57  my $sapObject = SAPserver->new();  my $sapObject = SAPserver->new();
58  use Getopt::Long;  use Getopt::Long;
59    use ScriptThing;
60    
61  my $usage = "usage: svr_function_of [-c column]";  my $usage = "usage: svr_function_of [-c column]";
62    
63  my $column;  my $column;
64  my $rc  = GetOptions('c=i' => \$column);  my $i = "-";
65    my $rc  = GetOptions('c=i' => \$column, 'i=s' => \$i);
66  if (! $rc) { print STDERR $usage; exit }  if (! $rc) { print STDERR $usage; exit }
67    open my $ih, "<$i";
68  my @lines = map { chomp; [split(/\t/,$_)] } <STDIN>;  while (my @tuples = ScriptThing::GetBatch($ih, undef, $column)) {
69  (@lines > 0) || exit;      my @ids = map { $_->[0] } @tuples;
70  if (! $column)  { $column = @{$lines[0]} }      my $functions = $sapObject->ids_to_functions(-ids => \@ids);
71  my @fids = map { $_->[$column-1] } @lines;      for my $tuple (@tuples) {
72            my ($id, $line) = @$tuple;
73  my $functions = $sapObject->ids_to_functions(-ids => \@fids);          my $function = $functions->{$id};
74  foreach $_ (@lines)          if (! defined $function) {
75  {              print STDERR "$id not found.\n";
76      my $func = $functions->{$_->[$column-1]};          } else {
77      if (! $func) { $func = '' }              print "$line\t$function\n";
78      print join("\t",(@$_,$func)),"\n";          }
79        }
80  }  }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3