-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbwaMap_andSort.sh
More file actions
34 lines (22 loc) · 815 Bytes
/
bwaMap_andSort.sh
File metadata and controls
34 lines (22 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# directory of processed sequences with trimmomatic
#trimdir=/2/scratch/Katie/africans/trim/zi192ef81
#variable for output/run
set=$1
# variable for the reference genome
refGenome=/home/katie/flyGenome/dmel_r6.23/bwa/dmel-all-chromosome-r6.23.fasta
# make output directory from mapping outputs
output=/2/scratch/Katie/africans/map/${set}
# make BWA directory path
bwa_dir=/usr/local/bwa/0.7.8
#list all files to be read (this selects the left end from each PE pair)
files=(*_R1_PE.fastq.gz)
#echo ${files[@]}
#For loop over every file
for file in ${files[@]}
do
name=${file}
base=`basename ${name} _R1_PE.fastq.gz`
#echo ${base}
bwa mem -t 12 -M ${refGenome} ${base}_R1_PE.fastq.gz ${base}_R2_PE.fastq.gz | samtools view -b -q 20 -@5 | samtools sort -o ${output}/${base}_bwa_PE.bam
done