From: Diane Trout Date: Wed, 18 Mar 2009 19:20:49 +0000 (+0000) Subject: Generate a gerald config file, even if the genome is unknown X-Git-Tag: 0.2.0.2~8 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=526a63bf0aef0e361fdccb65aedfa18b6f7bf1c0 Generate a gerald config file, even if the genome is unknown as it makes it easier to edit the wrong config file and manually launch an analysis. --- diff --git a/htsworkflow/pipelines/genome_mapper.py b/htsworkflow/pipelines/genome_mapper.py index a8ea871..d29e446 100644 --- a/htsworkflow/pipelines/genome_mapper.py +++ b/htsworkflow/pipelines/genome_mapper.py @@ -80,24 +80,28 @@ class constructMapperDict(object): Return the best match for key """ elements = re.split("\|", key) - - if len(elements) == 1: - # we just the species name - # get the set of builds - builds = self.genome_dict[elements[0]] + + try: + if len(elements) == 1: + # we just the species name + # get the set of builds + builds = self.genome_dict[elements[0]] - # sort build names the way humans would - keys = builds.keys() - keys.sort(cmp=alphanum) + # sort build names the way humans would + keys = builds.keys() + keys.sort(cmp=alphanum) - # return the path from the 'last' build name - return builds[keys[-1]] + # return the path from the 'last' build name + return builds[keys[-1]] - elif len(elements) == 2: - # we have species, and build name - return self.genome_dict[elements[0]][elements[1]] - else: - raise KeyError("Unrecognized key") + elif len(elements) == 2: + # we have species, and build name + return self.genome_dict[elements[0]][elements[1]] + else: + raise KeyError("Unrecognized key") + except KeyError, e: + logging.error('Unrecognized genome identifier: %s' % str((elements),)) + return "NoGenomeAvailable" def keys(self): keys = []