From: Diane Trout Date: Fri, 20 Mar 2015 21:45:29 +0000 (-0700) Subject: Use max on the iterator to find the last key X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=64eab6ef26d382df660a8ab20c7fc5f3fc89edee Use max on the iterator to find the last key --- diff --git a/htsworkflow/pipelines/genome_mapper.py b/htsworkflow/pipelines/genome_mapper.py index 4f57bbb..62619e2 100644 --- a/htsworkflow/pipelines/genome_mapper.py +++ b/htsworkflow/pipelines/genome_mapper.py @@ -88,11 +88,10 @@ class constructMapperDict(object): builds = self.genome_dict[elements[0]] # sort build names the way humans would - keys = builds.keys() - keys.sort(key=natural_sort_key) + last_key = max(builds, key=natural_sort_key) # return the path from the 'last' build name - return builds[keys[-1]] + return builds[last_key] elif len(elements) == 2: # we have species, and build name