mossmatters / HybPiper

Recovering genes from targeted sequence capture data
GNU General Public License v3.0
108 stars 45 forks source link

HybPiper

install with bioconda

Current version: 2.3.0 (September 2024). See the change_log.md here

DOI

-- Read our article in Applications in Plant Sciences (Open Access)

HybPiper version 1.x by Matt Johnson and Norm Wickett, Chicago Botanic Garden

If you would like to use HybPiper version 1.3, please download the Final HybPiper 1.3 Version release. The legacy wiki for version 1.3 can be found here.

HybPiper version 2.0 by Matt Johnson (Texas Tech University) and Chris Jackson (Royal Botanic Gardens Victoria, Melbourne)

hybpiper_logo

(logo by Elliot Gardner)

Purpose

HybPiper was designed for targeted sequence capture, in which DNA sequencing libraries are enriched for gene regions of interest, especially for phylogenetics. HybPiper is a suite of Python scripts/modules that wrap and connect bioinformatics tools in order to extract target sequences from high-throughput DNA sequencing reads.

Targeted bait capture is a technique for sequencing many loci simultaneously based on bait sequences. The HybPiper pipeline starts with high-throughput sequencing reads (for example from Illumina MiSeq), and assigns them to target genes using BLASTx/DIAMOND or BWA. The reads are distributed to separate directories, where they are assembled separately using SPAdes. The main output is a FASTA file of the (in frame) CDS portion of the sample for each target region, and a separate file with the translated protein sequence.

HybPiper also includes commands to extract the intronic regions flanking each exon, and investigate putative paralogs. For more information, please see our wiki.

HybPiper is run separately for each sample (single or paired-end sequence reads, with an optional file of unpaired reads in the latter scenerio). When HybPiper generates sequence files from the reads, it does so in a standardized directory hierarchy. Many of the post-processing commands rely on this directory hierarchy, so do not modify it after running the initial pipeline. It is a good idea to run the pipeline for each sample from the same directory. You will end up with one directory per run of HybPiper, and some of the later commands take advantage of this predictable directory structure.


Dependencies

NOTE:

Biopython

Biopython 1.80 is required as it contains bug fixes for the SearchIO module that HybPiper 2.0 uses to parse output from Exonerate.

Update 01/12/2022: Biopython 1.80 has now been released, and is available as a conda install here.

Prior to this release, HybPiper users needed to install an in-progress version by cloning the repository from https://github.com/biopython/biopython and following the instructions under the heading 'Installation from Source' here. Alternatively, the HybPiper conda package for all versions prior to 2.1.0 includes pre-release Biopython version 1.80.dev0; note that this causes problems if the user then installs Biopython 1.79 via conda in the HybPiper conda environment. The HybPiper conda package for version 2.1.0 now uses the conda Biopython 1.80 release package.

Python and SPAdes

The SPAdes assembler prior to version 3.15.4 is incompatible with Python 3.10 and 3.11, see here. The highest SPAdes version available as a macOS conda package is 3.15.2. This means that the macOS conda package for HybPiper is restricted to Python version 3.9 at the highest. This restriction will be removed once SPAdes >= 3.15.4 is released as a macOS conda package.

Update 29/05/2024: SPAdes version 3.15.5 is now available on Bioconda. Bioconda installs of HybPiper version >=2.1.7 will now use this SPAdes version or higher and a Python version higher than 3.9.


Setup

We strongly recommend installing HybPiper using conda with a new environment. This will install HybPiper, all required Python packages, and all required external programs. If you have conda installed and the channels bioconda and conda-forge have already been added, this can be done using the command:

conda create -n hybpiper hybpiper

...followed by:

conda activate hybpiper

For full installation instructions, including details on how to install on Macs with Apple Silicon (M1/M2/M3 chips), please see our wiki page:

https://github.com/mossmatters/HybPiper/wiki/Installation

Once all dependencies are installed you can download a test dataset here, extract the *.tar.gz file, and execute the run_hybpiper_test_dataset.sh script from the test_dataset directory for a demonstration of HybPiper.


Pipeline Input

Full instructions on running the pipeline, including a step-by-step tutorial using a small test dataset, are available on our wiki:

https://github.com/mossmatters/HybPiper/wiki

High-Throughput DNA Sequencing Reads

Before running the pipeline, you will likely want "cleaned" FASTQ file(s) - one or two depending on whether your sequencing was single or paired-end. Reads should have adapter sequences removed and should be trimmed to remove low quality base calls.

Target Sequences

You will also need to construct a "target" file of gene regions. The target file should contain one gene region per sequence, with exons "concatenated" into a contiguous sequence. For more information on constructing the target file, see the wiki, or view the example file in: test_dataset/test_targets.fasta

There can be more than one "source sequence" for each gene in the target file. This can be useful if the target enrichment baits were designed from multiple sources - for example a transcriptome in the focal taxon and a distantly related reference genome.


Pipeline Output

HybPiper will map the reads to the target sequences, sort the reads by gene, assemble the reads for each gene separately, align the contigs to the target sequence, and extract a coding sequence from each gene. Output from each of these phases is saved in a standardized directory hierarchy, making it easy for post-processing commands to summarize information across many samples.

For example, the coding sequence for gene "gene001" for sample "EG30" is saved in a FASTA file:

EG30/gene001/EG30/sequences/FNA/gene001.FNA

...and a list of genes for which a sequence could be extracted can be found:

EG30/genes_with_seqs.txt

For a full description of HybPiper output, see the wiki.


Changelog

2.1.8 June, 2024

Added the new subcommand hybpiper filter_by_length. Used to filter the sequence output of hybpiper retrieve sequences by absolute length and/or length relative to mean length in target file representatives. This is done on a per-sample/per-gene basis, rather than the sample-level filtering available in hybpiper retrieve_sequences. See wiki for more information. For a full list of changes see the changelog.

2.1.0 December, 2022

Added the new subcommand fix_targetfile. Assists with filtering target file sequences based on length and sequence complexity, and in ensuring sequences are in the correct reading frame (the latter for nucleotide target files only). For a full list of changes see the changelog.

New dependencies:

2.0 release candidate May, 2022

This update involves a substantial refactor of the HybPiper pipeline, with changes to the internal code, additional functionality, and additional output. For a full list of changes see the changelog.

New dependencies:

1.3.2 February, 2020

1.3.1 IMPORTANT BUG FIX August, 2018

1.3 The Herbarium Update January, 2018

Features

Bug Fixes

1.2.1 September, 2017

Bug Fixes

1.2 May, 2017

Features

Bug Fixes


1.1 May, 2016: Release associated with manuscript in Applications in Plant Sciences.

1.0 Feb, 2016: Initial fully-featured release associated with submission of manuscript to Applications in Plant Sciences.

-- Sequence assembly now uses SPAdes rather than Velvet + CAP3


Citation

Johnson, M. G., Gardner, E. M., Liu, Y., Medina, R., Goffinet, B., Shaw, A. J., Zerega, N. J. C, and Wickett, N. J. (2016). HybPiper: Extracting Coding Sequence and Introns for Phylogenetics from High-Throughput Sequencing Reads Using Target Enrichment. Applications in Plant Sciences, 4(7), 1600016. doi:10.3732/apps.1600016