-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dan_PassagedFibro_DNMTools.sh
133 lines (79 loc) · 3.53 KB
/
Dan_PassagedFibro_DNMTools.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
#SBATCH --job-name=AbisIndex
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=15
#SBATCH --mem=250GB
#SBATCH --partition=batch
#SBATCH --account=vsebast
#SBATCH --time=48:00:00
#SBATCH --array=1-6%6
#1-6%2 normally
#for mapping, originally set to 25 cores, 500 gb mem, running two at the same time. Need to rerun without mapping so gonna reduce the resourecs a bit
# sbatch Fibs_DNMTools_Map.sh ListOfSamps.txt /labs/vsebast/DJS/Project_Fibro_Passages/WGBS_DNMTools
module load dnmtools/1.2.2
module load bowtie2/2.5.0
module load samtools/1.9
module load ucsc_tools/309
index=$1
fileID=`sed "${SLURM_ARRAY_TASK_ID}p;d" ${index} | awk '{print $1}'`
bisIndex="/labs/vsebast/DJS/genomes/HomoSap/MethPipe/UCSC_Index/UCSC_hg38.abismalidx"
Index="/labs/vsebast/DJS/genomes/HomoSap/UCSC_ver/hg38.fa"
workdir=$2
echo '************************************'
echo Start ${fileID} Abismal alignment:
echo '************************************'
date
cd $workdir
mkdir $workdir/Abis_Mapping
# run alignment, adding sorting and conversion to bam in one step
dnmtools abismal -i $bisIndex ../WGBS/Trimmed/${fileID}*1.fq.gz ../WGBS/Trimmed/${fileID}*2.fq.gz -t 25 -v | samtools sort -O bam -@ 25 -o $workdir/Abis_Mapping/${fileID}_abis_mapped_sorted.bam
echo '************************************'
echo Start ${fileID} Uniqing:
echo '************************************'
date
mkdir $workdir/uniqueBams
#Uniqing
dnmtools uniq -v $workdir/Abis_Mapping/${fileID}_abis_mapped_sorted.bam $workdir/uniqueBams/${fileID}_out-sorted.bam
#Calculate conversion rate, will comment out now to save time
#dnmtools bsrate [OPTIONS] -c <chroms> <input.sam>
echo '************************************'
echo Start ${fileID} methcounts:
echo '************************************'
date
mkdir $workdir/methcounts
#Calculating counts. Doing CpG Context only to save time
dnmtools counts -v -cpg-only -c $Index -o $workdir/methcounts/${fileID}.meth $workdir/uniqueBams/${fileID}_out-sorted.bam
echo '************************************'
echo Start ${fileID} Sym:
echo '************************************'
date
mkdir $workdir/symCpGs
#Output to symmetryic CpGs
dnmtools sym -o $workdir/symCpGs/${fileID}_sym.meth $workdir/methcounts/${fileID}.meth
echo '************************************'
echo Start ${fileID} Bigwigs:
echo '************************************'
date
mkdir $workdir/meth_bigwigs
#awk -v OFS="\t" '{print $1, $2, $2+1, $4":"$6, $5, $3}' $workdir/symCpGs/${fileID}_sym.meth > $workdir/symCpGs/${fileID}_symmeth.bed
cut -f 1-3,5 $workdir/symCpGs/${fileID}_symmeth.bed | wigToBigWig /dev/stdin /labs/vsebast/DJS/genomes/HomoSap/UCSC_ver/hg38.chrom.sizes $workdir/meth_bigwigs/${fileID}_meth.bw
echo '************************************'
echo Start ${fileID} LMRs:
echo '************************************'
date
mkdir $workdir/LMRs
#Finding HMRs/LMRs
dnmtools hmr -v -o $workdir/LMRs/${fileID}.hmr $workdir/symCpGs/${fileID}_sym.meth
######### making merged LMRs (separate to above script ran as an array in SCG) ###############
mkdir Merged_sym
######NEO Merged ########
dnmtools merge -o Merged_sym/NEO2_allPs.meth symCpGs/NEO2_P2_sym.meth symCpGs/NEO2_P5_sym.meth symCpGs/NEO2_P8_sym.meth
mkdir Merged_LMRs
#Finding HMRs/LMRs
dnmtools hmr -v -o Merged_LMRs/NEO2_allPs.hmr Merged_sym/NEO2_allPs.meth
#### old merged ###
dnmtools merge -o Merged_sym/OLD3_allPs.meth symCpGs/OLD3_P2_sym.meth symCpGs/OLD3_P5_sym.meth symCpGs/OLD3_P8_sym.meth
mkdir Merged_LMRs
#Finding HMRs/LMRs
dnmtools hmr -v -o Merged_LMRs/OLD3_allPs.hmr Merged_sym/OLD3_allPs.meth