src/hg/utils/automation/doBlastzChainNet.pl 1.27

1.27 2009/03/13 22:33:13 hiram
New option -inclHap to pass along to the net stage, and properly find at least some kind of db name from the path
Index: src/hg/utils/automation/doBlastzChainNet.pl
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/utils/automation/doBlastzChainNet.pl,v
retrieving revision 1.26
retrieving revision 1.27
diff -b -B -U 4 -r1.26 -r1.27
--- src/hg/utils/automation/doBlastzChainNet.pl	23 Jan 2009 22:07:32 -0000	1.26
+++ src/hg/utils/automation/doBlastzChainNet.pl	13 Mar 2009 22:33:13 -0000	1.27
@@ -54,8 +54,9 @@
     $opt_readmeOnly
     $opt_ignoreSelf
     $opt_syntenicNet
     $opt_noDbNameCheck
+    $opt_inclHap
     /;
 
 # Specify the steps supported with -continue / -stop:
 my $stepper = new HgStepManager(
@@ -115,8 +116,9 @@
     -qRepeats table       Add -qRepeats=table to netClass (default: rmsk)
     -ignoreSelf           Do not assume self alignments even if tDb == qDb
     -syntenicNet          Perform optional syntenicNet step
     -noDbNameCheck        ignore Db name format
+    -inclHap              include haplotypes *_hap* in chain/net, default not
 _EOF_
   ;
 print STDERR &HgAutomate::getCommonOptionHelp('dbHost' => $dbHost,
 				      'workhorse' => $workhorse,
@@ -241,9 +243,9 @@
 
 # Globals:
 my %defVars = ();
 my ($DEF, $tDb, $qDb, $QDb, $isSelf, $selfSplit, $buildDir, $fileServer);
-my ($swapDir, $splitRef);
+my ($swapDir, $splitRef, $inclHap);
 
 sub isInDirList {
   # Return TRUE if $dir is under (begins with) something in dirList.
   my ($dir, @dirList) = @_;
@@ -280,9 +282,10 @@
 		      "qRepeats=s",
 		      "readmeOnly",
 		      "ignoreSelf",
                       "syntenicNet",
-                      "noDbNameCheck"
+                      "noDbNameCheck",
+                      "inclHap"
 		     );
   &usage(1) if (!$ok);
   &usage(0, 1) if ($opt_help);
   &HgAutomate::processCommonOptions();
@@ -406,8 +409,16 @@
   } else {
     die "Error: $DEF variable $var=$val must be a full path with " .
       "a recognizable database as one of its elements.\n"
   }
+  if (! defined($db)) {
+    if ($val =~ m#^/hive/data/genomes/#) {
+	$val =~ s#^/hive/data/genomes/##;
+	$val =~ s#/.*##;
+	$db = $val;
+	warn "Warning: assuming database $db from /hive/data/genomes/<db>/ path\n";
+    }
+  }
 return $db;
 }
 
 sub checkDef {
@@ -869,10 +880,10 @@
   my $bossScript = new HgRemoteScript("$runDir/netChains.csh", $workhorse,
 				      $runDir, $whatItDoes, $DEF);
   $bossScript->add(<<_EOF_
 # Make nets ("noClass", i.e. without rmsk/class stats which are added later):
-chainPreNet $chain $defVars{SEQ1_LEN} $defVars{SEQ2_LEN} stdout \\
-| chainNet stdin -minSpace=1 $defVars{SEQ1_LEN} $defVars{SEQ2_LEN} stdout /dev/null \\
+chainPreNet $inclHap $chain $defVars{SEQ1_LEN} $defVars{SEQ2_LEN} stdout \\
+| chainNet $inclHap stdin -minSpace=1 $defVars{SEQ1_LEN} $defVars{SEQ2_LEN} stdout /dev/null \\
 | netSyntenic stdin noClass.net
 
 # Make liftOver chains:
 netChainSubset -verbose=0 noClass.net $chain stdout \\
@@ -1471,8 +1482,10 @@
 
 &usage(1) if (scalar(@ARGV) != 1);
 ($DEF) = @ARGV;
 
+$inclHap = "";
+$inclHap = "-inclHap" if ($opt_inclHap);
 &loadDef($DEF);
 &checkDef();
 
 my $seq1IsSplit = (`wc -l < $defVars{SEQ1_LEN}` <=