@Override public String toString() { return concept.getPID() + "=" + (int) confidence; } }
@Override public String getPID() { return parent.getPID(); }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { if(AbstractConcept.class.isAssignableFrom(cOrr.getClass())){ return ((ONDEXConcept)cOrr).getPID(); } if(AbstractRelation.class.isAssignableFrom(cOrr.getClass())){ return ((ONDEXRelation)cOrr).getKey().toString(); } throw new InvalidOndexEntityException(cOrr.getClass()+": is not an Ondex class for which a pid or key is known"); }
public String assembleLine(ONDEXConcept c1, Set<ONDEXConcept> additional, ONDEXConcept c2, RelationType rt, Set<ONDEXConcept> other) { StringBuffer buf = new StringBuffer(); buf.append(c1.getPID()); buf.append("\t"); buf.append(additional); buf.append("\t"); if (c1.getAnnotation().contains("irreversible")) { buf.append("irreversible"); } else if (c1.getAnnotation().contains("reversible")) { buf.append("reversible"); } else { buf.append("unknown"); } buf.append("\t"); buf.append(c2.getPID()); buf.append("\t"); buf.append(rt.getId()); buf.append("\t"); buf.append(other); buf.append("\n"); return buf.toString(); }
public static void goFilter(OVTK2PropertiesAggregator viewer) { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); Set<ONDEXConcept> del = new HashSet<ONDEXConcept>(); for (ONDEXConcept c : graph.getConcepts()) { if (c.getPID().equals("GO:0008150")) { System.err.println("Found: GO:0008150"); del.add(c); } else if (c.getPID().equals("GO:0005575")) { System.err.println("Found: GO:0005575"); del.add(c); } else if (c.getPID().equals("GO:0003674")) { System.err.println("Found: GO:0003674"); del.add(c); } } for (ONDEXConcept c : del) { graph.deleteConcept(c.getId()); } }
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()")); } } }
/** * helper method to extract a usable concept name. * * @param c * a concept. * @return a usable name. */ private String extractName(ONDEXConcept c) { String str = ""; if (c.getConceptName() != null) str = c.getConceptName().getName(); if (str.trim().length() == 0) str = c.getPID(); if (str.trim().length() == 0) str = c.getId() + ""; return str; }
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 ) ); }
@Override public String getUri ( ONDEXConcept c, Map<String, Object> params ) { String ns = Java2RdfUtils.getParam ( params, "instanceNamespace", NamespaceUtils.ns ( "bkr" ) ); String ccPart = Optional .ofNullable ( c.getOfType () ) .flatMap ( cc -> Optional.ofNullable ( cc.getId () ) ) .orElse ( null ); return OndexRDFUtils.iri ( ns, ccPart, c.getPID (), c.getId () ); } }
public String getName(ONDEXConcept ac) { String label = ""; // get first preferred name as label for (ConceptName cn : ac.getConceptNames()) { if (cn.isPreferred()) { label = cn.getName(); break; } } // next try annotation if (label == null || label.trim().length() == 0) { label = ac.getAnnotation(); } // next try description if (label == null || label.trim().length() == 0) { label = ac.getDescription(); } // next try pid if (label == null || label.trim().length() == 0) { label = ac.getPID(); } // last resort to concept id if (label == null || label.trim().length() == 0) { label = String.valueOf(ac.getId()); } return label; }
break; case PID: builder.append(abstractConcept.getPID()); break; case ID:
/** * Tries to get the most worthwhile identifier for the concept * * @param c * - concept * @return - some id (in order of decreasing preference: name, pid, * description, concepts class+is) */ private static String getSomething(ONDEXConcept c) { if (c.getConceptName() != null) { return c.getConceptName().getName(); } if (c.getPID() != null && c.getPID().equals("")) { return c.getPID(); } if (c.getDescription() != null && c.getDescription().equals("")) { return c.getDescription(); } return "[" + c.getOfType().getId() + " " + c.getId() + "]"; }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { if(AbstractConcept.class.isAssignableFrom(cOrr.getClass())){ String preferedName = ""; for(ConceptName cn : ((ONDEXConcept)cOrr).getConceptNames()){ if(cn.isPreferred()){ preferedName = cn.getName(); } } if (preferedName.length() ==0) { preferedName = ((ONDEXConcept)cOrr).getPID(); } /** if (useLinks && preferedName.length() > 0 && ((AbstractConcept)cOrr).getElementOf().getId().endsWith("PlnTFDB")) { AbstractONDEXValidator validator = ONDEXRegistry.validators.get("htmlaccessionlink"); Condition condition = new Condition(((AbstractConcept)cOrr).getElementOf().getId(), ((AbstractConcept)cOrr).getOfType().getId()); String url = (String) validator.validate(condition); if (url != null) { return "=HYPERLINK(\""+url+preferedName +"\",\""+preferedName+"\")"; } } */ return preferedName; } throw new InvalidOndexEntityException(cOrr.getClass()+": is not an Ondex class for which a name is known"); }
targetSeqs.put(concept.getPID(), concept);
private void updateSelectedNodes() { selected.clear(); OVTK2PropertiesAggregator viewer = OVTK2Desktop.getDesktopResources() .getSelectedViewer(); if (viewer != null) { PickedState<ONDEXConcept> state = viewer.getVisualizationViewer() .getPickedVertexState(); Set<ONDEXConcept> set = state.getPicked(); for (ONDEXConcept node : set) { ONDEXConcept ac = node; selected.put(ac.getId() + ":" + ac.getPID(), ac.getId()); } } }
/** * Constructs the local name of a given concept. * * @param c * ONDEXConcept * @return String */ private String getLocalName(ONDEXConcept c) { String local = String.valueOf(c.getId()); if (concat) { // check if preferred name is present ConceptName preferredName = c.getConceptName(); if (preferredName != null) { local = local + ": " + quote(preferredName.getName()); } else { // use PID as fall-back local = local + ": " + quote(c.getPID()); } } return local; }
/** * Clone concept with having a new DataSource. * * @param oldC * old ONDEXConcept * @param newDataSource * new DataSource to use * @return new ONDEXConcept */ public ONDEXConcept clone(ONDEXConcept oldC, DataSource newDataSource) { // first clone concept with new DataSource ONDEXConcept newC = graph.createConcept(oldC.getPID(), oldC.getAnnotation(), oldC.getDescription(), newDataSource, oldC.getOfType(), oldC.getEvidence()); // copies everything else copyEverythingElse(oldC, newC); return newC; }
/** * Clone concept with having a new ConceptClass. * * @param oldC * old ONDEXConcept * @param newCC * new ConceptClass to use * @return new ONDEXConcept */ public ONDEXConcept clone(ONDEXConcept oldC, ConceptClass newCC) { // first clone concept with new ConceptClass ONDEXConcept newC = graph.createConcept(oldC.getPID(), oldC.getAnnotation(), oldC.getDescription(), oldC.getElementOf(), newCC, oldC.getEvidence()); // copies everything else copyEverythingElse(oldC, newC); return newC; }
/** * Creates a copy of a concept and provides an opportunity to select a new * concept class and new DataSource. * * @param graph * - graph * @param c * - original concept that will be copied * @param newCC * - new concept class that the copy will have * @param newDataSource * - new DataSource that the copy will have * @return concept that was created */ public static ONDEXConcept copyConcept(ONDEXGraph graph, ONDEXConcept c, ConceptClass newCC, DataSource newDataSource) { EvidenceType der = ControledVocabularyHelper.createEvidence(graph, "Derived_copy"); ONDEXConcept nc = graph.getFactory().createConcept(c.getPID(), newDataSource, newCC, der); copyConceptData(graph, c, nc); nc.removeEvidenceType(der); return nc; }
/** * Initialises table data with the given ONDEXGraph. * * @param graph * ONDEXGraph to extract concepts from */ public ConceptPanel(ONDEXGraph graph) { Object[][] data = new Object[graph.getConcepts().size()][]; int i = 0; for (ONDEXConcept concept : graph.getConcepts()) { // first entry in table row is concept itself Object[] row = { concept, concept.getPID(), concept.getAnnotation(), concept.getDescription(), concept.getElementOf(), concept.getOfType(), concept.getEvidence() }; data[i] = row; i++; } // initialise table model and populate table DefaultTableModel model = new DefaultTableModel(); model.setDataVector(data, header); table = new ConceptTable(model, graph); // add table to panel this.setLayout(new GridLayout(1, 1)); this.add(new JScrollPane(table)); Util.calcColumnWidths(table, 150); }