Beispiel #1
0
 def __init__(self,config,key=int(-1),sample=None,flowcell=None,description=None,recipe=None,input_dir=None,pipeline_config=None,pipeline_key=None,process_name='qcpipeline',running_location='Speed',storage_needed=500000000,project=None,flowcell_dir_name=None,seq_run_key=None,date=strftime("%Y%m%d",localtime()),*args,**kwargs):
     if not pipeline_config is None or not pipeline_key is None:
         if sample is None:
             sample = Sample(config,key="dummy_sample_key")
         if sample.__class__.__name__ != "Sample":
             raise Exception("Trying to start a qcpipeline process on a non-sample.")
         if flowcell is None:
             sample = Flowcell(config,key="dummy_flowcell_key")
         if flowcell.__class__.__name__ != "Flowcell":
             raise Exception("Trying to start a qcpipeline process on a sample not from a flowcell.")
         automation_parameters_config = MyConfigParser()
         automation_parameters_config.read(config.get("Filenames","automation_config"))
         #Specific information about this pipeline
         self.description = description
         self.recipe = recipe
         self.storage_needed = storage_needed
         self.input_dir = input_dir
         self.running_location = running_location
         self.seq_run_key = seq_run_key
         capture_target_bed = automation_parameters_config.safe_get("Target",pipeline_key)
         if not capture_target_bed is None:
             self.capture_target_bed = capture_target_bed
         if pipeline_config is None:
             pipeline_name = automation_parameters_config.safe_get("Pipeline",pipeline_key)
             pipeline_config = MyConfigParser()
             pipeline_config.read(config.get('Pipeline',pipeline_name))
         pipeline_steps = pipeline_config.get('Pipeline','steps').split(',')
         for step in pipeline_steps:
             setattr(self,step+"_key",None)
         base_output_dir = pipeline_config.get('Common_directories','archive_directory')
         if flowcell_dir_name is None:
             self.client_dir = self.input_dir
         else:
             sample_dir_name = sample.key
             if not str(sample_dir_name).startswith("Sample_"):
                 sample_dir_name = "Sample_" + sample_dir_name
             self.client_dir = os.path.join(config.get('Common_directories','casava_output'),flowcell_dir_name+"/Project_"+str(project)+"/"+sample_dir_name)
         self.flowcell_key = flowcell.key
         base_client_dir = config.get('Common_directories','casava_output')
         if project is None:
             if base_output_dir is None:
                 base_output_dir = ""
             self.output_dir = os.path.join(base_output_dir,sample.key + '_' + str(date))
         else:
             project_out = re.sub('_','-',project)
             self.project = project_out
             if re.search("[0-9]",project_out[0:1]):
                 project_out = "Project-" + project_out
             if base_output_dir == None:
                 base_output_dir = ""
             self.output_dir = os.path.join(base_output_dir,project_out + "_" + sample.key + '_' + str(date))
         if not os.path.exists(self.output_dir) and not re.search('dummy',sample.key):
             os.makedirs(self.output_dir)
         GenericProcess.__init__(self,config,key=key,process_name=process_name,**kwargs)
         self.date = date
         self.sample_key = sample.key
         self.altered_parameters = None
    print "Options are " + str(options)

#Load configs
configs = {}
system_config = MyConfigParser()
system_config.read(options.system_config_file)
system_config.add_section("Logging")
if options.debug is True:
    system_config.set("Logging","debug","True")
else:
    system_config.set("Logging","debug","False")
configs.update({'system':system_config})

config_instance = MyConfigParser()
configs.update({"seq_run":config_instance})
config_instance.read(system_config.get('Pipeline',"seq_run"))

pipelines = system_config.get('Pipeline','opts').split(',')
pipeline_config = {}
for pipeline_name in pipelines:
    config_instance = MyConfigParser()
    pipeline_config.update({pipeline_name:config_instance})
    pipeline_config[pipeline_name].read(system_config.get('Pipeline',pipeline_name))
#Initialize and load mockdb
if system_config.get("Logging","debug") is "True":
    print "Initializing mockdb"
mockdb=initiate_mockdb(system_config)

#Grab storage devices to keep track of storage
storage_devices = initiate_storage_devices(system_config)
if system_config.get("Logging","debug") is "True":