First release of HiData, which continues donordata 0.1.0 under a new name. The levels are groups, optional
subgroups and cells, where a group can be a donor, a patient, a target gene or a compound, and a subgroup a sample, a
time point, a guide or a dose. The behaviour is that of donordata 0.1.0; the names and the on-disk format change.
Changed
- The package
donordataishidataandDonorDataisHiData.DonorDataSchemaError,DONORDATA_ENCODING_TYPE,
DONORDATA_ENCODING_VERSION,register_donordata_namespaceandDAnnareHiDataSchemaError,
HIDATA_ENCODING_TYPE,HIDATA_ENCODING_VERSION,register_hidata_namespaceandGAnn. - The donor level
Dis the group levelG, and the sample levelSis the subgroup levelS:G=,group_idand
subgroup_idin the constructor andfrom_anndata,G_obsandG_varinsel,G_type, and the level names
"group"and"subgroup"inlevel=,levels,level_namesandinfer_levels.get_dftakes the prefixG:. n_donors,n_samples,donor_codes,sample_codes,sample_donor_codes,n_cells_per_donor,
n_cells_per_sampleandn_samples_per_donoraren_groups,n_subgroups,group_codes,subgroup_codes,
subgroup_group_codes,n_cells_per_group,n_cells_per_subgroupandn_subgroups_per_group.filter_donors,filter_samplesandfilter_donors_by_cellsarefilter_groups,filter_subgroupsand
filter_groups_by_cells, andnest(keep_in_samples=)isnest(keep_in_subgroups=).pp.donor_level_obs_filterandpp.donor_level_var_filterarepp.group_level_obs_filterand
pp.group_level_var_filter, withgroup_level_keyandgroup_level_values. The object passed toconcat,
validate, theppfunctions andMILDatasetis calledhdsorhd.MILDatasettakesgroup_layer,group_labels_key,group_batch_key,group_cat_covs_key,
group_cont_covs_key,group_indices_keyandsplit_groups, hasgroup_namesandhd, and yieldsgroup_id,
group_x,group_y,group_batch,group_cat_covs,group_cont_covsandgroup_indices.- The fields of
GAnnand their default names refer to groups, for exampleGAnn.groupis"group_id"and
GAnn.GROUP_LABELS_KEYis"group_labels", andCAnn.CELL_DONOR_KEYisCAnn.CELL_GROUP_KEY. The default
group_idis therefore"group_id". read_dd,read_h5_dd,read_zarr_dd,write_dd,write_h5_ddandwrite_zarr_ddareread_hd,read_h5_hd,
read_zarr_hd,write_hd,write_h5_hdandwrite_zarr_hd, and files end in.hd.h5and.hd.zarr.- The on-disk format 0.1.0 has the
encoding-type"hidata", the levelsG,SandC, the attributesgroup_id
andsubgroup_id, andhidata-tableon table levels.x_chunkstakes the key"G". - The representation reads
HiData(n_groups=..., n_subgroups=..., n_cells=...), andstrgivesn_G_obsand
n_G_vars.
Added
- Reading of files and stores written by donordata 0.1.0, and of the older files of cellink that donordata reads.
Writing such an object again stores it in the HiData format. ml.GroupMILModel, a PyTorch Lightning model that predicts the label of a group from its features and the bag of its
cells, as yielded byMILDataset. It wasDonorMILModelin cellink. Themlextra installs PyTorch Lightning.- The tutorial on multiple instance learning with
MILDatasetandGroupMILModel.
donordata releases
HiData was released as donordata before. These entries use the donordata names.
donordata [0.1.0] - 2026-11-20
First release of DonorData as a package of its own, split from cellink.
Changed
- Donors, samples and cells whose donor or sample identifier is missing are dropped with a warning that names
them. Before, a missing identifier became a donor or sample called"nan"or"None". A string that stands for
a missing value ("","NA","N/A","<NA>","nan","NaT","None"or"null", in any case) counts as
missing too and has to be renamed if it is a real name. nestandcollapsedrop donors whose grouping value is missing, with a warning.train_test_split,kfoldandsubsample_cellstreat a missingstratify,groupsorgroupbyvalue as a group
of its own.compositionandpseudobulkcount cells whosegroupbyvalue is missing as the group"nan";
filter_donors_by_cellsonly requires that group when it is listed ingroups.train_test_splitandkfoldmatch astratifygiven as apandas.Seriesto the donors by name. Before, they
read it by position, which assigned wrong classes when the Series was in another order than the donors.- Selections, splits,
nest,flatten,collapseandsubsample_cellsreturn objects that do not share levels or
unswith the original. - The constructor and the level setters leave their inputs unchanged; a rejected assignment leaves the object
unchanged; replacing a table keeps the matrices of the remaining units. - Identifiers are text in the index and the identifier column; whole-number floats match integer identifiers.
from_anndatagives a cell without a donor the donor of its sample.- MuData modalities are matched by name in
aggregate,pseudobulk,get_dfandMILDataset. get_dfgives one column per time point for an EHRData variable.concat(join="outer")keeps all columns of donor and sample matrices;concatrejects EHRData levels.- The
filter_*methods accept a set of names. - Requires Python 3.12 or newer and anndata 0.13.1 or newer, with the numpy (2.1), pandas (2.3), scipy (1.14) and h5py
(3.11) versions that anndata 0.13 needs. - Selections and the constructor keep the levels as views instead of copying them. Assigning
Xof a level copies
that level first, as anndata 0.13 does for every view, so the original never changes. - Views of a donor-level AnnData keep all categories of
obsandvar, so selecting donors, cells or genes costs no
more than reading the selected genotypes.
Added
DonorDatawith a donor levelD, an optional sample levelSand the cellsC, where each level can be a
table, anAnnData, aMuData, or for donors and samples anEHRData.- Selection at every level with
filter_donors,filter_samples,filter_cells,filter_donors_by_cellsand
subsample_cells, andcoverageandcomplete_casesforMuDatacells with assays on different cells. get_df,infer_levels,push_obs,pull_obs,push_obsmandto_anndatato move information between
levels.aggregate,pseudobulk,compositionandcell_weights.nest,flattenandcollapseto change the levels.train_test_splitandkfoldover donors, with stratification and groups.donordata.iowithread_dd,read_h5_ddandread_zarr_dd, and the on-disk format 0.3.0.read_zarr_ddand
read_h5_dd(lazy=True)keepXand layers on disk;read_zarr_dd(lazy=False)reads them into memory.
Writing to a file or store that a lazily read object still reads from raises an error.concat,validateandregister_donordata_namespace.concatreturns sparseobsmmatrices as scipy sparse
arrays (csr_array), since scipy 2 deprecates sparse matrices (csr_matrix).donordata.ml.MILDatasetwith bags per donor or per sample.- Reading of files in the versions 0.1.0 and 0.2.0 written by cellink. Their donor level
Gis read intoD
with a warning.
Fixed
sel,dd[...],D_varandC_varmatch a booleanpandas.Seriesto the axis by name, asfilter_donors,
filter_samplesandfilter_cellsalready do. Before, they applied it by position, which selected the wrong
samples or cells when the Series was built from the input tables, becauseDonorDatareorders samples and
cells. A Series whose index does not contain the names of the axis, such as the default index 0, 1, 2, ..., now
raises aValueErrorinstead of selecting by position, also when the cells have no real names and are
called"0","1", .... Boolean arrays and lists are still applied by position. A missing entry (NA) of a
mask counts asFalse.dd[mask, ...]with an ellipsis and a boolean array or Series no longer raises an error.filter_donors,filter_samplesandfilter_cellsraise aKeyErrorfor a name that does not exist, assel
anddd[...]do. Before, they ignored it. They raise aTypeErrorfor integers, which they used to read as