public boolean isValidConcept(ONDEXConcept c) { System.out.println("ISVALID"); if (cidsSet == null|| cidsSet.size() == 0) { System.out.println("finalf__"+(c.getId() == cid)+" "+c.getId()); return c.getId() == cid; } else { System.out.println("final__"+cidsSet.contains( c.getId() )+" "+c.getId()); return cidsSet.contains( c.getId() ); } }
/** * Generate metadata for Context. * @param context * A Context tag (from the Ondex API). * @return JSONObject * JSONObject containing information about the Context tag. */ private JSONObject buildContext(ONDEXConcept context) { JSONObject contextJson= new JSONObject(); contextJson.put(JSONAttributeNames.ID, context.getId()); return contextJson; }
/** * Generate metadata for Context. * @param context * A Context tag (from the Ondex API). * @return JSONObject * JSONObject containing information about the Context tag. */ private JSONObject buildContext(ONDEXConcept context) { JSONObject contextJson= new JSONObject(); contextJson.put(JSONAttributeNames.ID, context.getId()); return contextJson; }
public Integer getIndex(ONDEXConcept c, String att) { ArrayKey<Object> key = new ArrayKey<Object>(new Object[]{c.getId(), att}); Integer count = expIndex.get(key); if (count == null) { count = 0; } else { count++; } expIndex.put(key, count); return count; }
public static String conceptToUri(String graphUri, ONDEXConcept c) { return toUri(graphUri, "concept", String.valueOf(c.getId())); } public static String relationToUri(String graphUri, ONDEXRelation r) {
/** * Returns visibility for a given edge. * * @param edge * ONDEXRelation * @return is visible */ public boolean isVisible(ONDEXRelation edge) { if (edge == null) return false; return edge_visibility.get(edge.getId()) && vertex_visibility.get(edge.getFromConcept().getId()) && vertex_visibility.get(edge.getToConcept().getId()); }
@Override protected boolean dropTag(ONDEXConcept concept) { if (concept instanceof BerkeleyConcept) { berkeley.deleteFromDupDatabase(BerkeleyIntegerName.class, concept.getId(), idarray); return berkeley.deleteFromDupDatabase(BerkeleyConcept.class, (BerkeleyRelationKey) key, ((BerkeleyConcept) concept).serialise()); } else throw new UnsupportedOperationException("Tag " + concept.getId() + " of class " + concept.getClass() + " could not be saved as it is not BerkeleyConcept"); }
@Override protected void saveTag(ONDEXConcept concept) { if (concept instanceof BerkeleyConcept) { berkeley.insertIntoDupDatabase(BerkeleyConcept.class, (BerkeleyRelationKey) key, ((BerkeleyConcept) concept).serialise()); berkeley.insertIntoDupDatabase(BerkeleyIntegerName.class, concept.getId(), idarray); } else throw new UnsupportedOperationException("Tag " + concept.getId() + " of class " + concept.getClass() + " could not be saved as it is not BerkeleyConcept"); }
@Override protected boolean dropTag(ONDEXConcept concept) { if (concept instanceof BerkeleyConcept) { berkeley.deleteFromDupDatabase(Integer.class, concept.getId(), idarray); return berkeley.deleteFromDupDatabase(BerkeleyConcept.class, getId(), ((BerkeleyConcept) concept).serialise()); } else throw new UnsupportedOperationException("Tag " + concept.getId() + " of class " + concept.getClass() + " could not be saved as it is not BerkeleyConcept"); }
public static Set<ONDEXConcept> filteroutUnconnected(ONDEXGraph graph, Set<ONDEXConcept> setOfConcepts, Set<ONDEXRelation> validRelations) { BitSet resultSet = new BitSet(); for (ONDEXConcept c : setOfConcepts) { if (BitSetFunctions.and(graph.getRelationsOfConcept(c), validRelations).size() > 0) resultSet.set(c.getId()); } Set<ONDEXConcept> result = BitSetFunctions.create(graph, ONDEXConcept.class, resultSet); return result; }
/** * Updates the graph with the new concept and all tables with it. * * @param newConcept * ONDEXConcept newly created */ private void updateConceptInGraph(ONDEXConcept newConcept) { // update all linked tables GraphTableEditor.updateConceptInTables(newConcept, row); // delete old concept from graph, also deletes relations etc graph.deleteConcept(concept.getId()); }
public SerializableEvidencePathNode(EvidencePathNode pathNode) { List<ONDEXConcept> conceptL = pathNode.getConceptsInPositionOrder(); List<ONDEXRelation> relationL = pathNode.getRelationsInPositionOrder(); concepts = new int[conceptL.size()]; for (int i = 0; i < concepts.length; i++) concepts[i] = conceptL.get(i).getId(); relations = new int[relationL.size()]; for (int i = 0; i < relations.length; i++) relations[i] = relationL.get(i).getId(); evidences = pathNode.getEvidencesInPositionOrder(); }
private void propagate(BitSet toKeep, ONDEXConcept c, int l) throws NullValueException, AccessDeniedException { if (l > depth) return; if (toKeep.get(c.getId())) return; toKeep.set(c.getId()); for (ONDEXRelation r : graph.getRelationsOfConcept(c)) { if (!r.getToConcept().equals(c)) { propagate(toKeep, r.getToConcept(), l + 1); } else { propagate(toKeep, r.getFromConcept(), l + 1); } } }
@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; } });
@Override public void addTag(ONDEXConcept ac) throws AccessDeniedException, NullValueException { try { soapGraph.addTagConcept(graphId, id, ac.getId()); } catch (WebserviceException_Exception e) { parent.fireActionEvent(e, e.getMessage()); e.printStackTrace(); } }
@Override public boolean removeTag(ONDEXConcept ac) { try { return soapGraph.removeTagConcept(graphId, id, ac.getId()); } catch (WebserviceException_Exception e) { parent.fireActionEvent(e, e.getMessage()); e.printStackTrace(); } // indicates error return false; }
@Override public void addTag(ONDEXConcept ac) throws AccessDeniedException, NullValueException { try { soapGraph.addTagRelation(graphId, id, ac.getId()); } catch (WebserviceException_Exception e) { parent.fireActionEvent(e, e.getMessage()); e.printStackTrace(); } }
@Override public boolean removeTag(ONDEXConcept ac) { try { return soapGraph.removeTagRelation(graphId, id, ac.getId()); } catch (WebserviceException_Exception e) { parent.fireActionEvent(e, e.getMessage()); e.printStackTrace(); } // indicates error return false; }
/** * searches for paths. */ public void search() { for (ONDEXConcept c : og.getConcepts()) { if (!instanceOf(ccs[0], c)) { continue; } PathNode pn = new PathNode(c.getId()); searchRelations(c, pn, 1, false); } }
public int getOrCreateGeneID(String geneId) { if (poplarReg.containsGene(geneId)) { return poplarReg.getGene(geneId); } else { ONDEXConcept gene = og.getFactory().createConcept(geneId, dataSourcePHYTOZOME, ccGene, etIMPD); gene.createConceptAccession(geneId, dataSourcePHYTOZOME, false); gene.createConceptName(geneId, false); Integer ondexGeneId = gene.getId(); gene.createAttribute(anTaxID, Parser.POPLAR_TAX_ID, false); poplarReg.addGene(geneId, ondexGeneId); return ondexGeneId; } }