Entering edit mode
2.6 years ago
assane.mbodj
▴
10
Hi, I am coming to you for help. I am doing a mapping on short and long read files with BWA and MINIMAP2 My problem is that, I want to make an if loop that would allow me to choose either BWA if I work with short reads or MINIMAP2 for long reads on a single script
Here is the script I made in bash for the moment thanks in advance.
for R1 in ${DATA_DIR}/*_R1.fq.gz
do
R2=$(echo ${R1} | sed "s/R1.fq.gz/R2.fq.gz/g")
OUT=$(basename $R1 | awk -F "_" '{print $1}')
#mapping and sort bam file
$BWA/bwa mem $GENOME $R1 $R2 > $Bam_file/$OUT.sam
$Minimap --MD -t 4 -ax map-ont $GENOME $R1 $R2 > $Bam_file/$OUT.sam
$samtools view -bS $Bam_file/$OUT.sam > $Bam_file/$OUT.bam
$samtools sort $Bam_file/$OUT.bam -o $Bam_file/$OUT.sorted.bam
$samtools index $Bam_file/$OUT.sorted.bam
done