I am trying to loop paired end reads in hisat2 with an output of sorted bam using a pipe.
I am a novice at coding but am keen to improve my skills by learning how to loop.
I have created this loop using the answers from Run mutltiple Fastq files on Hisat2
for f in `ls *.fastq.gz | sed 's/_[12].fastq.gz//g' | sort -u`
do
echo hisat2 -x /mnt/z/NathanHaffordTear/RNAseqproject/RNAseqanalysis/hg38_index -1 ${f}_1.fastq.gz -2 ${f}_2.fastq.gz | samtools sort -o ${f}.hisat.sorted.bam
done
For some reason the loop does work without the pipe but not with. How can i configure this loop to work with the piping as I do not want to have the intermediate files?
Many thanks in advance
Is the
echo
supposed to precede the call to hisat2?I added it in to check the code before running.
--
output:
OP is supposed to run:
OP can also try parallel:
output: