Closed:paired-end sequence alignment
2
0
Entering edit mode
4.9 years ago
evelyn ▴ 230

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 • 224 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 1971 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6