7592170a1f176f724492f264eff0e094cc0bc316
hiram
  Mon Nov 4 03:54:26 2024 -0800
upgrade augustus binary and correct use of mktemp refs #34685

diff --git src/hg/utils/automation/doAugustus.pl src/hg/utils/automation/doAugustus.pl
index d3521ac..bdd69d9 100755
--- src/hg/utils/automation/doAugustus.pl
+++ src/hg/utils/automation/doAugustus.pl
@@ -24,41 +24,41 @@
     $opt_noDbGenePredCheck
     /;
 
 # Specify the steps supported with -continue / -stop:
 my $stepper = new HgStepManager(
     [ { name => 'partition',   func => \&doPartition },
       { name => 'augustus', func => \&doAugustus },
       { name => 'makeGp', func => \&doMakeGp },
       { name => 'load', func => \&doLoadAugustus },
       { name => 'cleanup', func => \&doCleanup },
     ]
 				);
 
 # Option defaults:
 # my $bigClusterHub = 'swarm';
-my $bigClusterHub = 'ku';
+my $bigClusterHub = 'hgwdev';
 my $workhorse = 'hgwdev';
 my $dbHost = 'hgwdev';
 my $ram = '6g';
 my $cpu = 1;
 my $defaultWorkhorse = 'hgwdev';
 my $maskedSeq = "$HgAutomate::clusterData/\$db/\$db.2bit";
 my $utr = "off";
 my $noDbGenePredCheck = 1;    # default yes, use -db for genePredCheck
 my $species = "human";
-my $augustusDir = "/hive/data/outside/augustus/augustus-3.3.1";
+my $augustusDir = "/hive/data/outside/augustus/augustus-3.5.0";
 my $augustusConfig="$augustusDir/config";
 
 my $base = $0;
 $base =~ s/^(.*\/)?//;
 
 sub usage {
   # Usage / help / self-documentation:
   my ($status, $detailed) = @_;
   # Basic help (for incorrect usage):
   print STDERR "
 usage: $base db
 options:
 ";
   print STDERR $stepper->getOptionHelp();
   print STDERR <<_EOF_
@@ -209,31 +209,48 @@
 #       start==end  for a multiple fasta file
 #     start is 0 relative, will increment by 1 here for augustus
 #     error result will end up in augErr/directory/file.err
 
 set db = "$db"
 set start = \$1
 set end = \$2
 set fasta = \$3
 set chrName = \$fasta:r:t
 
 set resultGz = \$4
 set gtfFile = \$resultGz:t:r
 set errFile = "augErr/\$resultGz:h:t/\$gtfFile:r:t.err"
 mkdir -p \$resultGz:h
 mkdir -p \$errFile:h
-set tmpDir = "/tmp/\$db.\$chrName.\$start.\$end"
+
+unsetenv TMPDIR
+if ( -d "/data/tmp" ) then
+  setenv TMPDIR "/data/tmp"
+else if ( -d "/scratch/tmp" ) then
+  setenv TMPDIR "/scratch/tmp"
+else
+  set tmpSz = `df --output=avail -k /tmp | tail -1`
+  set shmSz = `df --output=avail -k /dev/shm | tail -1`
+  if ( "\${shmSz}" > "\${tmpSz}" ) then
+     mkdir -p /dev/shm/tmp
+     chmod 777 /dev/shm/tmp
+     setenv TMPDIR "/dev/shm/tmp"
+  else
+     setenv TMPDIR "/tmp"
+  endif
+endif
+set tmpDir = `mktemp -d -p \$TMPDIR doAugustus.cluster.XXXXXX`
 
 mkdir -p \$tmpDir
 pushd \$tmpDir
 
 if ( \$start == \$end ) then
 $augustusDir/bin/augustus --species=$species --softmasking=1 --UTR=$utr --protein=off \\
  --AUGUSTUS_CONFIG_PATH=$augustusConfig \\
   --alternatives-from-sampling=true --sample=100 --minexonintronprob=0.2 \\
    --minmeanexonintronprob=0.5 --maxtracks=3 --temperature=2 \\
     \$fasta --outfile=\$gtfFile --errfile=\$errFile:t
 else
  @ start++
 $augustusDir/bin/augustus --species=$species --softmasking=1 --UTR=$utr --protein=off \\
  --AUGUSTUS_CONFIG_PATH=$augustusConfig \\
   --alternatives-from-sampling=true --sample=100 --minexonintronprob=0.2 \\