MCPcopy Index your code
hub / github.com/biobakery/biobakery_workflows

github.com/biobakery/biobakery_workflows @4.0.0a1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 4.0.0a1 ↗ · + Follow
387 symbols 986 edges 54 files 274 documented · 71%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

bioBakery Workflows

bioBakery workflows is a collection of workflows and tasks for executing common microbial community analyses using standardized, validated tools and parameters. Quality control and statistical summary reports are automatically generated for most data types, which include 16S amplicons, metagenomes, and metatranscriptomes. Workflows are run directly from the command line and tasks can be imported to create your own custom workflows. The workflows and tasks are built with AnADAMA2 which allows for parallel task execution locally and in a grid compute environment.

For additional information, see the bioBakery workflows tutorial.

Table of contents * Getting Started + Requirements + Installation - Install software - Install databases + How to Run - Basic Usage - Data Processing Workflows - Visualization Workflows + Parallelization Options * Data Processing Workflows + Whole Metagenome Shotgun (wmgx) + Whole Metagenome and Metatranscriptome Shotgun (wmgx_wmtx) + 16S rRNA (16s) + Isolate Assembly (isolate_assembly) * Visualization Workflow + Visualization for Whole Metagenome Shotgun and 16S (vis) * Stats Workflow * WDL Workflow


Getting Started


Requirements

  1. AnADAMA2 (installed automatically)
  2. Python v2.7+
  3. See individual workflows and tasks for additional software requirements.

Installation

Install software

bioBakery workflows can be installed with Conda, Docker, or pip.

To install with Conda:

$ conda install -c biobakery biobakery_workflows
  • Before installing the tool, configure your channels so biobakery is at the top of the list.
  • This will install almost all of the dependencies for all workflows (ie Kneaddata, MetaPhlan2, etc.) excluding those dependencies that have licenses.

To install and run with Docker:

$ docker run -it biobakery/workflows bash
  • The image will include all dependencies for all workflows (ie Kneaddata, MetaPhlan2, etc.) excluding those dependencies that have licenses.

To install with pip:

$ pip install biobakery_workflows

Install databases

Install automatically

Once the software and dependencies are installed, the databases can be installed automatically.

Run the following command to install the databases required for a workflow:

$ biobakery_workflows_databases --install $WORKFLOW

  • Replace $WORKFLOW with the workflow name (ie wmgx, 16s, wmgx_wmtx, or wmgx_demo, isolate_assembly).
  • The databases will be installed at $HOME/biobakery_workflow_databases/ or /opt/biobakery_workflow_databases/ depending on permissions.
  • To install to a custom location add the option --location $FOLDER. With this option you will also need to set the environment variable $BIOBAKERY_WORKFLOWS_DATABASES to the folder so the workflows can find the installed databases.
  • The database install requires some of the dependencies from the corresponding workflow to build and install the databases. For example, installing the wmgx databases requires HUMAnN, KneadData, StrainPhlAn and bowtie2. Please install these dependencies prior to installing the databases. Depending on the method used to install the workflows you might need to install these dependencies in addition to the workflow.

Install manually

Alternatively the databases can be installed manually and then referenced with environment variables. The shotgun data processing workflows require Kneaddata (human, human transcriptome, and SILVA), HUMAnN (utility mapping, nucleotide, and protein databases), and StrainPhlAn (reference and marker) databases while the 16s data processing workflow requires the GreenGenes fasta, taxonomy, and usearch formatted files.

When manually installing the databases, the following environment variables need to be set.

  • Shotgun workflows: KNEADDATA_DB_HUMAN_GENOME, KNEADDATA_DB_RIBOSOMAL_RNA, KNEADDATA_DB_HUMAN_TRANSCRIPTOME, STRAINPHLAN_DB_REFERENCE, and STRAINPHLAN_DB_MARKERS.
  • 16s workflows: GREEN_GENES_USEARCH_DB, GREEN_GENES_FASTA_DB, and GREEN_GENES_TAXONOMY_DB.

How to Run

Basic Usage

All workflows follow the general command format:

$ biobakery_workflows $WORKFLOW --input $INPUT --output $OUTPUT

