-
Notifications
You must be signed in to change notification settings - Fork 1
/
slurm_nanocompore_preprocess.sh
executable file
·59 lines (47 loc) · 2.17 KB
/
slurm_nanocompore_preprocess.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
#!/bin/bash
# Copyright (C) 2020 Tobias Jakobi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either self.version 3 of the License, or
# (at your option) any later self.version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @Author: Tobias Jakobi <tjakobi>
# @Email: tobias.jakobi@med.uni-heidelberg.de
# @Project: University Hospital Heidelberg, Section of Bioinformatics and Systems Cardiology
#SBATCH -n 1
#SBATCH -N 1
#SBATCH -c 20
#SBATCH --mem=350G
#SBATCH -J "Nanocompore"
#SBATCH -p long
#SBATCH --mail-type=END,FAIL,TIME_LIMIT_80
#SBATCH --mail-user=tobias.jakobi@med.uni-heidelberg.de
module load nanopolish
module load nanocompore
# check if we have 4 arguments
if [ ! $# == 4 ]; then
echo "Usage: $0 [Guppy folder] [Transcript file fasta] [Basecalled FASTQ file] [target dir e.g. /tmp/]"
exit
fi
# create the target directory
mkdir $4 -p
# Steps from https://nanocompore.rna.rocks/data_preparation/
# align to reference
#minimap2 -ax map-ont -L ${2} ${3} | samtools view -bh -F 2324 -q 10 | samtools sort -O bam > $4/aligned.bam
minimap2 -ax splice -uf -k14 -L ${2} ${3} | samtools view -bh -F 2324 -q 10 | samtools sort -O bam > $4/aligned.bam
# build index
samtools index $4/aligned.bam
# index first with nanopolish index
nanopolish index -s ${1}/sequencing_summary.txt -d ${1}/workspace ${3}
# realign raw signal to the expected reference sequence
nanopolish eventalign --threads 40 --reads ${3} --bam $4/aligned.bam --genome ${2} --samples --print-read-names --scale-events --samples | gzip -c --best > ${4}/eventalign_reads.tsv.gz
# data has to be collapsed per kmer and indexed by NanopolishComp Eventalign_collapse
zcat ${4}/eventalign_reads.tsv.gz | NanopolishComp Eventalign_collapse --threads 40 -o ${4}/