@Override protected Set<ONDEXRelation> retrieveRelationAllRelationType( RelationType relationType) { return parent.getRelationsOfRelationType(relationType); }
/** * @param rt * @return * @see net.sourceforge.ondex.core.ONDEXGraph#getRelationsOfRelationType(net.sourceforge.ondex.core.RelationType) */ public Set<ONDEXRelation> getRelationsOfRelationType(RelationType rt) { return og.getRelationsOfRelationType(rt); }
int counting(RelationType rt) { return graph.getRelationsOfRelationType(rt).size(); } }.count();
/** * Debug output method. */ private void printNumPfamMappings() { Set<ONDEXRelation> v = graph.getRelationsOfRelationType(rts_seq2pfam); System.out.println("Number of pfam mappings: " + v.size()); }
/** * @param annotationRelationTypes * @return */ private Set<ONDEXRelation> getRelationsOfTypes( Set<RelationType> annotationRelationTypes) { Set<ONDEXRelation> annotationRelations = null; for (RelationType annotationRelationType : annotationRelationTypes) { Set<ONDEXRelation> relations = graph.getRelationsOfRelationType(annotationRelationType); if (annotationRelations == null) { annotationRelations = relations; } else { BitSetFunctions.or(annotationRelations, relations); } } return annotationRelations; }
/** * Return all of the relations of relation types with provided ids in the graph * @param graph - Ondex graph * @param strIds - id of relation types * * @return view */ public static final Set<ONDEXRelation> getRelationsOfTypes(ONDEXGraph graph,Collection<String> strIds){ Set<ONDEXRelation> result = BitSetFunctions.create(graph, ONDEXRelation.class, new BitSet()); RelationType [] rts = ControledVocabularyHelper.convertRelationTypes(graph, strIds); for(RelationType rt : rts){ BitSetFunctions.or(result, graph.getRelationsOfRelationType(rt)); } return result; } }
/** * Creates a ComboBox which contains both concept classes and relation * types. * * @return ONDEX entity types ComboBox */ private JComboBox getEntityTypeComboBox() { JComboBox cb = new JComboBox(); // first add concept classes, sorted by ID Set<ConceptClass> ccs = graph.getMetaData().getConceptClasses(); ConceptClass[] arrayCC = ccs.toArray(new ConceptClass[0]); Arrays.sort(arrayCC); for (ConceptClass cc : arrayCC) { // only add meta data if used if (graph.getConceptsOfConceptClass(cc).size() > 0) cb.addItem(cc); } // second add relation types, sorted by ID Set<RelationType> rts = graph.getMetaData().getRelationTypes(); RelationType[] arrayRT = rts.toArray(new RelationType[0]); Arrays.sort(arrayRT); for (RelationType rt : arrayRT) { // only add meta data if used if (graph.getRelationsOfRelationType(rt).size() > 0) cb.addItem(rt); } return cb; }
/** * Constructs the view containing all of the relations of particular types, * specified by their string ids. * * @param graph * - graph to operate on * @param types * - string ids of the relation types that will be used to * determine which relation to include in the view. * @return - resulting view */ public static Set<ONDEXRelation> getRelationsByTypes(ONDEXGraph graph, List<String> types) { Set<ONDEXRelation> result = BitSetFunctions.create(graph, ONDEXRelation.class, new BitSet()); ONDEXGraphMetaData meta = graph.getMetaData(); for (String type : types) { RelationType rt = meta.getRelationType(type); if (rt != null) { result.addAll(graph.getRelationsOfRelationType(rt)); } } return result; }
public static void assignInteractionWeight(ONDEXGraph graph) { Map<String, Double> conf_map = new HashMap<String, Double>(); conf_map.put("2 hybrid", 0.5d); conf_map.put("biochemical", 0.8d); conf_map.put("tap", 0.7d); conf_map.put("bn-page", 0.7d); conf_map.put("protein array", 0.8d); conf_map.put("IMPD", 0d); Set<ONDEXRelation> itr = graph.getRelationsOfRelationType(graph.getMetaData().getRelationType("it_wi")); // Set<ONDEXRelation>itr = graph.getRelations(); AttributeName an = graph.getMetaData().getFactory().createAttributeName("INTERACTION_WEIGHT", Double.class); int count = 0; // for (ONDEXRelation r : itr) { // Attribute expSize = // r.getQualifier().getAttribute(graph.getMetaData().getAttributeName("EXPERIMENT_SIZE")); // Double conf = convertExperimentToConf(r.getEvidence(), conf_map); // if (expSize != null && ((Integer) expSize.getValue()) >= 20) { // if (conf == 0d) // System.err.println("Error"); // r.createAttribute(an, conf, false); // count++; // } else { // r.createAttribute(an, 1d, false); // count++; // } // } System.err.println("Values assigned: " + count); }
for (Transition transition : transitions) { transitionViewCache.put(transition, aog.getRelationsOfRelationType(transition.getValidRelationType()));
/** * @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; }
public void start() { ONDEXGraphMetaData metadata = graph.getMetaData(); for (ConceptClass cc : metadata.getConceptClasses()) { System.out.println("ConceptClass " + cc.getId() + " " + cc.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfConceptClass(cc).size()); } for (DataSource dataSource : metadata.getDataSources()) { System.out.println("DataSource " + dataSource.getId() + " " + dataSource.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfDataSource(dataSource).size()); } for (AttributeName att : metadata.getAttributeNames()) { System.out.println("AttributeName " + att.getId() + " " + att.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfAttributeName(att).size()); System.out.println("\tRelations = " + graph.getRelationsOfAttributeName(att).size()); } for (RelationType rt : metadata.getRelationTypes()) { System.out.println("RelationType " + rt.getId() + " " + rt.getFullname()); System.out.println("\tRelations = " + graph.getRelationsOfRelationType(rt).size()); } }
if (aog.getRelationsOfRelationType(rt).size() > 0) rtListModel.addRelationType(rt);
(String) getArguments().getUniqueValue(DATASET_RELATION)); Collection<ONDEXRelation> eqRelations = graph.getRelationsOfRelationType(eqRelation); Collection<ONDEXRelation> gsRR = graph.getRelationsOfRelationType(gsRelType); Set<ONDEXRelation> gsCR = new HashSet<ONDEXRelation>(graph.getRelationsOfConceptClass(gsCClass)); Set<ONDEXRelation> gsRelations = new HashSet<ONDEXRelation>(gsRR); Collection<ONDEXRelation> dsRR = graph.getRelationsOfRelationType(dsRelType); Set<ONDEXRelation> dsCR = new HashSet<ONDEXRelation>(graph.getRelationsOfConceptClass(dsCClass)); Set<ONDEXRelation> dsRelations = new HashSet<ONDEXRelation>(dsRR);
/** * checks all requirements in the graph. * * @return if everything is ok. */ private boolean checkGraphRequirements() { boolean continueRun = true; if (graph.getConceptsOfConceptClass(cc_protFam).isEmpty()) { continueRun = false; fireEventOccurred(new InconsistencyEvent("Graph does not contain protein families.", getName())); } if (graph.getConceptsOfConceptClass(cc_protein).isEmpty()) { continueRun = false; fireEventOccurred(new InconsistencyEvent("Graph does not contain proteins.", getName())); } if (graph.getRelationsOfRelationType(rts_ortholog).isEmpty()) { continueRun = false; fireEventOccurred(new InconsistencyEvent("Graph does not contain ortholog relations.", getName())); } if (graph.getRelationsOfRelationType(rts_seq2pfam).isEmpty()) { continueRun = false; fireEventOccurred(new InconsistencyEvent("Graph does not contain protein to pfam mappings.", getName())); } return continueRun; }
for (ONDEXRelation rel : graph.getRelationsOfRelationType(rtSimSeq)) { if ((rel.getFromConcept().getElementOf().equals(dataSourcePoplar1) || rel.getFromConcept().getElementOf().equals(dataSourcePoplar2)) && rel.getToConcept().getElementOf().equals(dataSourceUniprot)) { int id = rel.getFromConcept().getId(); for (ONDEXRelation rel : graph.getRelationsOfRelationType(rtMISP)) { if (rel.getToConcept().getOfType().equals(ccProtDomain)) { int id = rel.getFromConcept().getId();
Set<ONDEXRelation> set = graph.getRelationsOfRelationType(rt); if (set.size() > 0) {
int dupes = 0; for (RelationType[] rtsToChange : rtss) { Set<ONDEXRelation> rels = BitSetFunctions.copy(graph.getRelationsOfRelationType(rtsToChange[0])); for (ONDEXRelation r : rels) { if (!GraphElementManipulation.castRelation(graph, r, rtsToChange[1], false)) {
for (ONDEXRelation ortho_relation : graph.getRelationsOfRelationType(rts_ortholog)) { ONDEXConcept p1 = ortho_relation.getFromConcept(); ONDEXConcept p2 = ortho_relation.getToConcept();
for (ONDEXRelation r : graph.getRelationsOfRelationType(rt).toArray( new ONDEXRelation[0])) {