Test bionty¶
import lamindb_setup as ln_setup
from subprocess import getoutput
import pandas as pd
Pass bionty to init:
ln_setup.init(storage="mydata2", schema="bionty")
Check whether sources are written:
from bionty import Source
sources_df = pd.DataFrame(Source.objects.all().values())
sources_df.head()
from bionty.base import settings as bionty_base_settings
assert sources_df.shape[0] > 0
assert bionty_base_settings.lamindb_sources.exists()
Test what happens if we accidentally re-init the instance:
output = getoutput("lamin init --storage mydata2 --schema bionty")
print(output)
Now, let’s remove/corrupt the instance settings file so that the init is actually triggered:
ln_setup.settings.instance._get_settings_file().unlink()
output = getoutput("lamin init --storage mydata2 --schema bionty")
print(output)
Check that everything is still in place:
sources_df = pd.DataFrame(Source.objects.all().values())
sources_df.head()
!lamin delete --force mydata2