Exemplo n.º 1
0
    def __init__(self, id_a, id_b, mechanism, effect, direct, relation, pmid,
                 linenum):
        self.id_a = id_a
        self.id_b = id_b
        self.effect = effect
        self.direct = direct
        self.relation = relation
        self.pmid = pmid
        self.linenum = linenum
        self.complex_a = None

        try:
            if NamingConvention.is_complex(
                    self.id_a) and self.id_a in COMPLEXES:
                self.complex_a = COMPLEXES[self.id_a]
        except TypeError as err:
            print(self.id_a)
            raise err
        self.complex_b = None
        if NamingConvention.is_complex(self.id_b) and self.id_b in COMPLEXES:
            self.complex_b = COMPLEXES[self.id_b]
        # by default mechanism = molecular function
        mechanism_term = "GO:0003674"
        if self.direct == "YES":
            if (mechanism):
                mechanism_term = MECHANISM_GO_MAPPING[mechanism]
        self.mechanism = {
            "name": mechanism,
            "uri": None,
            "term": mechanism_term
        }
        self.regulated_activity = {"name": None, "uri": None, "term": None}

        self.individuals = {}
        self.enabled_by_stmt_a = None
Exemplo n.º 2
0
 def declare_entities(self, model):
     uri = model.declare_individual("GO:0032991")
     model.writer.writer.graph.add((uri, RDFS.label, Literal(str(self.name))))
     for entity in self.entities:
         entity_full_id = NamingConvention.full_id(entity)
         entity_uri = model.declare_individual(entity_full_id)
         part_of_stmt = model.writer.emit(uri, HAS_PART, entity_uri)
         model.add_axiom(part_of_stmt)
         "uri BFO:0000051 entity_uri"
     return uri
Exemplo n.º 3
0
 def uri_in_model(self, model):
     graph = model.writer.writer.graph
     complex_term = "GO:0032991"
     complex_uris = model.uri_list_for_individual(complex_term)
     for c_uri in complex_uris:
         found_entities = [] # Collect connected entities for set comparison
         for entity in self.entities:
             for entity_uri in model.uri_list_for_individual(NamingConvention.full_id(entity)):
                 if (c_uri, HAS_PART, entity_uri) in graph:
                     found_entities.append(entity)
         if set(self.entities) == set(found_entities):
             print(c_uri)
             return c_uri
Exemplo n.º 4
0
 def b_is_complex(self):
     return NamingConvention.is_complex(self.id_b)
Exemplo n.º 5
0
 def class_id_b(self):
     return NamingConvention.class_id(self.id_b)
Exemplo n.º 6
0
 def full_id_b(self):
     return NamingConvention.full_id(self.id_b)
Exemplo n.º 7
0
 def determine_entity(cls, entity_id: str, entity_name: str,
                      entity_type: str) -> SignorEntity:
     if NamingConvention.is_complex(entity_id):
         return SignorEntityFactory.complex_from_id(entity_id)
     else:
         return cls.entity_type_map[entity_type](entity_id, entity_name)