/** * Creates a new AttributeName with the given id and datatype. Adds the new * AttributeName to the list of AttributeNames of this graph. * * @param id * id of the new AttributeName * @param datatype * datatype of the new AttributeName * @return AttributeName * @throws NullValueException * if any parameter is null. * @throws EmptyStringException * if id parameter is an empty string. * @throws UnsupportedOperationException * for read-only graphs */ public AttributeName createAttributeName(String id, Class<?> datatype) throws NullValueException, EmptyStringException, UnsupportedOperationException { return createAttributeName(id, "", datatype); }
/** * Creates a new AttributeName with the given id, unit and datatype. Adds * the new AttributeName to the list of AttributeNames of this graph. * * @param id * id of the new AttributeName * @param unit * unit of the new AttributeName * @param datatype * datatype of the new AttributeName * @return AttributeName * @throws NullValueException * if any parameter is null. * @throws EmptyStringException * if id parameter is an empty string. * @throws UnsupportedOperationException * for read-only graphs */ public AttributeName createAttributeName(String id, Unit unit, Class<?> datatype) throws NullValueException, EmptyStringException, UnsupportedOperationException { return createAttributeName(id, "", unit, datatype); }
/** * Creates a new AttributeName with the given id, fullname and datatype. * Adds the new AttributeName to the list of AttributeNames of this graph. * * @param id * id of the new AttributeName * @param fullname * fullname of the new AttributeName * @param datatype * datatype of the new AttributeName * @return AttributeName * @throws NullValueException * if any parameter is null. * @throws EmptyStringException * if id parameter is an empty string. * @throws UnsupportedOperationException * for read-only graphs */ public AttributeName createAttributeName(String id, String fullname, Class<?> datatype) throws NullValueException, EmptyStringException, UnsupportedOperationException { return createAttributeName(id, fullname, "", datatype); }
protected static AttributeName createAttName(ONDEXGraphMetaData meta, String type, Class<?> cls) throws NullValueException, EmptyStringException{ AttributeName att = meta.getAttributeName(type); if(att == null)att = meta.getFactory().createAttributeName(type, cls); return att; } }
public AttributeName safeFetchAttributeName(String id, Class<?> type) { AttributeName an = metaData.getAttributeName(id); if (an == null) { an = metaData.getFactory().createAttributeName(id, type); } return an; }
protected static AttributeName createAttName(ONDEXGraphMetaData meta, String type, Class<?> cls) throws NullValueException, EmptyStringException{ AttributeName att = meta.getAttributeName(type); if(att == null)att = meta.getFactory().createAttributeName(type, cls); return att; } }
public static void initialiseMetaData(ONDEXGraph g) { graph = g; ONDEXGraphMetaData metaData = graph.getMetaData(); dataSource = metaData.getFactory().createDataSource("BCSDB", "bacterial carbohydrate structure database"); ccsd = metaData.getDataSource("CCSD"); cc = metaData.getConceptClass("Comp"); et = metaData.getEvidenceType("IMPD"); linearStructureAttributeName = metaData.getFactory().createAttributeName("linearBCSDB","structure in BCSDB linear format",String.class); structureTypeAttributeName = metaData.getFactory().createAttributeName("typeBCSDB","structure type according to BCSDB classification",String.class); molecularMassAttributeName = metaData.getFactory().createAttributeName("molmass","molecular mass",String.class); aglyconInfoAttributeName = metaData.getFactory().createAttributeName("alglyconinfo","info about biochemical entity to which glycan is bound",String.class); molecularFormulaAttributeName = metaData.getFactory().createAttributeName("molformula","molecular formula",String.class); trivialNameAttributeName = metaData.getFactory().createAttributeName("trivialname","trivial name",String.class); }
/** * Get Attribute name * * @param graph * @param type * @param cls * @return */ public static AttributeName createAttName(final ONDEXGraph graph, final String type, final Class<?> cls) { ONDEXGraphMetaData meta = graph.getMetaData(); AttributeName att = meta.getAttributeName(type); if (att == null) att = meta.getFactory().createAttributeName(type, cls); return att; }
/** * Get Attribute name * * @param graph * @param type * @param cls * @return */ public static AttributeName createAttName(final ONDEXGraph graph, final String type, final Class<?> cls) { ONDEXGraphMetaData meta = graph.getMetaData(); AttributeName att = meta.getAttributeName(type); if (att == null) att = meta.getFactory().createAttributeName(type, cls); return att; }
private AttributeName getAttributeName(ONDEXGraph aog, String str, Class<?> cls) { if (str.equals(WEIGHT)) str = NWBWeight; AttributeName an = aog.getMetaData().getAttributeName(str); if (an == null) { an = aog.getMetaData().getFactory().createAttributeName(str, cls); } else if (!an.getDataType().isAssignableFrom(cls) && !Number.class.isAssignableFrom(cls)) { System.err .println("Error: Attribute name " + str + " is already part of Ondex controlled vocabulary with " + an.getDataType() + ". Change NWB " + cls + " to conform or choose a differnt name for this attribute."); return null; } return an; }
/** * 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); } }
public static void assignBlastWeight(ONDEXGraph graph) { AttributeName an = graph.getMetaData().getFactory().createAttributeName("BLAST_WEIGHT", Double.class); for (ONDEXRelation r : graph.getRelations()) { Attribute attribute = r.getAttribute(graph.getMetaData().getAttributeName("BLEV")); if (attribute == null) continue; Float score = (float) (double) (Double) attribute.getValue(); Double value = (double) 1f / (1f + (float) Math.exp(((((float) Math.log10(score) + 3f) * 6.66667f) + 10f))); r.createAttribute(an, value, false); } }
public static void initialiseMetaData(ONDEXGraph g) { graph = g; ONDEXGraphMetaData metaData = graph.getMetaData(); // required metadata for a publication dataSource = metaData.getFactory().createDataSource("BCSDB", "bacterial carbohydrate structure database"); cc = metaData.getConceptClass("Publication"); // see entries of et = metaData.getEvidenceType("IMPD"); // Attributes for publication authorsAttributeName = metaData.getAttributeName("AUTHORS"); citationAttributeName = metaData.getAttributeName("JOURNAL_REF"); yearPublishedAttributeName = metaData.getAttributeName("YEAR"); articleTitleAttributeName = metaData.getAttributeName("AbstractHeader"); urlAttributeName = metaData.getAttributeName("URL"); publisherAttributeName = metaData.getFactory().createAttributeName("publisher","publisher of journal",String.class); analyticalMethodAttributeName = metaData.getFactory().createAttributeName("analyticalmethod","experimental techniqes used in publication",String.class); keywordsAttributeName = metaData.getFactory().createAttributeName("keywords","publication keywords",String.class); }
private static void assignCoexWeight(ONDEXGraph graph) { AttributeName an = graph.getMetaData().getFactory().createAttributeName("COEX_WEIGHT", Double.class); for (ONDEXRelation r : graph.getRelations()) { Attribute attribute = r.getAttribute(graph.getMetaData().getAttributeName("Correlation")); if (attribute == null) continue; Double score = (Double) attribute.getValue(); r.createAttribute(an, (Math.abs(score) - 0.6) / 0.4, false); } }
@Override public void init(OVTK2PropertiesAggregator v, Set<ONDEXConcept> e) { super.init(v, e); ONDEXJUNGGraph graph = this.viewer.getONDEXJUNGGraph(); anFlag = graph.getMetaData().getAttributeName(AppearanceSynchronizer.FLAGGED); if (anFlag == null) anFlag = graph.getMetaData().getFactory().createAttributeName(AppearanceSynchronizer.FLAGGED, "flagged concept", Boolean.class); }
public static void initialiseMetaData(ONDEXGraph g) { graph = g; ONDEXGraphMetaData metaData = graph.getMetaData(); // required metadata for a publication dataSource = metaData.getFactory().createDataSource("CARBBANK", "carbbank"); cc = metaData.getConceptClass("Publication"); // see entries of et = metaData.getEvidenceType("IMPD"); // Attributes for publication analyticalMethodAttributeName = metaData.getFactory().createAttributeName("analyticalmethod","experimental techniqes used in publication", Set.class); antigenInformationAttributeName = metaData.getFactory().createAttributeName("antigeninformation","information about antigens used in publication",Set.class); authorsAttributeName = metaData.getAttributeName("AUTHORS"); citationAttributeName = metaData.getAttributeName("JOURNAL_REF"); articleTitleAttributeName = metaData.getAttributeName("AbstractHeader"); }
@Override public void init(OVTK2PropertiesAggregator v, Set<ONDEXConcept> e) { super.init(v, e); ONDEXJUNGGraph graph = this.viewer.getONDEXJUNGGraph(); anFlag = graph.getMetaData().getAttributeName(AppearanceSynchronizer.FLAGGED); if (anFlag == null) anFlag = graph.getMetaData().getFactory().createAttributeName(AppearanceSynchronizer.FLAGGED, "flagged concept", Boolean.class); }
/** * @param graph */ public ProteinTransformer(ONDEXGraph graph) { this.graph = graph; pdb = graph.getMetaData().getFactory().createAttributeName( "Protein3dStructure", Protein3dStructure.class); ccProtein3DStructure = graph.getMetaData().getConceptClass( MetaData.CC_Protein3DStructure); dataSourcePDB = graph.getMetaData().getDataSource(MetaData.CV_PDB); dataSourceUniProt = graph.getMetaData().getDataSource(MetaData.CV_UniProt); dataSourceGenBank = graph.getMetaData().getDataSource(MetaData.CV_GenBank); etIMPD = graph.getMetaData().getEvidenceType("IMPD"); }
/** * initialise Ondex meta-data */ private void initMetaData() { // basic concept meta data dsCHEMBL = graph.getMetaData().getDataSource(DS_CHEMBL); dsCHEBI = graph.getMetaData().getDataSource(DS_CHEBI); ofType = graph.getMetaData().getConceptClass(CC_COMP); evidencetype = graph.getMetaData().getEvidenceType(ET_IMPD); // ChemicalStruture attribute anChemicalStructure = graph.getMetaData().getAttributeName( ATTR_CHEMICAL_STRUCTURE); if (anChemicalStructure == null) anChemicalStructure = graph .getMetaData() .getFactory() .createAttributeName(ATTR_CHEMICAL_STRUCTURE, ATTR_CHEMICAL_STRUCTURE, ChemicalStructure.class); }
public static void assignCombinedWeight(ONDEXGraph graph) { AttributeName coex = graph.getMetaData().getAttributeName("COEX_WEIGHT"); AttributeName blast = graph.getMetaData().getAttributeName("BLAST_WEIGHT"); AttributeName itwi = graph.getMetaData().getAttributeName("INTERACTION_WEIGHT"); AttributeName tm = graph.getMetaData().getAttributeName("Co-citation_weight"); AttributeName all = graph.getMetaData().getFactory().createAttributeName("COMBINED_WEIGHT", Double.class); for (ONDEXRelation r : graph.getRelations()) { Double value = ((getNumber(coex, r) + getNumber(blast, r) + getNumber(itwi, r) + getNumber(tm, r)) / 4d); if (r.getAttribute(all) != null) { r.deleteAttribute(all); } r.createAttribute(all, value, false); } }