Entering edit mode
4.6 years ago
Amaranta Remedios
▴
20
So I have this bowtie bash script that is working:
#!bin/bash
for a in /Volumes/Norwegian_woods/*.fastq;
do
Reference=/Volumes/Norwegian_woods/Phaw_5.0;
bowtie2 -N 1 -p 8 --no-unal -x ${Reference} -q $a --al ${a%.fastq}_bowtie2.fq -S ${a%.fastq}_bowtie2.sam
done
However, I would like to change the output name and have bowtie2 written as a prefix, looking like this:
bowtie2_${a%.fastq}.fq, bowtie2_${a%.fastq}.sam.
But this is not working. Any suggestion would be appreciated! Thanks
Nextflow/wdl/snakemake future you will thank you.
Soft quote your variables.
I tried that ('bowtie2_${a%.fastq}.fq') but the outputs now look like this: bowtie2_${a%.fastq}.fq
That's because that's a hard quote, not a soft quote.
I'd advise you to stop here and familiarise yourself with quotes in the shell. It's super important to get this right, especially if this code is going to be run on lots of files by others, or you won't know the input files well. At the moment, any white space in the file names would break this.
http://www.acadix.biz/Unix-guide/HTML/ch02s12.html