Skip to main content

Panpiper: snakemake workflow for bacterial isolate analysis

Project description

Project Status: Active - The project has reached a stable, usable state and is being actively developed.

Panpiper

This package conducts bacterial isolate analysis for one species.

  • Assembly
    • Using shovill the paired fastq files are assembled and sorted into ones which pass and fail assembly
  • Quality control
    • The assemblies are analyzed with CheckM and FastANI
    • Based on user-defined thresholds the samples are sorted into ones which pass or don't pass requirements
  • Pangenome analysis
  • Genome-wide association study
    • The pangenome is used with a continuous or binary phenotype to conduct a genome-wide association study with Pyseer
    • The wrapper scripts used to analyze and filter the data are predominantly taken from the pyseer package.

Note: Be sure to cite all packages used in the pipeline.

Credit: This package structure was inspired by the snakemake workflow MAGinator

Workflow Diagram

Installation

Create package and install dependencies

conda create -n panpiper -c bioconda -c conda-forge snakemake mamba
conda activate panpiper
pip install panpiper

Download databases

  • The databses necessary will be downloaded automatically except in the case of Kraken2 and EggNOG-mapper. These databases have already been downloaded and are maintained in the package structure. In the case that you would like to use your own database, these databases can be downloaded into user-defined directories and can be referenced in the arguments as follows
panpiper ... --kraken_dir {directory} --eggnog_dir {directory} --bakta_dir {directory}

Workflow

Note: The first time these functions are run, they will take a couple minutes before the workflow starts running because the conda dependendies need to be downloaded before start.

Assembly:

The fastq files should all be in a single directory. They need to be paired-end.

panpiper -w assembly -o {output directory} -q {fastq directory} 

Output:

  • Assembly/
    • incomplete_assembly_files.txt - samples for which assembly failed
    • complete_assembly_files.txt - samples for which assemblies passed
    • {sample}/
      • contigs.fa - edited assembly

Quality control:

The fasta file directory should contain a subdirectory for each sample where the subdirectory name is the sample of the sample. The fasta file within these directories should be formatted as contigs.fa. This is the standard output from Shovill. The sample list should have one sample name per line which corresponds to the name of the fasta file. The reference fasta file should be the representative strain of the species which the samples will be compared to using average nucleotide identity.

Additional parameters that may be included:

  • --ani_cutoff : percent identity to reference cutoff (default 95)
  • --n50 : N50 cutoff (default 5000)
  • --contig_number : number of contigs cutoff (default 1000)
panpiper -w quality -o {ouput directory} -a {fasta directory} -s  {sample list} -r {reference fasta file}

Output:

  • Quality/
    • sample_list.txt - samples which passed all requirements
    • failed_samples_checkm.csv - samples which did not meet checkM thresholds
    • failed_samples_ani.csv - samples which did not meet ANI threshold
    • quality_report.html - html to view the summary of quality of assemblies
    • CheckM/
      • checkm_stats.txt - statistics summary of assemblies
      • checkm_log.txt - summary of contamination, completeness, and strain heterogeneity
      • checkm_log_filter.txt - reformat and filter of checkm_log.txt
    • FastANI/
      • fastani_summary.txt - lists percent identity of each sample to the reference
      • fastani_reformat.csv - reformat of the same file
    • Assembly_filter/
      • {sample}/ - includes the filtered fasta files removing contigs less than 500bp and all CheckM information

Pangenome:

The fasta file directory should contain a subdirectory for each sample where the subdirectory name is the sample of the sample. The fasta file within these directories should be formatted as contigs.fa. This is the standard output from Shovill. The sample list should have one sample name per line which corresponds to the directory names. The reference fasta file should be the representative strain of the species which the samples will be compared to using average nucleotide identity.

panpiper -w pangenome  -o {ouput directory} -a {fasta directory} -s  {sample list} -r {reference fasta file}

Output:

  • Pangenome/
    • Bakta/
      • {sample}/ - contains Bakta output for each sample
    • Unitig/
      • unitig.pyseer.gz - the full unitig summary of all samples
    • Phylogeny/ - contains the intermediate trees
    • Panaroo/ - contains the full pangenome summary as well as Bakta annotation for the pangenome
    • AMR/ - contains the full AMR report for each sample
    • Kraken/ - contains the full Kraken report for each sample
    • Phylogroups/ - contains the full division process for phylogroups
    • Summary/
      • AMR.txt - the summary of AMR hits
      • amr.png - visualization of AMR as a heatmap
      • amr_wide.txt - reformat of AMR hits from long to wide
      • core_gene_alignment.aln.iqtree - the final nwk tree
      • db_clusters.csv - the final phylogroup clusters
      • krakn_ag.txt - the full kraken summary
      • mash.tsv - the full mash distance matrix
      • pan_genome_reference.faa - all the proteins in the pangenome
      • pan_genome_reference.tsv - the list of all proteins in the pangenome
      • Summary.emapper.annotations - Eggnog-Mapper annotation

Genome-wide association study:

The gene and structure presence/absence files should be the result of Panaroo or Roary - from Panaroo this is the .RTab file. The unitig file is a result of unitig-caller; this file should be gzipped. The tree file can be any newick tree - if this pipeline has been followed to this point, we would recommend the tree file from iqtree. Finally, the reference file is a tab-delimited list of files to be used for unitig annotation. The format is file.fna file.gff2 {draft, ref}.

panpiper -w pyseer  -o {ouput directory} -g {gene presence absence file} -p {structure presence absence file} -u {unitig file} -t {tree file from iqtree} -r {reference file}

Output:

  • Pyseer/
    • {variable_name}/
      • unitig_pattern_count.txt - a summary of tests conducted for p-value correction
      • unitig_gene_hits.txt - the genes which significant unitig hits match to
      • unitig.txt - the association study results for each unitig
      • significant_unitig.txt - the unitig.txt file filtered for significance
      • struct_analysis.txt - the associtaiton study results for each structural variant
      • significant_structure.txt - the structural variant results filtered for significance
      • gene_analysis.txt - the associtaiton study results for each gene
      • significant_genes.txt - the gene results filtered for significance
      • phylogeny_similarity.tsv - a matrix of similarity to use as a covariate to correct for population structure in the model

Run on a compute cluster

To run on a compute cluster, a profile folder must be specified which should contain a config.yaml file. Details on what to include in the config file can be found here.

panpiper ... --cluster --profile {profile folder}

Potential errors

  1. Kraken - "Error loading hash table" - you may need to request more memory
  2. Kraken - database download errors - I suggest downloading the database manually as it can be very glitchy

Project details


Download files

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

Source Distribution

panpiper-1.0.1.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

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

panpiper-1.0.1-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

File details

Details for the file panpiper-1.0.1.tar.gz.

File metadata

  • Download URL: panpiper-1.0.1.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.16

File hashes

Hashes for panpiper-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d02245a5678df403f3b7b253525ae60dbf80be6e112dd2eb3a4ed507ad49dfd5
MD5 4fb44022291d5465f224d8c00313e903
BLAKE2b-256 3e20a640431a78ccb74602940dc470c5235a5279718f34f1f8b60656c8b943ad

See more details on using hashes here.

File details

Details for the file panpiper-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: panpiper-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.16

File hashes

Hashes for panpiper-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 776ebce10469c45a2bc85ce51ed3dc5dd04edc8aeed37fea8830964de11d1637
MD5 3d32e726f15f35795d16cfd0f50304b6
BLAKE2b-256 ed62e156f7ee0f4bc68fbb505bbf65fb323b22cde741afa2cb6d0bb700d6a546

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