final boolean recursive = true; for ( String termId : terms ) { OBOObject oboObject = ( OBOObject ) session.getObject( termId ); allOboObjects.add( oboObject ); for ( SynonymType category : session.getSynonymTypes() ) { session2export.addSynonymType( category ); session2export.setDefaultNamespace( session.getDefaultNamespace() ); for ( Namespace namespace : session.getNamespaces() ) { session2export.addNamespace( namespace ); for ( TermSubset category : session.getSubsets() ) { session2export.addSubset( category ); session2export.addObject( oboObject );
/** * 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> 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; }
version = parser.getSession().getCurrentHistory().getVersion(); Date tmp = parser.getSession().getCurrentHistory().getDate(); Collection<SynonymType> synonymTypes = parser.getSession().getSynonymTypes(); if (synonymTypes != null && !synonymTypes.isEmpty()) { for (SynonymType st : synonymTypes) {
private void addHeaderInfo() { Collection<ExternalOntologyConfig> ontoConfigs = cvToOboMapExternalConfig.values(); oboSession.setDefaultNamespace( new Namespace( defaultOntologyConfig.getDefaultNamespace() ) ); oboSession.addPropertyValue(new PropertyValueImpl("auto-generated-by", "IntAct CvExporter")); oboSession.addSynonymType(new SynonymTypeImpl(defaultOntologyConfig.getAliasSynonymCategory(), defaultOntologyConfig.getAliasSynonymDefinition())); oboSession.addSynonymType(new SynonymTypeImpl(defaultOntologyConfig.getShortLabelSynonymCategory(), defaultOntologyConfig.getShortLabelSynonymDefinition())); for (ExternalOntologyConfig conf : ontoConfigs){ oboSession.addNamespace( new Namespace( conf.getDefaultNamespace() ) ); oboSession.addSynonymType(new SynonymTypeImpl(conf.getAliasSynonymCategory(), conf.getAliasSynonymDefinition())); oboSession.addSynonymType(new SynonymTypeImpl(conf.getShortLabelSynonymCategory(), conf.getShortLabelSynonymDefinition())); } }
OBOObject targetTerm = ( OBOObject ) target.getObject( omc.getTargetOntologyTerm() ); OBOObject sourceTerm = ( OBOObject ) source.getObject( omc.getSourceOntologyTerm() ); target.addObject( child ); OBOObject targetTermAfter = ( OBOObject ) target.getObject( omc.getTargetOntologyTerm() ); if ( log.isDebugEnabled() ) { log.debug( " targetTermAfter " + targetTermAfter.getID() + " " + targetTermAfter.getName() + " " + targetTermAfter.getChildren().size() );
protected void addObject( OBOClass oboObj ) { oboSession.addObject( oboObj ); }
version = parser.getSession().getCurrentHistory().getVersion(); Date tmp = parser.getSession().getCurrentHistory().getDate(); Collection<SynonymType> synonymTypes = parser.getSession().getSynonymTypes(); if (synonymTypes != null && !synonymTypes.isEmpty()) { for (SynonymType st : synonymTypes) {
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; }
version = parser.getSession().getCurrentHistory().getVersion(); Date tmp = parser.getSession().getCurrentHistory().getDate(); Collection<SynonymType> synonymTypes = parser.getSession().getSynonymTypes(); if (synonymTypes != null && !synonymTypes.isEmpty()) { for (SynonymType st : synonymTypes) {
/** * 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; }
public Collection<IdentifiedObject> getInvalidOBOObjects() { Collection<IdentifiedObject> invalidOboObjects = new ArrayList<IdentifiedObject>(); Collection<IdentifiedObject> allOBOObjects = oboSession.getObjects(); for ( IdentifiedObject identifiedObject : allOBOObjects ) { if ( identifiedObject instanceof OBOObject ) { if ( !identifiedObject.getID().startsWith( "MI:" ) ) { invalidOboObjects.add( identifiedObject ); if ( log.isTraceEnabled() ) log.trace( "invalidCv## " + identifiedObject.getID() + " " + identifiedObject.getName() ); } } } return invalidOboObjects; }
private void addFooterInfo() { OBOPropertyImpl partOf = new OBOPropertyImpl("part_of"); partOf.setName("part of"); partOf.setTransitive(true); oboSession.addObject(partOf); }
/** * 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; }
public static void saveSession( OBOSession session, File outputFile ) throws DataAdapterException { if ( log.isTraceEnabled() ) { log.trace( "Writting OBO session containing "+ session.getObjects().size() + " term(s) to " + outputFile.getAbsolutePath() ); } final OBOFileAdapter.OBOAdapterConfiguration config = new OBOFileAdapter.OBOAdapterConfiguration(); config.setWritePath( outputFile.getAbsolutePath() ); OBOFileAdapter adapter = new OBOFileAdapter(); adapter.doOperation( OBOFileAdapter.WRITE_ONTOLOGY, config, session ); } }
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; }
Collection<LinkedObject> tmpRoots = TermUtil.getRoots(RootAlgorithm.STRICT, session.getLinkDatabase()); for (LinkedObject lnk : tmpRoots) { if (lnk instanceof OBOClass) {
public OboOntologyIterator(String ontology, URL path) throws OBOParseException, IOException { this.ontology = ontology; DefaultOBOParser parser = new DefaultOBOParser(); OBOParseEngine engine = new OBOParseEngine(parser); engine.setPaths(Arrays.asList(path.toString())); engine.parse(); OBOSession session = parser.getSession(); List<OBOClassImpl> filteredList = new ArrayList<OBOClassImpl>(session.getObjects().size()); for (IdentifiedObject idObj : session.getObjects()) { if (idObj instanceof OBOClassImpl && !idObj.getID().startsWith("obo:")) { filteredList.add((OBOClassImpl)idObj); } } this.oboClassesIterator = filteredList.iterator(); }
Collection<LinkedObject> tmpRoots = TermUtil.getRoots(RootAlgorithm.STRICT, session.getLinkDatabase()); for (LinkedObject lnk : tmpRoots) { if (lnk instanceof OBOClass) {