Class CellLevelCharacteristicsMappingUtils
java.lang.Object
ubic.gemma.core.analysis.singleCell.aggregate.CellLevelCharacteristicsMappingUtils
Utilities for creating, reading and writing mappings of
CellLevelCharacteristics
to ExperimentalFactor
.
The most common use case for this is to map the cell type assigmnents from a CellTypeAssignment
to a cell type factor.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Map
<Characteristic, FactorValue> Map the cell types from a cell type assignment to factor values in a cell type factor.static Map
<Characteristic, FactorValue> createMappingBySubSetCharacteristics
(CellLevelCharacteristics clc, ExperimentalFactor factor, Map<FactorValue, ExpressionExperimentSubSet> subsets) Infer the mapping of cell type assignments to factor values using a subset structure.static String
printMapping
(Map<Characteristic, FactorValue> mappedCellTypeFactors) static void
printMapping
(Map<Characteristic, FactorValue> mappedCellTypeFactors, Appendable details) static Map
<Characteristic, FactorValue> readMappingFromFile
(CellLevelCharacteristics clc, ExperimentalFactor factor, Path cellTypeMappingFile) Create a mapping of cell type assignments to factor values from a file.static void
writeMapping
(CellLevelCharacteristics cta, ExperimentalFactor factor, Map<Characteristic, FactorValue> cta2f, Writer dest) Create a mapping of cell type assignments to factor values from a file.
-
Constructor Details
-
CellLevelCharacteristicsMappingUtils
public CellLevelCharacteristicsMappingUtils()
-
-
Method Details
-
createMappingByFactorValueCharacteristics
public static Map<Characteristic,FactorValue> createMappingByFactorValueCharacteristics(CellLevelCharacteristics cta, ExperimentalFactor factor) Map the cell types from a cell type assignment to factor values in a cell type factor.There is a possibility that no factor value is found for a given cell type, in which case it is ignored.
TODO: this should be private, but we reuse the same logic for aggregating in
SingleCellExpressionExperimentAggregatorServiceImpl
.- Throws:
IllegalStateException
- if there is more than one factor value mapping a given cell type
-
createMappingBySubSetCharacteristics
public static Map<Characteristic,FactorValue> createMappingBySubSetCharacteristics(CellLevelCharacteristics clc, ExperimentalFactor factor, Map<FactorValue, ExpressionExperimentSubSet> subsets) Infer the mapping of cell type assignments to factor values using a subset structure.This method is resilient to changes in the
FactorValue
as it will look up the characteristics of the subset viaInvestigation.getCharacteristics()
. -
readMappingFromFile
public static Map<Characteristic,FactorValue> readMappingFromFile(CellLevelCharacteristics clc, ExperimentalFactor factor, Path cellTypeMappingFile) throws IOException Create a mapping of cell type assignments to factor values from a file.- Throws:
IOException
-
writeMapping
public static void writeMapping(CellLevelCharacteristics cta, ExperimentalFactor factor, Map<Characteristic, FactorValue> cta2f, Writer dest) throws IOExceptionCreate a mapping of cell type assignments to factor values from a file.- Throws:
IOException
-
printMapping
-
printMapping
public static void printMapping(Map<Characteristic, FactorValue> mappedCellTypeFactors, Appendable details) throws IOException- Throws:
IOException
-