This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Trimmomatic error java.io.FileNotFoundException

Hi All,

I wrote a shell script, what executes a pipeline for all samples in the sample.list.txt. I run it with the bash -x ./testrun.sh command, and got the following strange error.

What could be the problem? Many thanks!

The relevant field of my script:

mkdir -p fastq/Trimmomatic/Paired
mkdir -p fastq/Trimmomatic/Unpaired

cat fastq/sample.list.txt | while read line;
do
    arrIN=(${line// / })
    i=${arrIN[0]}
    j=${arrIN[1]}
    k=${arrIN[2]}

   java -jar /opt/Trimmomatic-0.33/trimmomatic-0.33.jar PE -trimlog ./fastq/Trimmomatic/trimlog_"$k".txt ./fastq/"$i" ./fastq/"$j" ./fastq/Trimmomatic/Paired/"$k"_forward-paired.fastq ./fastq/Trimmomatic/Unpaired/"$k"_forward-unpaired.fastq ./fastq/Trimmomatic/Paired/"$k"_reverse-paired.fastq ./fastq/Trimmomatic/Unpaired/"$k"_reverse-unpaired.fastq ILLUMINACLIP:/opt/Trimmomatic-0.33/adapters/TruSeq3-PE.fa:2:40:10
done

The output of the bash -x ./testrun.sh is the following:

+ mkdir -p fastq/Trimmomatic/Paired
+ mkdir -p fastq/Trimmomatic/Unpaired
+ cat fastq/sample.list.txt
+ read line
+ arrIN=(${line// / })
+ i=control_0_D10_1.fq
+ j=control_0_D10_2.fq
+ k=control_0_D10
+ java -jar /opt/Trimmomatic-0.33/
    trimmomatic-0.33.jar PE -trimlog ./fastq/Trimmomatic/trimlog_control_0_D10.txt ./fastq/control_0_D10_1.fq ./fastq/control_0_D10_2.fq ./fastq/Trimmomatic/Paired/control_0_D10_forward-paired.fastq ./fastq/Trimmomatic/Unpaired/control_0_D10_forward-unpaired.fastq ./fastq/Trimmomatic/Paired/control_0_D10_reverse-paired.fastq ./fastq/Trimmomatic/Unpaired/control_0_D10_reverse-unpaired.fastq ILLUMINACLIP:/opt/Trimmomatic-0.33/adapters/TruSeq3-PE.fa:2:40:10

TrimmomaticPE: Started with arguments: -trimlog ./fastq/Trimmomatic/trimlog_control_0_D10.txt ./fastq/control_0_D10_1.fq ./fastq/control_0_D10_2.fq ./fastq/Trimmomatic/Paired/control_0_D10_forward-paired.fastq ./fastq/Trimmomatic/Unpaired/control_0_D10_forward-unpaired.fastq ./fastq/Trimmomatic/Paired/control_0_D10_reverse-paired.fastq ./fastq/Trimmomatic/Unpaired/control_0_D10_reverse-unpaired.fastq ILLUMINACLIP:/opt/Trimmomatic-0.33/adapters/TruSeq3-PE.fa:2:40:10

Multiple cores found: Using 4 threads

Using PrefixPair: 'TACACTCTTTCCCTACACGACGCTCTTCCGATCT' and 'GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCT'

ILLUMINACLIP: Using 1 prefix pairs, 0 forward/reverse sequences, 0 forward only sequences, 0 reverse only sequences
Quality encoding detected as phred33
Input Read Pairs: 511399 Both Surviving: 511399 (100.00%) Forward Only Surviving: 0 (0.00%) Reverse Only Surviving: 0 (0.00%) Dropped: 0 (0.00%)
TrimmomaticPE: Completed successfully
+ read line
+ arrIN=(${line// / })
+ i=
+ j=
+ k=
+ java -jar /opt/Trimmomatic-0.33/trimmomatic-0.33.jar PE -trimlog ./fastq/Trimmomatic/trimlog_.txt ./fastq/ ./fastq/ ./fastq/Trimmomatic/Paired/_forward-paired.fastq ./fastq/Trimmomatic/Unpaired/_forward-unpaired.fastq ./fastq/Trimmomatic/Paired/_reverse-paired.fastq ./fastq/Trimmomatic/Unpaired/_reverse-unpaired.fastq ILLUMINACLIP:/opt/Trimmomatic-0.33/adapters/TruSeq3-PE.fa:2:40:10
TrimmomaticPE: Started with arguments: -trimlog ./fastq/Trimmomatic/trimlog_.txt ./fastq/ ./fastq/ ./fastq/Trimmomatic/Paired/_forward-paired.fastq ./fastq/Trimmomatic/Unpaired/_forward-unpaired.fastq ./fastq/Trimmomatic/Paired/_reverse-paired.fastq ./fastq/Trimmomatic/Unpaired/_reverse-unpaired.fastq ILLUMINACLIP:/opt/Trimmomatic-0.33/adapters/TruSeq3-PE.fa:2:40:10
Multiple cores found: Using 4 threads
Using PrefixPair: 'TACACTCTTTCCCTACACGACGCTCTTCCGATCT' and 'GTGACTGGAGTTCAGACGTGTGCTCTTCCGATCT'
ILLUMINACLIP: Using 1 prefix pairs, 0 forward/reverse sequences, 0 forward only sequences, 0 reverse only sequences
Exception in thread "main" java.io.FileNotFoundException: ./fastq (Is a directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at org.usadellab.trimmomatic.fastq.FastqParser.parse(FastqParser.java:127)
    at org.usadellab.trimmomatic.TrimmomaticPE.process(TrimmomaticPE.java:252)
    at org.usadellab.trimmomatic.TrimmomaticPE.run(TrimmomaticPE.java:499)
    at org.usadellab.trimmomatic.Trimmomatic.main(Trimmomatic.java:35)
trimmomatic bash java

./fastq (is a directory), guess your input should be fastq format (just change input argument from ./fastq to something like ./fastq/reads.fq). And you got it right first time (./fastq/control_0_D10_1.fq ./fastq/control_0_D10_2.fq).

I did it in the script, the filepath is set in every run cycle of the script:

./fastq/"$i" is replaced with ./fastq/control_0_D10_1.fq if $i=control_0_D10_1.fq

Problem might come from this:

./fastq/Trimmomatic/trimlog_"$k".txt 
./fastq/Trimmomatic/trimlog_control_0_D10.txt
./fastq/Trimmomatic/trimlog_.txt

Can you please post head fastq/sample.list.txt

Currently it contains only one line:

control_0_D10_1.fastq control_0_D10_2.fastq control_0_D10

So your script ran without problems using first line as input, but probably there was a blank line in the end of your document.

Yes, but it is normal, that Trimmomatic using '0 forward/reverse sequences' even if I have paired-end sequences? or that using 0 sequences at all?

0 answers

No answers yet.

Log in to answer this question.