Example #1
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)
Example #2
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