public ONDEXRelation createRealtion(ONDEXConcept from, ONDEXConcept to, RelationType rt) { ONDEXRelation result = graph.getRelation(from, to, rt); if (result == null) { result = graph.getFactory().createRelation(from, to, rt, evidence); } return result; }
private static ONDEXRelation createRealtion(ONDEXGraph graph, ONDEXConcept from, ONDEXConcept to, RelationType ofType, EvidenceType ev) { ONDEXRelation result = graph.getRelation(from, to, ofType); if (result == null) { result = graph.getFactory().createRelation(from, to, ofType, ev); } return result; }
protected void makeFactorInteraction() { Iterator<String> keys = factorInteraction.keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); ONDEXConcept from = factorsWritten.get(key); ONDEXConcept to = factorsWritten.get(factorInteraction.get(key)); if (to != null) { aog.getFactory().createRelation(from, to, it_wi, evi); } else { Parser.propagateEventOccurred(new DataFileErrorEvent( "Factor for interaction missing: from " + from.getPID() + " to " + factorInteraction.get(from) + " (missing).", "makeFactorInteraction()")); } } }
public void parseLine(String[] data) throws FileNotFoundException, IOException { ONDEXConcept c = lookup.lookupMutatant(data[0]); if (data[1].length() != 0) c.createAttribute(eco, data[1], false); if (data[2].length() != 0) c.createAttribute(mutagenesis, data[2], false); if (data[3].length() != 0) c.createAttribute(dominance, data[3], false); if (data[5].length() != 0) c.createAttribute(comment, data[5], false); if (data[6].length() != 0) c.createAttribute(mutType, data[6], false); String[] ids = data[5].split(";"); for (String id : ids) { if (id.length() == 0) continue; ONDEXConcept pub = lookup.lookupPublication(id); graph.getFactory().createRelation(c, pub, pub_in, evidence); } } });
/** * recursively builds the output graph based on the * consensus tree. * * @param n input cluster (call this method with the root cluster) */ private ONDEXConcept buildOutput(Cluster n) { ONDEXConcept c = graph.getFactory().createConcept("hierarchy_node:" + n.toString(), dataSource_unknown, cc_hierarchy, ev); BitSet kidleaves = new BitSet(usedConcepts.size()); if (n.getChildren() != null) { for (Cluster kid : n.getChildren()) { ONDEXConcept c_kid = buildOutput(kid); kidleaves.or((BitSet) kid.getKey()); graph.getFactory().createRelation(c_kid, c, rts_isp, ev); } } BitSet leaves = (BitSet) n.getKey().clone(); leaves.andNot((BitSet) kidleaves); for (int i = leaves.nextSetBit(0); i > -1; i = leaves.nextSetBit(i + 1)) { ONDEXConcept cl = graph.getConcept(iid2cid.get(i)); graph.getFactory().createRelation(cl, c, rts_isp, ev); } return c; }
private void addCompounds(Reaction r, SpeciesReference sp, ONDEXConcept reaction, RelationType rt) { // process all lists of reactants and products String id = sp.getSpecies(); // this is compound which is consumed or produced by reaction ONDEXConcept fromConcept = concepts.get(id); if (fromConcept == null) { fireEventOccurred(new InconsistencyEvent( "fromConcept is empty for " + id, "[Parser - addSubstrates]")); return; } // create relation and add kinetics ONDEXRelation relation = graph.getFactory().createRelation(fromConcept, reaction, rt, evidence); addKinetics(r, relation, id); }
@Override public void pointerToRelation(AbstractNode node) { HashSet<ONDEXRelation> relations = new HashSet<ONDEXRelation>(); Compound compound = (Compound) node; for (AbstractNode abstractNode : compound.getCofactorOf()) { // Compound (cofactor of)=> Enzyme relations.add(graph.getFactory().createRelation(abstractNode.getConcept(), compound.getConcept(), rtCofectorOf, etIMPD)); } for( ONDEXRelation relation: relations ){ for (ONDEXConcept c : node.getConcept().getTags()){ relation.addTag(c); } }/* for( AbstractNode n: compound.getCofactorOf()){ Set<ONDEXConcept> toConcepts = node.getConcept().getContext(s); while( toConcepts.hasNext() ){ ONDEXConcept toContext = toConcepts.next(); if ( !n.getConcept().getContext(s).contains(toContext) ) n.getConcept().addContext(toContext); } }*/ } }
@Override public void pointerToRelation(AbstractNode node) { HashSet<ONDEXRelation> relations = new HashSet<ONDEXRelation>(); Compound compound = (Compound) node; for (AbstractNode abstractNode : compound.getCofactorOf()) { // Compound (cofactor of)=> Enzyme relations.add(graph.getFactory().createRelation(abstractNode.getConcept(), compound.getConcept(), rtCofectorOf, etIMPD)); } for( ONDEXRelation relation: relations ){ for (ONDEXConcept c : node.getConcept().getTags()){ relation.addTag(c); } }/* for( AbstractNode n: compound.getCofactorOf()){ Set<ONDEXConcept> toConcepts = node.getConcept().getContext(s); while( toConcepts.hasNext() ){ ONDEXConcept toContext = toConcepts.next(); if ( !n.getConcept().getContext(s).contains(toContext) ) n.getConcept().addContext(toContext); } }*/ } }
/** * recursively builds an output graph based on a * single binary tree. * * @param n input node. (call this method with the root node) */ private ONDEXConcept buildOutput(Node n) { ONDEXConcept c; if (n.isLeaf()) { c = graph.getConcept(iid2cid.get(n.getId())); } else { c = graph.getFactory().createConcept("hierarchy_node:" + n.getId(), dataSource_unknown, cc_hierarchy, ev); c.createAttribute(an_theta, new Double(n.theta), false); c.createAttribute(an_logl, new Double(n.logF), false); ONDEXConcept cl = buildOutput(n.getChild(Node.LEFT)); ONDEXConcept cr = buildOutput(n.getChild(Node.RIGHT)); graph.getFactory().createRelation(cl, c, rts_isp, ev); graph.getFactory().createRelation(cr, c, rts_isp, ev); } return c; }
public synchronized ONDEXRelation getRelation ( ONDEXConcept from, ONDEXConcept to, RelationType type, EvidenceType evidence ) { String id = from.getPID () + to.getPID () + type.getId () + evidence.getId (); return this.cacheGet ( ONDEXRelation.class, id, () -> this.graph.getFactory ().createRelation ( from, to, type, evidence ) ); }
/** * * @param node */ public final void pointerToRelationsCore(AbstractNode node) { Iterator<Publication> nodes = node.getPublications(); while (nodes.hasNext()) { AbstractNode toNode = nodes.next(); HashSet<ONDEXConcept> contexts = this.getNonRedundant(toNode.getConcept(),node.getConcept()); this.copyContext(toNode.getConcept(), contexts); this.copyContext( graph.getFactory().createRelation(node.getConcept(), toNode.getConcept(), rtPublishedIn, etIMPD),contexts); } this.pointerToRelation(node); }
/** * * @param node */ public final void pointerToRelationsCore(AbstractNode node) { Iterator<Publication> nodes = node.getPublications(); while (nodes.hasNext()) { AbstractNode toNode = nodes.next(); HashSet<ONDEXConcept> contexts = this.getNonRedundant(toNode.getConcept(),node.getConcept()); this.copyContext(toNode.getConcept(), contexts); this.copyContext( graph.getFactory().createRelation(node.getConcept(), toNode.getConcept(), rtPublishedIn, etIMPD),contexts); } this.pointerToRelation(node); }
/** * * @param node */ public final void pointerToRelationsCore(AbstractNode node) { Iterator<Publication> nodes = node.getPublications(); while (nodes.hasNext()) { AbstractNode toNode = nodes.next(); HashSet<ONDEXConcept> contexts = this.getNonRedundant(toNode.getConcept(),node.getConcept()); this.copyContext(toNode.getConcept(), contexts); this.copyContext( graph.getFactory().createRelation(node.getConcept(), toNode.getConcept(), rtPublishedIn, etIMPD),contexts); } this.pointerToRelation(node); }
/** * * @param node */ public final void pointerToRelationsCore(AbstractNode node) { Iterator<Publication> nodes = node.getPublications(); while (nodes.hasNext()) { AbstractNode toNode = nodes.next(); HashSet<ONDEXConcept> contexts = this.getNonRedundant(toNode.getConcept(),node.getConcept()); this.copyContext(toNode.getConcept(), contexts); this.copyContext( graph.getFactory().createRelation(node.getConcept(), toNode.getConcept(), rtPublishedIn, etIMPD),contexts); } this.pointerToRelation(node); }
private void processSpeciesReferences(ONDEXConcept reactionC, ListOf<? extends SimpleSpeciesReference> references, RelationType rt) { if (references == null) { return; } for (int j = 0; j < references.size(); j++) { SimpleSpeciesReference reactantRef = references.get(j); ONDEXConcept speciesC = speciesById.get(reactantRef.getSpecies()); if (speciesC != null) { ONDEXRelation reactantRel = graph.getFactory().createRelation(speciesC, reactionC, rt, etSBML); if (reactantRel != null) { if (reactantRef instanceof SpeciesReference) { reactantRel.createAttribute(anStoch, ((SpeciesReference) reactantRef).getStoichiometry(), false); // TODO: handle stoich math } } else { logFail("Failed to create relation!"); } } else { logFail("Unable to resolve species reference: " + reactantRef.getSpecies()); } } }
private void processSpeciesReferences(ONDEXConcept reactionC, ListOf<? extends SimpleSpeciesReference> references, RelationType rt) { if (references == null) { return; } for (int j = 0; j < references.size(); j++) { SimpleSpeciesReference reactantRef = references.get(j); ONDEXConcept speciesC = speciesById.get(reactantRef.getSpecies()); if (speciesC != null) { ONDEXRelation reactantRel = graph.getFactory().createRelation(speciesC, reactionC, rt, etSBML); if (reactantRel != null) { if (reactantRef instanceof SpeciesReference) { reactantRel.createAttribute(anStoch, ((SpeciesReference) reactantRef).getStoichiometry(), false); // TODO: handle stoich math } } else { logFail("Failed to create relation!"); } } else { logFail("Unable to resolve species reference: " + reactantRef.getSpecies()); } } }
@Override public void pointerToRelation(AbstractNode node) { Gene gene = (Gene) node; HashSet<ONDEXConcept> context = new HashSet<ONDEXConcept>(); if ( gene.getProduct() != null ){ context = super.getNonRedundant(gene.getConcept(), gene.getProduct().getConcept()); super.copyContext(node.getConcept(), context); } if (gene.getProduct() != null) { // Protein (encoded by)=> Gene super.copyContext( graph.getFactory().createRelation(gene.getProduct().getConcept(), gene .getConcept(), rtSetIsPartOf, etIMPD),context); } } }
@Override public void pointerToRelation(AbstractNode node) { Gene gene = (Gene) node; HashSet<ONDEXConcept> context = new HashSet<ONDEXConcept>(); if ( gene.getProduct() != null ){ context = super.getNonRedundant(gene.getConcept(), gene.getProduct().getConcept()); super.copyContext(node.getConcept(), context); } if (gene.getProduct() != null) { // Protein (encoded by)=> Gene super.copyContext( graph.getFactory().createRelation(gene.getProduct().getConcept(), gene .getConcept(), rtSetIsPartOf, etIMPD),context); } } }
@Override public void pointerToRelation(AbstractNode node) { Gene gene = (Gene) node; HashSet<ONDEXConcept> context = new HashSet<ONDEXConcept>(); if ( gene.getProduct() != null ){ context = super.getNonRedundant(gene.getConcept(), gene.getProduct().getConcept()); super.copyContext(node.getConcept(), context); } if (gene.getProduct() != null) { // Protein (encoded by)=> Gene super.copyContext( graph.getFactory().createRelation(gene.getProduct().getConcept(), gene .getConcept(), rtSetIsPartOf, etIMPD),context); } } }
@Override public void pointerToRelation(AbstractNode node) { Gene gene = (Gene) node; HashSet<ONDEXConcept> context = new HashSet<ONDEXConcept>(); if ( gene.getProduct() != null ){ context = super.getNonRedundant(gene.getConcept(), gene.getProduct().getConcept()); super.copyContext(node.getConcept(), context); } if (gene.getProduct() != null) { // Protein (encoded by)=> Gene super.copyContext( graph.getFactory().createRelation(gene.getProduct().getConcept(), gene .getConcept(), rtSetIsPartOf, etIMPD),context); } } }