예제 #1
0
 def reduceFunction(x, y):
     """
 Function for determining the more favorable gene.  If both genes have
 infinite e values(no blast hits) then the difference of the e values is NaN
 and the longest gene will be the more favorable one and the one returned.
 Otherwise, the gene with the lower e value will be returned.
 """
     if utils.isNaN(x.eValue - y.eValue):
         return max(x, y, key=lambda z: abs(z.location[1] - z.location[0]))
     else:
         return min(x, y, key=lambda z: z.eValue)
예제 #2
0
 def reduceFunction(x, y):
   """
   Function for determining the more favorable gene.  If both genes have
   infinite e values(no blast hits) then the difference of the e values is NaN
   and the longest gene will be the more favorable one and the one returned.
   Otherwise, the gene with the lower e value will be returned.
   """
   if utils.isNaN(x.eValue - y.eValue):
     return max(x, y, key = lambda z: abs(z.location[1] - z.location[0]))
   else:
     return min(x, y, key = lambda z: z.eValue)
예제 #3
0
 def reduceFunction(gene, x, y):
   if re.sub(r"(~\d+)~\d+", r"\1", y.query) == gene.query:
     if gene.location[0] < gene.location[1]:
       stop = max(filter(lambda z: z < gene.location[1], forwardStops))
       gapSize = y.location[0] - stop
     else:
       stop = min(filter(lambda z: z > gene.location[1], reverseStops))
       gapSize = stop - y.location[0]
     if gapSize < 0:
       return min(x, y, key = lambda z: abs(z.location[0] - stop))
     elif gapSize < 100 or abs(x.eValue - y.eValue) < 10e-5 or utils.isNaN(x.eValue-y.eValue):
       return max(x, y, key = lambda z: abs(z.location[1] - z.location[0]))
     else:
       return min(x, y, key = lambda z: z.eValue)
   else:
     return x
예제 #4
0
 def reduceFunction(gene, x, y):
     if re.sub(r"(~\d+)~\d+", r"\1", y.query) == gene.query:
         if gene.location[0] < gene.location[1]:
             stop = max(filter(lambda z: z < gene.location[1],
                               forwardStops))
             gapSize = y.location[0] - stop
         else:
             stop = min(filter(lambda z: z > gene.location[1],
                               reverseStops))
             gapSize = stop - y.location[0]
         if gapSize < 0:
             return min(x, y, key=lambda z: abs(z.location[0] - stop))
         elif gapSize < 100 or abs(
                 x.eValue - y.eValue) < 10e-5 or utils.isNaN(x.eValue -
                                                             y.eValue):
             return max(x,
                        y,
                        key=lambda z: abs(z.location[1] - z.location[0]))
         else:
             return min(x, y, key=lambda z: z.eValue)
     else:
         return x