@Override public Attribute getAttribute(AttributeName attrname) throws NullValueException { return parent.getAttribute(attrname); }
@Override protected void doAction() { // set flagged attribute to false on all concepts for (ONDEXConcept c : entities) { if (c.getAttribute(anFlag) != null) c.getAttribute(anFlag).setValue(Boolean.FALSE); } }
@Override public boolean accepts() { boolean found = false; for (ONDEXConcept c : entities) { // at least one concept flagged if (c.getAttribute(anFlag) != null && c.getAttribute(anFlag).getValue().equals(Boolean.TRUE)) { found = true; break; } } return found; }
@Override public boolean accepts() { boolean found = true; for (ONDEXConcept c : entities) { // at least one concept not flagged if (c.getAttribute(anFlag) == null) { found = false; break; } else if (c.getAttribute(anFlag).getValue().equals(Boolean.FALSE)) { found = false; break; } } return !found; }
private final boolean isInTargetPlain(ONDEXConcept possibleTarget, AttributeName an, Object id) { Attribute attribute = possibleTarget.getAttribute(an); if (attribute == null) return false; if (!attribute.getValue().equals(id)) return false; return true; } }
private static final void getGDSValues(Collection<ONDEXConcept> cs, AttributeName att, Set set) { for (ONDEXConcept c : cs) { Attribute attribute = c.getAttribute(att); if (attribute != null) { set.add(attribute.getValue()); } } }
@Override protected void doAction() { // set flagged attribute to true on all concepts for (ONDEXConcept c : entities) { if (c.getAttribute(anFlag) == null) { c.createAttribute(anFlag, Boolean.TRUE, false); } else { c.getAttribute(anFlag).setValue(Boolean.TRUE); } } }
@Override public boolean isValid(ONDEXConcept c, EvidencePathNode<ONDEXConcept, ONDEXRelation, State> path) { Attribute attribute = c.getAttribute(att); if (attribute == null) { if (ignoreConceptWithoutAttribute) { return false; } else { return true; } } Object value = attribute.getValue(); int result = Arrays.binarySearch(referenceValues, value); if (includeMatching) return result > -1; else return result == -1; }
@Override public int compare(ONDEXConcept o1, ONDEXConcept o2) { Attribute attribute1 = o1.getAttribute(an); Attribute attribute2 = o2.getAttribute(an); // both concepts must have a Attribute of the same type if (attribute1 != null && attribute2 != null) { Object v1 = attribute1.getValue(); Object v2 = attribute2.getValue(); // and it has to be a Number if (Number.class.isAssignableFrom(v1.getClass()) && Number.class.isAssignableFrom(v2.getClass())) { Number n1 = (Number) v1; Number n2 = (Number) v2; // this decides increasing / decreasing order return n1.intValue() - n2.intValue(); } } return 0; } }
@Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int index = list.getSelectedIndex(); if (index > -1) { goButton.setEnabled(true); AttributeName attNameName = graph.getMetaData().getAttributeName(((JLabel) list.getModel().getElementAt(index)).getName()); Set<String> attValues = new HashSet<String>(); for (ONDEXConcept c : graph.getConceptsOfAttributeName(attNameName)) attValues.add(c.getAttribute(attNameName).getValue().toString()); text.setText(""); for (String value : attValues) { text.append(value + "\n"); } } } }
@Override public Font transform(ONDEXConcept n) { ONDEXConcept c = graph.getConcept(n.getId()); Attribute attribute = c.getAttribute(an); if (attribute != null) { Float size = (float) (((Double) attribute.getValue() / (Double) gdsMax) * (maxSize - minSize) + minSize); return newFont.deriveFont(size); } return newFont; } });
/** * Sets attribute name to extract values from. * * @param an * AttributeName */ public Histogram(AttributeName an) { for (ONDEXConcept c : graph.getConceptsOfAttributeName(an)) { Attribute attribute = c.getAttribute(an); values.put(c, (Number) attribute.getValue()); } doBins(); }
/** * Annotates the nodes according to specified values. * * @param map * Map<ONDEXConcept, Double> */ private void annotateNodes(Map<ONDEXConcept, Double> map) { AttributeName an = graph.getMetaData().getFactory() .createAttributeName("Betweenness_centrality", Double.class); // scale node size according to percentage for (ONDEXConcept c : map.keySet()) { Double percentBase = map.get(c); if (c.getAttribute(an) == null) c.createAttribute(an, percentBase, false); else c.getAttribute(an).setValue(percentBase); } }
/** * @see AbstractContentDisplayPlugin.compileContent() */ @Override public String compileContent(ONDEXEntity e) { if (an != null) { StringBuffer b = new StringBuffer(""); if (e instanceof ONDEXConcept) { ONDEXConcept c = (ONDEXConcept) e; Attribute attribute = c.getAttribute(an); displayStructure(b, attribute); } else if (e instanceof ONDEXRelation) { ONDEXRelation r = (ONDEXRelation) e; Attribute attribute = r.getAttribute(an); displayStructure(b, attribute); } return b.toString(); } else return ""; }
/** * Adds a sequence to the fasta styled database * * @param b - BufferedWriter * @param concept - to store concept * @return if the entry was really added (could be false if the * <code>IGNORE_PFAM_ANNOTATION_ARG</code> argument was changed * @throws IOException */ private boolean addEntryToFastaDatabase(BufferedWriter b, ONDEXConcept concept, ONDEXGraph graph) throws IOException, InvalidPluginArgumentException { if (concept.getAttribute(atSource) == null || ((Boolean) super.args .getUniqueValue(ArgumentNames.IGNORE_PFAM_ANNOTATION_ARG) == false && this .hasPfamInformationAttached(concept .getConceptAccessions(), graph))) return false; Integer id = concept.getId(); String sequence = (String) concept.getAttribute(atSource).getValue(); b.write(">" + id + "\n" + sequence + "\n"); // writtenProteins.put(id, concept); return true; }
@Override public boolean accepts() { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); // ConceptClass ccProtein = // graph.getMetaData().getConceptClass("Protein"); AttributeName an = graph.getMetaData().getAttributeName("AA"); if (an != null) { int i = 0; for (ONDEXConcept c : entities) { if (c.getAttribute(an) != null) i++; // at least two proteins with AA if (i > 1) return true; } } return false; }
public void parseLine(String[] data) throws FileNotFoundException, IOException { ONDEXConcept protein = lookup.lookupProtein(data[1], data[2]); ONDEXConcept mut = lookup.lookupMutatant(data[4]); if (data.length > 5 && mut.getAttribute(description) == null) { mut.createAttribute(description, data[5], false); } ONDEXRelation rr = createRealtion(protein, mut, r); createHormoneContext(data[3], rr, protein, mut); } });
@Override public int compare(IntegerStringWrapper o1, IntegerStringWrapper o2) { Integer c1 = null; if (graph.getConcept(o1.getValue()).getOfType() .equals(ccChromosome)) c1 = (Integer) graph.getConcept(o1.getValue()) .getAttribute(anChromosome).getValue(); else c1 = (Integer) graph.getConcept(o1.getValue()) .getAttribute(anScaffold).getValue(); Integer c2 = null; if (graph.getConcept(o2.getValue()).getOfType() .equals(ccChromosome)) c2 = (Integer) graph.getConcept(o2.getValue()) .getAttribute(anChromosome).getValue(); else c2 = (Integer) graph.getConcept(o2.getValue()) .getAttribute(anScaffold).getValue(); return c1.compareTo(c2); }
/** * Creates a gds on concept only if it does not already exists * * @param target * - relation * @param newAttribute * - attribute to create * @throws AccessDeniedException * @throws NullValueException */ public static void addNewAttribute(ONDEXConcept target, Attribute newAttribute) throws NullValueException, AccessDeniedException { if (target.getAttribute(newAttribute.getOfType()) == null) target.createAttribute(newAttribute.getOfType(), newAttribute.getValue(), newAttribute.isDoIndex()); }
public static void changeAttributeValue(ONDEXEntity e, AttributeName n, Object value) { if (e instanceof ONDEXConcept) { ONDEXConcept c = (ONDEXConcept) e; boolean doIndex = c.getAttribute(n).isDoIndex(); c.deleteAttribute(n); c.createAttribute(n, value, doIndex); } if (e instanceof ONDEXRelation) { ONDEXRelation r = (ONDEXRelation) e; boolean doIndex = r.getAttribute(n).isDoIndex(); r.deleteAttribute(n); r.createAttribute(n, value, doIndex); } else { throw new IllegalArgumentException( "This method only works with Ondex concepts and relations."); } }