Hi all,

I am trying to do a couple of operations in automatic. Basically I have a directory of fastq PE files from  the same sample e.g.:

    L16-24MG-A_S14_L001_R1_001.fastq.gz  L16-24MG-A_S14_L003_R1_001.fastq.gz
    L16-24MG-A_S14_L002_R1_001.fastq.gz  L16-24MG-A_S14_L004_R1_001.fastq.gz
    
    L16-24MG-A_S14_L001_R2_001.fastq.gz  L16-24MG-A_S14_L003_R2_001.fastq.gz
    L16-24MG-A_S14_L002_R2_001.fastq.gz  L16-24MG-A_S14_L004_R2_001.fastq.gz

I am trying to cat the fastq file together and then run bowtie so at the and having only one .bam file.
This is my script so far but it's not quite working. In fact I am not even able to obtain a combined fastq file before bowtie. Can you help me out please?

    for i in $(ls *R1*.gz) do cat *R1* > ${i%.R1_combined.fastq}.gz  done
    
    for i in $(ls *R2*.gz) do cat *R2* > ${i%.R2_combined.fastq}.gz  done
    
    gunzip *.gz
    
    for i in $(ls *.fastq | rev | cut -c 13- | rev | uniq)
    
    do
    
    bowtie  /home/casaburi/ufrc/hybrid_pacbio_global/rsem/final_assembly_cdhit100 \
    -1 ${i}_R1_combined.fastq -2 ${i}_R2_combined.fastq \
    --all --best --strata -m 300 --chunkmbs 512 -S -p 10 | samtools view -F 4 -S -b -o ${i}.bam
    
    done


Try: `for i in $(ls -1 L16*R1*); do cat ${i%%_R1*}_R1_001.fastq.gz >> ${i%%_S14*}_combined.fastq.gz; done`