For a list of all available workflows, run:

$ biobakery_workflows --help

For specific options for a workflow, run:

$ biobakery_workflows $WORKFLOW --help

Data Processing Workflows

The basic command to run a data processing workflow, replacing $WORKFLOW with the workflow name, is:

$ biobakery_workflows $WORKFLOW --input $INPUT_DIR --output $DATA_OUTPUT_DIR

This command will run the workflow on the files in the input folder ($INPUT_DIR to be replaced with the path to the folder containing fastq files). It will write files to the output folder ($DATA_OUTPUT_DIR to be replaced with the folder to write output files).

Visualization Workflow

A single visualization workflow exists that can be used for any data processing workflow. The basic command to run a visualization workflow, replacing $WORKFLOW_VIS with the visualization workflow name, is:

$ biobakery_workflows $WORKFLOW_VIS --input $DATA_OUTPUT_DIR --project-name $PROJECT --output $OUTPUT_DIR

The input folder ($DATA_OUTPUT_DIR to be replaced with the path to the folder) in this command this is a subset of the output folder from the data processing workflow; Run the workflow with the option --help to determine which files are required and which are optional to run the workflow. The folder ($OUTPUT_DIR to be replaced with the path to the output folder) will contain the output files from the visualization workflow. The project name should replace $PROJECT in the command so the report can include the name.

Parallelization Options

When running any workflow you can add the following command line options to make use of existing computing resources:

  • --local-jobs <1> : Run multiple tasks locally in parallel. Provide the max number of tasks to run at once. The default is one task running at a time.
  • --grid-jobs <0> : Run multiple tasks on a grid in parallel. Provide the max number of grid jobs to run at once. The default is zero tasks are submitted to a grid resulting in all tasks running locally.
  • --grid <slurm> : Set the grid available on your machine. This will default to the grid found on the machine with options of slurm and sge.
  • --partition <serial_requeue> : Jobs will be submitted to the partition selected. The default partition selected is based on the default grid.

For additional workflow options, see the AnADAMA2 user manual.


Data Processing Workflows


bioBakery workflows includes a collection of workflows for shotgun sequences and 16s data processing. Most workflows can be run on the command line with the following syntax:

$ biobakery_workflows $WORKFLOW --input $INPUT --output $OUTPUT

See the section on parallelization options to optimize the workflow run based on your computing resources.

Whole Metagenome Shotgun (wmgx)

Super Tasks

  1. [Quality control]
  2. [Taxonomic profiling]
  3. [Functional profiling]
  4. Strain profiling
  5. Assembly (not run by default)

Requirements

  1. KneadData (v0.12.0+)
    1. Install with: $ conda install -c biobakery kneaddata OR $ pip install kneaddata
  2. MetaPhlAn
    1. Install with: $ conda install -c bioconda metaphlan
  3. HUMAnN
    1. Install with: $ conda install -c biobakery humann OR $ pip install humann
  4. StrainPhlAN
    1. Install with: $ conda install -c bioconda strainphlan
  5. Prokka (Only required if running in assembly mode)
  6. MegaHit (Only required if running in assembly mode)
  7. seqtk (Only required if running in assembly mode)

Inputs

  1. A set of fastq (or fastq.gz) files (single-end or paired-end). The files are expected to be named $SAMPLE.fastq.gz,$SAMPLE.R1.fastq.gz, or $SAMPLE.R2.fastq.gz where $SAMPLE is the sample name or identifier corresponding to the sequences. $SAMPLE can contain any characters except spaces or periods.

The workflow will detect if paired-end files are present. By default the workflow identifies paired end reads based on file names containing ".R1" and ".R2" strings. If your paired end reads have different identifiers, use the option --pair-identifier .R1 to provide the identifier string for the first file in the set of pairs.

The workflow by default expects input files with the extension "fastq.gz". If your files are not gzipped, run with the option --input-extension fastq.

