Angela Huynh
04/10/2025, 8:47 PM#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { SRATOOLS_FASTERQDUMP } from './modules/nf-core/sratools/fasterqdump/main'
include { FASTP } from './modules/nf-core/fastp/main'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROCESSES FOR WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
// Fetch SRA data and convert to FastQ format
process getSRA {
publishDir 'results', mode: 'copy'
input:
// Receive SRA accessions from the channel
val accession
output:
path "SRA/${accession}", emit: sra_dir
path "RawReads/${accession}_1.fastq", emit: read1
path "RawReads/${accession}_2.fastq", emit: read2
script:
"""
# Create directories for the accession and raw reads
mkdir -p SRA/
mkdir -p RawReads/
# Fetch the SRA data using prefetch
prefetch "${accession}" --output-directory "SRA/"
# Convert the SRA file to FastQ using fasterq-dump
fasterq-dump "${accession}" --outdir "RawReads/" --split-files --skip-technical
"""
}
// Trim the FastQ reads using fastp
process trim {
publishDir 'results', mode: 'copy'
container 'nfcore/fastp:latest'
input:
path read1
path read2
output:
path "CleanedReads/${read1.baseName}.R1.trimmed.fq.gz", emit: trimmed_read1
path "CleanedReads/${read2.baseName}.R2.trimmed.fq.gz", emit: trimmed_read2
script:
"""
fastp --help
"""
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
// Define the SRA accession
SRA_acc = Channel.of("SRR1556296") // You can modify these accessions as needed
// Fetch SRA data for each accession
sra_outputs = getSRA(SRA_acc)
// Extract read1 and read2 from the output of getSRA
read1 = sra_outputs.read1
read2 = sra_outputs.read2
// Now, run the trimming process on the fetched FastQ files
trimmed_reads = trim(read1, read2)
}Arthur
04/10/2025, 11:51 PMtrim module and not from anything to do with nf-core.
That module has a container: container 'nfcore/fastp:latest' but I don’t know if that’s a real container or if you are even running with a container engine