2f5ab86dbe1725b58789a00b199c64e0a68b2cff
hiram
  Fri Jun 14 13:35:06 2024 -0700
add new option to getSeq -revComp to reverse complement sequence output refs #26691

diff --git src/hg/hubApi/tests/jsonConsumer.pl src/hg/hubApi/tests/jsonConsumer.pl
index 8ad4545..b5513d4 100755
--- src/hg/hubApi/tests/jsonConsumer.pl
+++ src/hg/hubApi/tests/jsonConsumer.pl
@@ -26,30 +26,31 @@
 # command line options
 my $server = 'https://api-test.gi.ucsc.edu'; # defaults to api-test but can be set via "binary" command line arg
 my $endpoint = "";
 my $hubUrl = "";
 my $genome = "";
 my $track = "";
 my $chrom = "";
 my $start = "";
 my $end = "";
 my $test0 = 0;
 my $trackDump = 0;
 my $debug = 0;
 my $trackLeavesOnly = 0;
 my $measureTiming = 0;
 my $jsonOutputArrays = 0;
+my $revComp = 0;
 my $maxItemsOutput = "";
 ##############################################################################
 
 sub usage() {
 printf STDERR "usage: ./jsonConsumer.pl [arguments]\n";
 printf STDERR "arguments:
 -test0 - perform test of /list/publicHubs and /list/ucscGenomes endpoints
 -trackDump - obtain all data for a single track from: track, genome (hubUrl)
            - proof of concept, will not work for all cases
 -hubUrl=<URL> - use the URL to access the track or assembly hub
 -genome=<name> - name for UCSC database genome or assembly/track hub genome
 -track=<trackName> - specify a single track in a hub or database
 -chrom=<chromName> - restrict the operation to a single chromosome
 -start=<coordinate> - restrict the operation to a range, use both start and end
 -end=<coordinate> - restrict the operation to a range, use both start and end
@@ -137,30 +138,31 @@
     my @params;
     foreach my $key (keys %{$parameters}) {
       my $value = $parameters->{$key};
       push(@params, "$key=$value");
     }
     my $param_string = join(';', @params);
     $url.= '?'.$param_string;
   } else {
     if ($debug || $measureTiming || $jsonOutputArrays || length($maxItemsOutput) ) {
      $argSeparator = "?";
    }
   }
   if ($debug) { $url .= "${argSeparator}debug=1"; }
   if ($measureTiming) { $url .= "${argSeparator}measureTiming=1"; }
   if ($jsonOutputArrays) { $url .= "${argSeparator}jsonOutputArrays=1"; }
+  if ($revComp) { $url .= "${argSeparator}revComp=1"; }
   if (length($maxItemsOutput)) { $url .= "${argSeparator}maxItemsOutput=$maxItemsOutput"; }
   printf STDERR "### '%s'\n", $url;
   my $response = $http->get($url, {headers => $headers});
   my $status = $response->{status};
   if(!$response->{success}) {
     # Quickly check for rate limit exceeded & Retry-After (lowercase due to our client)
     if($status == 429 && exists $response->{headers}->{'retry-after'}) {
       my ($status, $reason) = ($response->{status}, $response->{reason});
       my $retry = $response->{headers}->{'retry-after'};
       printf STDERR "Failed for $endpoint! Status code: ${status}. Reason: ${reason}, retry-after: $retry seconds\n";
 #      hashOutput($response->{headers});
       Time::HiRes::sleep($retry);
       # After sleeping see that we re-request
       return performRestAction($endpoint, $parameters, $headers);
     }
@@ -456,30 +458,31 @@
 my $argc = scalar(@ARGV);
 
 GetOptions ("hubUrl=s" => \$hubUrl,
     "endpoint=s"  => \$endpoint,
     "genome=s"  => \$genome,
     "track=s"  => \$track,
     "chrom=s"  => \$chrom,
     "start=s"  => \$start,
     "end=s"    => \$end,
     "test0"    => \$test0,
     "trackDump"    => \$trackDump,
     "debug"    => \$debug,
     "trackLeavesOnly"    => \$trackLeavesOnly,
     "measureTiming"    => \$measureTiming,
     "jsonOutputArrays"    => \$jsonOutputArrays,
+    "revComp=s"    => \$revComp,
     "maxItemsOutput=s"   => \$maxItemsOutput,
     "serverName=s"           => \$server)
     or die "Error in command line arguments\n";
 
 if ($test0) {
    test0;
    elapsedTime();
    exit 0;
 }
 
 if ($argc > 0) {
    if (processEndPoint()) {
 	elapsedTime();
 	exit 255;
    } else {