Look in Temp directories for some of the files we have historically
authorDiane Trout <diane@caltech.edu>
Tue, 6 Jan 2009 02:05:10 +0000 (02:05 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 6 Jan 2009 02:05:10 +0000 (02:05 +0000)
used for our summary reports.

Version 1.1rc1 of the gapipeline started moving some of the files
into /Temp subdirectories of bustard and gerald.

htsworkflow/pipelines/eland.py
htsworkflow/pipelines/runfolder.py

index 864f8ca4454eb93c8ffde3f83aaac51dede72252..05563a1a2cb5ba455c7a4b360c955c60eb630738 100644 (file)
@@ -316,10 +316,13 @@ def check_for_eland_file(basedir, pattern, lane_id, end):
 def eland(basedir, gerald=None, genome_maps=None):
     e = ELAND()
 
-    #file_list = glob(os.path.join(basedir, "*_eland_result.txt"))
-    #if len(file_list) == 0:
-    #    # lets handle compressed eland files too
-    #    file_list = glob(os.path.join(basedir, "*_eland_result.txt.bz2"))
+    # if there is a basedir/Temp change basedir to point to the temp
+    # directory, as 1.1rc1 moves most of the files we've historically
+    # cared about to that subdirectory.
+    # we should look into what the official 'result' files are.
+    basedir_temp = os.path.join(basedir, 'Temp')
+    if os.path.isdir(basedir_temp):
+        basedir = basedir_temp
 
     lane_ids = range(1,9)
     ends = [None, 1, 2]
index ba99c4c25f31b956c18a7fbc20f548a02fa04bf0..f327b7891868034ca38c8327bdeed5ed2efdd135 100644 (file)
@@ -304,7 +304,15 @@ def extract_results(runs, output_base_dir=None):
 
       # tar score files
       score_files = []
-      for f in os.listdir(g.pathname):
+
+      # check for g.pathname/Temp a new feature of 1.1rc1
+      scores_path = g.pathname
+      scores_path_temp = os.path.join(scores_path, 'Temp')
+      if os.path.isdir(scores_path_temp):
+          scores_path = scores_path_temp
+
+      # hopefully we have a directory that contains s_*_score files
+      for f in os.listdir(scores_path):
           if re.match('.*_score.txt', f):
               score_files.append(f)
 
@@ -312,12 +320,13 @@ def extract_results(runs, output_base_dir=None):
       bzip_cmd = [ 'bzip2', '-9', '-c' ]
       tar_dest_name =os.path.join(cycle_dir, 'scores.tar.bz2')
       tar_dest = open(tar_dest_name, 'w')
-      logging.info("Compressing score files in %s" % (g.pathname,))
+      logging.info("Compressing score files from %s" % (scores_path,))
       logging.info("Running tar: " + " ".join(tar_cmd[:10]))
       logging.info("Running bzip2: " + " ".join(bzip_cmd))
       logging.info("Writing to %s" %(tar_dest_name))
 
-      tar = subprocess.Popen(tar_cmd, stdout=subprocess.PIPE, shell=False, cwd=g.pathname)
+      tar = subprocess.Popen(tar_cmd, stdout=subprocess.PIPE, shell=False, 
+                             cwd=scores_path)
       bzip = subprocess.Popen(bzip_cmd, stdin=tar.stdout, stdout=tar_dest)
       tar.wait()
 
@@ -327,6 +336,9 @@ def extract_results(runs, output_base_dir=None):
               source_name = eland_lane.pathname
               path, name = os.path.split(eland_lane.pathname)
               dest_name = os.path.join(cycle_dir, name)
+             logging.info("Saving eland file %s to %s" % \
+                          (source_name, dest_name))
+
               if is_compressed(name):
                 logging.info('Already compressed, Saving to %s' % (dest_name, ))
                 shutil.copy(source_name, dest_name)