-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathslurm_create_taiyaki_training_set.sh
More file actions
executable file
·65 lines (50 loc) · 2.1 KB
/
Copy pathslurm_create_taiyaki_training_set.sh
File metadata and controls
executable file
·65 lines (50 loc) · 2.1 KB
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
#!/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 40
#SBATCH --mem=50G
#SBATCH -J "build training set"
#SBATCH --mail-type=END,FAIL,TIME_LIMIT_80
#SBATCH --mail-user=tobias.jakobi@med.uni-heidelberg.de
# check if we have 8 arguments
if [ ! $# == 8 ]; then
echo "Usage: $0 [Target folder] [Read FASTA] [# unmod reads] [# mod reads] [mod read list] [unmod read list] [FAST5 dir]"
exit
fi
target_dir=${1}__${4}_unmod_${5}_mod
fasta=$2
num_unmod=$4
num_mod=$5
mod_reads=$6
unmod_reads=$7
fast5=${8}
module load seqtk
# create the target directory
mkdir $target_dir -pv
cd $target_dir
ln -s $fasta .
shuf -n $num_mod $mod_reads > ${num_mod}_random_curlcake_reads.list
shuf -n $num_unmod $unmod_reads > ${num_unmod}_random_reads.list
seqtk subseq $fasta ${num_mod}_random_curlcake_reads.list > ${num_mod}_random_curlcake_reads.fasta
seqtk subseq $fasta ${num_unmod}_random_reads.list > ${num_unmod}_random_reads.fasta
sed 's/A/Y/g' ${num_mod}_random_curlcake_reads.fasta > ${num_mod}_random_curlcake_reads_Y.fasta
cat ${num_mod}_random_curlcake_reads.list ${num_unmod}_random_reads.list > merged_reads.list
cat ${num_mod}_random_curlcake_reads_Y.fasta ${num_unmod}_random_reads.fasta > merged_reads.fasta
fast5_subset -i $fast5 -l merged_reads.list -t 40 -r -s training_set_fast5