utils

Various utility functions and classes

source

setup_nb

 setup_nb (_dev=False)

Sets up colab or local environment and corresponding paths to data root directory and cnn virus data

Type Default Details
_dev bool False
Returns tuple (colab, path to data root, path to data)
ON_COLAB, p2dataroot, p2data = setup_nb(_dev=True)
print('Notebook running on Colab?', ON_COLAB)
print("Path to data root:        ", p2dataroot.absolute())
print("Path to cnn virus data    ", p2data.absolute())
Running locally
Notebook running on Colab? False
Path to data root:         /home/vtec/projects/bio/metagentorch/nbs-dev/data_dev
Path to cnn virus data     /home/vtec/projects/bio/metagentorch/nbs-dev/data_dev
assert not ON_COLAB, 'ON_COLAB should be on False'
assert p2dataroot.name == 'data_dev', f"Should be 'data_dev` and not {p2dataroot.name}"
assert p2data.name == 'data_dev', f"Should be 'data_dev` and not {p2data.name}"

source

update_dev_cfg_file

 update_dev_cfg_file ()

Update the metagentorch configuration file used for development, to point to the correct package root and data directory

update_dev_cfg_file()