From 526a63bf0aef0e361fdccb65aedfa18b6f7bf1c0 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 18 Mar 2009 19:20:49 +0000 Subject: [PATCH] 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. --- htsworkflow/pipelines/genome_mapper.py | 34 ++++++++++++++------------ 1 file changed, 19 insertions(+), 15 deletions(-) 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 = [] -- 2.30.2