2 # Illumina Data Analysis Pipeline "Listener" fr Standard or IPAR mode. Checks for finished.txt in each main directory of the pipeline
5 exptrackmainsc="/usr/local/src/EXPTRACK/exp_track_main.py"
12 ## DBG: python $exptrackmainsc updsts $fcid $runfolder 1 ListenerStarted
15 analysis_mode='standard'
16 pipeline_version='1.3'
17 ## The Command that runs the making of the "make" files
18 if [ -d Data/IPAR_$pipeline_version ]
20 datadir=Data/IPAR_$pipeline_version
26 ## Make sure we find the ONE specific Start folder (Firecrest or Standard / Bustard for IPAR)
27 if [ $analysis_mode == 'IPAR' ]
29 #firecrestdir=`ls $datadir | grep "Firecrest"`
30 #countdirs=`ls $datadir | grep -c Firecrest`
32 startdir=`ls $datadir | grep Bustard$pipeline_version`
33 countdirs=`ls $datadir | grep -c Bustard$pipeline_version`
35 startdir=`ls $datadir | grep C1-[0-9][0-9]_Firecrest`
36 countdirs=`ls $datadir | grep -c C1-[0-9][0-9]_Firecrest`
39 if [ $countdirs == 1 ]
41 echo "ok. start folder '$startdir' found"
43 if [ $countdirs -gt 1 ]
45 echo "MPListner ERROR: Found too many ($countdirs) start directories (firecrest/bustard(for IPAR)). You need to specify ONE folder or REMOVE duplicates. Found:"
48 python $exptrackmainsc updsts $fcid $runfolder 0 ERROR:_Need_Specific_Start_Dir
51 echo "MPListner ERROR: Start (firecrest/bustard(for IPAR)) directory NOT FOUND."
52 python $exptrackmainsc updsts $fcid $runfolder 0 ERROR:_Start_Dir_Not_Found
57 # ---------------------- Check for finished.txt in each main directory of the pipeline ------------
59 if [ $analysis_mode == 'IPAR' ]
61 firecrestfinished=$datadir/$startdir/finished.txt # dummy check, since there's no need to check this one in IPAR
62 bustfinished=$datadir/$startdir/finished.txt
63 gerfinished=$datadir/$startdir/GERALD_*/finished.txt
65 firecrestfinished=$datadir/$startdir/finished.txt
66 bustfinished=$datadir/$startdir/Bustard*_*/finished.txt
67 gerfinished=$datadir/$startdir/Bustard*_*/GERALD_*/finished.txt
70 # Wait for 48 hours max
71 timeremain=`expr 60 \* 60 \* 72`
74 ## ---- Wait for Firecrest -----
75 while [ $analysis_mode != 'IPAR' ] && [ ! -f $firecrestfinished ] && [ $timeremain -gt 0 ]
77 #echo "wating $interval secs more to check for firecrestfinished ($timeremain secs left)"
78 sleep $(( $interval ))
79 timeremain=`expr $timeremain - $interval`
82 if [ $timeremain -gt 0 ]
84 if [ $analysis_mode != 'IPAR' ]
86 echo "Firecrest finished at `date`"
87 python $exptrackmainsc updsts $fcid $runfolder 1 Firecrest_finished
90 echo "Script time expired while waiting for Firecrest to finish."
91 python $exptrackmainsc updsts $fcid $runfolder 2 Script_time_expired_during_Firecrest
94 ## -------- Wait for Bustard ------
95 while [ ! -f $bustfinished ] && [ $timeremain -gt 0 ]
97 #echo "wating $interval secs more to check for bustfinished ($timeremain secs left)"
98 sleep $(( $interval ))
99 timeremain=`expr $timeremain - $interval`
102 if [ $timeremain -gt 0 ]
104 echo "Bustard finished at `date`"
105 python $exptrackmainsc updsts $fcid $runfolder 1 Bustard_finished
107 echo "Script time expired while waiting for Bustard to finish."
108 python $exptrackmainsc updsts $fcid $runfolder 2 Script_time_expired_during_Bustard
111 ## -------- Wait for Gerald ------
112 while [ ! -f $gerfinished ] && [ $timeremain -gt 0 ]
114 echo "wating $interval secs more to check for $gerfinished ($timeremain secs left)"
115 sleep $(( $interval ))
116 timeremain=`expr $timeremain - $interval`
120 if [ $timeremain -gt 0 ]
122 echo "Gerald finished at `date`"
123 python $exptrackmainsc updsts $fcid $runfolder 3 Gerald_finished__Starting_DataAnalysis
124 echo "Finished LISTENING TO SOLEXA PIPELINE ..."
125 echo "Starting DATA ANALYSIS PHASE ..."
126 /usr/local/src/EXPTRACK/MPAnalysis $fcid $runfolder
128 echo "Script time expired while waiting for Gerald to finish."
129 python $exptrackmainsc updsts $fcid $runfolder 2 Script_time_expired_during_Gerald
134 ## ---------------------------------------------------------------------------------