private void addPsimiShortSyn(OBOClass oboObj, String synonym) { Synonym syn = new SynonymImpl(); syn.setText( synonym ); SynonymType synCat = new SynonymTypeImpl(); synCat.setID(synonym); syn.setSynonymType( synCat ); syn.setScope( 1 ); oboObj.addSynonym( syn ); }
private void addChild(OBOClass parent, OBOClass child) { Link linkToIsA = new OBORestrictionImpl(child); linkToIsA.setType( OBOProperty.IS_A ); parent.addChild( linkToIsA ); }
protected void addObject( OBOClass oboObj ) { oboSession.addObject( oboObj ); }
public Collection<IdentifiedObject> getRootOBOObjects( OboCategory... categories ) { ArrayList<IdentifiedObject> rootOboObjects = new ArrayList<IdentifiedObject>(); OBOObject rootObj = ( OBOObject ) oboSession.getObject( MI_ROOT_IDENTIFIER ); Collection<Link> childLinks = rootObj.getChildren(); for ( Link childLink : childLinks ) { if (MI_ROOT_IDENTIFIER.equals(childLink.getParent().getID())) { OBOObject immediateChildOfRoot = (OBOObject) childLink.getChild(); if ( checkIfCategorySubset( immediateChildOfRoot, categories ) ) { rootOboObjects.add( immediateChildOfRoot ); } } } log.debug( "oboObjects " + rootOboObjects.size() ); return rootOboObjects; }
/** * returns all the terms parsed from an ontology * * @return a set of OBOClass/Instance objects, or null if session is not initialized */ public Set<OBOObject> getTerms() { LinkDatabase lnkDb = session.getLinkDatabase(); HashSet<OBOObject> terms = new HashSet<OBOObject>(); for (IdentifiedObject io : lnkDb.getObjects()) { //do not return built-in obo: constructs if ((io instanceof OBOClass || io instanceof Instance) && !io.getID().toLowerCase().startsWith("obo:")) { terms.add((OBOObject) io); } } return terms; }
public Collection<IdentifiedObject> getObsoleteOBOObjects() { Collection<IdentifiedObject> ObsoloteOboObjects = new ArrayList<IdentifiedObject>(); Collection<IdentifiedObject> allOBOObjects = oboSession.getObjects(); for ( IdentifiedObject identifiedObject : allOBOObjects ) { if ( identifiedObject.getID().startsWith( "MI:" ) ) { if ( identifiedObject instanceof OBOObject ) { OBOObject obj = ( OBOObject ) identifiedObject; String defText = obj.getDefinition(); if ( obj.isObsolete() || defText.contains( "\nOBSOLETE" ) ) { ObsoloteOboObjects.add( identifiedObject ); } } } } return ObsoloteOboObjects; }
private Collection<IdentifiedObject> getChildren( OBOSession source, String miTerm ) { OBOObject parentTerm = ( OBOObject ) source.getObject( miTerm ); Collection<Link> childLinks = parentTerm.getChildren(); Collection<IdentifiedObject> children = new ArrayList<IdentifiedObject>(); for ( Link childLink : childLinks ) { OBOObject childTerm = ( OBOObject ) childLink.getChild(); children.add( childTerm ); children.addAll( getChildren( source, childTerm.getID() ) ); } return children; }
protected <T extends CvObject> Class<T> findCvClassforMI( String id ) { Class<T> cvClass; cvClass = mi2Class.get( id ); if ( cvClass != null ) { //then it is one of rootCv return cvClass; } else { OBOObject oboObj = ( OBOObject ) oboSession.getObject( id ); Collection<Link> parentLinks = oboObj.getParents(); for ( Link parentLink : parentLinks ) { String parentId = parentLink.getParent().getID(); return findCvClassforMI( parentId ); } } return cvClass; }
public Collection<IdentifiedObject> getAllMIOBOObjects() { int obsoleteCounter = 0; ArrayList<IdentifiedObject> allMIObjects = new ArrayList<IdentifiedObject>(); Collection<IdentifiedObject> allOBOObjects = oboSession.getObjects(); for ( IdentifiedObject identifiedObject : allOBOObjects ) { if ( identifiedObject.getID().equalsIgnoreCase( MI_ROOT_IDENTIFIER ) ) { continue; } if ( identifiedObject.getID().startsWith( "MI:" ) ) { if ( identifiedObject instanceof OBOObject ) { OBOObject obj = ( OBOObject ) identifiedObject; if ( obj.isObsolete() ) obsoleteCounter++; allMIObjects.add( identifiedObject ); } } } log.info( "obsoleteCounter " + obsoleteCounter ); return allMIObjects; }
public Collection<IdentifiedObject> getAllOBOObjects() { Collection<IdentifiedObject> allOBOObjects = oboSession.getObjects(); Collection<IdentifiedObject> allOBOObjectsCol = new ArrayList<IdentifiedObject>(); for ( IdentifiedObject identifiedObject : allOBOObjects ) { if ( identifiedObject instanceof OBOObject ) { allOBOObjectsCol.add( identifiedObject ); } else { log.debug( "----Not Oboobject---" + identifiedObject.getID() ); } } return allOBOObjectsCol; }
private int getPubmedIndex( Object[] dbxrefArray ) { int index = 0; for ( int i = 0; i < dbxrefArray.length; i++ ) { Dbxref defDbxref = ( Dbxref ) dbxrefArray[i]; if ( defDbxref.getDatabase().equalsIgnoreCase( "PMID" ) ) { return i; } } return index; }
private void addFooterInfo() { OBOPropertyImpl partOf = new OBOPropertyImpl("part_of"); partOf.setName("part of"); partOf.setTransitive(true); oboSession.addObject(partOf); }
private void addLinkToRootFor(OBOClass oboObj) { OBOClass rootObject = getRootObject(); Link linkToRoot = new OBORestrictionImpl( oboObj ); OBOProperty oboProp = new OBOPropertyImpl( "part_of" ); linkToRoot.setType( oboProp ); rootObject.addChild( linkToRoot ); }
public OBOClass getOBOCellType() { if (cellTypeObj != null) { return cellTypeObj; } cellTypeObj = new OBOClassImpl("cell type", "IAX:0002"); cellTypeObj.setDefinition("IntAct cell type base object"); addLinkToRootFor(cellTypeObj); oboSession.addObject(cellTypeObj); return cellTypeObj; }
/** * returns all the terms parsed from an ontology * * @return a set of OBOClass/Instance objects, or null if session is not initialized */ public Set<OBOObject> getTerms() { LinkDatabase lnkDb = session.getLinkDatabase(); HashSet<OBOObject> terms = new HashSet<OBOObject>(); for (IdentifiedObject io : lnkDb.getObjects()) { //do not return built-in obo: constructs if ((io instanceof OBOClass || io instanceof Instance) && !io.getID().startsWith("obo:")) { terms.add((OBOObject) io); } // else { // if (io instanceof OBOProperty){ // System.out.println(((OBOProperty) io).getID()); // } // } } return terms; }
private Synonym createSynonym( String shortLabel, String shortLabelId ) { Synonym syn = new SynonymImpl(); syn.setText( shortLabel ); SynonymType synCat = new SynonymTypeImpl(); synCat.setID(shortLabelId); syn.setSynonymType( synCat ); syn.setScope( 1 ); return syn; }
private boolean checkIfUniqueResid( Object[] dbxrefArray ) { int countResid = 0; for ( Object aDbxrefArray : dbxrefArray ) { Dbxref defDbxref = ( Dbxref ) aDbxrefArray; if ( defDbxref.getDatabase().equalsIgnoreCase( "RESID" ) ) { countResid++; } } return countResid == 1; }
public OBOClass getOBOTissue() { if (tissueObj != null) { return tissueObj; } tissueObj = new OBOClassImpl("tissue", "IAX:0001"); tissueObj.setDefinition("IntAct tissue base object"); addLinkToRootFor(tissueObj); oboSession.addObject(tissueObj); return tissueObj; }
/** * returns all the terms parsed from an ontology * * @return a set of OBOClass/Instance objects, or null if session is not initialized */ public Set<OBOObject> getTerms() { LinkDatabase lnkDb = session.getLinkDatabase(); HashSet<OBOObject> terms = new HashSet<OBOObject>(); for (IdentifiedObject io : lnkDb.getObjects()) { //do not return built-in obo: constructs if ((io instanceof OBOClass || io instanceof Instance) && !io.getID().startsWith("obo:")) { terms.add((OBOObject) io); } // else { // if (io instanceof OBOProperty){ // System.out.println(((OBOProperty) io).getID()); // } // } } return terms; }
private Synonym createAlias( CvObjectAlias cvAlias, String aliasId ) { Synonym syn = new SynonymImpl(); syn.setText( cvAlias.getName() ); SynonymType synCat = new SynonymTypeImpl(); synCat.setID(aliasId); syn.setSynonymType( synCat ); syn.setScope( 1 ); return syn; }