0d886f89f8374347018e9c0620adf111d4e7078e hiram Thu Jan 4 12:22:56 2024 -0800 now working with dynamic blat on genome sizes over 4 Gb no redmine diff --git src/hg/makeDb/doc/asmHubs/mkGenomes.pl src/hg/makeDb/doc/asmHubs/mkGenomes.pl index 966fa59..5b5e869 100755 --- src/hg/makeDb/doc/asmHubs/mkGenomes.pl +++ src/hg/makeDb/doc/asmHubs/mkGenomes.pl @@ -18,32 +18,32 @@ printf STDERR "result will write a local asmId.genomes.txt file for each hub\n"; printf STDERR "and a local asmId.hub.txt file for each hub\n"; printf STDERR "and a local asmId.groups.txt file for each hub\n"; printf STDERR "and the output to stdout will be the overall genomes.txt\n"; printf STDERR "index file for all genomes in the given list\n"; exit 255; } my $downloadHost = "hgwdev"; my @blatHosts = qw( dynablat-01 dynablat-01 ); my @blatPorts = qw( 4040 4040 ); my $blatHostDomain = ".soe.ucsc.edu"; my $groupsTxt = `cat ~/kent/src/hg/makeDb/doc/asmHubs/groups.txt`; ################### writing out hub.txt file, twice ########################## -sub singleFileHub($$$$$$$$$$$$$) { - my ($fh1, $fh2, $accessionId, $orgName, $descr, $asmId, $asmDate, $defPos, $taxId, $trackDb, $accessionDir, $buildDir, $chromAuthority) = @_; +sub singleFileHub($$$$$$$$$$$$$$) { + my ($fh1, $fh2, $accessionId, $orgName, $descr, $asmId, $asmDate, $defPos, $taxId, $trackDb, $accessionDir, $buildDir, $chromAuthority, $hugeGenome) = @_; my @fhN; push @fhN, $fh1; push @fhN, $fh2; my %liftOverChain; # key is 'otherDb' name, value is bbi path my %liftOverGz; # key is 'otherDb' name, value is lift.over.gz file path my $hasChainNets = `ls -d $buildDir/trackData/lastz.* 2> /dev/null | wc -l`; chomp $hasChainNets; if ($hasChainNets) { printf STDERR "# hasChainNets: %d\t%s\n", $hasChainNets, $asmId; open (CH, "ls -d $buildDir/trackData/lastz.*|") or die "can not ls -d $buildDir/trackData/lastz.*"; while (my $line = <CH>) { chomp $line; my $otherDb = basename($line); $otherDb =~ s/lastz.//; @@ -86,44 +86,44 @@ printf $fh "chromSizes %s.chrom.sizes.txt\n", $accessionId; if ( -s "${buildDir}/${asmId}.chromAlias.bb" ) { printf $fh "chromAliasBb %s.chromAlias.bb\n", $accessionId; } else { printf $fh "chromAlias %s.chromAlias.txt\n", $accessionId; } if ($chromAuthority =~ m/^chromAuthority/) { printf $fh "%s\n", $chromAuthority; } printf $fh "organism %s %s\n", $assemblyName, $asmDate; printf $fh "defaultPos %s\n", $defPos; printf $fh "scientificName %s\n", $descr; printf $fh "htmlPath html/%s.description.html\n", $asmId; # until blat server host is ready for hgdownload, avoid these lines if ($blatHosts[$fileCount] ne $downloadHost) { - printf $fh "blat %s%s %s dynamic $accessionDir/$accessionId\n", $blatHosts[$fileCount], $blatHostDomain, $blatPorts[$fileCount]; - printf $fh "transBlat %s%s %s dynamic $accessionDir/$accessionId\n", $blatHosts[$fileCount], $blatHostDomain, $blatPorts[$fileCount]; - printf $fh "isPcr %s%s %s dynamic $accessionDir/$accessionId\n", $blatHosts[$fileCount], $blatHostDomain, $blatPorts[$fileCount]; + printf $fh "blat %s%s %s dynamic $accessionDir/$accessionId\n", $blatHosts[$fileCount], $blatHostDomain, $blatPorts[$fileCount]+$hugeGenome; + printf $fh "transBlat %s%s %s dynamic $accessionDir/$accessionId\n", $blatHosts[$fileCount], $blatHostDomain, $blatPorts[$fileCount]+$hugeGenome; + printf $fh "isPcr %s%s %s dynamic $accessionDir/$accessionId\n", $blatHosts[$fileCount], $blatHostDomain, $blatPorts[$fileCount]+$hugeGenome; } foreach my $otherDb (sort keys %liftOverGz) { printf $fh "liftOver.%s %s\n", $otherDb, $liftOverGz{$otherDb}; } printf $fh "\n"; foreach my $tdbLine (@tdbLines) { printf $fh "%s\n", $tdbLine; } ++$fileCount; } -} +} # sub singleFileHub($$$$$$$$$$$$$$) ############################################################################## my $home = $ENV{'HOME'}; my $toolsDir = "$home/kent/src/hg/makeDb/doc/asmHubs"; my $blatHost = shift; my $blatPort = shift; my $inputList = shift; my $orderList = $inputList; if ( ! -s "$orderList" ) { $orderList = $toolsDir/$inputList; } my @orderList; # asmId of the assemblies in order from the *.list files # the order to read the different .list files: @@ -225,104 +225,112 @@ printf "twoBitPath ../%s/%s/%s.2bit\n", $accessionDir, $accessionId, $accessionId; printf "twoBitBptUrl ../%s/%s/%s.2bit.bpt\n", $accessionDir, $accessionId, $accessionId; printf "chromSizes ../%s/%s/%s.chrom.sizes.txt\n", $accessionDir, $accessionId, $accessionId; # wait until code gets out for v429 release before using chromAlias.bb # for the chromInfoPage display of hgTracks if ( -s "${buildDir}/${asmId}.chromAlias.bb" ) { printf "chromAliasBb ../%s/%s/%s.chromAlias.bb\n", $accessionDir, $accessionId, $accessionId; } else { printf "chromAlias ../%s/%s/%s.chromAlias.txt\n", $accessionDir, $accessionId, $accessionId; } if ($chromAuthority =~ m/^chromAuthority/) { printf "%s\n", $chromAuthority; } printf "organism %s %s\n", $assemblyName, $asmDate; + my $hugeGenome = 0; + my $fourGb = 2**32 - 1; + my $asmSize=`ave -col=2 $buildDir/$asmId.chrom.sizes | grep -w total | awk '{printf "%d", \$NF}'`; + chomp $asmSize; + $hugeGenome = 1 if ($asmSize > $fourGb); 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 "$buildDir/defaultPos.txt" ) { $defPos=`cat "$buildDir/defaultPos.txt"`; chomp $defPos; } printf "defaultPos %s\n", $defPos; printf "orderKey %d\n", $buildDone; printf "scientificName %s\n", $descr; printf "htmlPath ../%s/%s/html/%s.description.html\n", $accessionDir, $accessionId, $asmId; # until blat server host is ready for hgdownload, avoid these lines if ($blatHost ne $downloadHost) { if ( -s "${destDir}/$accessionId.trans.gfidx" ) { - printf "blat $blatHost$blatHostDomain $blatPort dynamic $accessionDir/$accessionId\n"; - printf "transBlat $blatHost$blatHostDomain $blatPort dynamic $accessionDir/$accessionId\n"; - printf "isPcr $blatHost$blatHostDomain $blatPort dynamic $accessionDir/$accessionId\n"; + printf "blat $blatHost$blatHostDomain %d dynamic $accessionDir/$accessionId\n", $blatPort + $hugeGenome; + printf "transBlat $blatHost$blatHostDomain %d dynamic $accessionDir/$accessionId\n", $blatPort + $hugeGenome; + printf "isPcr $blatHost$blatHostDomain %d dynamic $accessionDir/$accessionId\n", $blatPort + $hugeGenome; + } else { + printf STDERR "# missing ${destDir}/$accessionId.trans.gfidx\n"; } } printf "\n"; # the original multi-file system: my $localHubTxt = "$buildDir/${asmId}.hub.txt"; open (HT, ">$localHubTxt") or die "can not write to $localHubTxt"; printf HT "hub %s genome assembly\n", $accessionId; printf HT "shortLabel %s\n", $orgName; printf HT "longLabel %s/%s/%s genome assembly\n", $orgName, $descr, $asmId; printf HT "genomesFile genomes.txt\n"; printf HT "email hclawson\@ucsc.edu\n"; printf HT "descriptionUrl html/%s.description.html\n", $asmId; close (HT); # try creating single file hub.txt, one for hgwdev, one for hgdownload my $downloadHubTxt = "$buildDir/${asmId}.download.hub.txt"; open (DL, ">$downloadHubTxt") or die "can not write to $downloadHubTxt"; $localHubTxt = "$buildDir/${asmId}.singleFile.hub.txt"; open (HT, ">$localHubTxt") or die "can not write to $localHubTxt"; singleFileHub(\*HT, \*DL, $accessionId, $orgName, $descr, $asmId, $asmDate, - $defPos, $taxId, $trackDb, $accessionDir, $buildDir, $chromAuthority); + $defPos, $taxId, $trackDb, $accessionDir, $buildDir, $chromAuthority, + $hugeGenome); my $localGenomesFile = "$buildDir/${asmId}.genomes.txt"; open (GF, ">$localGenomesFile") or die "can not write to $localGenomesFile"; printf GF "genome %s\n", $accessionId; printf GF "taxId %s\n", $taxId if (length($taxId) > 1); 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 "twoBitBptUrl %s.2bit.bpt\n", $accessionId; printf GF "chromSizes %s.chrom.sizes.txt\n", $accessionId; if ( -s "${buildDir}/${asmId}.chromAlias.bb" ) { printf GF "chromAliasBb %s.chromAlias.bb\n", $accessionId; } else { printf GF "chromAlias %s.chromAlias.txt\n", $accessionId; } if ($chromAuthority =~ m/^chromAuthority/) { printf GF "%s\n", $chromAuthority; } printf GF "organism %s %s\n", $assemblyName, $asmDate; printf GF "defaultPos %s\n", $defPos; printf GF "scientificName %s\n", $descr; printf GF "htmlPath html/%s.description.html\n", $asmId; # until blat server host is ready for hgdownload, avoid these lines if ($blatHost ne $downloadHost) { if ( -s "${destDir}/$accessionId.trans.gfidx" ) { - printf GF "blat $blatHost$blatHostDomain $blatPort dynamic $accessionDir/$accessionId\n"; - printf GF "transBlat $blatHost$blatHostDomain $blatPort dynamic $accessionDir/$accessionId\n"; - printf GF "isPcr $blatHost$blatHostDomain $blatPort dynamic $accessionDir/$accessionId\n"; + printf GF "blat $blatHost$blatHostDomain %d dynamic $accessionDir/$accessionId\n", $blatPort + $hugeGenome; + printf GF "transBlat $blatHost$blatHostDomain %d dynamic $accessionDir/$accessionId\n", $blatPort + $hugeGenome; + printf GF "isPcr $blatHost$blatHostDomain %d dynamic $accessionDir/$accessionId\n", $blatPort + $hugeGenome; } } close (GF); my $localGroups = "$buildDir/${asmId}.groups.txt"; open (GR, ">$localGroups") or die "can not write to $localGroups"; printf GR "%s", $groupsTxt; close (GR); } __END__ description Mastacembelus armatus twoBitPath GCA_900324485.2_fMasArm1.2/trackData/addMask/GCA_900324485.2_fMasArm1.2.masked.2bit organism Zig-Zag eel