/** * @return * @see net.sourceforge.ondex.core.ONDEXGraph#getRelations() */ public Set<ONDEXRelation> getRelations() { return og.getRelations(); }
/** * Calculates degree centrality on the ONDEX graph. Result returned as a map * of concept to its degree centrality value. * * @return Object2DoubleOpenHashMap<ONDEXConcept> * @throws AccessDeniedException * @throws NullValueException */ public static final Map<ONDEXConcept, Double> getDegreeCentrality(Set<ONDEXConcept> itc, Set<ONDEXRelation> itr, ONDEXGraph aog) throws NullValueException, AccessDeniedException { Map<ONDEXConcept, Double> conceptToDegree = new HashMap<ONDEXConcept, Double>(); double normalisationFactor = itc.size() - 1; for (ONDEXConcept c : itc) { if (itr.size() == aog.getRelations().size()) conceptToDegree.put(c, aog.getRelationsOfConcept(c).size() / normalisationFactor); else conceptToDegree.put(c, BitSetFunctions.and(aog.getRelationsOfConcept(c), itr).size() / normalisationFactor); } return conceptToDegree; }
/** * @see net.sourceforge.ondex.filter.ONDEXFilter#getVisibleRelations() */ @Override public Set<ONDEXRelation> getVisibleRelations() { if (seqSimRelationsToKeep == null) return graph.getRelations(); Set<ONDEXRelation> toKeep = BitSetFunctions.create(graph, ONDEXRelation.class, seqSimRelationsToKeep); Set<ONDEXRelation> toDelete = BitSetFunctions.andNot(graph.getRelationsOfRelationType(rts_ortholog), toKeep); Set<ONDEXRelation> out = BitSetFunctions.copy(graph.getRelations()); out.removeAll(toDelete); // returns: (all \ (ortholog \ keep)) return out; }
@Override protected Set<ONDEXRelation> retrieveRelationAll() { return parent.getRelations(); }
@Override public Set<ONDEXRelation> getVisibleRelations() { return graph.getRelations(); }
/** * @see net.sourceforge.ondex.filter.ONDEXFilter#getVisibleRelations() */ public Set<ONDEXRelation> getVisibleRelations() { while (!ready) { try { Thread.sleep(100); } catch (InterruptedException e) { } } if (!cancelled) { BitSet BitSet = new BitSet(relationBitSet.size()); for (int rid : relationBitSet) { BitSet.set(rid); } return BitSetFunctions.create(graph, ONDEXRelation.class, BitSet); } else { return graph.getRelations(); } }
/** * the constructor. */ public DataExtractor(ONDEXGraph aog) { this.aog = aog; clearAllFilters(); max_progress = aog.getConcepts().size() + aog.getRelations().size(); }
/** * Filters the graph and constructs the lists for visible concepts and * relations. */ public void start() throws InvalidPluginArgumentException { filterOnGraph(graph.getConcepts(), graph.getRelations()); }
/** * @return Object2DoubleOpenHashMap<ONDEXConcept> * @throws AccessDeniedException * @throws NullValueException * @author taubertj Calculates betweenness centrality on the ONDEX graph. * Result returned as a map of concept to its betweennes centrality * value. */ public static final Map<ONDEXConcept, Double> getBetweenessCentrality(ONDEXGraph aog) throws NullValueException, AccessDeniedException { return getBetweenessCentrality(aog.getConcepts(), aog.getRelations(), aog); }
/** * Calculates degree centrality on the ONDEX graph. Result returned as a map * of concept to its degree centrality value. * * @return Object2DoubleOpenHashMap<ONDEXConcept> * @throws AccessDeniedException * @throws NullValueException */ public static final Map<ONDEXConcept, Double> getDegreeCentrality(ONDEXGraph aog) throws NullValueException, AccessDeniedException { return getDegreeCentrality(aog.getConcepts(), aog.getRelations(), aog); }
public void start() throws Exception { AttributeName att = this.graph.getMetaData().createAttributeName("fact", "fact", "Interesting fact", null, String.class, null); for (ONDEXRelation rel : this.graph.getRelations()) { rel.createAttribute(att, "bob", false); } }
/** * NB if you make a clone request here and metadata and concepts have not * been cloned, then this will be done */ public void cloneAllRelations() { if (!metaDataHasBeenCloned) { cloneMetaData(); } if (!conceptsHaveBeenCloned) { cloneAllConcepts(); } if (relationsHaveBeenCloned) { System.err .println("Relations have already been cloned: Ignoring request"); return; } relationsHaveBeenCloned = true; for (ONDEXRelation r : origGraph.getRelations()) { cloneRelation(r); } }
public static void setAllToGrey(OVTK2PropertiesAggregator viewer) { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); for (ONDEXConcept c : graph.getConcepts()) { Annotation.setColor(viewer, c, Color.darkGray); } for (ONDEXRelation r : graph.getRelations()) { Annotation.setColor(viewer, r, Color.darkGray); } }
@Override public void copyResultsToNewGraph(ONDEXGraph exportGraph) { ONDEXGraphCloner graphCloner = new ONDEXGraphCloner(graph, exportGraph); for (ONDEXConcept c : graph.getConcepts()) { graphCloner.cloneConcept(c); } for (ONDEXRelation r : graph.getRelations()) { graphCloner.cloneRelation(r); } }
public static void printRelationState(OVTK2PropertiesAggregator viewer) { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); ONDEXJUNGGraph jung = viewer.getONDEXJUNGGraph(); for (ONDEXRelation r : graph.getRelations()) { System.err.println(viewer.getONDEXJUNGGraph().isVisible(jung.getRelation(r.getId()))); } }
public static void assignBlastWeight(ONDEXGraph graph) { AttributeName an = graph.getMetaData().getFactory().createAttributeName("BLAST_WEIGHT", Double.class); for (ONDEXRelation r : graph.getRelations()) { Attribute attribute = r.getAttribute(graph.getMetaData().getAttributeName("BLEV")); if (attribute == null) continue; Float score = (float) (double) (Double) attribute.getValue(); Double value = (double) 1f / (1f + (float) Math.exp(((((float) Math.log10(score) + 3f) * 6.66667f) + 10f))); r.createAttribute(an, value, false); } }
private static void assignCoexWeight(ONDEXGraph graph) { AttributeName an = graph.getMetaData().getFactory().createAttributeName("COEX_WEIGHT", Double.class); for (ONDEXRelation r : graph.getRelations()) { Attribute attribute = r.getAttribute(graph.getMetaData().getAttributeName("Correlation")); if (attribute == null) continue; Double score = (Double) attribute.getValue(); r.createAttribute(an, (Math.abs(score) - 0.6) / 0.4, false); } }
@Override public void start() throws Exception { String conceptClass = (String) args.getUniqueValue(CC); String name = (String) args.getUniqueValue(NAME); Set<ONDEXConcept> cs = graph.getConcepts(); Set<ONDEXRelation> rs = graph.getRelations(); ONDEXConcept c = graph.getFactory().createConcept(name, createDataSource(graph, "UC"), createCC(graph, conceptClass), createEvidence(graph, "M")); c.createConceptName(name, true); for (ONDEXConcept co : cs) { co.addTag(c); } for (ONDEXRelation re : rs) { re.addTag(c); } }
public Model createModel(ONDEXGraph og) { Model instanceModel = ModelFactory.createDefaultModel(); for (ONDEXConcept concept : og.getConcepts()) { Resource classOfConcept = instanceModel.createResource(urlPrefixMetaData + concept.getOfType().getId()); instanceModel.createResource(urlPrefixInstances + concept.getId(), classOfConcept); } for (ONDEXRelation or : og.getRelations()) { Property propertyOfPredicate = instanceModel.createProperty(urlPrefixMetaData, or.getOfType().getId()); Resource fromConcept = instanceModel.getResource(urlPrefixInstances + or.getFromConcept().getId()); Resource toConcept = instanceModel.getResource(urlPrefixInstances + or.getToConcept().getId()); instanceModel.createStatement(toConcept, propertyOfPredicate, fromConcept); } return instanceModel; }
public static void assignCombinedWeight(ONDEXGraph graph) { AttributeName coex = graph.getMetaData().getAttributeName("COEX_WEIGHT"); AttributeName blast = graph.getMetaData().getAttributeName("BLAST_WEIGHT"); AttributeName itwi = graph.getMetaData().getAttributeName("INTERACTION_WEIGHT"); AttributeName tm = graph.getMetaData().getAttributeName("Co-citation_weight"); AttributeName all = graph.getMetaData().getFactory().createAttributeName("COMBINED_WEIGHT", Double.class); for (ONDEXRelation r : graph.getRelations()) { Double value = ((getNumber(coex, r) + getNumber(blast, r) + getNumber(itwi, r) + getNumber(tm, r)) / 4d); if (r.getAttribute(all) != null) { r.deleteAttribute(all); } r.createAttribute(all, value, false); } }