Ejemplo n.º 1
0
 def __is_complete__(self,configs,mockdb,*args,**kwargs):
     """
     Since concordance search is an optional sub-process, this function checks for
     both the completeness of the self concordance program and the necessity,
     and if necessary the completeness, of the concordance search.  Then, once 
     complete, relevant statistics are stored.
     """
     if GenericProcess.__is_complete__(self,*args,**kwargs):
         return True
     elif not os.path.isfile(self.complete_file):
         return False
     store_snp_stats_in_db(self)
     if self.percentage_concordance > configs['pipeline'].get('Concordance','threshold'):
         self.__finish__(*args,**kwargs)
         return True
     #If the concordance is below the threshold, we need to conduct a concordance search against the database
     #First we split the search across processors
     if self.search_key is None:
         sample = mockdb['Sample'].objects[self.sample_key]
         concord_search = mockdb['ConcordanceSearch'].__new__(configs['system'],sample=sample,snp_stats=self)
         self.search_key = concord_search.key
         concord_search.__launch_split_searches__(configs)
         return False
     concord_search = mockdb['ConcordanceSearch'].objects[self.search_key]
     if concord_search.__is_complete__(configs['system'],*args,**kwargs):
         self.__finish__(*args,**kwargs)
         return True
     #Now we gather
     if concord_search.__are_split_searches_complete__(configs['pipeline']):
         if os.path.isfile(concord_search.qsub_file):
             return False
         concord_search.__fill_qsub_file__(configs)
         concord_search.__launch__(configs['system'])
         return False
     return False
Ejemplo n.º 2
0
def things_to_do_if_snp_stats_complete(configs,mockdb,pipeline,snp_stats):
    store_snp_stats_in_db(snp_stats)
    snp_stats.__finish__()
    if snp_stats.search_key is None:
        return 1
    search = mockdb['ConcordanceSearch'].__get__(configs['system'],snp_stats.search_key)
    store_search_stats_in_db(search)
    search.state = "Complete"
    return 1