use of ubic.gemma.model.common.description.BibliographicReferenceValueObject in project Gemma by PavlidisLab.
the class BibliographicReferenceServiceImpl method search.
@Override
@Transactional(readOnly = true)
public List<BibliographicReferenceValueObject> search(SearchSettingsValueObject settings) {
SearchSettings ss = SearchSettingsImpl.bibliographicReferenceSearch(settings.getQuery());
// noinspection unchecked
List<BibliographicReference> resultEntities = (List<BibliographicReference>) searchService.search(ss, BibliographicReference.class);
List<BibliographicReferenceValueObject> results = new ArrayList<>();
// only return associations with the selected entity types.
for (BibliographicReference entity : resultEntities) {
BibliographicReferenceValueObject vo = new BibliographicReferenceValueObject(entity);
if (settings.getSearchPhenotypes() || settings.getSearchBibrefs()) {
this.populateBibliographicPhenotypes(vo);
if (!vo.getBibliographicPhenotypes().isEmpty() || settings.getSearchBibrefs()) {
results.add(vo);
}
}
if (settings.getSearchExperiments() || settings.getSearchBibrefs()) {
this.populateRelatedExperiments(entity, vo);
if (!vo.getExperiments().isEmpty() || settings.getSearchBibrefs()) {
results.add(vo);
}
}
if (settings.getSearchBibrefs() && !settings.getSearchPhenotypes() && !settings.getSearchExperiments()) {
results.add(vo);
}
}
return results;
}
use of ubic.gemma.model.common.description.BibliographicReferenceValueObject in project Gemma by PavlidisLab.
the class PhenotypeController method findBibliographicReference.
/**
* Finds bibliographic reference with the given pubmed id.
*
* @return bibliographic reference with the given pubmed id
*/
public Collection<BibliographicReferenceValueObject> findBibliographicReference(String pubMedId, Long evidenceId) {
BibliographicReferenceValueObject valueObject = this.phenotypeAssociationManagerService.findBibliographicReference(pubMedId);
// Contain at most 1 element.
ArrayList<BibliographicReferenceValueObject> valueObjects = new ArrayList<>(1);
if (valueObject != null) {
valueObjects.add(valueObject);
}
return valueObjects;
}
use of ubic.gemma.model.common.description.BibliographicReferenceValueObject in project Gemma by PavlidisLab.
the class SearchServiceImpl method expressionExperimentSearch.
/**
* A general search for expression experiments. This search does both an database search and a compass search.
* A problem with this is that we cap the number of results that can be returned. This could be a limitation for
* applications like building data set groups. Thus MAX_CHARACTERISTIC_SEARCH_RESULTS should not be too low.
*
* @return {@link Collection}
*/
private Collection<SearchResult> expressionExperimentSearch(final SearchSettings settings) {
StopWatch watch = this.startTiming();
SearchServiceImpl.log.info("Starting search for " + settings.getQuery() + " in taxon: " + settings.getTaxon());
Collection<SearchResult> results = new HashSet<>();
if (settings.getUseDatabase()) {
results.addAll(this.databaseExpressionExperimentSearch(settings));
if (watch.getTime() > 1000)
SearchServiceImpl.log.info("Expression Experiment database search for '" + settings + "' took " + watch.getTime() + " ms, " + results.size() + " hits.");
watch.reset();
watch.start();
}
if (settings.getUseIndices() && results.size() < SearchServiceImpl.MAX_CHARACTERISTIC_SEARCH_RESULTS) {
results.addAll(this.compassExpressionSearch(settings));
if (watch.getTime() > 1000)
SearchServiceImpl.log.info("Expression Experiment index search for '" + settings + "' took " + watch.getTime() + " ms, " + results.size() + " hits.");
watch.reset();
watch.start();
}
if (results.size() < SearchServiceImpl.MAX_CHARACTERISTIC_SEARCH_RESULTS) {
/*
* Try a more thorough search. This is slower; calls to ontologySearchAnnotatedObject take a long time
*/
if (settings.getUseCharacteristics()) {
results.addAll(this.characteristicExpressionExperimentSearch(settings));
}
if (watch.getTime() > 1000)
SearchServiceImpl.log.info("Expression Experiment ontology search for '" + settings + "' took " + watch.getTime() + " ms, " + results.size() + " hits.");
watch.reset();
watch.start();
}
/*
* Find data sets that match the platform
*/
if (results.size() == 0) {
Collection<SearchResult> matchingPlatforms = this.arrayDesignSearch(settings, null);
for (SearchResult adRes : matchingPlatforms) {
if (adRes.getResultObject() instanceof ArrayDesign) {
ArrayDesign ad = (ArrayDesign) adRes.getResultObject();
Collection<ExpressionExperiment> expressionExperiments = this.arrayDesignService.getExpressionExperiments(ad);
if (expressionExperiments.size() > 0)
results.addAll(this.dbHitsToSearchResult(expressionExperiments, null));
}
}
if (watch.getTime() > 1000)
SearchServiceImpl.log.info("Expression Experiment platform search for '" + settings + "' took " + watch.getTime() + " ms, " + results.size() + " hits.");
watch.reset();
watch.start();
}
if (results.size() == 0) {
/*
* Search for bib refs
*/
List<BibliographicReferenceValueObject> bibrefs = bibliographicReferenceService.search(settings.getQuery());
if (!bibrefs.isEmpty()) {
Collection<BibliographicReference> refs = new HashSet<>();
Collection<SearchResult> r = this.compassBibliographicReferenceSearch(settings);
for (SearchResult searchResult : r) {
refs.add((BibliographicReference) searchResult.getResultObject());
}
Map<BibliographicReference, Collection<ExpressionExperiment>> relatedExperiments = this.bibliographicReferenceService.getRelatedExperiments(refs);
for (Entry<BibliographicReference, Collection<ExpressionExperiment>> e : relatedExperiments.entrySet()) {
results.addAll(this.dbHitsToSearchResult(e.getValue(), null));
}
if (watch.getTime() > 1000)
SearchServiceImpl.log.info("Expression Experiment publication search for '" + settings + "' took " + watch.getTime() + " ms, " + results.size() + " hits.");
watch.reset();
watch.start();
}
}
watch.stop();
if (watch.getTime() > 1000)
SearchServiceImpl.log.info("Expression Experiment search for '" + settings + "' took " + watch.getTime() + " ms, " + results.size() + " hits.");
return results;
}
Aggregations