forked from LeifAnderssonLab/2023_Horse_mackerel_popgen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07-3-2-calculate-WattTheta.sh
34 lines (28 loc) · 1.41 KB
/
07-3-2-calculate-WattTheta.sh
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
#SBATCH -A snic2020-5-36
#SBATCH -p core -n 4
#SBATCH -t 4-00:00:00
#SBATCH -J HOM_Wtheta
#SBATCH -e HOM_Wtheta_%J_%A_%a.err
#SBATCH -o HOM_Wtheta_%J_%A_%a.out
#SBATCH --mail-type=all
#SBATCH --mail-user=angela.fuentespardo@gmail.com
#SBATCH -a 1-12
# Load required software.
module load bioinfo-tools
module load popoolation/1.2.2
module load perl/5.26.2
# Directory where the BAM files will be stored.
cd /proj/snic2020-16-14/private/HorseMackerel/analysis/07-popgen-stats
# Set path to required files and directories as environment variables.
ID_FILE='./HOM_12pops_sampleIDs.txt'
POOLSIZE_FILE='./HOM_12pops_poolSize.txt'
# For a given job in the array, set the correspondent sample files.
ID_target=$(sed -n "$SLURM_ARRAY_TASK_ID"p $ID_FILE)
POOLSIZE_target=$(sed -n "$SLURM_ARRAY_TASK_ID"p $POOLSIZE_FILE)
# Print current file info to stdout for future reference.
echo This is array job: $SLURM_ARRAY_TASK_ID
echo -e This is the ID target: ${ID_target}
echo -e This is the POOLSIZE target: ${POOLSIZE_target}
# Calculate Watterson’s Theta.
perl /sw/apps/bioinfo/popoolation/1.2.2/rackham/Variance-sliding.pl --input ./pileup-files/${ID_target}.pileup --output ./Wattersons-Theta/${ID_target}.pileup.WS-SS10K.minCnt.4.minCov.10.maxCov.885.theta --measure theta --window-size 10000 --step-size 10000 --min-count 4 --min-coverage 10 --max-coverage 885 --min-qual 20 --pool-size ${POOLSIZE_target} --fastq-type sanger