### Get Schema Snapshot from Chewie-NS Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/tutorials/chewieNS_step_by_step.md Example command to download a snapshot of the schema from chewie-NS, representing its state at a specific point in time, prior to a synchronization process. This is useful for version control and rollback. Ensure to use '--ns tutorial'. ```bash chewie-ns schema snapshot --schema-dir sagalactiae_schema --snapshot-dir sagalactiae_schema_snapshot --ns tutorial ``` -------------------------------- ### LoadSchema Command Examples Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/LoadSchema.md Examples of how to use the chewBBACA.py LoadSchema command with different options. ```APIDOC ## LoadSchema Command Examples This section provides examples of using the `chewBBACA.py LoadSchema` command to upload schema files and annotations. ### Basic Schema Upload To upload a schema for *Escherichia coli* using its species ID: ```none chewBBACA.py LoadSchema -i path/to/SchemaFolder -sp 9 -sn cgMLST_95 -lp cgMLST_95 ``` To upload a schema for *Escherichia coli* using its species name: ```none chewBBACA.py LoadSchema -i path/to/SchemaFolder -sp "Escherichia coli" -sn cgMLST_95 -lp cgMLST_95 ``` ### Schema Upload with Description and Annotations To upload a schema and provide a description file and a TSV file with annotations: ```none chewBBACA.py LoadSchema -i path/to/SchemaFolder -sp 9 -sn cgMLST_95 -lp cgMLST_95 --df description.txt --a annotations.tsv ``` ### Resuming an Interrupted Upload To continue an upload that was interrupted or aborted, add the `--continue_up` argument to the original command: ```none chewBBACA.py LoadSchema -i path/to/SchemaFolder -sp 9 -sn cgMLST_95 -lp cgMLST_95 --continue_up ``` ### Contact Information If you encounter issues with schema upload or data accuracy, please contact us via email: [imm-bioinfo@medicina.ulisboa.pt](mailto:imm-bioinfo@medicina.ulisboa.pt) ``` -------------------------------- ### Upload Tutorial Schema to Chewie-NS Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/tutorials/chewieNS_step_by_step.md Example command to upload a tutorial schema to the chewie-NS tutorial instance. Ensure to include '--ns tutorial' to target the correct instance. This action uploads the schema definition for further use. ```bash chewie-ns schema upload --file sagalactiae_schema/Streptococcus_agalactiae.trn --ns tutorial ``` -------------------------------- ### Download Schema from Chewie-NS Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/tutorials/chewieNS_step_by_step.md Example command to download a schema previously uploaded to the chewie-NS tutorial instance. This retrieves the schema definition, allowing for local analysis or backup. Always specify '--ns tutorial' to connect to the tutorial instance. ```bash chewie-ns schema download --schema-dir sagalactiae_schema --ns tutorial ``` -------------------------------- ### Load Schema via CLI Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/LoadSchema.md Commands to upload a schema into chewBBACA. These examples demonstrate how to specify the schema directory, species identification, and schema naming conventions. ```bash chewBBACA.py LoadSchema -i path/to/SchemaFolder -sp 9 -sn cgMLST_95 -lp cgMLST_95 chewBBACA.py LoadSchema -i path/to/SchemaFolder -sp "Escherichia coli" -sn cgMLST_95 -lp cgMLST_95 ``` -------------------------------- ### GET /species/{species_id}/schemas/{schema_id}/zip Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/DownloadSchema.md Downloads a compressed ZIP archive of a specific schema for a given species. ```APIDOC ## GET /species/{species_id}/schemas/{schema_id}/zip ### Description Downloads a ZIP archive containing a ready-to-use schema for the specified species and schema ID. ### Method GET ### Endpoint /species/{species_id}/schemas/{schema_id}/zip ### Parameters #### Path Parameters - **species_id** (integer) - Required - The ID of the species. - **schema_id** (integer) - Required - The ID of the schema. #### Query Parameters - **request_type** (string) - Required - Set to 'download'. ### Response #### Success Response (200) - **file** (binary) - The ZIP archive containing the schema files. #### Response Example Binary stream of the .zip file. ``` -------------------------------- ### GET /species/list Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/DownloadSchema.md Retrieves a list of all available bacterial species and their corresponding IDs from Chewie-NS. ```APIDOC ## GET /species/list ### Description Returns a list of all species currently available in the Chewie-NS database. ### Method GET ### Endpoint /species/list ### Response #### Success Response (200) - **species_list** (array) - A list of objects containing species names and IDs. #### Response Example { "species": [ { "id": 9, "name": "Escherichia coli" } ] } ``` -------------------------------- ### GET /species/{species_id} Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/DownloadSchema.md Retrieves detailed information about a specific species, including available schemas and their IDs. ```APIDOC ## GET /species/{species_id} ### Description Fetches details for a specific species, including a list of associated schemas. ### Method GET ### Endpoint /species/{species_id} ### Parameters #### Path Parameters - **species_id** (integer) - Required - The unique identifier for the species. ### Response #### Success Response (200) - **schemas** (array) - List of schemas associated with the species. #### Response Example { "species_id": 9, "schemas": [ { "id": 1, "name": "Core Genome Schema" } ] } ``` -------------------------------- ### Adapt External Schema using chewBBACA CLI Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/PrepExternalSchema.md This command-line interface (CLI) command demonstrates the basic usage of the PrepExternalSchema module. It takes a directory of external schema files and an output directory as required arguments, along with an optional Prodigal training file. ```bash chewBBACA.py PrepExternalSchema -g /path/to/ExternalSchemaFolder -o /path/to/OutputFolder --ptf /path/to/ProdigalTrainingFile ``` -------------------------------- ### Retrieve Schema via cURL Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/DownloadSchema.md Directly download a zipped schema file from the Chewie-NS API using a standard HTTP GET request. ```bash curl -X GET "https://chewbbaca.online/NS/api/species/9/schemas/1/zip?request_type=download" -H "accept: application/json" ``` -------------------------------- ### Upload Schema to chewie-NS Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/tutorials/chewieNS_step_by_step.md This command executes the LoadSchema module to upload a local schema to the chewie-NS tutorial instance. It requires specifying the input directory, species ID, schema name, description file, and annotation file. ```bash chewBBACA.py LoadSchema -i sagalactiae_schema/ -sp 1 -sn tut -lp tut --df sagalactiae_description.md --a sagalactiae_annotations.tsv --ns tutorial ``` -------------------------------- ### Download Schema Snapshot by Date Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/DownloadSchema.md Downloads a schema snapshot as it existed at a specific date and time. The date format must be yyyy-mm-ddThh:mm:ss. ```bash chewBBACA.py DownloadSchema -sp 9 -sc 1 -o path/to/DownloadFolder --date 2020-06-30T19:10:37 ``` -------------------------------- ### Load Schema with Metadata and Annotations Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/LoadSchema.md Commands to upload a schema while including a description file and a custom TSV annotation file. This allows for enriched metadata for specific loci within the schema. ```bash chewBBACA.py LoadSchema -i path/to/SchemaFolder -sp 9 -sn cgMLST_95 -lp cgMLST_95 --df description.txt --a annotations.tsv ``` -------------------------------- ### Download Schema via chewBBACA CLI Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/DownloadSchema.md Basic command to download a schema by specifying the species ID, schema ID, and output directory. The output directory must be empty or non-existent. ```bash chewBBACA.py DownloadSchema -sp 9 -sc 1 -o path/to/DownloadFolder ``` -------------------------------- ### Download schema using chewBBACA DownloadSchema module Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/tutorials/chewieNS_step_by_step.md Executes the DownloadSchema module to retrieve a schema from the chewie-NS server. Requires the species ID (-sp) and schema ID (-sc) to be specified, with the output directory defined by the -o flag. ```bash chewBBACA.py DownloadSchema -sp 1 -sc 1 -o sagalactiae_ns --ns tutorial ``` -------------------------------- ### Download Schemas from Chewie-NS Source: https://context7.com/b-ummi/chewbbaca/llms.txt The DownloadSchema module retrieves pre-defined cg/wgMLST schemas from the Chewie-NS public nomenclature server. Users can specify species, schema IDs, snapshots, or use the latest versions. ```bash chewBBACA.py DownloadSchema -sp 9 -sc 1 -o /path/to/download_folder chewBBACA.py DownloadSchema -sp 9 -sc 1 -o /path/to/download_folder --date 2024-06-30T19:10:37 chewBBACA.py DownloadSchema -sp 9 -sc 1 -o /path/to/download_folder --latest --cpu 6 chewBBACA.py DownloadSchema -sp 1 -sc 1 -o /path/to/download_folder --ns tutorial ``` -------------------------------- ### POST /PrepExternalSchema Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/PrepExternalSchema.md Adapts an external schema directory into a format compatible with chewBBACA by filtering and validating sequences. ```APIDOC ## POST /PrepExternalSchema ### Description Adapts an external schema directory into a format compatible with chewBBACA. It filters sequences based on coding sequence integrity and character validity. ### Method POST ### Endpoint chewBBACA.py PrepExternalSchema ### Parameters #### Query Parameters - **-g, --schema-directory** (string) - Required - Path to the directory containing schema FASTA files. - **-o, --output-directory** (string) - Required - Path to the output directory. - **--ptf, --training-file** (string) - Optional - Path to the Prodigal training file. - **--bsr** (float) - Optional - BLAST Score Ratio threshold (default: 0.6). - **--cpu** (integer) - Optional - Number of CPU cores to use (default: 1). - **--size-filter** (boolean) - Optional - Flag to apply length and size threshold filtering. ### Request Example chewBBACA.py PrepExternalSchema -g /path/to/ExternalSchemaFolder -o /path/to/OutputFolder --ptf /path/to/ProdigalTrainingFile ### Response #### Success Response (200) - **files** (array) - Generates _invalid_alleles.txt, _invalid_genes.txt, and _summary_stats.tsv. ``` -------------------------------- ### Download Latest Schema Version Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/DownloadSchema.md Forces the retrieval of the latest schema version, ensuring the local copy is up-to-date with the server. ```bash chewBBACA.py DownloadSchema -sp 9 -sc 1 -o path/to/DownloadFolder --latest ``` -------------------------------- ### Synchronize Local Schema with Chewie-NS Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/tutorials/chewieNS_step_by_step.md Command to synchronize novel alleles identified during local analysis back to the remote schema on chewie-NS. This updates the central schema with new findings. Use '--ns tutorial' to ensure synchronization with the tutorial instance. ```bash chewie-ns schema sync --schema-dir sagalactiae_schema --alleles-dir sagalactiae_genomes/subset1 --ns tutorial ``` -------------------------------- ### DownloadSchema Source: https://context7.com/b-ummi/chewbbaca/llms.txt Downloads pre-defined cg/wgMLST schemas from the Chewie-NS nomenclature server. ```APIDOC ## CLI DownloadSchema ### Description Retrieves cg/wgMLST schemas from the public Chewie-NS server based on species and schema IDs. ### Method CLI Command ### Endpoint chewBBACA.py DownloadSchema ### Parameters #### Required - **-sp** (int) - Species ID - **-sc** (int) - Schema ID - **-o** (path) - Output directory #### Optional - **--date** (string) - Specific snapshot date (ISO format) - **--latest** (flag) - Download the latest version - **--ns** (string) - Specify nomenclature server (e.g., 'tutorial') ``` -------------------------------- ### Create wgMLST Schema Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/CreateSchema.md Executes the CreateSchema command to generate a new schema from a folder of FASTA assemblies. It requires a path to the input assemblies, an output directory, a schema name, and a Prodigal training file. ```bash chewBBACA.py CreateSchema -i /path/to/InputAssembliesFolder -o /path/to/OutputFolder --n SchemaName --ptf /path/to/ProdigalTrainingFile ``` -------------------------------- ### LoadSchema Module - Schema Upload Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/modules/LoadSchema.md This endpoint allows users to upload local schemas to Chewie-NS. It requires several parameters to identify the species, schema, and associated files, and supports optional parameters for descriptions, annotations, and performance tuning. ```APIDOC ## POST /b-ummi/chewbbaca/upload/schema ### Description Uploads a local schema to the Chewie-NS database. This process involves user authentication, schema validation, data upload, and association with species. ### Method POST ### Endpoint /b-ummi/chewbbaca/upload/schema ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **schema_directory** (string) - Required - Path to the directory of the schema to upload. - **species_id** (integer or string) - Required - The integer identifier or name of the species that the schema will be associated to in Chewie-NS. - **schema_name** (string) - Required - A brief and meaningful name for the schema. - **loci_prefix** (string) - Required - Prefix included in the name of each locus of the schema. - **description_file** (string) - Optional - Path to a text file with a description about the schema. Markdown syntax is supported. Defaults to the schema's name if not provided. - **annotations** (string) - Optional - Path to a TSV file with loci annotations. - **cpu_cores** (integer) - Optional - Number of CPU cores/threads to use for the process. Defaults to 1. - **nomenclature_server** (string) - Optional - The base URL for the Chewie-NS instance. Defaults to 'main' (https://chewbbaca.online/). - **continue_up** (boolean) - Optional - If true, attempts to continue an interrupted schema upload. Defaults to False. ### Request Example ```json { "schema_directory": "/path/to/your/schema", "species_id": 123, "schema_name": "MySchema", "loci_prefix": "LOC", "description_file": "/path/to/description.md", "annotations": "/path/to/annotations.tsv", "cpu_cores": 4, "nomenclature_server": "tutorial", "continue_up": false } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of successful schema upload. - **schema_id** (string) - The unique identifier of the uploaded schema. #### Response Example ```json { "message": "Schema uploaded successfully.", "schema_id": "schema_abc123" } ``` ### Error Handling - **400 Bad Request**: Invalid input parameters or schema format. - **401 Unauthorized**: User does not have contributor privileges. - **404 Not Found**: Species not found in Chewie-NS. - **500 Internal Server Error**: An error occurred during the upload process. ``` -------------------------------- ### Create wgMLST Schema Source: https://github.com/b-ummi/chewbbaca/wiki/Tutorial-example Initializes a new wgMLST schema from a set of complete genomes. It processes input genomes from a directory and outputs the schema to a specified folder. ```bash chewBBACA.py CreateSchema -i complete_genomes/ --cpu 6 -o schema_seed -t Streptococcus_Agalactiae ``` -------------------------------- ### Perform Allele Calling with chewBBACA Source: https://github.com/b-ummi/chewbbaca/wiki/2.-Allele-Calling This command initiates the allele calling process using chewBBACA. It requires input assemblies, a schema, and an output directory. Optional parameters allow for specifying training files, gene lists, CPU usage, BLAST executables, Prodigal modes, and process continuation or reset. ```bash chewBBACA.py AlleleCall -i /path/to/InputAssemblies -g /path/to/SchemaName -o /path/to/OutputFolderName --cpu 4 ``` -------------------------------- ### Run AlleleCallEvaluator Module Source: https://github.com/b-ummi/chewbbaca/blob/master/CHEWBBACA/docs/user/tutorials/chewie_step_by_step.md Executes the AlleleCallEvaluator module to process allele calling results, generate statistics, and create an interactive HTML report. It requires input directories for results and schema, and optionally accepts annotation files and CPU core configuration. ```bash chewBBACA.py AlleleCallEvaluator -i results680_cgMLST -g tutorial_schema/schema_seed -o results_report --a schema_annotations/schema_seed_annotations.tsv --cpu 6 ```