Class AnnDataSingleCellDataLoader
- java.lang.Object
-
- ubic.gemma.core.loader.expression.singleCell.AnnDataSingleCellDataLoader
-
- All Implemented Interfaces:
Closeable,AutoCloseable,DataLoader,SequencingDataLoader,SingleCellDataLoader
public class AnnDataSingleCellDataLoader extends Object implements SingleCellDataLoader
Reads single-cell vectors from the AnnData on-disk HDF5 format.- Author:
- poirigui
-
-
Constructor Summary
Constructors Constructor Description AnnDataSingleCellDataLoader(Path file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Free any resources that the loaded has setup.Set<CellTypeAssignment>getCellTypeAssignments(SingleCellDimension dimension)Load single-cell type assignments present in the data.Set<ExperimentalFactor>getFactors(Collection<BioAssay> samples, Map<BioMaterial,Set<FactorValue>> factorValueAssignments)Load experimental factors present in the data.Set<String>getGenes()Load gene identifiers present in the data.Set<String>getGenes(QuantitationType qt)Obtain the genes for a specific QT.Set<CellLevelCharacteristics>getOtherCellLevelCharacteristics(SingleCellDimension dimension)Load cell-level characteristics that are not cell type assignments present in the data.Set<QuantitationType>getQuantitationTypes()Load quantitation types present in the data.Set<String>getSampleNames()Obtain the sample names present in the data.Map<BioMaterial,Set<Characteristic>>getSamplesCharacteristics(Collection<BioAssay> samples)Load samples characteristics present in the data.Map<BioAssay,SequencingMetadata>getSequencingMetadata(Collection<BioAssay> samples)Retrieve various sequencing metadata if counting data is present.Map<BioAssay,SequencingMetadata>getSequencingMetadata(SingleCellDimension dimension)SingleCellDimensiongetSingleCellDimension(Collection<BioAssay> bioAssays)Load the single-cell dimension present in the data.Stream<SingleCellExpressionDataVector>loadVectors(Collection<CompositeSequence> designElements, SingleCellDimension dimension, QuantitationType quantitationType)Produces a stream of single-cell expression data vectors for the givenQuantitationType.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ubic.gemma.core.loader.expression.DataLoader
setBioAssayToSampleNameMapper, setDesignElementToGeneMapper, setIgnoreUnmatchedDesignElements, setIgnoreUnmatchedSamples
-
-
-
-
Constructor Detail
-
AnnDataSingleCellDataLoader
public AnnDataSingleCellDataLoader(Path file)
-
-
Method Detail
-
getSampleNames
public Set<String> getSampleNames() throws IOException
Description copied from interface:DataLoaderObtain the sample names present in the data.- Specified by:
getSampleNamesin interfaceDataLoader- Throws:
IOException
-
getSingleCellDimension
public SingleCellDimension getSingleCellDimension(Collection<BioAssay> bioAssays) throws IOException
Description copied from interface:SingleCellDataLoaderLoad the single-cell dimension present in the data.Not all samples might be present and thus the returned
SingleCellDimensionwill have a expression data for a subset of the data.- Specified by:
getSingleCellDimensionin interfaceSingleCellDataLoader- Parameters:
bioAssays- a set of bioassays to use when populating the dimension, not all bioassays may be used- Throws:
IOException
-
getQuantitationTypes
public Set<QuantitationType> getQuantitationTypes() throws IOException
Description copied from interface:DataLoaderLoad quantitation types present in the data.- Specified by:
getQuantitationTypesin interfaceDataLoader- Throws:
IOException
-
getCellTypeAssignments
public Set<CellTypeAssignment> getCellTypeAssignments(SingleCellDimension dimension) throws IOException
Description copied from interface:SingleCellDataLoaderLoad single-cell type assignments present in the data.- Specified by:
getCellTypeAssignmentsin interfaceSingleCellDataLoader- Throws:
IOException
-
getOtherCellLevelCharacteristics
public Set<CellLevelCharacteristics> getOtherCellLevelCharacteristics(SingleCellDimension dimension) throws IOException
Description copied from interface:SingleCellDataLoaderLoad cell-level characteristics that are not cell type assignments present in the data.- Specified by:
getOtherCellLevelCharacteristicsin interfaceSingleCellDataLoader- Throws:
IOException
-
getFactors
public Set<ExperimentalFactor> getFactors(Collection<BioAssay> samples, @Nullable Map<BioMaterial,Set<FactorValue>> factorValueAssignments) throws IOException
Description copied from interface:DataLoaderLoad experimental factors present in the data.- Specified by:
getFactorsin interfaceDataLoader- Parameters:
samples- samples to use when determining which factors to loadfactorValueAssignments- if non-null, the proposed assignment of factor values to samples are populated in the mapping.- Returns:
- a set of factors present in the data
- Throws:
IOException
-
getSamplesCharacteristics
public Map<BioMaterial,Set<Characteristic>> getSamplesCharacteristics(Collection<BioAssay> samples) throws IOException
Description copied from interface:DataLoaderLoad samples characteristics present in the data.- Specified by:
getSamplesCharacteristicsin interfaceDataLoader- Parameters:
samples- to use when determining which characteristics to load- Returns:
- proposed characteristics grouped by sample
- Throws:
IOException
-
getGenes
public Set<String> getGenes() throws IOException
Description copied from interface:DataLoaderLoad gene identifiers present in the data.- Specified by:
getGenesin interfaceDataLoader- Throws:
IOException
-
getSequencingMetadata
public Map<BioAssay,SequencingMetadata> getSequencingMetadata(Collection<BioAssay> samples) throws IOException
Description copied from interface:SequencingDataLoaderRetrieve various sequencing metadata if counting data is present.- Specified by:
getSequencingMetadatain interfaceSequencingDataLoader- Throws:
IOException
-
getSequencingMetadata
public Map<BioAssay,SequencingMetadata> getSequencingMetadata(SingleCellDimension dimension) throws IOException
- Specified by:
getSequencingMetadatain interfaceSingleCellDataLoader- Throws:
IOException
-
getGenes
public Set<String> getGenes(QuantitationType qt) throws IOException
Obtain the genes for a specific QT.- Throws:
IOException
-
loadVectors
public Stream<SingleCellExpressionDataVector> loadVectors(Collection<CompositeSequence> designElements, SingleCellDimension dimension, QuantitationType quantitationType) throws IOException, IllegalArgumentException
Description copied from interface:SingleCellDataLoaderProduces a stream of single-cell expression data vectors for the givenQuantitationType.- Specified by:
loadVectorsin interfaceSingleCellDataLoader- Parameters:
designElements- a collection of design elements for mapping of element names used in the dataset toCompositeSequencedimension- a dimension to use for creating vectors, may be loaded from the single-cell data withSingleCellDataLoader.getSingleCellDimension(Collection)quantitationType- a quantitation type to extract from the data for, may be loaded from the single-cell data withDataLoader.getQuantitationTypes()- Returns:
- a stream of single-cell expression data vectors that must be closed when done, preferably using a try-with-resource block.
- Throws:
IllegalArgumentException- if a design element present in the data cannot be matched to one of the supplied elements, requires settingDataLoader.setIgnoreUnmatchedDesignElements(boolean)to falseIOException
-
close
public void close() throws IOExceptionDescription copied from interface:DataLoaderFree any resources that the loaded has setup.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDataLoader- Throws:
IOException
-
-