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.3-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.3-cp314-cp314-manylinux_2_35_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.35+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.14macOS 10.15+ x86-64

silodb-0.11.3-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.3-cp313-cp313-manylinux_2_35_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.15+ x86-64

silodb-0.11.3-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.3-cp312-cp312-manylinux_2_35_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.15+ x86-64

silodb-0.11.3-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.3-cp311-cp311-manylinux_2_35_aarch64.whl (8.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

silodb-0.11.3-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.3-cp314-cp314-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for silodb-0.11.3-cp314-cp314-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 71b7bfc7c56cd4df3da29fff7f6e7953c4e4115f3081262ffd8390996fc3b2d0
MD5 2bd0e966c08ccbd5c06f91c47b96182f
BLAKE2b-256 5fd46729d6f772711e6b743a8d3a1abd29c4ca75b766c963a0c65e64c4a64fe5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp314-cp314-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 c18b493d6da8873ec3b59dc52575e0afb16ea14148ff9ad8707ab62167b0b59d
MD5 23a1116168779470ac11aa2c27f5dcb9
BLAKE2b-256 06f23e5c4550fa302783983159f59a6a4c1581c2a4a3b875e5f5eb9502fc8cc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5debf0bf2a6767501257af6bef49114e91be1236ab97863c1bb470769f03bac
MD5 733a01807bd2fb47abee2e6699513ceb
BLAKE2b-256 e41ca3812dbd43c10f981acccbe4a01ed41d4c8247a94c674eb4fa06cb4c3d4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d63ac0357c52137e96f25703a49a1ea2c77e592f7e10d2fde91082fbb8100034
MD5 78b7cecfc8d34a37a5b4cfe7be453d85
BLAKE2b-256 70aeab515edfa1f6b6c9bff9e898ce0b9ccfab8cad0694b7c810798f2bed9666

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 5e885627be3b511187daea9ea72df3b08f479f97f97013ecbb69d492152f32f3
MD5 c8ebd6aae8c557444a4aced1d9c41365
BLAKE2b-256 836821bedd2e9fc473b536df69fb416996d908672e1dbfd31e11f1a5ff38f5da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp313-cp313-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 fb72a5857dd07d7c600c76e9f233587b3f974f44fddc79417dc95bf8cef38124
MD5 389bd69792fa75c4cea26a51fc618ba1
BLAKE2b-256 761f40f7439f14c23189dba7bc47a317e5148bd8ea367d16588a9ca46976e350

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6a20267e571f406f88715a42fc7d9e458c58227709d040904410172a80410d6
MD5 2857defe1219d55c9bd93653c030207f
BLAKE2b-256 448ff111df1c294ab0b0d6fba5276d047b826cee52380e3d0f6914eb8f120066

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp313-cp313-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 8ff24d9b635fee0f231ba18fe8971438d2dd99dd5e6c345fd8795b3f19999e44
MD5 52c388a78f0140882821e8a60cc16c62
BLAKE2b-256 dd23a6a6e6aa7e8bfaeaa762553018982819e285f31bd10360040c8b4b987ea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 bf2c762d342d04c97a59b5c0302da2106055af5a2616eb6067458b4dfaa41e09
MD5 442c375e98d54ce052782c437bb07714
BLAKE2b-256 71e36959046fc8960df6748dbd0d9b2317f80d672031188be08ae2f0b9bc3bf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp312-cp312-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 4a7283f53b469c3a1d34a75a374156a4b5e62e80bb1582878289ae06c1b5a22d
MD5 52dba943986fada5ab13cac93cb93506
BLAKE2b-256 645b37442689f2ca2e24e252051d0e6fe51f4d5f51b1968009a671eb85a6a0c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edca7b464a2d24e8efa1d3fd209be0912ec071af8008fc372cff059e38fa717a
MD5 7905b1ecb7ddbeb68d0ec4065c6c38cf
BLAKE2b-256 d79e45f34e7f42e891ac3b6079997d717c115b3bd0cf714c78874b342d738442

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp312-cp312-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 7a6d5f7717f2f6d5504393837e1ce23a1eb12f20bcc7c474a8c5cad9e7ca3668
MD5 ca9a7bbb1688c68aa40ef5e42dd68232
BLAKE2b-256 eab12bf08dde296d6d46f5fa5a7a46dca922878584869d487f93dd1bc40328d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 9d94ba1de2a0466865d0baf8deecb29fdf343fb6e9408087e0adfdb745c2a956
MD5 0295e45dfe6549baa6401b4aae9d666e
BLAKE2b-256 3d8229ebb9bf4dc893b4a394b8ff09d0e63c89acfb22c83e5055b6a35c7cd2f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp311-cp311-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 f1d23cf3d17d016496b3e6006c746979a4621e22fe4762ac10bb8b4e75038915
MD5 7e17550c9a3b8599ef0e35a455522ddf
BLAKE2b-256 eaae9595d0904f85d1ae06eca221ee27c515b24fa61536bb66c4b777c5f625a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e77b038a34ba904166000c94da6257b68579b4c990a5778acc4127a1bee110ba
MD5 5ffc48fdf138e07d4278c2cb06f724ea
BLAKE2b-256 92c61ebb0f377606af434a7a41891a26035c1c6e09ee1cf1d04bbb7d9537a5a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for silodb-0.11.3-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 9a7ff0b66f685902fd8000ce20b68370f667ae61009af0e0abd49d2124cbe98f
MD5 7e78a70a434a5fab3d948e419b20c6d1
BLAKE2b-256 b83403040096e5a8a66548043e5b23c0713dc7b2892c4f808a5d5759199469f8

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