This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bwa mem for multiple paired read samples FastQfiles

Hi,

I want to make alignments for multiple fastq files. They are named as follows:

  • forwardC123_1.fq.gz forwardC124_1.fq.gz forwardC124_1.fq.gz forwardC126_1.fq.gz . .

    and reverseC123_1.fq.gz reverseC124_1.fq.gz reverseC124_1.fq.gz reverseC126_1.fq.gz . .

I have tried the following code in the script from a previous post

#/bin/bash
#date
#author
#purpose

total_files=`find -name '*.fq.gz' | wc -l`
arr=( $(ls *.fq.gz) )
echo "mapping started" >> map.log
echo "---------------" >> map.log

for ((i=0; i<$total_files; i+=2))
{
sample_name=`echo ${arr[$i]} | awk -F "_" '{print $1}'`
echo "[mapping running for] $sample_name"
printf "\n"
echo "bwa mem -t 12 GRCh38.primary_assembly.genome.fa ${arr[$i]} ${arr[$i+1]} > $sample_name.sam" >> map.log
bwa mem GRCh38.primary_assembly.genome.fa ${arr[$i]} ${arr[$i+1]} > $sample_name.sam

This is the error

./Alignment_bwa_TEST.sh: line 19: syntax error: unexpected end of file

Can anyone please assist or recommend some other script/changes? I have in total 23 paired end files.

Best

fastq reads mem bwa paired

for ((i=0; i<$total_files; i+=2))

you should use a workflow manager like Snakemake or Nextflow.

0 answers

No answers yet.

Log in to answer this question.