Skip to main content

Python bindings for SILO - high-performance sequence database

Project description

LAPIS-SILO

High-performance analytical database for sequence alignment data

For information on how to build, test, and contribute to SILO, see Contributing.

Python Bindings

SILO provides Python bindings via Cython. The bindings wrap the core C++ Database and are installable by pip install silodb.

See Contributing for build instructions.

Usage

from silodb import Database

# Create a new database
db = Database()

# Or load from a saved state
db = Database("/path/to/saved/database")

# Create a nucleotide sequence table
db.create_nucleotide_sequence_table(
    table_name="sequences",
    primary_key_name="id",
    sequence_name="main",
    reference_sequence="ACGT..."
)

# Append data from file
db.append_data_from_file("sequences", "/path/to/data.ndjson")

# Get reference sequence
ref = db.get_nucleotide_reference_sequence("sequences", "main")

# Get filtered bitmap (list of matching row indices)
indices = db.get_filtered_bitmap("sequences", "some_filter")

# Get prevalent mutations
mutations = db.get_prevalent_mutations(
    table_name="sequences",
    sequence_name="main",
    prevalence_threshold=0.05,
    filter_expression=""
)

# Save database state
db.save_checkpoint("/path/to/save/directory")

# Print all data (to stdout)
db.print_all_data("sequences")

Configuration Files

For SILO, there are three different configuration files:

  • DatabaseConfig described in file database_config.h
  • PreprocessingConfig used when started with preprocessing and described in file preprocessing_config.h. For details see silo preprocessing --help.
  • RuntimeConfig used when started with api and described in file runtime_config.h For details see silo api --help.

The database config contains the schema of the database and is always required when preprocessing data. The database config will be saved together with the output of the preprocessing and is therefore not required when starting SILO as an API.

An example configuration file can be seen in testBaseData/exampleDataset/database_config.yaml.

By default, the config files are expected to be YAML files in the current working directory in snake_case (database_config.yaml, preprocessing_config.yaml, runtime_config.yaml), but their location can be overridden using the options --database-config=X, --preprocessing-config=X, and --runtime-config=X.

Preprocessing and Runtime configurations contain default values for all fields and are thus only optional. Their parameters can also be provided as command-line arguments in snake_case and as environment variables prefixed with SILO_ in capital SNAKE_CASE. (e.g. SILO_INPUT_DIRECTORY).

The precendence is CLI argument > Environment Variable > Configuration File > Default Value

Run The Preprocessing

The preprocessing acts as a program that takes an input directory that contains the to-be-processed data and an output directory where the processed data will be stored. Both need to be mounted to the container.

SILO expects a preprocessing config that can to be mounted to the default location /app/preprocessing_config.yaml.

Additionally, a database config and a ndjson file containing the data are required. They should typically be mounted in /preprocessing/input.

docker run \
  -v your/input/directory:/preprocessing/input \
  -v your/preprocessing/output:/preprocessing/output \
  -v your/preprocessing_config.yaml:/app/preprocessing_config.yaml
  silo preprocessing

Both config files can also be provided in custom locations:

silo preprocessing --preprocessing-config=./custom/preprocessing_config.yaml --database-config=./custom/database_config.yaml

The Docker image contains a default preprocessing config that sets defaults specific for running SILO in Docker. Apart from that, there are default values if neither user-provided nor default config specify fields. The user-provided preprocessing config can be used to overwrite the default values. For a full reference, see the help text.

Run docker container (api)

After preprocessing the data, the api can be started with the following command:

docker run
  -p 8081:8081
  -v your/preprocessing/output:/data
  silo api

The directory where SILO expects the preprocessing output can be overwritten via silo api --data-directory=/custom/data/directory or in a corresponding configuration file.

Acknowledgments

Original genome indexing logic with roaring bitmaps by Prof. Neumann: https://db.in.tum.de/~neumann/gi/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

silodb-0.11.2-cp314-cp314-manylinux_2_35_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.35+ x86-64

silodb-0.11.2-cp314-cp314-manylinux_2_35_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.35+ ARM64

silodb-0.11.2-cp314-cp314-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

silodb-0.11.2-cp314-cp314-macosx_10_15_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

silodb-0.11.2-cp313-cp313-manylinux_2_35_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ x86-64

silodb-0.11.2-cp313-cp313-manylinux_2_35_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ ARM64

silodb-0.11.2-cp313-cp313-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

silodb-0.11.2-cp313-cp313-macosx_10_15_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.13macOS 10.15+ x86-64

silodb-0.11.2-cp312-cp312-manylinux_2_35_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

silodb-0.11.2-cp312-cp312-manylinux_2_35_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ ARM64

silodb-0.11.2-cp312-cp312-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

silodb-0.11.2-cp312-cp312-macosx_10_15_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.12macOS 10.15+ x86-64

silodb-0.11.2-cp311-cp311-manylinux_2_35_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

silodb-0.11.2-cp311-cp311-manylinux_2_35_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ ARM64

silodb-0.11.2-cp311-cp311-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

silodb-0.11.2-cp311-cp311-macosx_10_15_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.11macOS 10.15+ x86-64

File details

