Asymmetric read QC using Trimmomatic?

Hello,

I’m a little confused. Initially, I had an issue with Kneaddata not realizing my reads were paired-end, which I fixed with the trick mentioned in another thread about adding /1 and /2 to the headers and taking out spaces using the sed command. Which worked – bowtie2 started processing my reads as paired-end.

However, as you’ll see from my code below, it didn’t work for Trimmomatic, which trimmed my reads as if they were single-end. Do you know how to make it so that Trimmomatic trims my reads as if they’re paired-end?

Also, a side question, but one which would add a lot of convenience – is there a way to make bowtie2 use more than 1 thread for the bowtie2 step that kneaddata kicks off?

For reference, I’m running this on one of two AWS instances, the “bad” one being an m6i.4xl and the “good” one an m6i.16xl, so I have plenty of computing power.
my command:

kneaddata --verbose -i Phinal/Phi_R1.fastq -i Phinal/Phi_R2.fastq -db wheat_ref -o KneadPhi --trimmomatic /home/ubuntu/anaconda3/share/trimmomatic-0.39-2 --decontaminate-pairs lenient

The readout:

Reordering read identifiers ...

Initial number of reads ( /home/ubuntu/KneadPhi/reordered_8bsy21iy_Phi_R1 ): 16997678.0
Initial number of reads ( /home/ubuntu/KneadPhi/reordered_gdt6pix0_Phi_R2 ): 16997678.0
Running Trimmomatic ...

java -Xmx500m -jar /home/ubuntu/anaconda3/share/trimmomatic-0.39-2/trimmomatic.jar PE -threads 1 -phred33 /home/ubuntu/KneadPhi/reordered_8bsy21iy_Phi_R1 /home/ubuntu/KneadPhi/reordered_gdt6pix0_Phi_R2 /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.1.fastq /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.single.1.fastq /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.2.fastq /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.single.2.fastq MINLEN:60 ILLUMINACLIP:/home/ubuntu/anaconda3/lib/python3.7/site-packages/kneaddata/adapters/NexteraPE-PE.fa:2:30:10:8:TRUE SLIDINGWINDOW:4:20 MINLEN:75

Total reads after trimming ( /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.1.fastq ): 14685246.0
Total reads after trimming ( /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.2.fastq ): 14685246.0
Total reads after trimming ( /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.single.1.fastq ): 422991.0
Total reads after trimming ( /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.single.2.fastq ): 608622.0
Running trf ...

kneaddata_trf_parallel --input /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.1.fasta --output /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.1.fasta.trf.parameters.2.7.7.80.10.50.500.dat --trf-path /home/ubuntu/anaconda3/bin/trf --trf-options '2 7 7 80 10 50 500 -h -ngs' --nproc 1

Running trf ...

kneaddata_trf_parallel --input /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.2.fasta --output /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.2.fasta.trf.parameters.2.7.7.80.10.50.500.dat --trf-path /home/ubuntu/anaconda3/bin/trf --trf-options '2 7 7 80 10 50 500 -h -ngs' --nproc 1

Running trf ...

kneaddata_trf_parallel --input /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.single.1.fasta --output /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.single.1.fasta.trf.parameters.2.7.7.80.10.50.500.dat --trf-path /home/ubuntu/anaconda3/bin/trf --trf-options '2 7 7 80 10 50 500 -h -ngs' --nproc 1

Running trf ...

kneaddata_trf_parallel --input /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.single.2.fasta --output /home/ubuntu/KneadPhi/Phi_R1_kneaddata.trimmed.single.2.fasta.trf.parameters.2.7.7.80.10.50.500.dat --trf-path /home/ubuntu/anaconda3/bin/trf --trf-options '2 7 7 80 10 50 500 -h -ngs' --nproc 1

Decontaminating ...
Running bowtie2 ...

/home/ubuntu/anaconda3/bin/bowtie2 --threads 1 --very-sensitive-local --phred33 -x /home/ubuntu/wheat_ref -1 /home/ubuntu/KneadPhi/Phi_R1_kneaddata.repeats.removed.1.fastq -2 /home/ubuntu/KneadPhi/Phi_R1_kneaddata.repeats.removed.2.fastq --un-conc /home/ubuntu/KneadPhi/Phi_R1_kneaddata_paired_wheat_ref_bowtie2_clean_%.fastq --al-conc /home/ubuntu/KneadPhi/Phi_R1_kneaddata_paired_wheat_ref_bowtie2_contam_%.fastq -S /dev/null

Error executing: /home/ubuntu/anaconda3/bin/bowtie2 --threads 1 --very-sensitive-local --phred33 -x /home/ubuntu/wheat_ref -1 /home/ubuntu/KneadPhi/Phi_R1_kneaddata.repeats.removed.1.fastq -2 /home/ubuntu/KneadPhi/Phi_R1_kneaddata.repeats.removed.2.fastq --un-conc /home/ubuntu/KneadPhi/Phi_R1_kneaddata_paired_wheat_ref_bowtie2_clean_%.fastq --al-conc /home/ubuntu/KneadPhi/Phi_R1_kneaddata_paired_wheat_ref_bowtie2_contam_%.fastq -S /dev/null

Error message returned from bowtie2 :
Error, fewer reads in file specified with -2 than in file specified with -1
terminate called after throwing an instance of 'int'
Aborted (core dumped)
(ERR): bowtie2-align exited with value 134

Subprocess reported error. Please see log file for more details.

If this is similar to anything up here, please let me know! Sometimes, my keyword-fu is weak.
Thank you for your help!

Hi @corbolero,

Is it possible to post your Kneaddata log file by any chance? When two inputs “-i” are passed in Kneaddata, trimmomatic should consider them as the paired reads.

Also, “–threads” flag will allow you to use more than 1 thread.

Thanks,
Sagun

I actually deleted my log file for this folder! But I’m pretty sure I could make it do this again, if you’d like. I’m pretty sure that kneaddata did consider them paired-end from the beginning; I think it was the command --decontaminate-pairs lenient that confused it, actually.

Thank you for mentioning the -threads command! It took a while to find but it really helped me test this out a few times much more quickly. Turns out, it counted them as paired-end without sed and using sed actually confused it – got 0 reads with those. It ran, though, when I removed that --decontaminate-pairs lenient bit, when it otherwise looked like it was counting the unmatched files as another set of paired reads.