22a9ec8b34dd60a14257bdef408f21c03db601b4 hiram Mon Feb 17 16:06:38 2020 -0800 now using the shorter assembly name for genome identifier and fix some common names refs #23891 diff --git src/hg/makeDb/doc/asmHubs/mkGenomes.pl src/hg/makeDb/doc/asmHubs/mkGenomes.pl index e8c2acb..4ab17f0 100755 --- src/hg/makeDb/doc/asmHubs/mkGenomes.pl +++ src/hg/makeDb/doc/asmHubs/mkGenomes.pl @@ -13,93 +13,95 @@ my $Name = shift; my $asmHubName = shift; my %betterName; # key is asmId, value is common name my $srcDocDir = "${asmHubName}AsmHub"; my $buildDir = "/hive/data/genomes/asmHubs/refseqBuild"; my $destDir = "/hive/data/genomes/asmHubs/$asmHubName"; my $home = $ENV{'HOME'}; my $toolsDir = "$home/kent/src/hg/makeDb/doc/asmHubs"; my $commonNameList = "$asmHubName.asmId.commonName.tsv"; my $commonNameOrder = "$asmHubName.commonName.asmId.orderList.tsv"; open (FH, "<$toolsDir/${commonNameList}") or die "can not read $toolsDir/${commonNameList}"; while (my $line = ) { + next if ($line =~ m/^#/); chomp $line; my ($asmId, $name) = split('\t', $line); $betterName{$asmId} = $name; } close (FH); my @orderList; # asmId of the assemblies in order from the *.list files # the order to read the different .list files: my $assemblyCount = 0; open (FH, "<$toolsDir/${commonNameOrder}") or die "can not read ${commonNameOrder}"; while (my $line = ) { + next if ($line =~ m/^#/); chomp $line; my ($commonName, $asmId) = split('\t', $line); push @orderList, $asmId; ++$assemblyCount; } close (FH); my $orderKey = 1; foreach my $asmId (reverse(@orderList)) { my ($gcPrefix, $accession, undef) = split('_', $asmId); my $accessionId = sprintf("%s_%s", $gcPrefix, $accession); my $accessionDir = substr($asmId, 0 ,3); $accessionDir .= "/" . substr($asmId, 4 ,3); $accessionDir .= "/" . substr($asmId, 7 ,3); $accessionDir .= "/" . substr($asmId, 10 ,3); my $buildDir = "/hive/data/genomes/asmHubs/refseqBuild/" . substr($asmId, 0 ,3); $buildDir .= "/" . substr($asmId, 4 ,3); $buildDir .= "/" . substr($asmId, 7 ,3); $buildDir .= "/" . substr($asmId, 10 ,3); $buildDir .= "/" . $asmId; my $asmReport="$buildDir/download/${asmId}_assembly_report.txt"; next if (! -s $asmReport); printf STDERR "# %03d genomes.txt %s/%s\n", $orderKey, $accessionDir, $accessionId; my $descr=`grep -i "organism name:" $asmReport | head -1 | sed -e 's#.*organism name: *##i; s# (.*\$##;'`; chomp $descr; my $orgName=`grep -i "organism name:" $asmReport | head -1 | sed -e 's#.* name: .* (##; s#).*##;'`; chomp $orgName; $orgName = $betterName{$asmId} if (exists($betterName{$asmId})); - printf "genome %s\n", $asmId; - printf "trackDb %s/%s/trackDb.txt\n", $accessionDir, $accessionId; + printf "genome %s\n", $accessionId; + printf "trackDb ../%s/%s/trackDb.txt\n", $accessionDir, $accessionId; printf "groups groups.txt\n"; printf "description %s\n", $orgName; - printf "twoBitPath %s/%s/%s.2bit\n", $accessionDir, $accessionId, $accessionId; + printf "twoBitPath ../%s/%s/%s.2bit\n", $accessionDir, $accessionId, $accessionId; printf "organism %s\n", $descr; my $chrName=`head -1 $buildDir/$asmId.chrom.sizes | awk '{print \$1}'`; chomp $chrName; my $bigChrom=`head -1 $buildDir/$asmId.chrom.sizes | awk '{print \$NF}'`; chomp $bigChrom; my $oneThird = int($bigChrom/3); my $tenK = $oneThird + 10000; $tenK = $bigChrom if ($tenK > $bigChrom); my $defPos="${chrName}:${oneThird}-${tenK}"; if ( -s "$asmId/defaultPos.txt" ) { $defPos=`cat "$asmId/defaultPos.txt"`; chomp $defPos; } printf "defaultPos %s\n", $defPos; printf "orderKey %d\n", $orderKey++; printf "scientificName %s\n", $descr; - printf "htmlPath %s/%s/html/%s.description.html\n", $accessionDir, $accessionId, $asmId; + printf "htmlPath ../%s/%s/html/%s.description.html\n", $accessionDir, $accessionId, $asmId; printf "\n"; my $localGenomesFile = "$buildDir/${asmId}.genomes.txt"; my $localOrderKey; open (GF, ">$localGenomesFile") or die "can not write to $localGenomesFile"; printf GF "genome %s\n", $accessionId; printf GF "trackDb trackDb.txt\n"; printf GF "groups groups.txt\n"; printf GF "description %s\n", $orgName; printf GF "twoBitPath %s.2bit\n", $accessionId; printf GF "organism %s\n", $descr; printf GF "defaultPos %s\n", $defPos; printf GF "orderKey %d\n", $localOrderKey++; printf GF "scientificName %s\n", $descr; printf GF "htmlPath html/%s.description.html\n", $asmId; close (GF);