19f3e5917459c97a2732f9c054cc4f12ef13b327 hiram Wed Jul 29 22:22:54 2026 -0700 add a date version to the ncbiGene track and can later get a more definate name out of the assembly_summary files refs #37958 diff --git src/hg/utils/automation/AsmHub.pm src/hg/utils/automation/AsmHub.pm index 9cab4a83f87..f2402d09757 100755 --- src/hg/utils/automation/AsmHub.pm +++ src/hg/utils/automation/AsmHub.pm @@ -1,26 +1,27 @@ # AsmHub: common routines for building assembly hubs # # DO NOT EDIT the /cluster/bin/scripts copy of this file -- # edit ~/kent/src/hg/utils/automation/AsmHub.pm instead. package AsmHub; use warnings; use strict; use Carp; use File::Basename; +use File::stat; use vars qw(@ISA @EXPORT_OK); use Exporter; @ISA = qw(Exporter); # This is a listing of the public methods and variables (which should be # treated as constants) exported by this module: @EXPORT_OK = ( # Support for common command line options: qw( commify asmSize ncbiGeneDescription ), ); # from Perl Cookbook Recipe 2.17, print out large numbers with comma # delimiters, input is a large number with no commas: @@ -60,30 +61,38 @@ # copies; the live page passes it undef). sub ncbiGeneDescription($$$$$;$) { my ($bbPath, $statsPath, $chromSizes, $namesFile, $ncbiAsmId, $archiveNote) = @_; if ( ! -s $bbPath ) { printf STDERR "ERROR: can not find %s file\n", $bbPath; exit 255; } my @partNames = split('_', $ncbiAsmId); my $ftpDirPath = sprintf("%s/%s/%s/%s/%s", $partNames[0], substr($partNames[1],0,3), substr($partNames[1],3,3), substr($partNames[1],6,3), $ncbiAsmId); my $asmType = ($partNames[0] =~ m/GCA/) ? "genbank" : "refseq"; + # the .bb's mtime is stamped from the source gff's own mtime (see the + # 'touch -r $gffFile' step in doNcbiGene.pl), so it doubles as this + # track's own version/build date -- the same convention archiving uses + # to name archive// directories, which is why this lines up with + # the dates listed under "Archived versions" below. + my ($mday,$mon,$year) = (localtime(stat($bbPath)->mtime))[3,4,5]; + my $dataVersion = sprintf("%04d-%02d-%02d", $year+1900, $mon+1, $mday); + my $totalBases = asmSize($chromSizes); my $geneStats = `cat $statsPath | awk '{printf "%d\\n", \$2}' | xargs echo`; chomp $geneStats; my ($itemCount, $basesCovered) = split('\s+', $geneStats); my $percentCoverage = sprintf("%.3f", 100.0 * $basesCovered / $totalBases); $itemCount = commify($itemCount); $basesCovered = commify($basesCovered); my $totalBasesText = commify($totalBases); my $em = ""; my $noEm = ""; my $assemblyDate = `grep -v "^#" $namesFile | cut -f9`; chomp $assemblyDate; my $organism = `grep -v "^#" $namesFile | cut -f5`; chomp $organism; @@ -110,30 +119,31 @@ genome assembly is constructed from the gff file ${ncbiAsmId}_genomic.gff.gz supplied with the genome assembly at the FTP location:
https://ftp.ncbi.nlm.nih.gov/genomes/all/$ftpDirPath/

The gene models were constructed by the submitter of the assembly to the NCBI assembly release system.

_EOF_ } $html .= <<_EOF_;

Track statistics summary

+Data version: $dataVersion
Total genome size: $totalBasesText
Gene count: $itemCount
Bases in genes: $basesCovered
Percent genome coverage: % $percentCoverage

_EOF_ # Only the live page advertises archives (an archived page's own # description already carries $archiveNote and has nothing further # under it to list). Archived copies are published to hgdownload at # https://hgdownload.soe.ucsc.edu/hubs///archive/ncbiGene//hub.txt # -- one self-contained hub.txt per version -- regardless of where they # sit in the local build tree, so we just need the version list. if ( ! $archiveNote ) {