I am trying to use a for loop to use multiple files for trimmomatic but the output files are kept in a different directory that has pre-installed directories with Input names. But when I am running the command, it is not able to detect the sub directories:
/home/samarpana/archive/3_Trimmomatic/Sample_x_R1.fastq (No such file or directory).
The output directories are named as Sample_x_R1, Sample_y_R2 etc.. What has to edited so that the output directory reads only the file name and not its extension (i.e .fastq in this case).
The command that I am using is given below.
for file in *.fastq; do
java7 -Xmx8g -jar /opt/apps/Trimmomatic-0.30/trimmomatic-0.30.jar PE -threads 12 -phred33 /home/samarpana/archive/Project_Asthma_Exome_25062015/Fastq/$file /home/samarpana/archive/3_Trimmomatic/$file ILLUMINACLIP:/home/samarpana/scratch/adapters/TruSeq3-PE.fa:2:30:10 CROP:98 HEADCROP:3 SLIDINGWINDOW:25:20 MINLEN:50;
done
${file%.*}
to remove the extension. See here and the duplicate for more information. – terdon Oct 08 '15 at 10:38