Default to sequencing if we don't have a genome for the provided
authorDiane Trout <diane@caltech.edu>
Tue, 6 Oct 2009 00:04:50 +0000 (00:04 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 6 Oct 2009 00:04:50 +0000 (00:04 +0000)
species.
Also I added some additional logging messages to make it easier
to se what's going on with retrieve config.

htsworkflow/pipelines/retrieve_config.py
scripts/retrieve_config

index dbd3e69dde2346d402cd34ffef4c13073ea4899f..1a5e1360d389355044c887133e699b25e088d608 100644 (file)
@@ -130,14 +130,20 @@ def format_gerald_config(options, flowcell_info, genome_map):
         lane_numbers.sort()
         lane_prefix = u"".join(lane_numbers)
         
+        species_path = genome_map.get(species, None)
+        logging.debug("Looked for genome '%s' got location '%s'" % (species, species_path))
+        if species_path is None:
+            no_genome_msg = "Forcing lanes %s to sequencing as there is no genome for %s"
+            logging.warning(no_genome_msg % (lane_numbers, species))
+            is_sequencing = True
+            
         if not is_sequencing:
             config += ['%s:ANALYSIS eland%s' % (lane_prefix, analysis_suffix)]
+            config += ['%s:ELAND_GENOME %s' % (lane_prefix, species_path) ]
         else:
             config += ['%s:ANALYSIS sequence%s' % (lane_prefix, analysis_suffix)]
         #config += ['%s:READ_LENGTH %s' % ( lane_prefix, read_length ) ]
         config += ['%s:USE_BASES Y%s' % ( lane_prefix, read_length ) ]
-        species_path = genome_map.get(species, "Unknown")
-        config += ['%s:ELAND_GENOME %s' % (lane_prefix, species_path) ]
 
     # add in option for running script after 
     if options.post_run is not None:
@@ -220,7 +226,9 @@ Config File:
     parser.add_option("-r", "--runfolder",
                       action="store", type="string",
                       help="specify runfolder for post_run command ")
-    
+
+    parser.add_option('-v', '--verbose', action='store_true', default=False,
+                       help='increase logging verbosity')
     return parser
     
 def constructConfigParser():
@@ -269,13 +277,6 @@ def getCombinedOptions(argv=None):
         if options.runfolder is not None:
             options.output_filepath = os.path.join(options.runfolder, 'config-auto.txt')
             
-    logging.info('USING OPTIONS:')
-    logging.info(u'     URL: %s' % (options.url,))
-    logging.info(u'     OUT: %s' % (options.output_filepath,))
-    logging.info(u'      FC: %s' % (options.flowcell,))
-    #logging.info(': %s' % (options.genome_dir,))
-    logging.info(u'post_run: %s' % ( unicode(options.post_run),))
-    
     return options
 
 
@@ -284,10 +285,19 @@ def saveConfigFile(options):
   retrieves the flowcell eland config file, give the base_host_url
   (i.e. http://sub.domain.edu:port)
   """
+  logging.info('USING OPTIONS:')
+  logging.info(u'     URL: %s' % (options.url,))
+  logging.info(u'     OUT: %s' % (options.output_filepath,))
+  logging.info(u'      FC: %s' % (options.flowcell,))
+  #logging.info(': %s' % (options.genome_dir,))
+  logging.info(u'post_run: %s' % ( unicode(options.post_run),))
+   
   flowcell_info = retrieve_flowcell_info(options.url, options.flowcell)
 
+  logging.debug('genome_dir: %s' % ( options.genome_dir, ))
   available_genomes = getAvailableGenomes(options.genome_dir)
   genome_map = constructMapperDict(available_genomes)
+  logging.debug('available genomes: %s' % ( unicode( genome_map.keys() ),))
 
   config = format_gerald_config(options, flowcell_info, genome_map)
 
index 9e8ccf53b6c21f911bccaa976e532587016b244f..e4fdff1fad42122e6a20b0f678f9660aed9c5809 100644 (file)
@@ -13,6 +13,11 @@ def main(argv=None):
     
   #Display help if no args are presented
   options = getCombinedOptions(argv)
+
+  if options.verbose:
+    logging.basicConfig(level=logging.DEBUG)
+  else:
+    logging.basicConfig(level=logging.INFO)
   
   msg_list = ['ERROR MESSAGES:']
   if options.flowcell is None:
@@ -35,5 +40,4 @@ def main(argv=None):
   return 0
   
 if __name__ == "__main__":
-  logging.basicConfig(level=logging.INFO)
   sys.exit(main(sys.argv[1:]))