This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Trimmomatic adapter file not found when running using conda environment (Nextflow)

I have a nextflow script which uses trimmomatic, I am running the script using a conda environment from HPC server. Trimmomatic is able to run however it does now find the adapter TruSeq3-PE.fa that comes with the Trimmomatic package.

script:
"""
    trimmomatic \
        PE -phred33 \
        ${reads[0]} ${reads[1]} \
        "trimmed_${pair_id}_R1_paired.fastq.gz" "trimmed_${pair_id}_R1_unpaired.fastq.gz" \
        "trimmed_${pair_id}_R2_paired.fastq.gz" "trimmed_${pair_id}_R2_unpaired.fastq.gz" \
        ILLUMINACLIP:TruSeq3-PE.fa:2:30:10:2:True \
        LEADING:3 TRAILING:3 SLIDINGWINDOW:4:15 MINLEN:36 -threads 12
"""

My current workaround is to store the TruSeq3-PE.fa file in the project directory and point to its path. Is there a better way to do this? I plan to eventually containerize the workflow.

params.adapter = "$projectDir/ref/TruSeq3-PE.fa"

    script:
    """
    trimmomatic \
        PE -phred33 \
        ${reads[0]} ${reads[1]} \
        "trimmed_${pair_id}_R1_paired.fastq.gz" "trimmed_${pair_id}_R1_unpaired.fastq.gz" \
        "trimmed_${pair_id}_R2_paired.fastq.gz" "trimmed_${pair_id}_R2_unpaired.fastq.gz" \
        ILLUMINACLIP:$adapter:2:30:10:2:True \
        LEADING:3 TRAILING:3 SLIDINGWINDOW:4:15 MINLEN:36 -threads 12
    """
conda adapter nextflow trimmomatic environment

1 answer

quick hack.

"""
cat << EOF > TruSeq3-PE.fa
>PrefixPE/1
TACACTCTTTCCCTACACGACGCTCTTCCGATCT
>PrefixPE/2
GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCT
EOF

(...)
"""

or

"""
wget -O TruSeq3-PE.fa "https://raw.githubusercontent.com/usadellab/Trimmomatic/main/adapters/TruSeq3-PE.fa"

(...)
"""

Log in to answer this question.