Configure schema modules#
import lamindb as ln
πΆ You haven't yet setup an instance using the CLI: Please call `ln.setup.init()` or `ln.setup.load()`
Core schema module#
The core schema module is part of any LaminDB instance and tracks data lineage.
Show code cell content
ln.setup.load("mydata")
π¬ Found cached instance metadata: /home/runner/.lamin/testuser1-instance-mydata.env
β
Loaded instance: testuser1/mydata
'migrate-unnecessary'
You can find the code here: https://github.com/laminlabs/lnschema-core
ln.setup.schema.draw()
Schema modules bionty
& lamin1
#
The bionty
schema module maps fundamental biological entities: https://github.com/laminlabs/lnschema-bionty
The lamin1
module is an example for a configurable in-house schema that tracks lab operations: https://github.com/laminlabs/lnschema-lamin1
ln.setup.init(
storage="mydata2", schema="bionty,lamin1"
) # CLI: lamin init --storage mydata2 --schema bionty,lamin1
π¬ Not registering instance on hub, if you want, call `lamin register`
π¬ Loading schema modules: core==0.34.0 bionty==0.18.0 lamin1==0.17.0
β
Loaded instance: testuser1/mydata2
β
Created & loaded instance: testuser1/mydata2
ln.setup.schema.draw()
For bionty
, supporting public ontology versions are automatically tracked:
Show code cell content
from lndb.dev._setup_knowledge import load_bionty_versions
load_bionty_versions(ln.setup.settings.instance, display=True)
database | database_v | |
---|---|---|
entity | ||
Species | ensembl | release-108 |
Gene | ensembl | release-108 |
Protein | uniprot | 2022-04 |
CellMarker | cellmarker | 2.0 |
CellLine | clo | 2022-03-21 |
CellType | cl | 2023-02-15 |
Tissue | uberon | 2023-02-14 |
Disease | mondo | 2023-02-06 |
Readout | efo | 3.48.0 |
Phenotype | hp | 2023-01-27 |
Pathway | pw | 7.78 |
BFXPipeline | lamin | 1.0.0 |
Drug | dron | 2023-03-10 |
Show code cell content
# clean up
ln.setup.delete("mydata2")
# test with postgres
from laminci.db import setup_local_test_postgres
pgurl = setup_local_test_postgres()
ln.setup.init(storage="mydata2", schema="bionty,lamin1", db=pgurl)
!docker stop pgtest && docker rm pgtest
ln.setup.delete("pgtest")
π¬ Deleting instance testuser1/mydata2
π¬ instance settings '.env' deleted
π¬ current instance settings /home/runner/.lamin/current_instance.env deleted
π¬ consider deleting your stored data manually: /home/runner/work/lndb/lndb/docs/guide/mydata2
π¬ deleted '.lndb' sqlite file
π¬ Created Postgres test instance: 'postgresql://postgres:pwd@0.0.0.0:5432/pgtest'
It runs in docker container 'pgtest'
πΆ Instance metadata exists, but DB might have been corrupted or deleted. Re-initializing the DB.
π¬ Not registering instance on hub, if you want, call `lamin register`
π¬ Loading schema modules: core==0.34.0 bionty==0.18.0 lamin1==0.17.0
β
Loaded instance: testuser1/pgtest
β
Created & loaded instance: testuser1/pgtest
pgtest
pgtest
π¬ Deleting instance testuser1/pgtest
π¬ instance settings '.env' deleted
π¬ current instance settings /home/runner/.lamin/current_instance.env deleted
π¬ consider deleting your stored data manually: /home/runner/work/lndb/lndb/docs/guide/mydata2