Exemplo n.º 1
0
def advance_running_qc_pipeline(configs,pipeline,mockdb,*args,**kwargs):
    """
    Determines which stage the pipeline currently is running, determines
    if that stage is complete, and then passes the relevant
    objects to subfunctions that handle the next step.
    

    This needs to be combined with the other advance the pipeline function... A more general framework
    where the process are stored.
    """
    if pipeline.zcat_key is None: #zcat hasn't begun, which should not be the case.
        pipeline.state = 'Initialized'
        raise FormattingError("The pipeline somehow began running before zcatting.")
    if pipeline.bcbio_key is None: #bcbio hasn't begun
        zcat = mockdb['Zcat'].__get__(configs['system'],key=int(pipeline.zcat_key))
        #print pipeline.zcat_key
        #print zcat.__is_complete__(config)
        if zcat.__is_complete__(configs):
            things_to_do_if_zcat_complete(configs,mockdb,pipeline,zcat)
        return 1
    if pipeline.snp_stats_key is None: #snp_stats hasn't begun
        bcbio = mockdb['Bcbio'].__get__(configs['system'],int(pipeline.bcbio_key))
        if bcbio.__snps_called__():
            things_to_do_if_snps_called(configs,mockdb,pipeline,bcbio)
        return 1
    if pipeline.cleaning_key is None: #cleaning hasn't begun
        bcbio = mockdb['Bcbio'].__get__(configs['system'],int(pipeline.bcbio_key))
        snp_stats = mockdb['SnpStats'].__get__(configs['system'],int(pipeline.snp_stats_key))
        if configs["system"].get("Logging","debug") is "True":
            print pipeline.key
            print bcbio.__is_complete__(configs)
            print snp_stats.__is_complete__(configs,mockdb)
        if bcbio.__is_complete__(configs) and snp_stats.__is_complete__(configs,mockdb):
            things_to_do_if_bcbio_complete(configs,mockdb,pipeline,bcbio)
            things_to_do_if_snp_stats_complete(configs,mockdb,pipeline,snp_stats)
        return 1
    clean_bcbio = mockdb['CleanBcbio'].__get__(configs['system'],int(pipeline.cleaning_key))
    if configs["system"].get("Logging","debug") is "True":
        sys.stderr.write(pipeline.sample_key+"\n");
        sys.stderr.write(clean_bcbio.key+"\n")
    if clean_bcbio.__is_complete__():
        things_to_do_if_bcbio_cleaning_complete(mockdb,pipeline,clean_bcbio,*args,**kwargs)
    return 1
Exemplo n.º 2
0
def advance_running_std_pipeline(configs,pipeline,mockdb,*args,**kwargs):
    """
    Same as the advance_running_qc_pipeline function, except for any completely linear pipeline.
    """ 
    if pipeline.zcat_key == None: #zcat hasn't begun, which should not be the case.
        pipeline.state = 'Initialized'
        raise FormattingError("The pipeline somehow began running before zcatting.")
    if pipeline.bcbio_key == None: #bcbio hasn't begun
        zcat = mockdb['Zcat'].__get__(configs['system'],key=int(pipeline.zcat_key))
        if zcat.__is_complete__():
            things_to_do_if_zcat_complete(configs,mockdb,pipeline,zcat)
        return 1
    if pipeline.cleaning_key is None: #cleaning hasn't begun
        bcbio = mockdb['Bcbio'].__get__(configs['system'],int(pipeline.bcbio_key))
        if bcbio.__is_complete__(configs):
            things_to_do_if_bcbio_complete(configs,mockdb,pipeline,bcbio)
        return 1
    clean_bcbio = mockdb['CleanBcbio'].__get__(configs['system'],int(pipeline.cleaning_key))
    if clean_bcbio.__is_complete__():
        things_to_do_if_bcbio_cleaning_complete(mockdb,pipeline,clean_bcbio,*args,**kwargs)
    return 1