-
Notifications
You must be signed in to change notification settings - Fork 0
/
WGBS_legacy_bismarkAlign.sh
executable file
·42 lines (34 loc) · 1.08 KB
/
WGBS_legacy_bismarkAlign.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
35
36
37
38
39
40
41
42
#!/bin/bash -l
# Jimmy ([email protected]) - 20141002
# Run Bismark on all Trimmed Sample in a directory in parallel
# (Whole genome BS-Seq data)
# Load modules
. /opt/shared/Modules/3.2.7/init/bash
module load bowtie/2-2.2.3
module load bismark
module load picard/1.71
module load python
module load parallel
module load SamTools/0.1.19
module load perl
if [ "$#" != "3" ]; then
echo "Usage: jb_WGBS_align.sh [Data Directory] [Reference file directory] [num_of_threads]"
exit 0
fi
if [ ! -d "$2" ]; then
echo "Reference Genome \"$2\" doesnt exist. Now creating..."
bismark_genome_preparation --bowtie2 $Refdir
exit 1
else
echo "Reference Genome is \"$2\" "
fi
# Inputs
data=$1
Refdir=$2
# Processes to run in parallel
threads=$3
# Run bismark alignment command in parallel
parallel -j $threads 'bismark -p 4 --bowtie2 --score_min L,0,-0.6 -X 1000 --bam \
{1} -1 {2} -2 {3}' ::: $Refdir ::: $data/*_R1_val_1.fq.gz ::: $data/*_R2_val_2.fq.gz
wait
parallel -j $threads 'samtools sort {} - | samtools rmdup -S - {}.sorted.nodup.bam' ::: *_bismark_bt2_pe.bam