def _get_agent_node_no_bcs(agent): node_data = _get_agent_grounding(agent) if node_data is None: logger.warning('Agent %s has no grounding.', agent) return None, None variants = [] for mod in agent.mods: pybel_mod = pmod_namespace.get(mod.mod_type) if not pybel_mod: logger.info('Skipping modification of type %s on agent %s', mod.mod_type, agent) continue var = pmod(namespace=pc.BEL_DEFAULT_NAMESPACE, name=pybel_mod) if mod.residue is not None: res = amino_acids[mod.residue]['short_name'].capitalize() var[pc.PMOD_CODE] = res if mod.position is not None: var[pc.PMOD_POSITION] = int(mod.position) variants.append(var) for mut in agent.mutations: var = hgvs(mut.to_hgvs()) variants.append(var) if variants: node_data = node_data.with_variants(variants) if isinstance(node_data, (bioprocess, pathology)): return node_data, None # Also get edge data for the agent edge_data = _get_agent_activity(agent) return node_data, edge_data
def _get_agent_node_no_bcs(agent): (abundance_type, db_ns, db_id) = _get_agent_grounding(agent) if abundance_type is None: logger.warning('Agent %s has no grounding.', agent) return (None, None) node_data = {pc.FUNCTION: abundance_type, pc.NAMESPACE: db_ns, pc.NAME: db_id} variants = [] for mod in agent.mods: pybel_mod = pmod_namespace.get(mod.mod_type) if not pybel_mod: logger.info('Skipping modification of type %s on agent %s', mod.mod_type, agent) continue var = {pc.KIND: pc.PMOD, pc.IDENTIFIER: { pc.NAMESPACE: pc.BEL_DEFAULT_NAMESPACE, pc.NAME: pybel_mod}} if mod.residue is not None: res = amino_acids[mod.residue]['short_name'].capitalize() var[pc.PMOD_CODE] = res if mod.position is not None: var[pc.PMOD_POSITION] = int(mod.position) variants.append(var) for mut in agent.mutations: var = {pc.KIND: pc.HGVS, pc.IDENTIFIER: mut.to_hgvs()} variants.append(var) if variants: node_data[pc.VARIANTS] = variants # Also get edge data for the agent edge_data = _get_agent_activity(agent) return (node_data, edge_data)
def _get_agent_node_no_bcs(agent): node_data = _get_agent_grounding(agent) if node_data is None: logger.warning('Agent %s has no grounding.', agent) return None, None variants = [] for mod in agent.mods: pybel_mod = pmod_namespace.get(mod.mod_type) if not pybel_mod: logger.info('Skipping modification of type %s on agent %s', mod.mod_type, agent) continue pmod_entity = pmod_mappings[pybel_mod]['xrefs'][0] var = ProteinModification( namespace=pmod_entity.namespace, name=pmod_entity.name, identifier=pmod_entity.identifier, ) if mod.residue is not None: res = amino_acids[mod.residue]['short_name'].capitalize() var[pc.PMOD_CODE] = res if mod.position is not None: var[pc.PMOD_POSITION] = int(mod.position) variants.append(var) for mut in agent.mutations: var = hgvs(mut.to_hgvs()) variants.append(var) if variants and not isinstance(node_data, CentralDogma): logger.warning('Node should not have variants: %s, %s', node_data, variants) elif variants: node_data = node_data.with_variants(variants) if isinstance(node_data, (bioprocess, pathology)): return node_data, None # Also get edge data for the agent edge_data = _get_agent_activity(agent) return node_data, edge_data