I have a large number of files. It is paired end sequencing. My files are of type _1.fastq.gz
and _2.fastq.gz
.
In the fastp command I must enter the 2 files corresponding to the same samples in _1
and _2
in the form fastp -i file_a_1.fastq.gz -I file_a_2.fastq.gz
.
How could I do this for all my files without having to manually write the command with each file? When there is only one variable I do a loop for i in $ (ls Fastq_dir / *. fastq.gz) do ...
But with 2 variables?
Using parallel, try:
parallel --dry-run fastp -i {} {=s/_1/_2/=} ::: *_1.fastq.gz
or in bash loop try one ofdo echo $i ${i/_1/_2}
ordo echo $i ${i%_*}_2.fastq.gz
.