Chains

DataAxesFormats.Chains Module

View a chain of Daf data as a single data set. This allows creating a small Daf data set that contains extra (or overriding) data on top of a larger read-only data set. In particular this allows creating several such incompatible extra data sets (e.g., different groupings of cells to metacells), without having to duplicate the common (read only) data.

DataAxesFormats.Chains.chain_reader Function
chain_reader(dafs::AbstractVector{<:DafReader}; name::Maybe{AbstractString} = nothing)::DafReader

Create a read-only chain wrapper of DafReader s, presenting them as a single DafReader . When accessing the content, the exposed value is that provided by the last data set that contains the data, that is, later data sets can override earlier data sets. However, if an axis exists in more than one data set in the chain, then its entries must be identical. This isn't typically created manually; instead call chain_reader .

Note

While this verifies the axes are consistent at the time of creating the chain, it's no defense against modifying the chained data after the fact, creating inconsistent axes. Don't do that .

DataAxesFormats.Chains.chain_writer Function
chain_writer(dafs::AbstractVector{<:DafReader}; name::Maybe{AbstractString} = nothing)::DafWriter

Create a chain wrapper for a chain of DafReader data, presenting them as a single DafWriter . This acts similarly to chain_reader , but requires the final entry in the chain to be a DafWriter . Any modifications or additions to the chain are directed only at this final writer.

Note

Deletions are only allowed for data that exists only in the final writer. That is, it is impossible to delete from a chain something that exists in any of the readers; it is only possible to override it.

DataAxesFormats.Chains.ReadOnlyChain Type
struct ReadOnlyChain <: DafReadOnly ... end

A wrapper for a chain of DafReader data, presenting them as a single DafReadOnly . When accessing the content, the exposed value is that provided by the last data set that contains the data, that is, later data sets can override earlier data sets. However, if an axis exists in more than one data set in the chain, then its entries must be identical. This isn't typically created manually; instead call chain_reader .

DataAxesFormats.Chains.WriteChain Type
struct WriteChain <: DafWriter ... end

A wrapper for a chain of DafReader data, with a final DafWriter , presenting them as a single DafWriter . When accessing the content, the exposed value is that provided by the last data set that contains the data, that is, later data sets can override earlier data sets (where the writer has the final word). However, if an axis exists in more than one data set in the chain, then its entries must be identical. This isn't typically created manually; instead call chain_reader .

Any modifications or additions to the chain are directed at the final writer. Deletions are only allowed for data that exists only in this writer. That is, it is impossible to delete from a chain something that exists in any of the readers; it is only possible to override it.

DataAxesFormats.Chains.complete_chain! Function
complete_chain!(;
    base_daf::Union{DafReader, BaseDaf, AbstractVector{<:Union{BaseDaf, DafReader}}},
    new_daf::DafWriter,
    name::Maybe{AbstractString} = nothing,
    absolute::Bool = false
)::DafWriter

Immediately after creating an empty disk based new_daf , chain it on top of one or more disk based base repositories, and return the new chain. Each base is a DafReader , or a BaseDaf when only a view of it is used. Give several of them when the new_daf rests on more than one repository - say, a repository of shared computed results and a repository of the parameters this variant of the analysis uses, both resting in turn on the same raw data. Later bases override earlier ones, as in any chain, and a repository reached more than once is used once, at its earliest position.

This will set the base_daf_repository scalar property of the new_daf to describe the bases, so that the chain can be recreated by calling complete_daf in the future.

By default, the stored paths will be relative to the new_daf , for the common case where a group of repositories is stored under a common root. This allows this root to be renamed or moved somewhere else and still allow complete_daf to work. If absolute is set, then the stored paths will be absolute.

DataAxesFormats.Chains.BaseDaf Type
@kwdef struct BaseDaf
    daf::DafReader
    axes::Maybe{ViewAxes} = nothing
    data::Maybe{ViewData} = nothing
end

One base repository of a complete_chain! , and the viewer parameters to apply to it, which restrict it to a subset of its data and/or rename that data. Pass a plain DafReader instead wherever the whole of it is used, which is the common case.

Index