To run the workflow

  • $ biobakery_workflows wmgx --input $INPUT --output $OUTPUT
  • In the command replace $INPUT with the path to the folder containing your fastq input files and $OUTPUT with the path to the folder to write output files.
  • See the section on parallelization options to optimize the workflow run based on your computing resources.
  • The workflow runs with the default settings for all main tool subtasks. These settings will work for most data sets. However, if you need to customize your workflow settings for the KneadData and StrainPhlAn subtasks please read the documentation for each tool to determine the optimum settings. Then apply these settings by using options for each tool. For example, --qc-options="$OPTIONS" will modify the default settings when running the KneadData subtask and --strain-profiling-options="$OPTIONS" will modify the options when running the StrainPhlAn subtask (replacing the $OPTIONS in each with your selected settings).
  • Add the option --run-assembly to add the tasks to run assembly.

To run a demo

  • Single-end
    • $ biobakery_workflows wmgx --input examples/wmgx/single/ --output workflow_output
  • Paired-end
    • $ biobakery_workflows wmgx --input examples/wmgx/paired/ --output workflow_output
  • Demo input files can be found in the biobakery_workflow source examples folder.

Whole Metagenome and Metatranscriptome Shotgun (wmgx_wmtx)

Super Tasks

  1. [Quality control]
  2. [Taxonomic profiling]
  3. [Functional profiling]
  4. Strain profiling

Requirements

  1. KneadData (v0.12.0+)
    1. Install with: $ conda install -c biobakery kneaddata OR $ pip install kneaddata
  2. MetaPhlAn
    1. Install with: $ conda install -c bioconda metaphlan
  3. HUMAnN
    1. Install with: $ conda install -c biobakery humann OR $ pip install humann
  4. StrainPhlAN
    1. Install with: $ conda install -c bioconda strainphlan

Inputs

  1. Two sets of fastq (or fastq.gz) files (single-end or paired-end). One set is of whole metagenome shotgun data and the other is whole metatranscriptome shotgun data. The files are expected to be named $SAMPLE.fastq.gz,$SAMPLE.R1.fastq.gz, or $SAMPLE.R2.fastq.gz where $SAMPLE is the sample name or identifier corresponding to the sequences. $SAMPLE can contain any characters except spaces or periods.
  2. Optionally, provide a mapping file. This file will have two columns and be tab delimited. The first column is the sample names for the metatranscriptomes and the second is the corresponding metagenome sample. See the demo mapping file for an example.

The workflow will detect if paired-end files are present. By default the workflow identifies paired end reads based on file names containing ".R1" and ".R2" strings. If your paired end reads have different identifiers, use the option --pair-identifier .R1 to provide the identifier string for the first file in the set of pairs.

The workflow by default exp

Core symbols most depended-on inside this repo

path
called by 33
biobakery_workflows/files.py
readline
called by 28
biobakery_workflows/utilities.py
name_files
called by 18
biobakery_workflows/utilities.py
run_command
called by 13
biobakery_workflows/biobakery_workflows_databases.py
find_data_file
called by 11
biobakery_workflows/utilities.py
catch_open
called by 10
biobakery_workflows/scripts/create_otu_tables_from_alignments.py
run_task
called by 8
biobakery_workflows/utilities.py
try_create_folder
called by 5
biobakery_workflows/biobakery_workflows_databases.py

Shape

Function 302
Method 69
Class 16

Languages

Python100%

Modules by API surface

biobakery_workflows/utilities.py109 symbols
tests/test_utilities.py52 symbols
biobakery_workflows/visualizations.py31 symbols
biobakery_workflows/tasks/sixteen_s.py23 symbols
biobakery_workflows/tasks/shotgun.py18 symbols
biobakery_workflows/files.py13 symbols
biobakery_workflows/scripts/create_otu_tables_from_alignments.py12 symbols
biobakery_workflows/tasks/dadatwo.py10 symbols
biobakery_workflows/scripts/rna_dna_norm.py9 symbols
biobakery_workflows/scripts/create_fasta_per_taxonomy_from_alignments.py9 symbols
biobakery_workflows/config.py9 symbols
biobakery_workflows/scripts/merge_and_rename_fastq.py7 symbols

Datastores touched

hg38Database · 1 repos

For agents

$ claude mcp add biobakery_workflows \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page