629c77052d6b1f7def62cd6cd641b7f383eb8b2c hiram Wed Jul 29 14:54:16 2026 -0700 now archiving versions of NCBI GenBank gene track when updated refs #37958 diff --git src/hg/utils/automation/asmHubNcbiGene.pl src/hg/utils/automation/asmHubNcbiGene.pl index c6ccac395bc..716ae53ccf3 100755 --- src/hg/utils/automation/asmHubNcbiGene.pl +++ src/hg/utils/automation/asmHubNcbiGene.pl @@ -7,105 +7,25 @@ use AsmHub; use File::Basename; my $argc = scalar(@ARGV); if ($argc != 4) { printf STDERR "usage: asmHubNcbiGene.pl asmId ncbiAsmId asmId.names.tab .../trackData/\n"; printf STDERR "where asmId is the assembly identifier,\n"; printf STDERR "and .../trackData/ is the path to the /trackData/ directory.\n"; printf STDERR "asmId may be equal to ncbiAsmId if it is a GenArk build\n"; printf STDERR "or asmId might be a default dbName if it is a UCSC style\n"; printf STDERR "browser build.\n"; exit 255; } -# from Perl Cookbook Recipe 2.17, print out large numbers with comma -# delimiters: -sub commify($) { - my $text = reverse $_[0]; - $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; - return scalar reverse $text -} - my $asmId = shift; my $ncbiAsmId = shift; my $namesFile = shift; my $trackDataDir = shift; my $ncbiGeneBbi = "$trackDataDir/ncbiGene/$asmId.ncbiGene.bb"; -my $asmType = "refseq"; - -if ( ! -s $ncbiGeneBbi ) { - printf STDERR "ERROR: can not find $asmId.ncbiGene.bb file\n"; - 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); - -$asmType = "genbank" if ($partNames[0] =~ m/GCA/); -my $totalBases = `/cluster/bin/x86_64/ave -col=2 $trackDataDir/../${asmId}.chrom.sizes | grep "^total" | awk '{printf "%d", \$2}'`; -chomp $totalBases; -my $geneStats = `cat $trackDataDir/ncbiGene/${asmId}.ncbiGene.stats.txt | 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); -$totalBases = commify($totalBases); - -my $em = ""; -my $noEm = ""; -my $assemblyDate = `grep -v "^#" $namesFile | cut -f9`; -chomp $assemblyDate; -my $ncbiAssemblyId = `grep -v "^#" $namesFile | cut -f10`; -chomp $ncbiAssemblyId; -my $organism = `grep -v "^#" $namesFile | cut -f5`; -chomp $organism; - -if ( "${asmType}" eq "refseq" ) { - -print <<_EOF_ -
-The NCBI Gene track for the $assemblyDate $em${organism}$noEm/$ncbiAsmId
-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 model track for the $assemblyDate $em${organism}$noEm/$ncbiAsmId
-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_ - ; -} - -print <<_EOF_ -
-Total genome size: $totalBases
-Gene count: $itemCount
-Bases in genes: $basesCovered
-Percent genome coverage: % $percentCoverage
-