(no commit message)
authorUnknown Author <unknown>
Tue, 12 Aug 2008 23:19:38 +0000 (23:19 +0000)
committerUnknown Author <unknown>
Tue, 12 Aug 2008 23:19:38 +0000 (23:19 +0000)
htswdataprod/scripts/MainPipelineScript

index e172a8ffe6340d8694a637a22ead62c7b78af9c7..5cd52cae414f5faba24802499a42c821a1377fe6 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Last updated: Jul/31/2008 By Rami
+# Last updated: Aug/11/2008 By Rami
 # ---------------------------------
 # Main Desc: Top level wrapper script for the whole Data pipeline after sequencing is done until data analysis. 
 # Start: Read current folder as input Run Folder (ex: 080220_HWI-FC2057U).
 ################################################################################
                                                                          
 
-fullpath=`pwd`
-runfolder=`pwd | sed -e 's/^.*\///'`
-
 if [ $1 ]
 then echo ""
 else
   echo "Missing argument: FlowcellId. Try again. Example: ./MainPipelineScript FC99999 <enter>"
   exit
 fi
+fcid=$1
+echo "fcid is $fcid"
+
+#fullpath=`pwd`
+#runfolder=`pwd | sed -e 's/^.*\///'`
+#changed for the HTSW merged
+fullpath=$2
+#echo "fullpath is $fullpath"
+runfolder=`echo $fullpath | sed -e 's/^.*\///'` 
+#echo "runfolder is $runfolder"
 
-fcid=$1 
 
-if [ $2 ] && [ $2 == 'init' ]
- then 
+if [ $3 ] && [ $3 == 'init' ]
+ then
    rm -r ExpTrackLog
    echo "==== Starting from scratch ====\n"
 fi
 
+
 if [ -d ExpTrackLog ]
  then echo ""
 else mkdir ExpTrackLog
@@ -50,7 +57,7 @@ fi
 exptrackmainsc="exp_track_main.py"
 # -- Check Image folders and find out cycle number 
 #tocycle=`$HOME/EXPTRACK/CheckImageFolders`
-tocycle=`CheckImageFolders`
+#tocycle=`CheckImageFolders`
 
 ## Uncomment this if you want to force a cycle number:
 tocycle=36
@@ -73,7 +80,7 @@ makefilescmd="/Applications/GAPipeline-0.3.0/Goat/goat_pipeline.py --cycles=1-$t
                                                                                
 ## PRINT PRE CHECK REPORT
 echo "=================================== PRELIMINARY CHECKS ================================"
-echo "Full current path: $fullpath"
+echo "Full path: $fullpath"
 echo "Run Folder: $runfolder" 
 echo "FlowcellId: $fcid"
 echo "------------------------------------------------------"
@@ -87,7 +94,8 @@ else
  echo "ERROR: config.txt not found."
  exit
 fi
-cat config.txt
+#cat config.txt
+
 echo ""
 echo "------------------------------------------------------"
 echo "LaneNames.xml file generation: "
@@ -101,7 +109,7 @@ else
  echo "ERROR: LaneNames.xml not found."
  exit
 fi
-cat LaneNames.xml
+#cat LaneNames.xml
 echo ""
 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
 echo "Will run Cycles: 1 to $tocycle"
@@ -114,105 +122,122 @@ echo ""
 echo ""
 echo "If these are the correct parameters for your Data Pipeline Run type GO to proceed\n Otherwise type anything else to quit."
 echo "====================================================================================="
+
 confirm="GO";
-if [ $2 ] && [ $2 == 'GO' ]
+if [ $3 ] && [ $3 == 'GO' ]
 then
 echo "Autostarting";
 else
 read confirm
 fi
-                                                                                                                             
+                                                                                                                       
 
 #######################
 
 if [ $confirm ] && [ $confirm == "GO" ]
-then echo "Proceeding .."
+then echo ""
 else echo "Response: "$confirm; exit
 fi
+
 ###### START PROCESS
 
 ## First check if this is a run from scratch or from Bustard or Gerald ~~~~~
