Interface ExpressionAnalysisResultSetDao

All Superinterfaces:
AnalysisResultSetDao<DifferentialExpressionAnalysisResult, ExpressionAnalysisResultSet>, BaseDao<ExpressionAnalysisResultSet>, BaseVoEnabledDao<ExpressionAnalysisResultSet, DifferentialExpressionAnalysisResultSetValueObject>, FilteringDao<ExpressionAnalysisResultSet>, FilteringVoEnabledDao<ExpressionAnalysisResultSet, DifferentialExpressionAnalysisResultSetValueObject>
All Known Implementing Classes:
ExpressionAnalysisResultSetDaoImpl

  • Method Details

    • loadWithResultsAndContrasts

      @Nullable ExpressionAnalysisResultSet loadWithResultsAndContrasts(Long id)
      Load an analysis result set with its all of its associated results.
      Parameters:
      id - the ID of the analysis result set
      Returns:
      the analysis result set with its associated results, or null if not found
    • loadWithAnalysisAndExperimentAnalyzed

      @Nullable ExpressionAnalysisResultSet loadWithAnalysisAndExperimentAnalyzed(Long id)
      Load 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.
    • loadWithResultsAndContrasts

      @Nullable ExpressionAnalysisResultSet loadWithResultsAndContrasts(Long id, int offset, int limit)
      Load a slice of an analysis result set.

      Results are sorted by ascending correct P-value.

      Parameters:
      offset - an offset of results to load
      limit - a limit of results to load, or -1 to load all results starting at offset
      See Also:
    • loadWithResultsAndContrasts

      @Nullable ExpressionAnalysisResultSet loadWithResultsAndContrasts(Long id, double threshold, int offset, int limit)
      Load 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.0 is not equivalent to loadWithResultsAndContrasts(Long, int, int).

      Parameters:
      threshold - corrected P-value maximum threshold (inclusive)
    • canDelete

      boolean canDelete(DifferentialExpressionAnalysis differentialExpressionAnalysis)
    • loadValueObjectWithResults

      DifferentialExpressionAnalysisResultSetValueObject loadValueObjectWithResults(ExpressionAnalysisResultSet resultSet, boolean includeFactorValuesInContrasts, boolean queryGenesByResult, boolean includeTaxonInGenes)
      Load an analysis result set with its all of its associated results.
      Parameters:
      includeFactorValuesInContrasts - include complete FV in the contrasts, only IDs are displayed if false
      queryGenesByResult - query genes by results instead of result set, this is considerably faster if the results are sliced (i.e. from loadWithResultsAndContrasts(Long, int, int))
      includeTaxonInGenes - include complete taxon in the contrasts, only the ID is displayed if false
      See Also:
    • loadResultToGenesMap

      Map<Long, Set<Gene>> loadResultToGenesMap(ExpressionAnalysisResultSet resultSet, boolean queryByResult)
      Load a DifferentialExpressionAnalysisResult to Gene multi-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.

      Parameters:
      queryByResult - query by results instead of result set, this is considerably faster if the results are sliced (i.e. from loadWithResultsAndContrasts(Long, int, int))
    • findByBioAssaySetInAndDatabaseEntryInLimit

      Slice<DifferentialExpressionAnalysisResultSetValueObject> findByBioAssaySetInAndDatabaseEntryInLimit(@Nullable Collection<BioAssaySet> bioAssaySets, @Nullable Collection<DatabaseEntry> databaseEntries, @Nullable Filters filters, int offset, int limit, @Nullable Sort sort)
      Retrieve result sets associated to a set of BioAssaySet and external database entries.
      Parameters:
      bioAssaySets - related BioAssaySet, or any if null
      databaseEntries - related external identifier associated to the BioAssaySet, or any if null
      filters - filters for restricting results
      limit - maximum number of results to return
      sort - field and direction by which the collection is ordered
    • findByBioAssaySetInAndDatabaseEntryInByCursor

      CursorPage<DifferentialExpressionAnalysisResultSetValueObject> findByBioAssaySetInAndDatabaseEntryInByCursor(@Nullable Collection<BioAssaySet> bioAssaySets, @Nullable Collection<DatabaseEntry> databaseEntries, @Nullable Filters filters, @Nullable Cursor cursor, int limit)
      Cursor-paged counterpart to findByBioAssaySetInAndDatabaseEntryInLimit(Collection, Collection, Filters, int, int, Sort): keyset pagination over the result sets associated to a set of BioAssaySet and external database entries, always sorted by ascending id.

      Single-component id-asc sort only — see CURSOR_PAGINATION_STEP1_PLAN.md step 1i (compound sorts deferred pending the indexed-column audit, recce sec. 3.4). When cursor is non-null the cursor's sortSpec must equal "+id" and its key tuple must be a single numeric id.

      Parameters:
      bioAssaySets - related BioAssaySet, or any if null
      databaseEntries - related external identifier associated to the BioAssaySet, or any if null
      filters - filters for restricting results
      cursor - decoded cursor (forward or backward) for keyset pagination, or null for the first page
      limit - maximum number of results to return
    • thaw

      void thaw(ExpressionAnalysisResultSet ears)
      Initialize the analysis and subset factor vale.
    • thawAll

      Batch counterpart to 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 sequential Hibernate.initialize round-trips per row. Idempotent and safe to call with an empty or null collection (no-op).

    • countResults

      long countResults(ExpressionAnalysisResultSet ears)
      Count the number of results in a given result set.
    • countResults

      long countResults(ExpressionAnalysisResultSet ears, double threshold)
      Count the number of results in a given result set below a given corrected P-value threshold.
    • getBaseline

      @Nullable Baseline getBaseline(ExpressionAnalysisResultSet ears)
      Retrieve the baseline for the given result set.

      Factor values are always initialized.

      Returns:
      a baseline, or null if none could be determined for the given result set
    • getBaselinesForInteractions

      Map<@MayBeUninitialized ExpressionAnalysisResultSet, Baseline> getBaselinesForInteractions(Collection<@MayBeUninitialized ExpressionAnalysisResultSet> resultSets, boolean initializeFactorValues)
      Retrieve baselines for all the given result sets representing factor interactions.
      Parameters:
      initializeFactorValues - whether to initialize factor values
    • getBaselinesForInteractionsByIds

      Map<Long,Baseline> getBaselinesForInteractionsByIds(Collection<Long> ids, boolean initializeFactorValues)
      Retrieve baselines using result set IDs representing factor interactions.
      Parameters:
      initializeFactorValues - whether to initialize factor values
    • getPrefetchForVo

      Batch-fetch the experimentalFactors + baselineGroup associations of the given result sets in two queries (one per association, to avoid MultipleBagFetchException and Cartesian explosion on a multi-row join), and return a map keyed by result-set id.

      Consumed by the findByExperimentIds VO enrichment path so the per-row DiffExResultSetSummaryValueObject ctor can skip three sequential Hibernate.initialize round-trips on a warm cache.

      Returns an empty map if ids is 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.

      Parameters:
      ids - the result-set ids to prefetch
      Returns:
      map from result-set id to DiffExResultSetSummaryValueObject.Prefetch
    • loadPvalueDistribution

      @Nullable Histogram loadPvalueDistribution(ExpressionAnalysisResultSet resultSet)
      Obtain the stored histogram of the P-value distribution for a given result set.

      Read straight out of the PVALUE_DISTRIBUTION row hanging off the result set; nothing is aggregated. DifferentialExpressionAnalyzerServiceImpl#addPvalueDistribution writes it at analysis time with 100 fixed-width bins over [0, 1] of the RAW p-values, so bin i covers (i/100, (i+1)/100] and bin 0 also holds 0.0. There is no stored corrected-p-value histogram.

      Returns:
      the stored histogram, or null when PVALUE_DISTRIBUTION_FK is null