Use max on the iterator to find the last key
authorDiane Trout <diane@ghic.org>
Fri, 20 Mar 2015 21:45:29 +0000 (14:45 -0700)
committerDiane Trout <diane@ghic.org>
Fri, 20 Mar 2015 21:45:29 +0000 (14:45 -0700)
htsworkflow/pipelines/genome_mapper.py

index 4f57bbbaac97f4742fcee673b9ff17fd320f632d..62619e2155362207612a7f0dabf3ed13c5b77db4 100644 (file)
@@ -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