Groups

DataAxesFormats.Groups Module

Functions for dealing with computing groups of axis entries (typically for creating a new axis).

TODO: Migrate this to TanayLabUtilities ?

DataAxesFormats.Groups.group_names Function
group_names(
    names_of_entries::AbstractVector{<:AbstractString},
    entries_of_groups::AbstractVector{<:AbstractVector{<:Integer}};
    prefix::AbstractString,
)::Vector{String}

Given an entries_of_groups vector of vectors, one for each group, containing the (sorted) indices of the entries of the group along some axis of some daf data set, return a vector giving a unique name for each group. This name consists of the prefix , followed by the index of the group, followed by a .XX two-digit suffix which is a hash of the names of the axis entries of the group.

The returned names strike a balance between readability and safety. A name like M123.89 for group #123 is easy to deal with manually, but is also reasonably safe in the common use case that groups are re-computed, and there is per-group metadata lying around associated with the old groups, as the probability of the new group #123 having the same suffix is only 1% (unless it is actually identical).

DataAxesFormats.Groups.compact_groups! Function
compact_groups!(
    group_indices::AbstractVector{<:Integer},
)::Int

Given an array group_indices which assigns each entry of some axis to a non-negative group index (with zero meaning "no group"), compact it in-place so that the group indices will be 1...N , and return N .

DataAxesFormats.Groups.collect_group_members Function
collect_group_members(
    group_indices::AbstractVector{T},
)::Vector{Vector{T}} where {T <: Integer}

Given an array group_indices which assigns each entry of some axis to a non-negative group index (with zero meaning "no group"), where the group indices are compact (in the range 1...N ), return a vector of vectors, one for each group, containing the (sorted) indices of the entries of the group.

Index