Share artifacts in immunohub¶
!lamin load covim/immunohub
import lamindb as ln
import lnschema_covim as cv
# track the current notebook
# run ln.track() alone to generate the tracking id
ln.track()
Query artifacts from local instance:
local_instance = "anonymous/testdata"
artifacts = (
ln.Artifact.using(local_instance)
.filter(created_by__handle="anonymous", suffix=".h5ad")
.all()
)
artifacts.df()
artifact = artifacts.first()
artifact.describe()
artifact.biosamples.df()
Transfer artifact to remote instance immunohub:
Show code cell content Hide code cell content
# clean up the previously ingested record in case a run fails
cv.Biosample.filter(created_by__handle="anonymous").delete()
cv.transfer_artifact_to_immunohub(artifact)
Artifact record with metadata is now on the remote instance, but the linked file stays local:
artifact.describe()
artifact.path
Share notebook¶
Share your notebook report in the immunohub instance by running:
ln.finish()
Show code cell content Hide code cell content
# clean up CI run
cv.Biosample.filter(created_by__handle="anonymous").delete()
artifact.delete(permanent=True, storage=False)
ln.Storage.get(artifact.storage.uid).delete()
transform = ln.context.transform
run = transform.runs.all().one()
feature_set = ln.FeatureSet.filter(run=run).one()
if feature_set.artifacts.count() == 0:
feature_set.delete()
else:
feature_set.run = None
feature_set.save()
run.delete()
transform.delete()