Class SampleCoexpressionAnalysisServiceImpl
- All Implemented Interfaces:
SampleCoexpressionAnalysisService
- Author:
- paul
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompute(ExpressionExperiment ee, PreparedCoexMatrices matrices) Unfortunately, this method breaks under high contention (see #400, so we need to fully lock the database while undergoing usingIsolation.SERIALIZABLEtransaction isolation level.booleanLoads the analysis containing the coexpression matrices for the given experiment and converts the regressed coexpression matrix into a double matrix.Loads the analysis containing the coexpression matrices for the given experiment and converts the full (non-regressed) coexpression matrix into a double matrix.Load the regressed coexpression matrix for the given experiment.🛑Propagation.NEVER, and it has to be: this is where the time goes.voidRemoves all coexpression matrices for the given experiment.
-
Constructor Details
-
SampleCoexpressionAnalysisServiceImpl
public SampleCoexpressionAnalysisServiceImpl()
-
-
Method Details
-
loadFullMatrix
@Transactional(readOnly=true) public DoubleMatrix<BioAssay,BioAssay> loadFullMatrix(ExpressionExperiment ee) Description copied from interface:SampleCoexpressionAnalysisServiceLoads the analysis containing the coexpression matrices for the given experiment and converts the full (non-regressed) coexpression matrix into a double matrix. If the analysis or the matrix does not exist, computes it.- Specified by:
loadFullMatrixin interfaceSampleCoexpressionAnalysisService- Parameters:
ee- the experiment to load the raw coexpression matrix for.- Returns:
- the full, non-regressed matrix. If the matrix is not available event after attempted computation, returns null.
-
loadRegressedMatrix
@Transactional(readOnly=true) public DoubleMatrix<BioAssay,BioAssay> loadRegressedMatrix(ExpressionExperiment ee) Description copied from interface:SampleCoexpressionAnalysisServiceLoad the regressed coexpression matrix for the given experiment.- Specified by:
loadRegressedMatrixin interfaceSampleCoexpressionAnalysisService- Returns:
- the regressed matrix if available, null might indicate that the is either no analysis or no regressed
matrix, use
SampleCoexpressionAnalysisService.hasAnalysis(ExpressionExperiment)to tell these apart.
-
loadBestMatrix
@Transactional(readOnly=true) public DoubleMatrix<BioAssay,BioAssay> loadBestMatrix(ExpressionExperiment ee) Description copied from interface:SampleCoexpressionAnalysisServiceLoads the analysis containing the coexpression matrices for the given experiment and converts the regressed coexpression matrix into a double matrix. If the analysis or the matrix does not exist, computes it. If there are problems loading or computing the regressed matrix (e.g. because the experiment has no experimental design), the full matrix is returned instead.- Specified by:
loadBestMatrixin interfaceSampleCoexpressionAnalysisService- Parameters:
ee- the experiment to load the regressed coexpression matrix for.- Returns:
- sample correlation matrix with major factors regressed out, if such matrix exists for the given experiment. If not, the full non-regressed matrix is returned. If no matrix is available event after attempted computation, returns null.
-
retrieveExisting
@Transactional(readOnly=true) public DoubleMatrix<BioAssay,BioAssay> retrieveExisting(ExpressionExperiment ee) - Specified by:
retrieveExistingin interfaceSampleCoexpressionAnalysisService
-
prepare
@Transactional(propagation=NEVER) public PreparedCoexMatrices prepare(ExpressionExperiment ee) throws FilteringException 🛑Propagation.NEVER, and it has to be: this is where the time goes.The two
getMatrixlegs run quantile normalization, an all-pairs correlation and a least-squares fit. On GSE260875 (34,330 x 1,090) that was 44 minutes, and withhibernate.connection.handling_mode = DELAYED_ACQUISITION_AND_HOLDa transaction around it pinned a pooled connection for the whole stretch without issuing a statement — against a pool that recycles at 30 minutes (gemma.db.hikari.maxLifetime). Every read below already goes through a service method with its own transaction, andcompute(ExpressionExperiment, PreparedCoexMatrices)is the write with its own.⚠️ NEVER is viral upward: a caller that is itself transactional will now fail at entry with
IllegalTransactionStateException. That is the rule doing its job, not a regression to route around — the caller needs splitting too.- Specified by:
preparein interfaceSampleCoexpressionAnalysisService- Throws:
FilteringException
-
compute
@Transactional(isolation=SERIALIZABLE) public DoubleMatrix<BioAssay,BioAssay> compute(ExpressionExperiment ee, PreparedCoexMatrices matrices) Unfortunately, this method breaks under high contention (see #400, so we need to fully lock the database while undergoing usingIsolation.SERIALIZABLEtransaction isolation level. This annotation also has to be appled to other methods of this class that call compute() directly or indirectly. PP changed this to do more of the processing in a read-only transaction- Specified by:
computein interfaceSampleCoexpressionAnalysisService- Parameters:
ee- the experiment to create a sample correlation matrix for.- Returns:
- the regressed coexpression matrix if available, otherwise the full
-
hasAnalysis
- Specified by:
hasAnalysisin interfaceSampleCoexpressionAnalysisService
-
removeForExperiment
Description copied from interface:SampleCoexpressionAnalysisServiceRemoves all coexpression matrices for the given experiment.- Specified by:
removeForExperimentin interfaceSampleCoexpressionAnalysisService- Parameters:
ee- the experiment to remove the analysis for.
-