Sorry for the confusion, had mixed version of it. All sorted now with your post. Thanks alot! works like a charm.
Hello,
I'm trying to run hisat on loop and I've been trying to modify an existing loop I had set up but can't get it to work with my new file names.
My R1 is called WTCH_1_val_1.fastq and my R2 is called WTCH_2_val_2.fastq, where every time WTCH is actually a different value to distinguish the difference samples. This is the loop I was using so far when all of my samples were WTCH_1.fastq and WTCH_2.fastq
for f in `ls -1 *_1.fastq.gz | sed 's/_1.fastq.gz//' `
do
echo hisat2 -x mm10idx -1 ${f}_1.fastq.gz -2 ${f}_2.fastq.gz -S ${f}.bam
done
Could someone that is much better at this than I am please modify it for me? thanks
1 answer
Revise and clean up your post: you are using .fastq, .fastq.gz and .fq.gz, with no indication on which is the correct.
If your files are named ${whatever}_1_val_1.fastq.gz and ${whatever}_2_val_2.fastq.gz, then:
for f in `ls -1 *_1.fastq.gz | sed 's/_1_val_1.fastq.gz//' `
do
echo hisat2 -x mm10idx -1 ${f}_1_val_1.fastq.gz -2 ${f}_2_val_2.fastq.gz -S ${f}.bam
done
Log in to answer this question.
Just replace every instance of
.fastq.gzwith.fastqand it should work.I've tried that but it doesnt work sadly, the echo returns:
The loop as is thinks that the R2 finishes in "_1_val_2.fq.gz" but it finishes in "_2_val_2.fq.gz" the issue is the first _2 I think.