@Override public String getAnnotationSource() { return this.relocationService.getRelocation(ANNOTATION_SOURCE); }
/** Loads the terms from the vocabulary when needed. */ private synchronized void loadTerms() { if (this.terms == null) { this.terms = this.vocabulary.getTerms(this.identifiers); } } }
@Override public String getName() { return this.term.getTranslatedName(); }
private Set<String> getGeneSymbols(Set<String> set, String status) { Set<String> result = new HashSet<>(); Vocabulary hgnc = VOCABULARY_MANAGER.getVocabulary("HGNC"); for (String geneEnsemblId : set) { VocabularyTerm term = hgnc.getTerm(geneEnsemblId); String symbol = (term != null) ? (String) term.get("symbol") : null; symbol = StringUtils.isBlank(symbol) ? geneEnsemblId : symbol; symbol = StringUtils.isBlank(status) ? symbol : symbol + " (" + status + ")"; result.add(symbol); } return result; }
private String getLabelFromOntology(String id) { if (!id.startsWith("HP:")) { return id; } VocabularyTerm phObj = this.ontologyService.getTerm(id); if (phObj != null) { return phObj.getTranslatedName(); } return id; }
/** * Gets the {@link VocabularyTerm} associated with the provided {@code categoryId}. If {@code categoryId} refers to * a non-standard category, will set "phenotypic abnormality" ("HP:0000118") as the default. * * @param categoryId the ID of a category of interest * @return a {@link VocabularyTerm} associated with the provided {@code categoryId} or {@link VocabularyTerm} for * "HP:0000118" */ private VocabularyTerm getCategoryTerm(final String categoryId) { final VocabularyTerm categoryTerm = this.ontologyService.getTerm(categoryId); return categoryTerm != null ? categoryTerm : this.ontologyService.getTerm("HP:0000118"); }
@Override public String getId() { return this.term.getId(); }
/** * Gets a connection to the targeted core, used for sending the schema requests. * * @return a valid solr client */ protected SolrClient getClient() { return this.coreConnection.getSolrConnection(this.vocabularyManager.getVocabulary(getTargetVocabularyId())); }
/** * Retrieve a term from its owner vocabulary. For this to work properly, the term identifier must contain a known * vocabulary prefix. * * @param termId the term identifier, in the format {@code <vocabulary prefix>:<term id>}, for example * {@code HP:0002066} * @return the requested term, or {@code null} if the term doesn't exist in the vocabulary, or no matching * vocabulary is available */ public VocabularyTerm resolveTerm(String termId) { return this.manager.resolveTerm(termId); }
/** * Retrieve a vocabulary given its identifier. This is a shortcut for {@link #getVocabulary(String)} which allows * scripts to use the shorter {@code $services.vocabularies.hpo} notation for accessing a vocabulary. * * @param vocabularyId the vocabulary identifier, which is also used as a prefix in every term identifier from that * vocabulary, or a {@link Vocabulary#getAliases() known alias} for it, for example {@code MIM}, * {@code HP} or {@code HPO} * @return the requested vocabulary, or {@code null} if it doesn't exist or isn't available in the platform */ public Vocabulary get(String vocabularyId) { return this.manager.getVocabulary(vocabularyId); }
@Override public boolean isVocabularySupported(@Nonnull final Vocabulary vocabulary) { return getTargetVocabularyIds().contains(vocabulary.getIdentifier()); }
/** * Retrieves a list of vocabulary ids that are available for use with {@link #getVocabulary(String)}. * * @return a list of {@link Vocabulary#getIdentifier() vocabulary identifiers}, one for each vocabulary * @since 1.3 */ public List<String> getAvailableVocabularies() { return this.manager.getAvailableVocabularies(); }
@Override public long getDistance(VocabularyTerm fromTerm, VocabularyTerm toTerm) { if (fromTerm == null || toTerm == null) { return -1; } return fromTerm.getDistanceTo(toTerm); }
/** * Get the location where the sources for this vocabulary can be fetched from. * * @return the string containing the URL for the vocabulary source * @since 1.4 */ default String getSourceLocation() { return getDefaultSourceLocation(); }
/** * Suggest the terms that best match the user's input, in all vocabularies * {@link Vocabulary#getSupportedCategories() supporting the target category of terms}. * * @param input the text to search for * @param category the category of terms to search in * @param maxResults the maximum number of terms to be returned * @return a list of suggestions, possibly empty * @since 1.4 */ public List<VocabularyTerm> search(String input, String category, int maxResults) { return this.manager.search(input, category, maxResults); } }
private String getLabelFromOntology(String id) { if (!id.startsWith("HP:")) { return id; } VocabularyTerm phObj = this.ontologyService.getTerm(id); if (phObj != null) { return phObj.getTranslatedName(); } return id; }
/** * Gets the {@link VocabularyTerm} associated with the provided {@code categoryId}. If {@code categoryId} refers to * a non-standard category, will set "phenotypic abnormality" ("HP:0000118") as the default. * * @param categoryId the ID of a category of interest * @return a {@link VocabularyTerm} associated with the provided {@code categoryId} or {@link VocabularyTerm} for * "HP:0000001" */ private VocabularyTerm getCategoryTerm(final String categoryId) { final VocabularyTerm categoryTerm = this.ontologyService.getTerm(categoryId); return categoryTerm != null ? categoryTerm : this.ontologyService.getTerm(ROOT_ID); }
/** * Retrieve a vocabulary given its identifier. * * @param vocabularyId the vocabulary identifier, which is also used as a prefix in every term identifier from that * vocabulary, or a {@link Vocabulary#getAliases() known alias} for it, for example {@code MIM}, * {@code hpo}, {@code HP} or {@code HPO} * @return the requested vocabulary, or {@code null} if it doesn't exist or isn't available in the platform */ public Vocabulary getVocabulary(String vocabularyId) { return this.manager.getVocabulary(vocabularyId); }
@Override public String getAnnotationSource() { return this.relocationService.getRelocation(ANNOTATION_SOURCE); }
@Override public String getAnnotationSource() { return this.relocationService.getRelocation(ANNOTATION_SOURCE); }