c8828612e3aba9e6c3072768129de10abe337878 hiram Fri May 29 11:29:04 2020 -0700 now allow orderList to be specifically stated and begin common set of html functions refs #23734 diff --git src/hg/makeDb/doc/asmHubs/mkGenomes.pl src/hg/makeDb/doc/asmHubs/mkGenomes.pl index a00425b..0222ee0 100755 --- src/hg/makeDb/doc/asmHubs/mkGenomes.pl +++ src/hg/makeDb/doc/asmHubs/mkGenomes.pl @@ -6,41 +6,46 @@ my $argc = scalar(@ARGV); if ($argc != 1) { printf STDERR "mkGenomes.pl [two column name list] > .../hub/genomes.txt\n"; printf STDERR "e.g.: mkGenomes.pl vgp.primary.assemblies.tsv > .../vgp/genomes.txt\n"; printf STDERR "the name list is found in \$HOME/kent/src/hg/makeDb/doc/asmHubs/\n"; printf STDERR "\nthe two columns are 1: asmId (accessionId_assemblyName)\n"; printf STDERR "column 2: common name for species, columns separated by tab\n"; printf STDERR "result will write a local asmId.genomes.txt file for each hub\n"; printf STDERR "and a local asmId.hub.txt file for each hub\n"; printf STDERR "and a local asmId.groups.txt file for each hub\n"; printf STDERR "and the output to stdout will be the overall genomes.txt\n"; printf STDERR "index file for all genomes in the given list\n"; exit 255; } -my $commonNameOrder = shift; my $home = $ENV{'HOME'}; my $toolsDir = "$home/kent/src/hg/makeDb/doc/asmHubs"; +my $inputList = shift; +my $orderList = $inputList; +if ( ! -s "$orderList" ) { + $orderList = $toolsDir/$inputList; +} + my %commonName; # key is asmId, value is common name my @orderList; # asmId of the assemblies in order from the *.list files # the order to read the different .list files: my $assemblyCount = 0; -open (FH, "<$toolsDir/${commonNameOrder}") or die "can not read ${commonNameOrder}"; +open (FH, "<${orderList}") or die "can not read ${orderList}"; while (my $line = <FH>) { next if ($line =~ m/^#/); chomp $line; my ($asmId, $commonName) = split('\t', $line); if (defined($commonName{$asmId})) { printf STDERR "ERROR: duplicate asmId: '%s'\n", $asmId; printf STDERR "previous name: '%s'\n", $commonName{$asmId}; printf STDERR "duplicate name: '%s'\n", $commonName; exit 255; } $commonName{$asmId} = $commonName; push @orderList, $asmId; printf STDERR "orderList[$assemblyCount] = $asmId\n"; ++$assemblyCount; }