-firecrestdir=`ls Data | grep "^C1-$tocycle.*_Firecrest.*"`
-firecrestfinished=Data/$firecrestdir/finished.txt
-bustfinished=Data/$firecrestdir/Bustard*_*/finished.txt
-gerfinished=Data/$firecrestdir/Bustard*_*/GERALD_*/finished.txt
+firecrestdir=`ls $fullpath/Data | grep "^C1-$tocycle.*_Firecrest.*"`
+#echo "tocycle is $tocycle. fullpath is $fullpath"
+#echo "firecrestdir is $firecrestdir"
+firecrestfinished=$fullpath/Data/$firecrestdir/finished.txt
+bustfinished=$fullpath/Data/$firecrestdir/Bustard*_*/finished.txt
+gerfinished=$fullpath/Data/$firecrestdir/Bustard*_*/GERALD_*/finished.txt
+
 phaseMsg=''
 nextDo='all'
 
 if [ -f $firecrestfinished ] 
 then
-  phaseMsg='Firecrest Finished (found finished.txt). Start from BUSTARD? [Yes/[Any Key]] (Enter [Any Key] to Start from scratch)'
+  phaseMsg='Firecrest Finished (found finished.txt). Start from BUSTARD' 
+  #? [Yes/[Any Key]] (Enter [Any Key] to Start from scratch)'
   nextDo='Bustard'
+  echo "Firecrest finished.txt found."
   if [ -f $bustfinished ]
   then 
-    phaseMsg='Bustard Finished (found finished.txt). Start from GERALD? [Yes/[Any Key]] (Enter [Any Key] to Start from scratch)'
+    phaseMsg='Bustard Finished (found finished.txt). Start from GERALD'
+    # ? [Yes/[Any Key]] (Any Key = Start from scratch)'
     nextDo='Gerald'
+    echo " and Bustard finished.txt found."
     if [ -f $gerfinished ]
     then
-      phaseMsg='It seems like Solexa pipeline has completed (found all 3 finished.txt files). Procees to next steps (CollectReads etc..)? [Yes/[Any Key]] (Enter [Any Key] to Start from scratch)'
-      nextDo='next'
+      phaseMsg='It seems like Solexa pipeline has completed (found all 3 finished.txt files). Procees to next steps (CollectReads etc..)'
+      #? [Yes/[Any Key]] (Any Key = Start from scratch)'
+      nextDo='CollectReads'
+      echo " and Gerald finished.txt found."
     fi
   fi
 else
-  echo "Finished.txt not found: $firecrestfinished
+  echo "Run from start
 fi
 
 echo $phaseMsg 
+
+
+
 if [ $nextDo == "all" ]
 then 
-  echo ""
+  echo "Run from start"
 else
   confirm=''
-  read confirm
+  # Can't read from prompt yet using the Jabber api 
+  # read confirm
+  confirm="Yes"
   if [ $confirm == "Yes" ]
-  then 
+  then
     #Launch MPListener in the background 
-    #$HOME/EXPTRACK/MPListener $fcid $runfolder $tocycle &
-    MPListener $fcid $runfolder $tocycle & 
-    if [ $nextDxo == "Bustard" ]
+    echo " ..... supposed to run MPListener in the background here ...." 
+    ##NOT READY YET MPListener $fcid $runfolder $tocycle & 
+    if [ $nextDo == "Bustard" ]
     then
-      #Change dir down to Bustard run folder
-      echo "Changing dir to Data/$firecrestdir/Bustard*_*/"
-      cd Data/$firecrestdir/Bustard*_*
-      echo "Starting Solexa data process (`date`) FROM BUSTARD ..."
-      python $exptrackmainsc updsts $fcid $runfolder 1 From_BUSTARD
-      make -j 8 recursive
-      ## MPListner takes care of the rest 
+      #Change dir down to Bustard run folder      
+      #echo "Starting Solexa data process (`date`) FROM BUSTARD ..."
+      python $exptrackmainsc updsts $fcid $runfolder 1 Start_from_BUSTARD
+      echo "Changing dir to $fullpath/Data/$firecrestdir/Bustard*_*/"
+      cd $fullpath/Data/$firecrestdir/Bustard*_*
+      echo " ..... supposed to run make -j 8 recursive here  ...."
+      ##NOT READY YET  make -j 8 recursive
     else 
