13eb4b7b261fe9065ec6b1ff0f893148bd8ddb6b hiram Wed May 3 23:09:36 2023 -0700 allow ebiGene to become ensGene for HPRC assemblies refs #29545 diff --git src/hg/makeDb/doc/asmHubs/trackData.pl src/hg/makeDb/doc/asmHubs/trackData.pl index 47ed7c6..bc480df 100755 --- src/hg/makeDb/doc/asmHubs/trackData.pl +++ src/hg/makeDb/doc/asmHubs/trackData.pl @@ -495,30 +495,37 @@ $hubUrl = "https://hgdownload.soe.ucsc.edu/goldenPath/$asmId/bigZips"; $browserUrl = "https://genome.ucsc.edu/cgi-bin/hgTracks?db=$asmId"; $browserName = "$commonName ($asmId)"; if ($testOutput) { $browserUrl = "https://genome-test.gi.ucsc.edu/cgi-bin/hgTracks?db=$asmId"; $hubUrl = "https://hgdownload-test.gi.ucsc.edu/goldenPath/$asmId/bigZips"; } } elsif ($testOutput) { $browserUrl = "https://genome-test.gi.ucsc.edu/h/$accessionId"; } printf "<tr><td align=right>%d</td>\n", ++$asmCount; printf "<td align=center><a href='%s' target=_blank>%s<br>%s</a></td>\n", $browserUrl, $browserName, $accessionId; foreach my $track (@trackList) { my $trackFile = "$buildDir/bbi/$asmId.$track"; my $trackFb = "$buildDir/trackData/$track/fb.$asmId.$track.txt"; + # no ensGene file ? Then look for ebiGene file + if ($track eq "ensGene" && ! -s $trackFb) { + if ( -d "$buildDir/trackData/ebiGene" ) { + $trackFb = "$buildDir/trackData/ebiGene/fb.ebiGene.txt" if ( -d "$buildDir/trackData/ebiGene/fb.ebiGene.txt"); + $trackFile = "$buildDir/bbi/$asmId.ebiGene"; + } + } my $runDir = "$buildDir/trackData/$track"; my ($itemCount, $percentCover); my $customKey = ""; if ($asmId !~ m/^GC/) { $itemCount = "n/a"; $percentCover = "n/a"; if ($track eq "ncbiRefSeq") { my $refSeqDir=`ls -d /hive/data/genomes/$asmId/bed/ncbiRefSeq.20* | tail -1`; chomp $refSeqDir; if ( -d "${refSeqDir}" ) { my $trackFb = "${refSeqDir}/fb.ncbiRefSeq.$asmId.txt"; if ( -s "${trackFb}" ) { $itemCount = `hgsql -N -e 'select count(*) from $track;' $asmId 2> /dev/null`; chomp $itemCount; $percentCover = pcFbFile($trackFb); @@ -586,33 +593,38 @@ open (RS, ">$rmskStats") or die "can now write to $rmskStats"; printf RS "%s\t%s\n", $itemCount, $percentCover; close (RS); } else { $itemCount = "n/a"; $percentCover = "n/a"; } } else { ($itemCount, $percentCover) = split('\s+', `cat $rmskStats`); chomp $percentCover; $customKey = sprintf("%.2f", $percentCover); $percentCover = sprintf("%.2f %%", $percentCover); } } else { # not the rmsk track ($itemCount, $percentCover) = oneTrackData($asmId, $track, $trackFile, $totalSize, $trackFb, $runDir); - if (0 == $testOutput) { + if (0 == $testOutput) { # only on the production stats page + # if track ensGene does not exist, try the ebiGene track + if ($track eq "ensGene" && $itemCount eq "n/a") { + $runDir = "$buildDir/trackData/ebiGene"; + $trackFile = "$buildDir/bbi/$asmId.$track.bb"; + ($itemCount, $percentCover) = oneTrackData($asmId, "ebiGene", $trackFile, $totalSize, $trackFb, $runDir); + } elsif ($track eq "ncbiRefSeq" && $itemCount eq "n/a") { # if track ncbiRefSeq does not exist, try the ncbiGene track - if ($track eq "ncbiRefSeq" && $itemCount eq "n/a") { $runDir = "$buildDir/trackData/ncbiGene"; $trackFile = "$buildDir/bbi/$asmId.$track.bb"; ($itemCount, $percentCover) = oneTrackData($asmId, "ncbiGene", $trackFile, $totalSize, $trackFb, $runDir); } } } # else not the rmsk track } # else if ($asmId !~ m/^GC/) if (($percentCover =~ m/%/) || ($percentCover !~ m#n/a#)) { $customKey = $percentCover; $customKey =~ s/[ %]+//; } if (length($customKey)) { printf " <td align=right sorttable_customkey='%s'>%s<br>(%s)</td>\n", $customKey, $itemCount, $percentCover; } else { if ($itemCount eq "n/a") {