Class ExpressionAnalysisResultSetDaoImpl
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, AnalysisResultSetDao<DifferentialExpressionAnalysisResult, ExpressionAnalysisResultSet>, ExpressionAnalysisResultSetDao, BaseDao<ExpressionAnalysisResultSet>, BaseVoEnabledDao<ExpressionAnalysisResultSet, DifferentialExpressionAnalysisResultSetValueObject>, FilteringDao<ExpressionAnalysisResultSet>, FilteringVoEnabledDao<ExpressionAnalysisResultSet, DifferentialExpressionAnalysisResultSetValueObject>
- Author:
- Paul
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractCriteriaFilteringVoEnabledDao
AbstractCriteriaFilteringVoEnabledDao.CriteriaContext<T,R> Nested classes/interfaces inherited from class AbstractFilteringVoEnabledDao
AbstractFilteringVoEnabledDao.FilterablePropertiesConfigurer, AbstractFilteringVoEnabledDao.FilterablePropertyMetaNested classes/interfaces inherited from interface FilteringDao
FilteringDao.ConjunctSpec -
Field Summary
Fields inherited from class AbstractVoEnabledDao
REPORT_SLOW_QUERY_AFTER_MS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDelete(DifferentialExpressionAnalysis differentialExpressionAnalysis) protected voidconfigureFilterableProperties(AbstractFilteringVoEnabledDao<ExpressionAnalysisResultSet, DifferentialExpressionAnalysisResultSetValueObject>.FilterablePropertiesConfigurer configurer) Register filterable properties.longCount the number of results in a given result set.longcountResults(ExpressionAnalysisResultSet ears, double threshold) Count the number of results in a given result set below a given corrected P-value threshold.create(ExpressionAnalysisResultSet entity) Create an entity in the persistent storage.Load a value object for a given entity.findByBioAssaySetInAndDatabaseEntryInByCursor(Collection<BioAssaySet> bioAssaySets, Collection<DatabaseEntry> databaseEntries, Filters filters, Cursor cursor, int limit) Cursor-paged counterpart toExpressionAnalysisResultSetDao.findByBioAssaySetInAndDatabaseEntryInLimit(Collection, Collection, Filters, int, int, Sort): keyset pagination over the result sets associated to a set ofBioAssaySetand externaldatabase entries, always sorted by ascendingid.findByBioAssaySetInAndDatabaseEntryInLimit(Collection<BioAssaySet> bioAssaySets, Collection<DatabaseEntry> databaseEntries, Filters filters, int offset, int limit, Sort sort) Retrieve result sets associated to a set ofBioAssaySetand external database entries.Retrieve the baseline for the given result set.getBaselinesForInteractions(Collection<@MayBeUninitialized ExpressionAnalysisResultSet> resultSets, boolean initializeFactorValues) Retrieve baselines for all the given result sets representing factor interactions.getBaselinesForInteractionsByIds(Collection<Long> ids, boolean initializeFactorValues) Retrieve baselines using result set IDs representing factor interactions.getPrefetchForVo(Collection<Long> ids) Batch-fetch theexperimentalFactors+baselineGroupassociations of the given result sets in two queries (one per association, to avoidMultipleBagFetchExceptionand Cartesian explosion on a multi-row join), and return a map keyed by result-set id.Obtain the stored histogram of the P-value distribution for a given result set.loadResultToGenesMap(ExpressionAnalysisResultSet resultSet, boolean queryByResult) Load aDifferentialExpressionAnalysisResulttoGenemulti-map.loadValueObjectWithResults(ExpressionAnalysisResultSet entity, boolean includeFactorValuesInContrasts, boolean queryGenesByResult, boolean includeTaxonInGenes) Load an analysis result set with its all of its associated results.Load a result set with its analysis and the analysis' experimentAnalyzed fully initialized, in a single round-trip.Load an analysis result set with its all of its associated results.loadWithResultsAndContrasts(Long id, double threshold, int offset, int limit) Load a slice of an analysis result set with a corrected P-value threshold.loadWithResultsAndContrasts(Long id, int offset, int limit) Load a slice of an analysis result set.protected voidpostProcessValueObjects(List<DifferentialExpressionAnalysisResultSetValueObject> differentialExpressionAnalysisResultSetValueObjects) Post-process VOs in bulk.voidremove(ExpressionAnalysisResultSet entity) Remove a persistent entity.voidInitialize the analysis and subset factor vale.voidBatch counterpart toExpressionAnalysisResultSetDao.thaw(ExpressionAnalysisResultSet)for a whole page of result sets.Methods inherited from class AbstractCriteriaFilteringVoEnabledDao
count, getFilteringCriteria, load, load, loadIds, loadValueObjects, loadValueObjectsMethods inherited from class AbstractFilteringVoEnabledDao
afterPropertiesSet, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyMeta, getFilterablePropertyObjectAliases, getFilterablePropertyType, getObjectAlias, getSort, isFilterablePropertyDeprecated, isFilterablePropertyUsingSubquery, resolveFilterablePropertyMeta, resolveFilterablePropertyMetaMethods inherited from class AbstractVoEnabledDao
doLoadValueObjects, loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIdsMethods inherited from class AbstractDao
countAll, create, find, findByProperty, findByPropertyIn, findIdByProperty, findOneByProperty, findOrCreate, getBatchSize, getElementClass, getEntityName, getIdentifierPropertyName, getSessionFactory, load, load, loadAll, loadReference, loadReference, reload, reload, remove, save, save, streamAll, streamAll, streamQuery, update, updateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BaseDao
countAll, create, find, findOrCreate, getElementClass, load, load, loadAll, loadReference, loadReference, reload, reload, remove, save, save, streamAll, streamAll, update, updateMethods inherited from interface BaseVoEnabledDao
loadAllValueObjects, loadValueObject, loadValueObjectById, loadValueObjects, loadValueObjectsByIdsMethods inherited from interface FilteringDao
count, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilter, getFilterableProperties, getFilterablePropertyAllowedValues, getFilterablePropertyDescription, getFilterablePropertyType, getSort, isFilterablePropertyDeprecated, isFilterablePropertyUsingSubquery, load, load, loadIdsMethods inherited from interface FilteringVoEnabledDao
loadValueObjects, loadValueObjects, loadValueObjectsByCursor
-
Constructor Details
-
ExpressionAnalysisResultSetDaoImpl
-
-
Method Details
-
create
Description copied from interface:BaseDaoCreate an entity in the persistent storage.- Specified by:
createin interfaceBaseDao<ExpressionAnalysisResultSet>- Overrides:
createin classAbstractDao<ExpressionAnalysisResultSet>- Parameters:
entity- the entity to create- Returns:
- the persistent version of the entity
- See Also:
-
remove
Description copied from interface:BaseDaoRemove a persistent entity.- Specified by:
removein interfaceBaseDao<ExpressionAnalysisResultSet>- Overrides:
removein classAbstractDao<ExpressionAnalysisResultSet>- Parameters:
entity- the entity to be removed
-
loadWithAnalysisAndExperimentAnalyzed
Description copied from interface:ExpressionAnalysisResultSetDaoLoad a result set with its analysis and the analysis' experimentAnalyzed fully initialized, in a single round-trip. Avoids the sequential lazy-init chain that thaw() does — the dominant cost on the /datasets/{id}/expressions/differential endpoint over a high-latency DB link.- Specified by:
loadWithAnalysisAndExperimentAnalyzedin interfaceExpressionAnalysisResultSetDao
-
loadWithResultsAndContrasts
Description copied from interface:ExpressionAnalysisResultSetDaoLoad an analysis result set with its all of its associated results.- Specified by:
loadWithResultsAndContrastsin interfaceExpressionAnalysisResultSetDao- Parameters:
id- the ID of the analysis result set- Returns:
- the analysis result set with its associated results, or null if not found
-
loadWithResultsAndContrasts
Description copied from interface:ExpressionAnalysisResultSetDaoLoad a slice of an analysis result set.Results are sorted by ascending correct P-value.
- Specified by:
loadWithResultsAndContrastsin interfaceExpressionAnalysisResultSetDao- Parameters:
offset- an offset of results to loadlimit- a limit of results to load, or -1 to load all results starting at offset- See Also:
-
loadWithResultsAndContrasts
public ExpressionAnalysisResultSet loadWithResultsAndContrasts(Long id, double threshold, int offset, int limit) Description copied from interface:ExpressionAnalysisResultSetDaoLoad a slice of an analysis result set with a corrected P-value threshold.Important note: when using a threshold, results with null P-values will not be included, thus setting the threshold to
1.0is not equivalent toExpressionAnalysisResultSetDao.loadWithResultsAndContrasts(Long, int, int).- Specified by:
loadWithResultsAndContrastsin interfaceExpressionAnalysisResultSetDao- Parameters:
threshold- corrected P-value maximum threshold (inclusive)
-
canDelete
- Specified by:
canDeletein interfaceExpressionAnalysisResultSetDao
-
findByBioAssaySetInAndDatabaseEntryInLimit
public Slice<DifferentialExpressionAnalysisResultSetValueObject> findByBioAssaySetInAndDatabaseEntryInLimit(@Nullable Collection<BioAssaySet> bioAssaySets, @Nullable Collection<DatabaseEntry> databaseEntries, @Nullable Filters filters, int offset, int limit, @Nullable Sort sort) Description copied from interface:ExpressionAnalysisResultSetDaoRetrieve result sets associated to a set ofBioAssaySetand external database entries.- Specified by:
findByBioAssaySetInAndDatabaseEntryInLimitin interfaceExpressionAnalysisResultSetDao- Parameters:
bioAssaySets- relatedBioAssaySet, or any if nulldatabaseEntries- related external identifier associated to theBioAssaySet, or any if nullfilters- filters for restricting resultslimit- maximum number of results to returnsort- field and direction by which the collection is ordered
-
findByBioAssaySetInAndDatabaseEntryInByCursor
public CursorPage<DifferentialExpressionAnalysisResultSetValueObject> findByBioAssaySetInAndDatabaseEntryInByCursor(@Nullable Collection<BioAssaySet> bioAssaySets, @Nullable Collection<DatabaseEntry> databaseEntries, @Nullable Filters filters, @Nullable Cursor cursor, int limit) Description copied from interface:ExpressionAnalysisResultSetDaoCursor-paged counterpart toExpressionAnalysisResultSetDao.findByBioAssaySetInAndDatabaseEntryInLimit(Collection, Collection, Filters, int, int, Sort): keyset pagination over the result sets associated to a set ofBioAssaySetand externaldatabase entries, always sorted by ascendingid.Single-component
id-asc sort only — seeCURSOR_PAGINATION_STEP1_PLAN.mdstep 1i (compound sorts deferred pending the indexed-column audit, recce sec. 3.4). Whencursoris non-null the cursor'ssortSpecmust equal"+id"and its key tuple must be a single numeric id.- Specified by:
findByBioAssaySetInAndDatabaseEntryInByCursorin interfaceExpressionAnalysisResultSetDao- Parameters:
bioAssaySets- relatedBioAssaySet, or any if nulldatabaseEntries- related external identifier associated to theBioAssaySet, or any if nullfilters- filters for restricting resultscursor- decoded cursor (forward or backward) for keyset pagination, ornullfor the first pagelimit- maximum number of results to return
-
postProcessValueObjects
protected void postProcessValueObjects(List<DifferentialExpressionAnalysisResultSetValueObject> differentialExpressionAnalysisResultSetValueObjects) Description copied from class:AbstractVoEnabledDaoPost-process VOs in bulk.Use this as an opportunity to load extra informations that could not be populated in the initial
AbstractVoEnabledDao.doLoadValueObject(Identifiable)orAbstractVoEnabledDao.doLoadValueObjects(Collection) -
thaw
Description copied from interface:ExpressionAnalysisResultSetDaoInitialize the analysis and subset factor vale.- Specified by:
thawin interfaceExpressionAnalysisResultSetDao
-
thawAll
Description copied from interface:ExpressionAnalysisResultSetDaoBatch counterpart toExpressionAnalysisResultSetDao.thaw(ExpressionAnalysisResultSet)for a whole page of result sets.Initializes the same set of lazy associations as the single-element form (analysis,
analysis.experimentAnalyzed,analysis.subsetFactorValue(+EF),experimentalFactors,baselineGroup(+EF)) but issues a small fixed number of queries across the whole collection instead of 5-7 sequentialHibernate.initializeround-trips per row. Idempotent and safe to call with an empty ornullcollection (no-op).- Specified by:
thawAllin interfaceExpressionAnalysisResultSetDao
-
countResults
Description copied from interface:ExpressionAnalysisResultSetDaoCount the number of results in a given result set.- Specified by:
countResultsin interfaceExpressionAnalysisResultSetDao
-
countResults
Description copied from interface:ExpressionAnalysisResultSetDaoCount the number of results in a given result set below a given corrected P-value threshold.- Specified by:
countResultsin interfaceExpressionAnalysisResultSetDao
-
getBaseline
Description copied from interface:ExpressionAnalysisResultSetDaoRetrieve the baseline for the given result set.Factor values are always initialized.
- Specified by:
getBaselinein interfaceExpressionAnalysisResultSetDao- Returns:
- a baseline, or null if none could be determined for the given result set
-
getBaselinesForInteractions
public Map<@MayBeUninitialized ExpressionAnalysisResultSet, Baseline> getBaselinesForInteractions(Collection<@MayBeUninitialized ExpressionAnalysisResultSet> resultSets, boolean initializeFactorValues) Description copied from interface:ExpressionAnalysisResultSetDaoRetrieve baselines for all the given result sets representing factor interactions.- Specified by:
getBaselinesForInteractionsin interfaceExpressionAnalysisResultSetDao- Parameters:
initializeFactorValues- whether to initialize factor values
-
getBaselinesForInteractionsByIds
public Map<Long,Baseline> getBaselinesForInteractionsByIds(Collection<Long> ids, boolean initializeFactorValues) Description copied from interface:ExpressionAnalysisResultSetDaoRetrieve baselines using result set IDs representing factor interactions.- Specified by:
getBaselinesForInteractionsByIdsin interfaceExpressionAnalysisResultSetDao- Parameters:
initializeFactorValues- whether to initialize factor values
-
loadPvalueDistribution
Description copied from interface:ExpressionAnalysisResultSetDaoObtain the stored histogram of the P-value distribution for a given result set.Read straight out of the
PVALUE_DISTRIBUTIONrow hanging off the result set; nothing is aggregated.DifferentialExpressionAnalyzerServiceImpl#addPvalueDistributionwrites it at analysis time with 100 fixed-width bins over[0, 1]of the RAW p-values, so binicovers(i/100, (i+1)/100]and bin 0 also holds0.0. There is no stored corrected-p-value histogram.- Specified by:
loadPvalueDistributionin interfaceExpressionAnalysisResultSetDao- Returns:
- the stored histogram, or
nullwhenPVALUE_DISTRIBUTION_FKis null
-
configureFilterableProperties
protected void configureFilterableProperties(AbstractFilteringVoEnabledDao<ExpressionAnalysisResultSet, DifferentialExpressionAnalysisResultSetValueObject>.FilterablePropertiesConfigurer configurer) Description copied from class:AbstractFilteringVoEnabledDaoRegister filterable properties. -
doLoadValueObject
protected DifferentialExpressionAnalysisResultSetValueObject doLoadValueObject(ExpressionAnalysisResultSet entity) Description copied from class:AbstractVoEnabledDaoLoad a value object for a given entity.This should be fast and efficient, and avoid any database query or post-processing. If you need to perform additional queries, implement
AbstractVoEnabledDao.postProcessValueObjects(List)instead. -
loadValueObjectWithResults
public DifferentialExpressionAnalysisResultSetValueObject loadValueObjectWithResults(ExpressionAnalysisResultSet entity, boolean includeFactorValuesInContrasts, boolean queryGenesByResult, boolean includeTaxonInGenes) Description copied from interface:ExpressionAnalysisResultSetDaoLoad an analysis result set with its all of its associated results.- Specified by:
loadValueObjectWithResultsin interfaceExpressionAnalysisResultSetDao- Parameters:
includeFactorValuesInContrasts- include complete FV in the contrasts, only IDs are displayed if falsequeryGenesByResult- query genes by results instead of result set, this is considerably faster if the results are sliced (i.e. fromExpressionAnalysisResultSetDao.loadWithResultsAndContrasts(Long, int, int))includeTaxonInGenes- include complete taxon in the contrasts, only the ID is displayed if false- See Also:
-
loadResultToGenesMap
public Map<Long, Set<Gene>> loadResultToGenesMap(ExpressionAnalysisResultSet resultSet, boolean queryByResult) Description copied from interface:ExpressionAnalysisResultSetDaoLoad aDifferentialExpressionAnalysisResulttoGenemulti-map.This is much faster than navigating through the probe's alignments, transcripts and then genes as it uses the internal GENE2CS table described in
TableMaintenanceUtil.updateGene2CsEntries().Note: Not all probes have associated genes, so you should use
Map.getOrDefault(Object, Object)with an empty collection to handle this case.- Specified by:
loadResultToGenesMapin interfaceExpressionAnalysisResultSetDao- Parameters:
queryByResult- query by results instead of result set, this is considerably faster if the results are sliced (i.e. fromExpressionAnalysisResultSetDao.loadWithResultsAndContrasts(Long, int, int))
-
getPrefetchForVo
Description copied from interface:ExpressionAnalysisResultSetDaoBatch-fetch theexperimentalFactors+baselineGroupassociations of the given result sets in two queries (one per association, to avoidMultipleBagFetchExceptionand Cartesian explosion on a multi-row join), and return a map keyed by result-set id.Consumed by the
findByExperimentIdsVO enrichment path so the per-rowDiffExResultSetSummaryValueObjectctor can skip three sequentialHibernate.initializeround-trips on a warm cache.Returns an empty map if
idsis empty. Result-sets missing from the result (e.g. concurrently deleted) are simply absent from the map; the caller should fall back to the lazy-load path for those.- Specified by:
getPrefetchForVoin interfaceExpressionAnalysisResultSetDao- Parameters:
ids- the result-set ids to prefetch- Returns:
- map from result-set id to
DiffExResultSetSummaryValueObject.Prefetch
-