Ejemplo n.º 1
0
def pipeline(task, wkname, conf=None):
    logindent(2)

    if not task: # in this case, conf is expected
        source_seqtype = "aa" if "aa" in GLOBALS["seqtypes"] else "nt"
        all_seqs = GLOBALS["target_sequences"]
        initial_task = Msf(set(all_seqs), set(),
                           seqtype=source_seqtype)
            
        initial_task.main_tree = None
        initial_task.threadid = generate_runid()
        initial_task.configid = initial_task.threadid
        initial_task.target_wkname = wkname
        # Register node 
        db.add_node(initial_task.threadid, initial_task.nodeid,
                    initial_task.cladeid, initial_task.target_seqs,
                    initial_task.out_seqs)
        
        new_tasks = [initial_task]
    else:
        conf = GLOBALS[task.configid]                
        npr_conf = IterConfig(conf, wkname, task.size, task.seqtype)
        new_tasks  = process_task(task, wkname, npr_conf, conf["_nodeinfo"])

    process_new_tasks(task, new_tasks, conf)
    logindent(-2)
  
    return new_tasks
Ejemplo n.º 2
0
 def load_jobs(self):
     # I want a single phylognetic tree for each cog
     from nprlib.workflow.genetree import pipeline
     
     for co in self.cogs:
         # Register a new msf task for each COG, using the same
         # config file but opening an new tree reconstruction
         # thread.
         job = Msf(set(co), set(), seqtype = self.seqtype)
         job.main_tree = None
         job.threadid = generate_runid()
         job.configid = self.conf["_configid"]
         # This converts the job in a workflow job. As soon as a
         # task is done, it will be automatically processed and the
         # new tasks will be registered as new jobs.
         job.task_processor = pipeline
         job.target_wkname = self.genetree_workflow
         self.jobs.append(job)
         self.cog_ids.add(job.nodeid)