Details for the file silodb-0.11.2-cp314-cp314-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp314-cp314-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 3f86f725bc8a587fb3b9c59c27d3d823e074cd8c1a23e3b50786791d9d22bbe1
MD5 f02f5a7e65216e9bba9762e301db4f4b
BLAKE2b-256 e3a26114216801bc4643d1692a54b5f40ab456e10f89ce2e8ab82866366e4948

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp314-cp314-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp314-cp314-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 24313080eef643447157e98c505c0a5ed3fa7d551c058b98a7379fe57385aed0
MD5 6fe5bc0f3f9ab244b88a3a5c0a6dd29d
BLAKE2b-256 d5ce95b3432c804c8d357981a3a538a6d0ccaf78f65adb8922c2ee01c7e06dda

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 067f59e090ba0d9c4c3976efd80c848a59a92561f4a7062479a90bb41450330f
MD5 b38196444ebad06d376429316d95a290
BLAKE2b-256 4569ebd30c2c40ad14781c9e832104c3292a24d07b1c7ce09976ef4ca4a74953

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d2c18da9235a66bac5c5692712bb8e4da3fcd972b60d2b2793744e799c9f0b44
MD5 b63071116ac3ce251a181cadebbe18f1
BLAKE2b-256 ae5bc370bd8347a392df6ff38318cd070cca2edfa8a8dbf01dc3d92a158f29e8

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 919caddb9ff53a616ee36ac81285b2ebf87620778c06c671ea7205df906ae08c
MD5 06f7c4e345981ff2a5d67bffd7e0fa56
BLAKE2b-256 ca06e2bd8222b95b4945fa1fa51335137b7972603d803d4a89bd2d318bc4c051

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp313-cp313-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp313-cp313-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 4ad7efeac2e7c30a1430807d5b7ed289c801e349a9da9148a3d7bc343cfa54d5
MD5 8b470a567c2e1979c51d9fb7bd15b94b
BLAKE2b-256 6b650b87bd80863119c4ce96514bca6678a730e471228e83c18ca27617ab5493

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3969ce4df1a5e514c17a633289201d57119aade9b75e8a4c7d2afaff58e0e375
MD5 f186cfc0e7a8ed0529143628fcce747b
BLAKE2b-256 3b78394e81eb7b9f76a090c188ca11edb48bf512ad295b163ec39cc2adb66737

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp313-cp313-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp313-cp313-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 6303290e5c7a06c8b2f9a98075083b9d91768c06b469c30d0510ab0534ca948d
MD5 00ce4de8ebdb7b0b4581e39576c51d1c
BLAKE2b-256 3b385d0b0d642fbe4ec6fb5ec45288c011483b3a7aebf2501219b467e1dcb3f1

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 9d18489c56813621d2dac2e17724ddea2c437f6a928e9907c86669126e9a6404
MD5 10aee5b4ab504119d4cb498a5faae9f8
BLAKE2b-256 46e79e6abfdbf160818d9d6ea7efdedf5ad664e26831967e04300b9988762b74

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp312-cp312-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp312-cp312-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 cde786c0262a55908db2340affc7a059691313ce6f24bc9faaa1a9e5f8651206
MD5 73a2ab335c3ae8dc221967d35113ea89
BLAKE2b-256 09ac55a784425c89b38d8eaad9e6a739e409475310d7d803d87e43e072220962

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3dcde2e6cc35d59adff5a9ce26fdecfaa186399c2d3085f64abafca26a17282
MD5 eb4b8691d60b34b41bd8056f7372070c
BLAKE2b-256 792679c7142a692ac1fe434372adf8062c66338d7e2339a4a4e8784014b59f46

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp312-cp312-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp312-cp312-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 1d21c586694b8375823a7e7bdff1c5e58e03918112ee939c90a1a4d67cd8f998
MD5 0a10a1cb919ebcf5314ffe2f1d29345e
BLAKE2b-256 840a82470d4adc9ffb6b0d4eec91557f7b1f7783e24c3f69e7227e4ead5db90b

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 64064a051f71d60b42cd63443500ca501099494c96d9f96b974444185f1c6b78
MD5 354b65fe40faf890003d1c787ddbd710
BLAKE2b-256 5f93b739e0df6fd196ffa39c3fa9d8f35ecb617b2c9177049abedb2c4bcc5e26

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp311-cp311-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp311-cp311-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 4ede4bd6ae65de2a00cde3fa006e331fc469677433a79ad7253668a597a377ba
MD5 7f950519cb9e7eff102af4b464e15d47
BLAKE2b-256 023238dd3b54f44d53e303ff8457530e21a84347f3335d870f4783e2a5033aff

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 868b923ef5d9b7139c97fbbaea41e4f10ed2761910a179cbe1b384c34d08e380
MD5 11590a16b0fb6e22534c85ef1c2529a9
BLAKE2b-256 b21fff01d46f9f3df726bda82fd23904fa4de100c700bd52be6989aacac9f11f

See more details on using hashes here.

File details

Details for the file silodb-0.11.2-cp311-cp311-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.2-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 35037accdac4b3044be57160309f822a8c6acee3000c676a6ac3f1df0a3cf8e6
MD5 369d2704d32280aa243d7b62bf796b48
BLAKE2b-256 2e74fe0f06a683dbc8a5f47071dcfab211588344f932f3e4f01d9185c96765fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page