/** * Return all of the evidence types of the entities * contained in the collection * * @param cs * @return set of evidence types */ public static Set<EvidenceType> getConceptEvidence(Collection<ONDEXEntity> cs) { Set<EvidenceType> result = new HashSet<EvidenceType>(); for (ONDEXEntity c : cs) { result.addAll(c.getEvidence()); } return result; }
/** * @param entities relations to extract the given attribute values on (where they exist) * @param att * @return an array of the attribute values where they exist (can be null if the path is unrankable) */ public static Double[] valuesToArray(Set<ONDEXEntity> entities, AttributeName att) { List<Double> values1 = new ArrayList<Double>(); for (ONDEXEntity entity : entities) { Attribute value = entity.getAttribute(att); if (value != null) values1.add(((Number) value.getValue()).doubleValue()); } return values1.toArray(new Double[values1.size()]); }
public void writeEntity(Resource res, ONDEXEntity entity, Model model, String graphURI) { // contexts for(ONDEXConcept ctxt : entity.getTags()) { res.addProperty(model.createProperty(ONDEXRdf.contextUri), model.createResource(ONDEXRdf.conceptToUri(graphURI, ctxt))); } // evidence for(EvidenceType evt : entity.getEvidence()) { res.addProperty(model.createProperty(ONDEXRdf.evidenceUri), model.createResource(ONDEXRdf.etToUri(graphURI, evt))); } // Attribute values for(Attribute attribute : entity.getAttributes()) { // todo: add more handlers Property p = model.createProperty(ONDEXRdf.attributeNameToUri(graphURI, attribute.getOfType())); Object value = attribute.getValue(); if (value instanceof String) res.addProperty(p, (String) value); else if (value instanceof Integer) res.addLiteral(p, (Integer) value); else if (value instanceof Double) res.addLiteral(p, (Double) value); else if (value instanceof Boolean) res.addLiteral(p, (Boolean) value); else if (value instanceof Long) res.addLiteral(p, (Long) value); //else res.addProperty(p, value.toString()); } }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { Set<ONDEXConcept> contexts = cOrr.getTags(); return processContexts(contexts); }
for ( Attribute attr: oe.getAttributes () )
public void createHormoneContext(String hormoneName, ONDEXEntity... cs) { if (createHormoneContext) { for (ONDEXEntity c : cs) { ONDEXConcept h = lookup.lookupHormone(hormoneName); c.addTag(h); } } }
/** * @see AbstractContentDisplayPlugin.compileContent() */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(); if (taxid_an != null) { // get attribute on both concepts and relations Attribute attribute = e.getAttribute(taxid_an); if (attribute != null) { String taxid = attribute.getValue().toString(); b.append("<h2>Taxonomy</h2>"); b.append("<a href=\"http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=" + taxid + "\">" + taxid + "</a>"); } } return b.toString(); }
public boolean containsRelationId(int relationId) { for (ONDEXEntity entity : entitiesInPositionOrder) if (entity instanceof ONDEXRelation && entity.getId() == relationId) return true; return false; }
/** * @see AbstractContentDisplayPlugin.compileContent() */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(""); if (uri_an != null) { // get attribute on concepts and relations Attribute attribute = e.getAttribute(uri_an); if (attribute != null) { String uri = attribute.getValue().toString(); b.append("<h2>URI</h2>"); b.append("<a href=\"" + uri + "\">" + uri + "</a>"); } } if (url_an != null) { // get attribute on concepts and relations Attribute attribute = e.getAttribute(url_an); if (attribute != null) { String url = attribute.getValue().toString(); b.append("<h2>URL</h2>"); b.append("<a href=\"" + url + "\">" + url + "</a>"); } } return b.toString(); }
/** * Return all of the evidence types of the entities * contained in the collection * * @param cs * @return set of evidence types */ public static Set<EvidenceType> getConceptEvidence(Collection<ONDEXEntity> cs) { Set<EvidenceType> result = new HashSet<EvidenceType>(); for (ONDEXEntity c : cs) { result.addAll(c.getEvidence()); } return result; }
public boolean containsConceptId(int conceptId) { for (ONDEXEntity entity : entitiesInPositionOrder) if (entity instanceof ONDEXConcept && entity.getId() == conceptId) return true; return false; }
/** * @see net.sourceforge.ondex.ovtk2.ui.contentsdisplay.AbstractContentDisplayPlugin#compileContent(net.sourceforge.ondex.core.AbstractONDEXEntity) */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(); // check for attribute name AttributeName confAN = aog.getMetaData().getAttributeName("CONF"); if (confAN != null) { // get attribute of either concept or relation Attribute g = e.getAttribute(confAN); if (g != null) { double conf = (Double) g.getValue(); NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(4); b.append("<h2>Confidence information</h2>"); b.append("<i>c</i> = " + nf.format(conf) + "<br/>"); } } return b.toString(); }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { for (EvidenceType et : cOrr.getEvidence()){ if(et.equals(ofEv))return ofEv.getId(); } return ""; }
/** * @see net.sourceforge.ondex.ovtk2.ui.contentsdisplay.AbstractContentDisplayPlugin#compileContent(net.sourceforge.ondex.core.AbstractONDEXEntity) */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(); // get attribute from concept and relation Attribute g = e.getAttribute(att); if (g != null && g.getValue() instanceof Boolean) { String name = att.getFullname(); if (name == null || name.trim().length() == 0) name = att.getId(); b.append("<h2>" + name + "?</h2>"); b.append(g.getValue().toString() + "<br/>"); } return b.toString(); }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { StringBuilder sb = new StringBuilder(); boolean first = true; for (EvidenceType evidence : cOrr.getEvidence()) { if (!first) sb.append(", "); sb.append(evidence.getId()); first = false; } return sb.toString(); }
/** * @see net.sourceforge.ondex.ovtk2.ui.contentsdisplay.AbstractContentDisplayPlugin#compileContent(net.sourceforge.ondex.core.AbstractONDEXEntity) */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(); // get attribute from concept and relation Attribute g = e.getAttribute(att); if (g != null && g.getValue() instanceof String) { String string = (String) g.getValue(); // make hyper-links explicit for PLUGINS-52 if (string.startsWith("http://") || string.startsWith("https://")) { string = "<a href=\"" + string + "\">" + string + "</a>"; } String name = att.getFullname(); if (name == null || name.trim().length() == 0) name = att.getId(); b.append("<h2>" + name + "</h2>"); b.append(string + "<br/>"); } return b.toString(); }
/** * Adds a weighting to the entity corresponding to the highest weight * evidence * * @param entity the Relation or Concept to add to * @param weightings a map of evidence to weights * @param weightingAtt the weighting attribute */ private void createWeightingsOnEntity(ONDEXEntity entity, Map<EvidenceType, Double> weightings, AttributeName weightingAtt) { Double highestWeighting = null; for (EvidenceType evidence : entity.getEvidence()) { Double weighting = weightings.get(evidence); if (weighting != null) { if (highestWeighting == null || weighting > highestWeighting) { highestWeighting = weighting; } } } if (highestWeighting != null) { if (entity instanceof ONDEXConcept) ((ONDEXConcept) entity).createAttribute(weightingAtt, highestWeighting, false); else if (entity instanceof ONDEXRelation) ((ONDEXRelation) entity).createAttribute(weightingAtt, highestWeighting, false); } }