Class SingleCellExpressionExperimentServiceImpl
- java.lang.Object
-
- ubic.gemma.persistence.service.expression.experiment.SingleCellExpressionExperimentServiceImpl
-
- All Implemented Interfaces:
SingleCellExpressionExperimentService
@Service public class SingleCellExpressionExperimentServiceImpl extends Object implements SingleCellExpressionExperimentService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ubic.gemma.persistence.service.expression.experiment.SingleCellExpressionExperimentService
SingleCellExpressionExperimentService.SingleCellVectorInitializationConfig
-
-
Constructor Summary
Constructors Constructor Description SingleCellExpressionExperimentServiceImpl()
-
Method Summary
-
-
-
Method Detail
-
loadWithSingleCellVectors
@Transactional(readOnly=true) public ExpressionExperiment loadWithSingleCellVectors(Long id)
Description copied from interface:SingleCellExpressionExperimentService
Load an experiment with its single-cell data vectors initialized.The rest of the experiment is also initialized as per
ExpressionExperimentDao.thawLite(ExpressionExperiment)
.- Specified by:
loadWithSingleCellVectors
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDataVectors
@Transactional(readOnly=true) public List<SingleCellExpressionDataVector> getSingleCellDataVectors(ExpressionExperiment ee, QuantitationType quantitationType)
Description copied from interface:SingleCellExpressionExperimentService
Obtain single-cell vectors for a given quantitation type.- Specified by:
getSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDataVectors
@Transactional(readOnly=true) public Collection<SingleCellExpressionDataVector> getSingleCellDataVectors(ExpressionExperiment ee, QuantitationType quantitationType, SingleCellExpressionExperimentService.SingleCellVectorInitializationConfig config)
- Specified by:
getSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDataVectors
@Transactional(readOnly=true) public Collection<SingleCellExpressionDataVector> getSingleCellDataVectors(ExpressionExperiment ee, List<BioAssay> samples, QuantitationType quantitationType)
Description copied from interface:SingleCellExpressionExperimentService
Obtain single-cell vectors for a particular sample.- Specified by:
getSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDataVectors
@Transactional(readOnly=true) public Collection<SingleCellExpressionDataVector> getSingleCellDataVectors(ExpressionExperiment ee, List<BioAssay> samples, QuantitationType quantitationType, SingleCellExpressionExperimentService.SingleCellVectorInitializationConfig config)
- Specified by:
getSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
streamSingleCellDataVectors
@Transactional(readOnly=true) public Stream<SingleCellExpressionDataVector> streamSingleCellDataVectors(ExpressionExperiment ee, QuantitationType quantitationType, int fetchSize, boolean createNewSession)
Description copied from interface:SingleCellExpressionExperimentService
Obtain a stream over single-cell vectors for a given quantitation type.- Specified by:
streamSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
streamSingleCellDataVectors
@Transactional(readOnly=true) public Stream<SingleCellExpressionDataVector> streamSingleCellDataVectors(ExpressionExperiment ee, QuantitationType quantitationType, int fetchSize, boolean createNewSession, SingleCellExpressionExperimentService.SingleCellVectorInitializationConfig config)
- Specified by:
streamSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
streamSingleCellDataVectors
@Transactional(readOnly=true) public Stream<SingleCellExpressionDataVector> streamSingleCellDataVectors(ExpressionExperiment ee, List<BioAssay> samples, QuantitationType quantitationType, int fetchSize, boolean createNewSession, SingleCellExpressionExperimentService.SingleCellVectorInitializationConfig config)
- Specified by:
streamSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
streamSingleCellDataVectors
@Transactional(readOnly=true) public Stream<SingleCellExpressionDataVector> streamSingleCellDataVectors(ExpressionExperiment ee, List<BioAssay> samples, QuantitationType quantitationType, int fetchSize, boolean createNewSession)
- Specified by:
streamSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDataVectorWithoutCellIds
@Transactional(readOnly=true) public SingleCellExpressionDataVector getSingleCellDataVectorWithoutCellIds(ExpressionExperiment ee, QuantitationType quantitationType, CompositeSequence designElement)
Description copied from interface:SingleCellExpressionExperimentService
Obtain a single single-cell vector without initializing cell IDs.
-
getNumberOfSingleCellDataVectors
@Transactional(readOnly=true) public long getNumberOfSingleCellDataVectors(ExpressionExperiment ee, QuantitationType qt)
Description copied from interface:SingleCellExpressionExperimentService
Obtain the number of single-cell vectors for a given quantitation type.- Specified by:
getNumberOfSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
getNumberOfNonZeroes
@Transactional(readOnly=true) public long getNumberOfNonZeroes(ExpressionExperiment ee, QuantitationType qt)
- Specified by:
getNumberOfNonZeroes
in interfaceSingleCellExpressionExperimentService
-
getNumberOfNonZeroesBySample
@Transactional(readOnly=true) public Map<BioAssay,Long> getNumberOfNonZeroesBySample(ExpressionExperiment ee, QuantitationType qt, int fetchSize)
- Specified by:
getNumberOfNonZeroesBySample
in interfaceSingleCellExpressionExperimentService
-
getPreferredSingleCellDataVectors
@Transactional(readOnly=true) public Optional<Collection<SingleCellExpressionDataVector>> getPreferredSingleCellDataVectors(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain preferred single-cell vectors.- Specified by:
getPreferredSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
-
getSingleCellQuantitationTypes
@Transactional(readOnly=true) public Collection<QuantitationType> getSingleCellQuantitationTypes(ExpressionExperiment ee)
- Specified by:
getSingleCellQuantitationTypes
in interfaceSingleCellExpressionExperimentService
-
getPreferredSingleCellQuantitationType
@Transactional(readOnly=true) public Optional<QuantitationType> getPreferredSingleCellQuantitationType(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain the preferred single cell quantitation type.- Specified by:
getPreferredSingleCellQuantitationType
in interfaceSingleCellExpressionExperimentService
-
getSingleCellExpressionDataMatrix
@Transactional(readOnly=true) public SingleCellExpressionDataMatrix<?> getSingleCellExpressionDataMatrix(ExpressionExperiment expressionExperiment, List<BioAssay> samples, QuantitationType quantitationType)
Description copied from interface:SingleCellExpressionExperimentService
Obtain a single-cell expression data matrix for the given quantitation type.- Specified by:
getSingleCellExpressionDataMatrix
in interfaceSingleCellExpressionExperimentService
-
getSingleCellExpressionDataMatrix
@Transactional(readOnly=true) public SingleCellExpressionDataMatrix<?> getSingleCellExpressionDataMatrix(ExpressionExperiment expressionExperiment, QuantitationType quantitationType)
Description copied from interface:SingleCellExpressionExperimentService
Obtain a single-cell expression data matrix for the given quantitation type.- Specified by:
getSingleCellExpressionDataMatrix
in interfaceSingleCellExpressionExperimentService
-
addSingleCellDataVectors
@Transactional public int addSingleCellDataVectors(ExpressionExperiment ee, QuantitationType quantitationType, Collection<SingleCellExpressionDataVector> vectors, @Nullable String details)
Description copied from interface:SingleCellExpressionExperimentService
Add single-cell data vectors.- Specified by:
addSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
- Returns:
- the number of vectors that were added
-
replaceSingleCellDataVectors
@Transactional public int replaceSingleCellDataVectors(ExpressionExperiment ee, QuantitationType quantitationType, Collection<SingleCellExpressionDataVector> vectors, @Nullable String details)
Description copied from interface:SingleCellExpressionExperimentService
Replace existing single-cell data vectors for the given quantitation type.- Specified by:
replaceSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
details
- additional details to include in the audit event- Returns:
- the number of vectors that were replaced
-
updateSparsityMetrics
@Transactional public void updateSparsityMetrics(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Update the sparsity metrics.If no preferred single-cell vectors are present, the sparsity metrics will be cleared.
- Specified by:
updateSparsityMetrics
in interfaceSingleCellExpressionExperimentService
-
removeSingleCellDataVectors
@Transactional public int removeSingleCellDataVectors(ExpressionExperiment ee, QuantitationType quantitationType)
Description copied from interface:SingleCellExpressionExperimentService
Remove single-cell data vectors for the given quantitation type.- Specified by:
removeSingleCellDataVectors
in interfaceSingleCellExpressionExperimentService
- Returns:
- the number of vectors that were removed
-
getSingleCellDimensionWithCellLevelCharacteristics
@Transactional(readOnly=true) public SingleCellDimension getSingleCellDimensionWithCellLevelCharacteristics(ExpressionExperiment ee, QuantitationType qt)
- Specified by:
getSingleCellDimensionWithCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDimensionWithoutCellIds
@Transactional(readOnly=true) public SingleCellDimension getSingleCellDimensionWithoutCellIds(ExpressionExperiment ee, QuantitationType qt, boolean includeBioAssays, boolean includeCtas, boolean includeClcs, boolean includeCharacteristics, boolean includeIndices)
- Specified by:
getSingleCellDimensionWithoutCellIds
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDimensions
@Transactional(readOnly=true) public List<SingleCellDimension> getSingleCellDimensions(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain all the single-cell dimensions used by a given dataset.- Specified by:
getSingleCellDimensions
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDimensionsWithoutCellIds
@Transactional(readOnly=true) public List<SingleCellDimension> getSingleCellDimensionsWithoutCellIds(ExpressionExperiment ee)
- Specified by:
getSingleCellDimensionsWithoutCellIds
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDimensionsWithoutCellIds
@Transactional(readOnly=true) public List<SingleCellDimension> getSingleCellDimensionsWithoutCellIds(ExpressionExperiment ee, boolean includeBioAssays, boolean includeCtas, boolean includeClcs, boolean includeCharacteristics, boolean includeIndices)
- Specified by:
getSingleCellDimensionsWithoutCellIds
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDimension
@Transactional(readOnly=true) public SingleCellDimension getSingleCellDimension(ExpressionExperiment ee, QuantitationType qt)
Description copied from interface:SingleCellExpressionExperimentService
Obtain a single-cell dimension used for a given dataset and QT.- Specified by:
getSingleCellDimension
in interfaceSingleCellExpressionExperimentService
-
getSingleCellDimensionWithoutCellIds
@Transactional(readOnly=true) public SingleCellDimension getSingleCellDimensionWithoutCellIds(ExpressionExperiment ee, QuantitationType qt)
- Specified by:
getSingleCellDimensionWithoutCellIds
in interfaceSingleCellExpressionExperimentService
-
getPreferredSingleCellDimension
@Transactional(readOnly=true) public Optional<SingleCellDimension> getPreferredSingleCellDimension(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain the preferred single-cell dimension.Cell type assignments and other cell-level characteristics are eagerly initialized.
- Specified by:
getPreferredSingleCellDimension
in interfaceSingleCellExpressionExperimentService
-
getPreferredSingleCellDimensionWithoutCellIds
@Transactional(readOnly=true) public Optional<SingleCellDimension> getPreferredSingleCellDimensionWithoutCellIds(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain the preferred single-cell dimension without its cell IDs.The returned object is not persistent since it's a projection.
- Specified by:
getPreferredSingleCellDimensionWithoutCellIds
in interfaceSingleCellExpressionExperimentService
-
getPreferredSingleCellDimensionWithCellLevelCharacteristics
@Transactional(readOnly=true) public Optional<SingleCellDimension> getPreferredSingleCellDimensionWithCellLevelCharacteristics(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain the preferred single-cell dimension.Cell type assignments and other cell-level characteristics are eagerly initialized.
- Specified by:
getPreferredSingleCellDimensionWithCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
streamCellIds
@Transactional(readOnly=true) public Optional<Stream<String>> streamCellIds(ExpressionExperiment ee, boolean createNewSession)
- Specified by:
streamCellIds
in interfaceSingleCellExpressionExperimentService
-
streamCellIds
@Transactional(readOnly=true) public Stream<String> streamCellIds(ExpressionExperiment ee, QuantitationType qt, boolean createNewSession)
- Specified by:
streamCellIds
in interfaceSingleCellExpressionExperimentService
-
streamCellTypes
@Transactional(readOnly=true) public Stream<Characteristic> streamCellTypes(ExpressionExperiment ee, CellTypeAssignment cta, boolean createNewSession)
- Specified by:
streamCellTypes
in interfaceSingleCellExpressionExperimentService
-
getCellTypeAt
@Transactional(readOnly=true) public Characteristic getCellTypeAt(ExpressionExperiment ee, QuantitationType qt, Long ctaId, int cellIndex)
- Specified by:
getCellTypeAt
in interfaceSingleCellExpressionExperimentService
-
getCellTypeAt
@Transactional(readOnly=true) public Characteristic[] getCellTypeAt(ExpressionExperiment ee, QuantitationType qt, Long ctaId, int startIndex, int endIndexExclusive)
- Specified by:
getCellTypeAt
in interfaceSingleCellExpressionExperimentService
-
getCellTypeAt
@Transactional(readOnly=true) public Characteristic getCellTypeAt(ExpressionExperiment ee, QuantitationType qt, String ctaName, int cellIndex)
- Specified by:
getCellTypeAt
in interfaceSingleCellExpressionExperimentService
-
getCellTypeAt
@Transactional(readOnly=true) public Characteristic[] getCellTypeAt(ExpressionExperiment ee, QuantitationType qt, String ctaName, int startIndex, int endIndexExclusive)
- Specified by:
getCellTypeAt
in interfaceSingleCellExpressionExperimentService
-
getCellLevelCharacteristicsCategory
@Transactional(readOnly=true) public Category getCellLevelCharacteristicsCategory(ExpressionExperiment ee, CellLevelCharacteristics clc)
- Specified by:
getCellLevelCharacteristicsCategory
in interfaceSingleCellExpressionExperimentService
-
streamCellLevelCharacteristics
@Transactional(readOnly=true) public Stream<Characteristic> streamCellLevelCharacteristics(ExpressionExperiment ee, CellLevelCharacteristics clc, boolean createNewSession)
- Specified by:
streamCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
relabelCellTypes
@Transactional public CellTypeAssignment relabelCellTypes(ExpressionExperiment ee, QuantitationType qt, SingleCellDimension dimension, List<String> newCellTypeLabels, @Nullable Protocol protocol, @Nullable String description)
Description copied from interface:SingleCellExpressionExperimentService
Relabel the cell types of an existing set of single-cell vectors.- Specified by:
relabelCellTypes
in interfaceSingleCellExpressionExperimentService
newCellTypeLabels
- the new cell types labels, must match the number of cellsprotocol
- the protocol used to generate the new labelling, or null if unknown- Returns:
- a new, preferred cell type labelling
-
addCellTypeAssignment
@Transactional public CellTypeAssignment addCellTypeAssignment(ExpressionExperiment ee, QuantitationType qt, SingleCellDimension dimension, CellTypeAssignment cta)
- Specified by:
addCellTypeAssignment
in interfaceSingleCellExpressionExperimentService
-
removeCellTypeAssignment
@Transactional public void removeCellTypeAssignment(ExpressionExperiment ee, SingleCellDimension dimension, CellTypeAssignment cellTypeAssignment)
Description copied from interface:SingleCellExpressionExperimentService
Remove the given cell type assignment.If the cell type labelling is preferred and applies to the preferred vectors as per
SingleCellExpressionExperimentService.getPreferredCellTypeAssignment(ExpressionExperiment)
, the cell type factor will be removed.- Specified by:
removeCellTypeAssignment
in interfaceSingleCellExpressionExperimentService
-
removeCellTypeAssignment
@Transactional public void removeCellTypeAssignment(ExpressionExperiment ee, QuantitationType qt, CellTypeAssignment cellTypeAssignment)
Description copied from interface:SingleCellExpressionExperimentService
Remove the given cell type assignment by QT.
-
getCellTypeAssignments
@Transactional(readOnly=true) public List<CellTypeAssignment> getCellTypeAssignments(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain all the cell type labellings from all single-cell vectors.- Specified by:
getCellTypeAssignments
in interfaceSingleCellExpressionExperimentService
-
getCellTypeAssignments
@Transactional(readOnly=true) public List<CellTypeAssignment> getCellTypeAssignments(ExpressionExperiment expressionExperiment, QuantitationType qt)
- Specified by:
getCellTypeAssignments
in interfaceSingleCellExpressionExperimentService
-
getCellTypeAssignment
@Transactional(readOnly=true) public CellTypeAssignment getCellTypeAssignment(ExpressionExperiment expressionExperiment, QuantitationType qt, Long ctaId)
Description copied from interface:SingleCellExpressionExperimentService
Obtain a cell type assignment by ID.- Specified by:
getCellTypeAssignment
in interfaceSingleCellExpressionExperimentService
- Returns:
- that cell type assignmente, or null if none is found
-
getCellTypeAssignment
@Transactional(readOnly=true) public CellTypeAssignment getCellTypeAssignment(ExpressionExperiment expressionExperiment, QuantitationType qt, String ctaName)
Description copied from interface:SingleCellExpressionExperimentService
Obtain a cell type assignment by name.- Specified by:
getCellTypeAssignment
in interfaceSingleCellExpressionExperimentService
- Returns:
- that cell type assignmente, or null if none is found
-
getPreferredCellTypeAssignment
@Transactional(readOnly=true) public Optional<CellTypeAssignment> getPreferredCellTypeAssignment(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain the preferred cell type labelling from the preferred single-cell vectors.- Specified by:
getPreferredCellTypeAssignment
in interfaceSingleCellExpressionExperimentService
-
getPreferredCellTypeAssignment
@Transactional(readOnly=true) public Optional<CellTypeAssignment> getPreferredCellTypeAssignment(ExpressionExperiment ee, QuantitationType qt)
- Specified by:
getPreferredCellTypeAssignment
in interfaceSingleCellExpressionExperimentService
-
addCellLevelCharacteristics
@Transactional public CellLevelCharacteristics addCellLevelCharacteristics(ExpressionExperiment ee, SingleCellDimension scd, CellLevelCharacteristics clc)
Description copied from interface:SingleCellExpressionExperimentService
Add new cell-level characteristics.- Specified by:
addCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
removeCellLevelCharacteristics
@Transactional public void removeCellLevelCharacteristics(ExpressionExperiment ee, SingleCellDimension scd, CellLevelCharacteristics clc)
Description copied from interface:SingleCellExpressionExperimentService
Remove existing cell-level characteristics.- Specified by:
removeCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
removeCellLevelCharacteristics
@Transactional public void removeCellLevelCharacteristics(ExpressionExperiment ee, QuantitationType qt, CellLevelCharacteristics clc)
Description copied from interface:SingleCellExpressionExperimentService
Remove existing cell-level characteristics by QT.- Specified by:
removeCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
getCellLevelCharacteristics
@Transactional(readOnly=true) public List<CellLevelCharacteristics> getCellLevelCharacteristics(ExpressionExperiment ee)
- Specified by:
getCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
- See Also:
ExpressionExperimentDao.getCellLevelCharacteristics(ExpressionExperiment)
-
getCellLevelCharacteristics
@Transactional(readOnly=true) public List<CellLevelCharacteristics> getCellLevelCharacteristics(ExpressionExperiment ee, Category category)
Description copied from interface:SingleCellExpressionExperimentService
Obtain CLC for given category.- Specified by:
getCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
getCellLevelCharacteristics
@Nullable @Transactional(readOnly=true) public CellLevelCharacteristics getCellLevelCharacteristics(ExpressionExperiment expressionExperiment, QuantitationType qt, Long id)
- Specified by:
getCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
getCellLevelCharacteristics
@Transactional(readOnly=true) public List<CellLevelCharacteristics> getCellLevelCharacteristics(ExpressionExperiment expressionExperiment, QuantitationType qt)
- Specified by:
getCellLevelCharacteristics
in interfaceSingleCellExpressionExperimentService
-
getCellTypes
@Transactional(readOnly=true) public List<Characteristic> getCellTypes(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain the cell types of a given single-cell dataset.Only the cell types applicable to the preferred single-cell vectors and labelling are returned.
- Specified by:
getCellTypes
in interfaceSingleCellExpressionExperimentService
-
getCellTypeFactor
public Optional<ExperimentalFactor> getCellTypeFactor(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Obtain the cell type factor.- Specified by:
getCellTypeFactor
in interfaceSingleCellExpressionExperimentService
- Returns:
- a cell type factor, or null of none exist
-
recreateCellTypeFactor
@Transactional public ExperimentalFactor recreateCellTypeFactor(ExpressionExperiment ee)
Description copied from interface:SingleCellExpressionExperimentService
Recreate the cell type factor based on the preferred labelling of the preferred single-cell vectors.Analyses involving the factor are removed and samples mentioning the factor values are updated as per
ExperimentalFactorService.remove(ExperimentalFactor)
.- Specified by:
recreateCellTypeFactor
in interfaceSingleCellExpressionExperimentService
- Returns:
- the created cell type factor
-
-