Prepare transfer artifacts from a local instance to a cloud instance¶
!lamin settings set auto-connect false
import lamindb as ln
import bionty as bt
import wetlab as wl
import pandas as pd
ln.setup.init(storage="./test-transfer-to-cloud", schema="bionty,wetlab,findrefs")
ln.setup.settings.auto_connect = False
artifact = ln.Artifact.from_df(pd.DataFrame({'a': [1, 2, 3]}), description='test-transfer-to-cloud')
artifact.save()
features = bt.CellMarker.from_values(["PD1", "CD21"], field=bt.CellMarker.name, organism="human")
ln.save(features)
artifact.features.add_feature_set(ln.FeatureSet(features), slot="var")
organism = bt.Organism.from_source(name="human")
organism.save()
artifact.labels.add(organism)
experiment = wl.Experiment(name="experiment-test-transfer-to-cloud")
experiment.save()
artifact.experiments.add(experiment)
artifact.describe()
! no run & transform got linked, call `ln.track()` & re-run
Artifact(uid='377fgyf51EVGC7X90000', is_latest=True, description='test-transfer-to-cloud', suffix='.parquet', type='dataset', size=1571, hash='5v6hhBMnN8GEQz6OMYjeeQ', _hash_type='md5', _accessor='DataFrame', visibility=1, _key_is_virtual=True, created_at=2024-10-29 21:22:57 UTC)
Provenance
.storage = '/home/runner/work/lamindb/lamindb/docs/storage/test-transfer-to-cloud'
.created_by = 'testuser1'
Labels
.organisms = 'human'
.experiments = 'experiment-test-transfer-to-cloud'
Feature sets
'var' = 'PD1', 'CD21'
assert artifact.features["var"].count() == 2