コード例 #1
0
class InducibilityQuery:
    """
  InducibilityQuery. 
    The query depends on a choice of gene, and two sets of domain bounds named bounds1 and bounds2.
    Given: a reduced parameter index 
    Return: a triple of boolean values (a,b,c) such that:
      a is true if and only if (0,reduced_parameter_index) is monostable and has an FP in bounds1
      b is true if and only if (max_gpi,reduced_parameter_index) is monostable and has an FP in bounds2
      c is true if and only if (gpi,reduced_parameter_index) has an FP in bounds1 and an FP in bounds2
                               for some 0 < gpi < max_gpi
  """
    def __init__(self, database, gene, bounds1, bounds2):
        self.QueryFP1 = MonostableFixedPointQuery(database, bounds1)
        self.QueryFP2 = MonostableFixedPointQuery(database, bounds2)
        self.QueryDoubleFP = DoubleFixedPointQuery(database, bounds1, bounds2)
        self.GeneQuery = SingleGeneQuery(database, gene)
        self.max_gpi = self.GeneQuery.number_of_gene_parameters() - 1

    def __call__(self, reduced_parameter_index):
        """
    Given a reduced parameter index, return a triple of boolean values (a,b,c)
    """
        query_graph = self.GeneQuery(reduced_parameter_index)
        a = self.QueryFP1(query_graph.mgi(0))
        b = self.QueryFP2(query_graph.mgi(self.max_gpi))
        c = any(
            self.QueryDoubleFP(query_graph.mgi(i))
            for i in range(1, self.max_gpi))
        return (a, b, c)
コード例 #2
0
class InducibilityQuery:
    """
  InducibilityQuery. 
    The query depends on a choice of gene, and two sets of domain bounds named bounds1 and bounds2.
    Given: a reduced parameter index 
    Return: a triple of boolean values (a,b,c) such that:
      a is true if and only if (0,reduced_parameter_index) is monostable and has an FP in bounds1
      b is true if and only if (max_gpi,reduced_parameter_index) is monostable and has an FP in bounds2
      c is true if and only if (gpi,reduced_parameter_index) has an FP in bounds1 and an FP in bounds2
                               for some 0 < gpi < max_gpi
  """

    def __init__(self, database, gene, bounds1, bounds2):
        self.QueryFP1 = MonostableFixedPointQuery(database, bounds1)
        self.QueryFP2 = MonostableFixedPointQuery(database, bounds2)
        self.QueryDoubleFP = DoubleFixedPointQuery(database, bounds1, bounds2)
        self.GeneQuery = SingleGeneQuery(database, gene)
        self.max_gpi = self.GeneQuery.number_of_gene_parameters() - 1

    def __call__(self, reduced_parameter_index):
        """
    Given a reduced parameter index, return a triple of boolean values (a,b,c)
    """
        query_graph = self.GeneQuery(reduced_parameter_index)
        a = self.QueryFP1(query_graph.mgi(0))
        b = self.QueryFP2(query_graph.mgi(self.max_gpi))
        c = any(self.QueryDoubleFP(query_graph.mgi(i)) for i in range(1, self.max_gpi))
        return (a, b, c)
コード例 #3
0
 def __init__(self, database, gene, quiescent_bounds, proliferative_bounds):
     """
 In order to perform hysteresis queries we must first categorize each Morse graph as either 
 'Q' monostable quiescent, 'P' monostable proliferative, 'q' quiescent, 'p' quiescent, 'B' bistable, or 'O' other
 We assume the quiescent and proliferative FP states are given by disjoint bounding rectangles
 """
     self.database = database
     self.gene = gene
     # Create query object to check if morse graph indices have quiescent FP as only minimal morse node
     Q = MonostableFixedPointQuery(database, quiescent_bounds)
     # Create query object to check if morse graph indices has quiescent FP
     q = SingleFixedPointQuery(database, quiescent_bounds)
     # Create query object to check if morse graph indices have proliferative FP as only minimal morse node
     P = MonostableFixedPointQuery(database, proliferative_bounds)
     # Create query object to check if morse graph indices has proliferative FP
     p = SingleFixedPointQuery(database, proliferative_bounds)
     # Check query object to check if morse graph index has both quiescent FP and proliferative FP
     B = DoubleFixedPointQuery(database, quiescent_bounds,
                               proliferative_bounds)
     # Create a labelling function which accepts a morse graph index and returns Q, P, B, p, q, or O
     # Note: case fallthrough order matters here
     self.matching_label = lambda mgi: 'Q' if Q(mgi) else ('P' if P(
         mgi) else ('B'
                    if B(mgi) else ('q'
                                    if q(mgi) else ('p'
                                                    if p(mgi) else 'O'))))
     # Create the pattern graph to represent Q -> B -> P (with self-loop on Q, B, and P)
     self.patterngraph = Graph(set([0, 1, 2, 3, 4]),
                               [(0, 0), (1, 1), (0, 1), (1, 0), (0, 2),
                                (1, 2), (2, 2), (2, 3), (2, 4), (3, 3),
                                (3, 4), (4, 4), (4, 3)])
     self.patterngraph.matching_label = lambda v: {
         0: 'Q',
         1: 'q',
         2: 'B',
         3: 'p',
         4: 'P'
     }[v]
     # Create matching relation (in this case we just check for equality of the matching labels)
     self.matching_relation = lambda label1, label2: label1 == label2
     # Create SingleGeneQuery object
     self.GeneQuery = SingleGeneQuery(database, gene)
コード例 #4
0
 def __init__(self, database, gene, bounds1, bounds2):
     self.QueryFP1 = MonostableFixedPointQuery(database, bounds1)
     self.QueryFP2 = MonostableFixedPointQuery(database, bounds2)
     self.QueryDoubleFP = DoubleFixedPointQuery(database, bounds1, bounds2)
     self.GeneQuery = SingleGeneQuery(database, gene)
     self.max_gpi = self.GeneQuery.number_of_gene_parameters() - 1
コード例 #5
0
 def __init__(self, database, gene, bounds1, bounds2):
     self.QueryFP1 = MonostableFixedPointQuery(database, bounds1)
     self.QueryFP2 = MonostableFixedPointQuery(database, bounds2)
     self.QueryDoubleFP = DoubleFixedPointQuery(database, bounds1, bounds2)
     self.GeneQuery = SingleGeneQuery(database, gene)
     self.max_gpi = self.GeneQuery.number_of_gene_parameters() - 1