5ab456ddf76e0e021fe6a7f5fb821888edbf1c2f hiram Mon Nov 28 13:27:24 2022 -0800 more generic use of file names refs #30326 diff --git src/hg/utils/automation/chromAlias.pl src/hg/utils/automation/chromAlias.pl index 6d30abd..9ba2119 100755 --- src/hg/utils/automation/chromAlias.pl +++ src/hg/utils/automation/chromAlias.pl @@ -7,31 +7,31 @@ my $argc = scalar(@ARGV); if ($argc < 1) { printf STDERR "usage: chromAlias.pl <ucsc.refseq.tab> <ucsc.genbank.tab> \\\n\t<ucsc.ensembl.tab> <ucsc.others.tab> > <db>.chromAlias.tab\n"; printf STDERR "must have at least one of these input files, others when available\n"; printf STDERR "the names of the input files must be of this pattern so\n"; printf STDERR "the name of the alias can be identified\n"; exit 255; } my %names; # key is name identifier (refseq, genbank, ensembl, flybase, etc...) # value is a hash with key identifer name, value ucsc chr name my %chrNames; # key is UCSC chrom name, value is number of times seen while (my $file = shift @ARGV) { my $name = $file; - $name =~ s/ucsc.//; + $name =~ s/^[^.]+.//; $name =~ s/.tab//; printf STDERR "# working: %s\n", $name; my $namePtr; if (exists($names{$name})) { $namePtr = $names{$name}; } else { my %nameHash; $namePtr = \%nameHash; $names{$name} = $namePtr; } open (FH, "<$file") or die "can not read $file"; while (my $line = <FH>) { chomp $line; my ($chr, $other) = split('\t+', $line); if (exists($namePtr->{$chr})) {