tiledbsoma.Measurement.add_new_collection¶
- Measurement.add_new_collection(key: str, kind: Type[CollectionBase] | None = None, *, uri: str | None = None, platform_config: Dict[str, Mapping[str, Any]] | object | None = None, **kwargs: Any) CollectionBase[Any] ¶
Adds a new sub-collection to this collection.
- Parameters:
key – The key to add.
kind – Optionally, the specific type of sub-collection to create. For instance, passing
tiledbsoma.Experiment
here will create aSOMAExperiment
as the sub-entry. By default, a basicCollection
will be created.uri – If provided, the sub-collection will be created at this URI. This can be absolute, in which case the sub-collection will be linked to by absolute URI in the stored collection, or relative, in which case the sub-collection will be linked to by relative URI. The default is to use a relative URI generated based on the key. Absolute example:
uri="s3://mybucket/myexperiment/ms/RNA/newchild"
. Relative example:uri="newchild"
.platform_config – Platform configuration options to use when creating this sub-collection. This is passed directly to
[CurrentCollectionType].create()
.kwargs – Other keyword arguments to pass to the
create
method of the new sub-collection type.
Examples
>>> with tiledbsoma.Collection.create("/tmp/parent") as parent_collection: ... # Create a Collection, with the key ``child_collection`` ... parent_collection.add_new_collection("child_collection") ... # And an Experiment, with the key ``child_experiment`` ... parent_collection.add_new_collection("child_experiment", tiledbsoma.Experiment) ... >>> with tiledbsoma.open("/tmp/parent") as parent_collection: ... print(parent_collection['child_collection'].uri) ... print(parent_collection['child_experiment'].uri) ... file:///tmp/parent/child_collection file:///tmp/parent/exp
Lifecycle
Maturing.