Class Dataframe<K>

java.lang.Object
ubic.gemma.core.loader.util.anndata.Dataframe<K>
Type Parameters:
K - the type of index being used
All Implemented Interfaces:
AutoCloseable, Iterable<Dataframe.Column<K,?>>

public class Dataframe<K> extends Object implements Iterable<Dataframe.Column<K,?>>, AutoCloseable
Represents an AnnData dataframe.
Author:
poirigui
  • Constructor Details

    • Dataframe

      public Dataframe(H5Group group, @Nullable Class<K> indexClass)
      Create a new dataframe from an H5 group.
      Parameters:
      group - an H5 group that contains a dataset
      indexClass - the type of index to use, or null to ignore. If left unset, indexing will not be possible via Dataframe.Column.get(Object).
  • Method Details

    • getIndexColumn

      public String getIndexColumn()
      Obtain the name of the column used as an index.
    • getColumns

      public List<String> getColumns()
      Obtain all the columns defined in the dataframe.

      Unsupported encoding types are ignored.

    • getColumnEncodingType

      public String getColumnEncodingType(String columnName)
      Obtain the encoding type of a column.

      This is usually one of string-array, categorical or array, but many other encodings are possible.

    • getIndex

      public Dataframe.Column<K,K> getIndex()
      Obtain the index column.
    • getIndex

      public <T> Dataframe.Column<T,T> getIndex(Class<T> indexClass)
      Obtain the index column.
    • getColumnType

      public Class<?> getColumnType(String columnName)
      Guess the type of a given column.
    • getColumn

      public Dataframe.Column<K,?> getColumn(String columnName)
      Obtain a column, the element type is guessed as per getColumnType(String)
      See Also:
    • getColumn

      public <T> Dataframe.Column<K,T> getColumn(String columnName, Class<T> clazz)
      Obtain a column of the given element type.
    • getArrayColumn

      public H5Dataset getArrayColumn(String columnName)
      Obtain an array column as a H5 dataset.
    • getCategoricalColumn

      public <T> CategoricalArray<T> getCategoricalColumn(String columnName, Class<T> categoryType)
      Obtain a categorical column.
    • getCategoricalColumn

      public CategoricalArray<?> getCategoricalColumn(String columnName)
      Obtain a categorical column.
    • getStringArrayColumn

      public String[] getStringArrayColumn(String columnName)
      Obtain a string-array column.
    • getNullableIntegerArrayColumn

      public Integer[] getNullableIntegerArrayColumn(String columnName)
      Obtain a nullable integer array column.
    • getNullableBooleanArrayColumn

      public Boolean[] getNullableBooleanArrayColumn(String columnName)
      Obtain a nullable boolean array column.
    • iterator

      @Nonnull public Iterator<Dataframe.Column<K,?>> iterator()
      Specified by:
      iterator in interface Iterable<K>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable