Biostar Beta. Not for public use.
Closed:paired-end sequence alignment
Entering edit mode
16 months ago
evelyn • 30

I am trying to run bwa for multiple paired end fastq files, located in a folder named sample_data. I am using this code to get .sorted.bam files to a new folder called output:

total_files=`ls ./sample_data/*.fastq | wc -l`
arr=( $(ls ./sample_data/*.fastq) )
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"
bwa mem -t 12 ref.fa ${arr[$i]} ${arr[$i+1]} | samtools sort -o output/$sample_name.sorted.bam

But the echo says

[mapping running for] ./sample

And got only one sorted.bam file named sample.sorted.bam It is not giving the output files named as input files. Any suggestion is appreciated.

alignment • 210 views
This thread is not open. No new answers may be added
Similar Posts
Loading Similar Posts
Powered by the version 2.3