-      if [ $nextDxo == "Gerald" ]
+      if [ $nextDo == "Gerald" ]
       then
         #Change dir down to Bustard run folder    
-        echo "Changing dir to Data/$firecrestdir/Bustard*_*/Gerald..."
-        cd Data/$firecrestdir/Bustard*_*/GERALD_*
-        echo "Starting Solexa data process (`date`) FROM GERALD ..."
-        python $exptrackmainsc updsts $fcid $runfolder 1 From_GERALD
-        make -j 8
-        ## MPListner takes care of the rest
+        python $exptrackmainsc updsts $fcid $runfolder 1 Start_from_GERALD
+        #echo "Starting Solexa data process (`date`) FROM GERALD ..."
+        echo "Changing dir to $fullpath/Data/$firecrestdir/Bustard*_*/Gerald..."
+        cd $fullpath/Data/$firecrestdir/Bustard*_*/GERALD_*
+        echo " ..... supposed to run make -j 8  here  ...."
+        ##NOT READY YET make -j 8
       fi
     fi
+    ## MPListner takes care of the rest 
     exit 
   fi
 fi 
 ### ~~~~~~~~  
 
 
-
 if [ -f ExpTrackLog/OK_get_check_config_file ]
  then
   echo "Ready for Make file generation step"
   #run Make files generation step
   python $exptrackmainsc updsts $fcid $runfolder 0 Generating_Make_files
-  $makefilescmd
+  ##NOT READY YET $makefilescmd
  else
   echo "FAILED: get_check_config_file."
   python $exptrackmainsc updsts $fcid $runfolder 0 Check_ConfigFile_Failed
   exit
 fi 
 
-## Make sure we find the Firecrest folder, then check "Makefile" in the 3 directories
-# firecrestdir=`ls Data | grep C1.*_Firecrest.*_encode`
-firecrestdir=`ls Data | grep "^C1-$tocycle.*_Firecrest.*"`
-countdirs=`ls Data | grep -c "^C1-$tocycle.*_Firecrest.*"`
+
+
+## CHECKING OF THE MAKE FILE. Checks presence of the Firecrest folder, then check "Makefile" in the 3 directories
+firecrestdir=`ls $fullpath/Data | grep "^C1-$tocycle.*_Firecrest.*"`
+countdirs=`ls $fullpath/Data | grep -c "^C1-$tocycle.*_Firecrest.*"`
 if [ $countdirs == 1 ]
 then
   echo "ok. firecrest folder '$firecrestdir' found"
@@ -231,20 +256,20 @@ else
   fi
 fi
 
-firemakefile=Data/$firecrestdir/Makefile
-bustmakefile=Data/$firecrestdir/Bustard*_*/Makefile
-germakefile=Data/$firecrestdir/Bustard*_*/GERALD_*/Makefile
+firemakefile=$fullpath/Data/$firecrestdir/Makefile
+bustmakefile=$fullpath/Data/$firecrestdir/Bustard*_*/Makefile
+germakefile=$fullpath/Data/$firecrestdir/Bustard*_*/GERALD_*/Makefile
 if [ -f $firemakefile ] && [ -f $bustmakefile ] && [ -f $germakefile ]
 then 
  #Launch MPListener in the background 
  #$HOME/EXPTRACK/MPListener $fcid $runfolder $tocycle &
  MPListener $fcid $runfolder $tocycle & 
  #Change dir down 2 folders to the Firecrest folder
- echo "Changing dir to Data/$firecrestdir"
- cd Data/$firecrestdir
- echo "Starting Solexa data process at `date`. This would be a good time for a short ski escapade at Lake Tahoe ... ;) ..."
  python $exptrackmainsc updsts $fcid $runfolder 1
  python $exptrackmainsc updsts $fcid $runfolder 1 Firecrest_Dir:_$firecrestdir
+ echo "Changing dir to $fullpath/Data/$firecrestdir"
+ cd $fullpath/Data/$firecrestdir
+ echo "Starting Solexa data process at `date`. This would be a good time for a short ski escapade at Lake Tahoe ... ;) ..."
  make -j 8 recursive
 else 
  echo "FAILED: can't find 3 Makefile. Looked for: $firemakefile, $bustmakefile, $germakefile"