9909807c4830a971e6493793a4d48b3ff42e3a1e hiram Fri Dec 8 07:39:14 2023 -0800 do not make any alias for UCSC db names refs #28930 diff --git src/hg/gar/mkAlias.pl src/hg/gar/mkAlias.pl index d230944..26f1d44 100755 --- src/hg/gar/mkAlias.pl +++ src/hg/gar/mkAlias.pl @@ -4,39 +4,43 @@ use warnings; my %alreadyDone; # a record of lc(names) already used, can not have # duplicate alias names pointing to different destinations # value is lc(destination) my %ambiguous; # alias names that match to more than one target, don't use # them. key is lc(alias) value is destination my %goodToGo; # key is lc(alias), value is alias<tab>destination neither lc() # any ambiguous ones have been removed if so discovered later my %protectedAliases; # key is the lc(alias) name, value is their destination # if any other aliases come in after they are in this list, # don't use them or knock anything out if they are ambiguous # these aliases are pointing to database browser instances # on the RR, they take precedence over any other relationships +## establish a list of active database browsers +my %rrActive; # key is db name from hgcentral where active=1, value is 1 +my %rrCiActive; # key is lc(db) name for case insensitive matches sub outOne($$) { my ($alias, $destination) = @_; my $lcAlias = lc($alias); my $lcDest = lc($destination); return if ($lcAlias eq $lcDest); # no identity functions return if (defined($ambiguous{$lcAlias})); # ignore ambiguous aliases return if (defined($ambiguous{$lcDest})); # ignore ambiguous aliases - if (defined($protectedAliases{lc($alias)})) { + return if (defined($rrCiActive{$lcAlias})); # no aliases for UCSC db names + if (defined($protectedAliases{$lcAlias})) { ## warning if ambiguous if ($protectedAliases{lc($alias)} ne lc($destination)) { printf STDERR "# WARNING: protected and ambiguous ? %s -> %s %s\n", $alias, $destination, $protectedAliases{lc($alias)}; } return; } if (defined($alreadyDone{$lcAlias})) { # check for ambiguous dups if ($alreadyDone{$lcAlias} ne $lcDest) { $ambiguous{$lcAlias} = $destination; $ambiguous{$lcDest} = $alias; printf STDERR "# ambiguous %s %s %s\n", $alias, $destination, $alreadyDone{$lcAlias}; delete($goodToGo{$lcDest}) if (defined($goodToGo{$lcDest})); delete($goodToGo{$lcAlias}) if (defined($goodToGo{$lcAlias})); } # else it is not ambiguous, only an exact duplicate } else { # this is a new one @@ -68,37 +72,36 @@ $protectedAliases{lc($asmId)} = lc($db); my @a = split('_', $asmId, 3); my $accession = "$a[0]_$a[1]"; if (defined($protectedAliases{lc($accession)})) { priorityAmbiguous($accession, $db); } outOne($accession, $db); $protectedAliases{lc($accession)} = lc($db); if (defined($protectedAliases{lc($a[2])})) { priorityAmbiguous($a[2], $db); } outOne($a[2], $db); $protectedAliases{lc($a[2])} = lc($db); } -## establish a list of active database browsers -my %rrActive; # key is db name from hgcentral where active=1, value is 1 open (FH, "hgsql -N -hgenome-centdb -e 'select name from dbDb where active=1;' hgcentral|") or die "can not hgsql select from dbDb.hgcentral"; while (my $dbName = <FH>) { chomp $dbName; $rrActive{$dbName} = 1; + $rrCiActive{lc($dbName)} = 1; } close (FH); printf STDERR "# first preference, specific high priority database assemblies\n"; # first preference are the high priority database assemblies # these should override GenArk hubs or any other relations, these are # manually verified dbPriority("GCA_009914755.4_T2T-CHM13v2.0", "hs1"); dbPriority("GCF_009914755.1_T2T-CHM13v2.0", "hs1"); dbPriority("GCF_000001405.40_GRCh38.p14", "hg38"); dbPriority("GCA_000001405.29_GRCh38.p14", "hg38"); dbPriority("GCA_000001405.14_GRCh37.p13", "hg19"); dbPriority("GCF_000001405.25_GRCh37.p13", "hg19");