Class HeatmapDataService

java.lang.Object
ubic.gemma.rest.HeatmapDataService

@Service public class HeatmapDataService extends Object
Assembles HeatmapDataValueObject payloads for the GET /datasets/{id}/heatmap-data endpoint. The service stays out of the legacy sortVectorDataByDesign / prepareFactorsForFrontEndDisplay path entirely — no reordering, no colour assignment, no factor-display strings on the wire.
Author:
claude
  • Constructor Details

    • HeatmapDataService

      public HeatmapDataService()
  • Method Details

    • buildHeatmapData

      @Transactional(readOnly=true) public HeatmapDataValueObject buildHeatmapData(ExpressionExperiment ee, @Nullable Collection<Long> geneIds, @Nullable Collection<Long> probeIds, @Nullable Long resultSetId, double threshold, @Nullable Integer pcaComponent, int pcaCount, int sampleSize, String encoding, @Nullable Long subSetId, @Nullable QuantitationType quantitationType, boolean maskOutliers)
      Build a heatmap payload for ee given a vector-selection mode. Caller has already resolved ee via ACL. Exactly one of geneIds, probeIds, resultSetId, pcaComponent should be non-null; if all are null the random sample-N path is used.
      Parameters:
      ee - dataset entity (ACL-resolved by caller)
      geneIds - query mode: vectors for these gene IDs
      probeIds - query mode: vectors for these probe (composite-sequence) IDs
      resultSetId - query mode: top-hit vectors from this differential analysis result set
      threshold - p-value threshold for the resultSetId mode (default 0.01)
      pcaComponent - query mode: top-loaded vectors for this PCA component (1-based)
      pcaCount - how many probes per PCA component (default 20)
      sampleSize - fallback random-N size when no other mode applies (default 20, max 200)
      encoding - "json" (default) or "base64f32" for the matrix encoding
      subSetId - optional ExpressionExperimentSubSet id; when non-null, the response is restricted to that subset's sample columns. The subset must belong to ee; otherwise IllegalArgumentException is raised.
      quantitationType - optional QuantitationType to source the matrix from. When null or when it resolves to the dataset's processed QT, the processed-data path is used (all selection modes). For any other (non-processed) QT the raw vectors for that QT are served instead; the geneIds/probeIds selection modes and the random-sample fallback (sampleSize) are supported in that case, while resultSetId/pcaComponent raise IllegalArgumentException (no raw-vector equivalent). Non-DOUBLE representations (e.g. integer read-counts) are coerced to double.
      maskOutliers - when true (default) the values of assays flagged as outliers are masked to NaN. When false the stored expression values are returned for those assays as well, by reading them back from the stored vectors. The row selection is unchanged either way; only the emitted values differ. For a non-processed QT (raw vectors) the stored value is always present, so this restores it. For the processed QT it restores whatever is on disk: today processed data is masked at creation time so this is usually a no-op, but it becomes effective if processed-data creation stops masking outliers on disk (or where a reprocess after an outlier flag failed). Legitimate missing values remain NaN regardless.
    • decodeBase64Float32

      public static double[][] decodeBase64Float32(String b64, int rowsCount, int colsCount)
      Decode a base64f32 string back into a double[][] of the given shape. Provided for the test path and any server-side debugging; clients do their own decode.