-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08_map_reads_SE.srun
executable file
·54 lines (34 loc) · 1.81 KB
/
08_map_reads_SE.srun
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#SBATCH -A phillipslab
#SBATCH --partition=phillips ### Partition
#SBATCH --job-name=map ### Job Name
#SBATCH --time=10:00:00 ### WallTime
#SBATCH --nodes=1 ### Number of Nodes
#SBATCH --ntasks=1 ### Number of tasks per array job
#SBATCH --array=0-1 ### Array index
#SBATCH --mail-type=END ### Mail events (NONE, BEGIN, END, FAIL, ALL)
#SBATCH [email protected] ### Where to send mail
#SBATCH --cpus-per-task=10 ### Number of CPU cores per task
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
module load bwa samtools
ref_CE="/projects/phillipslab/ateterina/CITP_pi/ref/c_elegans.PRJNA13758.WS280.genomic.fa"
ref_CB="/projects/phillipslab/ateterina/CITP_pi/ref/c_briggsae.PRJNA10731.WS280.genomic.fa"
#ref_CT="/projects/phillipslab/ateterina/CITP_pi/ref/c_tropicalis.PRJNA53597.WS280.genomic.fa"
#index the references
cd /projects/phillipslab/ateterina/CITP_pi/data/
#mv ED3092_fs1.fastq CB_ED3092_fs1.fastq
#mv PD1073_fs1.fastq CE_PD1073_fs1.fastq
LISTFILES=(*_fs1.fastq)
file=${LISTFILES[$SLURM_ARRAY_TASK_ID]}
name=${file/_fs1.fastq/}
echo $file;
if [[ "$name" =~ "CE".* ]]; then
echo "C. elegans"
bwa mem -M -t 10 -R "@RG\tID:$name\tSM:$name\tPL:Illumina\tPI:330" $ref_CE $file > ${file/_fs1.fastq/.sam} 2>${file/_fs1.fastq/.bwa.log}
elif [[ "$name" =~ "CB".* ]]; then
echo "C. briggsae"
bwa mem -M -t 10 -R "@RG\tID:$name\tSM:$name\tPL:Illumina\tPI:330" $ref_CB $file > ${file/_fs1.fastq/.sam} 2>${file/_fs1.fastq/.bwa.log}
fi
samtools view -@ 9 -F 4 -bS -q 20 ${file/_fs1.fastq/.sam} | samtools sort -@ 10 -o ${file/_fs1.fastq/.s.bam} -
samtools index ${file/_fs1.fastq/.s.bam};
samtools depth -a ${file/_fs1.fastq/.s.bam} | awk '{sum+=$3} END { print "Average = ",sum/NR; }' > ${file/_fs1.fastq/.cov_mean};