|
| 1 | +# ww-fastp Module |
| 2 | + |
| 3 | +[](https://getwilds.org/badges/#prototype) |
| 4 | +[](https://opensource.org/licenses/MIT) |
| 5 | + |
| 6 | +A WILDS WDL module for [fastp](https://github.com/OpenGene/fastp), an ultra-fast all-in-one FASTQ preprocessor. fastp performs quality filtering, adapter trimming, and comprehensive QC reporting in a single pass over the data. |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +This module provides WDL tasks for running fastp on both paired-end and single-end sequencing data. fastp is significantly faster than similar tools (Trimmomatic, Cutadapt) while performing multiple preprocessing operations simultaneously, including adapter auto-detection, quality filtering, length filtering, and HTML/JSON report generation. |
| 11 | + |
| 12 | +## Module Structure |
| 13 | + |
| 14 | +This module is part of the [WILDS WDL Library](https://github.com/getwilds/wilds-wdl-library) and follows the standard WILDS module structure: |
| 15 | + |
| 16 | +- **Main WDL file**: `ww-fastp.wdl` - Contains task definitions for the module |
| 17 | +- **Test workflow**: `testrun.wdl` - Demonstration workflow for testing and examples |
| 18 | +- **Documentation**: This README with usage examples and parameter descriptions |
| 19 | + |
| 20 | +## Available Tasks |
| 21 | + |
| 22 | +### `fastp_paired` |
| 23 | + |
| 24 | +Run fastp on paired-end FASTQ files for quality filtering, adapter trimming, and QC reporting. |
| 25 | + |
| 26 | +**Inputs:** |
| 27 | +- `sample_name` (String): Name identifier for the sample |
| 28 | +- `r1_fastq` (File): Read 1 input FASTQ file (gzipped or uncompressed) |
| 29 | +- `r2_fastq` (File): Read 2 input FASTQ file (gzipped or uncompressed) |
| 30 | +- `qualified_quality_phred` (Int, default=15): Minimum base quality score for a base to be qualified |
| 31 | +- `length_required` (Int, default=15): Minimum read length after trimming |
| 32 | +- `detect_adapter_for_pe` (Boolean, default=true): Enable auto-detection of adapters for paired-end data |
| 33 | +- `adapter_fasta` (File?, optional): FASTA file with custom adapter sequences |
| 34 | +- `cpu_cores` (Int, default=4): Number of CPU cores allocated for the task |
| 35 | +- `memory_gb` (Int, default=8): Memory allocated for the task in GB |
| 36 | + |
| 37 | +**Outputs:** |
| 38 | +- `r1_trimmed` (File): Trimmed and filtered R1 FASTQ file |
| 39 | +- `r2_trimmed` (File): Trimmed and filtered R2 FASTQ file |
| 40 | +- `html_report` (File): HTML quality control report |
| 41 | +- `json_report` (File): JSON quality control report |
| 42 | + |
| 43 | +### `fastp_single` |
| 44 | + |
| 45 | +Run fastp on single-end FASTQ files for quality filtering, adapter trimming, and QC reporting. |
| 46 | + |
| 47 | +**Inputs:** |
| 48 | +- `sample_name` (String): Name identifier for the sample |
| 49 | +- `fastq` (File): Input FASTQ file (gzipped or uncompressed) |
| 50 | +- `qualified_quality_phred` (Int, default=15): Minimum base quality score for a base to be qualified |
| 51 | +- `length_required` (Int, default=15): Minimum read length after trimming |
| 52 | +- `adapter_fasta` (File?, optional): FASTA file with custom adapter sequences |
| 53 | +- `cpu_cores` (Int, default=4): Number of CPU cores allocated for the task |
| 54 | +- `memory_gb` (Int, default=8): Memory allocated for the task in GB |
| 55 | + |
| 56 | +**Outputs:** |
| 57 | +- `trimmed_fastq` (File): Trimmed and filtered FASTQ file |
| 58 | +- `html_report` (File): HTML quality control report |
| 59 | +- `json_report` (File): JSON quality control report |
| 60 | + |
| 61 | +## Usage as a Module |
| 62 | + |
| 63 | +### Importing into Your Workflow |
| 64 | + |
| 65 | +```wdl |
| 66 | +import "https://raw.githubusercontent.com/getwilds/wilds-wdl-library/refs/heads/main/modules/ww-fastp/ww-fastp.wdl" as fastp_tasks |
| 67 | +
|
| 68 | +struct FastpSample { |
| 69 | + String name |
| 70 | + File r1_fastq |
| 71 | + File r2_fastq |
| 72 | +} |
| 73 | +
|
| 74 | +workflow my_preprocessing_pipeline { |
| 75 | + input { |
| 76 | + Array[FastpSample] samples |
| 77 | + } |
| 78 | +
|
| 79 | + scatter (sample in samples) { |
| 80 | + call fastp_tasks.fastp_paired { |
| 81 | + input: |
| 82 | + sample_name = sample.name, |
| 83 | + r1_fastq = sample.r1_fastq, |
| 84 | + r2_fastq = sample.r2_fastq |
| 85 | + } |
| 86 | + } |
| 87 | +
|
| 88 | + output { |
| 89 | + Array[File] trimmed_r1 = fastp_paired.r1_trimmed |
| 90 | + Array[File] trimmed_r2 = fastp_paired.r2_trimmed |
| 91 | + Array[File] reports = fastp_paired.html_report |
| 92 | + } |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +### Advanced Usage Examples |
| 97 | + |
| 98 | +**Custom quality filtering:** |
| 99 | +```wdl |
| 100 | +call fastp_tasks.fastp_paired { |
| 101 | + input: |
| 102 | + sample_name = "stringent_sample", |
| 103 | + r1_fastq = r1_file, |
| 104 | + r2_fastq = r2_file, |
| 105 | + qualified_quality_phred = 20, |
| 106 | + length_required = 50, |
| 107 | + cpu_cores = 8, |
| 108 | + memory_gb = 16 |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +### Integration Examples |
| 113 | + |
| 114 | +This module integrates seamlessly with other WILDS components: |
| 115 | +- **ww-fastqc**: Can be used alongside fastp for additional QC checks |
| 116 | +- **ww-bwa / ww-star**: Trimmed reads can be passed directly to alignment modules |
| 117 | + |
| 118 | +## Testing the Module |
| 119 | + |
| 120 | +The module includes a test workflow (`testrun.wdl`) that can be run independently: |
| 121 | + |
| 122 | +```bash |
| 123 | +# Using miniWDL |
| 124 | +miniwdl run testrun.wdl |
| 125 | + |
| 126 | +# Using Sprocket |
| 127 | +sprocket run testrun.wdl --entrypoint fastp_example |
| 128 | + |
| 129 | +# Using Cromwell |
| 130 | +java -jar cromwell.jar run testrun.wdl |
| 131 | +``` |
| 132 | + |
| 133 | +### Automatic Demo Mode |
| 134 | + |
| 135 | +The test workflow automatically: |
| 136 | +1. Downloads paired-end test FASTQ data using `ww-testdata` |
| 137 | +2. Runs fastp paired-end trimming and quality filtering |
| 138 | +3. Runs fastp single-end trimming and quality filtering (using R1 as input) |
| 139 | +4. Produces trimmed FASTQ files and HTML/JSON QC reports for both modes |
| 140 | + |
| 141 | +## Docker Container |
| 142 | + |
| 143 | +This module uses the `getwilds/fastp:1.1.0` container image, which includes: |
| 144 | +- fastp v1.1.0 |
| 145 | +- All necessary system dependencies for FASTQ preprocessing |
| 146 | + |
| 147 | +## Citation |
| 148 | + |
| 149 | +> Chen S, Zhou Y, Chen Y, Gu J. fastp: an ultra-fast all-in-one FASTQ preprocessor. |
| 150 | +> Bioinformatics. 2018;34(17):i884-i890. |
| 151 | +> DOI: https://doi.org/10.1093/bioinformatics/bty560 |
| 152 | +
|
| 153 | +## Parameters and Resource Requirements |
| 154 | + |
| 155 | +### Default Resources |
| 156 | +- **CPU**: 4 cores |
| 157 | +- **Memory**: 8 GB |
| 158 | +- **Runtime**: Typically under 5 minutes for standard WGS samples |
| 159 | + |
| 160 | +### Resource Scaling |
| 161 | +- `cpu_cores`: fastp supports multi-threading; 4 cores is a good default |
| 162 | +- `memory_gb`: 8 GB is sufficient for most use cases; increase for very large files |
| 163 | + |
| 164 | +## Contributing |
| 165 | + |
| 166 | +To improve this module or report issues: |
| 167 | +1. Fork the [WILDS WDL Library repository](https://github.com/getwilds/wilds-wdl-library) |
| 168 | +2. Make your changes following WILDS conventions |
| 169 | +3. Test thoroughly with the demonstration workflow |
| 170 | +4. Submit a pull request with detailed documentation |
| 171 | + |
| 172 | +## Support and Feedback |
| 173 | + |
| 174 | +For questions about this module or to report issues: |
| 175 | +- Open an issue in the [WILDS WDL Library repository](https://github.com/getwilds/wilds-wdl-library/issues) |
| 176 | +- Contact us via the Fred Hutch Office of the Chief Data Officer (OCDO) at wilds@fredhutch.org |
| 177 | +- See the library's [Contributor Guide](https://github.com/getwilds/wilds-wdl-library/blob/main/.github/CONTRIBUTING.md) for detailed guidelines |
| 178 | + |
| 179 | +## Related Resources |
| 180 | + |
| 181 | +- **[WILDS Docker Library](https://github.com/getwilds/wilds-docker-library)**: Container images used by WDL workflows |
| 182 | +- **[WILDS Documentation](https://getwilds.org/)**: Comprehensive guides and best practices |
| 183 | +- **[WDL Specification](https://openwdl.org/)**: Official WDL language documentation |
0 commit comments