FelixKrueger / TrimGalore

A wrapper around Cutadapt and FastQC to consistently apply adapter and quality trimming to FastQ files, with extra functionality for RRBS data
GNU General Public License v3.0
459 stars 149 forks source link

Please provide an even number of input files for paired-end FastQ trimming! Aborting .. #176

Closed shaghayeghsoudi closed 11 months ago

shaghayeghsoudi commented 11 months ago

I just started using TrimeGalore for our RRBS sequencing and I wrote a short slurm script to run to but I keep getting this error message: Please provide an even number of input files for paired-end FastQ trimming! Aborting ... I think my slurm script is OK, so wondering what is wrong and why I am getting this error message. Any help or advice is really appreciated. I installed trim_glore through anaconda (v. 0.6.10)

#!/bin/bash -l
# ---------------------------------------------------------------------
# SLURM script for trim_glore
# ---------------------------------------------------------------------
#SBATCH --job-name==trim_glore
#SBATCH --cpus-per-task=2
#SBATCH --array=1-3
#SBATCH --mem-per-cpu=40G
#SBATCH --tasks=1
#SBATCH --nodes=1
#SBATCH --time=12:00:00
#SBATCH --mail-type=ALL
#SBATCH --export=ALL
#module purge
# Activate Anaconda work environment for OpenDrift

# ---------------------------------------------------------------------
echo "Current working directory: `pwd`"
echo "Starting run at: `date`"
# ---------------------------------------------------------------------
echo ""
echo "Job Array ID / Job ID: $SLURM_ARRAY_JOB_ID / $SLURM_JOB_ID"
echo "This is job $SLURM_ARRAY_TASK_ID out of $SLURM_ARRAY_TASK_COUNT jobs."
echo ""

## Locate the fastqc
source ~/anaconda3/etc/profile.d/conda.sh
source activate /home/users/trim-galore

## Directories:
# Locate the input data
CUTADAPT=/home/users/trim-galore/bin/cutadapt
ROOT_DIR=/methylation_RRBS/p1/usftp21.novogene.com/01.RawData/P1

# Specify the path to the config file
CONFIG=${ROOT_DIR}/demultiplexed/sample_ID_config.txt

# Extract the sample name for the current $SLURM_ARRAY_TASK_ID
BASE_NAME=$(awk -v ArrayTaskID=$SLURM_ARRAY_TASK_ID '$1==ArrayTaskID {print $2}' $CONFIG)
SAMPLE_R1=${ROOT_DIR}/demultiplexed/${BASE_NAME}_R1.fq.gz
SAMPLE_R2=${ROOT_DIR}/demultiplexed/${BASE_NAME}_R2.fq.gz

OUTPUT_DIR=${ROOT_DIR}/demultiplexed/trimmed_fastq

trim_galore --gzip --illumina --path_to_cutadapt ${CUTADAPT} --output_dir ${TRIMMED_FASTQ}  --stringency 1 --fastqc --rrbs --paired ${SAMPLE_R1} ${SAMPLE_R2} 

# ---------------------------------------------------------------------
echo "Job finished with exit code $? at: `date`"
# ---------------------------------------------------------------------
FelixKrueger commented 11 months ago

Hmm, something you are doing seems to get passed to Trim Galore as positional arguments, rather than as options, resulting in an uneven number of arguments (you should only have 2, 4, 6 etc input files as paired-end trimming).

Is there a chance that the parameter ${TRIMMED_FASTQ} is in fact 2 input files, of which the first one would be passed to --output_dir, hence resulting in an uneven number of files? Maybe you wanted to pass --output_dir ${OUTPUT_DIR} instead?

shaghayeghsoudi commented 11 months ago

Hi Felix, Thanks so much for your kind reply. I think That was exactly the issue. I just passed --output_dir ${OUTPUT_DIR} and it seems working without the error. As I just got the issue solved I am closing the thread. Thanks