-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDNA_data_storage_channel.sh
executable file
·125 lines (93 loc) · 2.04 KB
/
DNA_data_storage_channel.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
#---------------------------------------------------------------------------#
# @Authors: Belaid Hamoum, Elsa Dupraz #
# Project : DnarXiv, funded by CominLabs #
# email : belaid.hamoum@gmail.com #
#---------------------------------------------------------------------------#
# DNA Data Storage SIMULATOR #
# (From Synthesis to Basecalling) #
# #
#---------------------------------------------------------------------------#
####
#->Parameters:
# -$1:Seq path to simulate
# -$2:Nbr of reads to simulate
# -$3:Simulated sequences output path
# -$4:Channel memory length, k=6 by default [RECOMENDED]
###
cd $(dirname $0)
prevDir=$(pwd)
inPath=""
k=6
nbrRead=0
outPath=""
while [ "$1" != "" ]; do
case $1 in
-i | --inputSeq )
shift
inPath=$1
;;
-o | --outPath )
shift
outPath=$1
;;
-k | --memLen )
shift
k=$1
;;
-n | --nbrRead )
shift
nbrRead=$1
;;
esac
shift
done
#inputs checking
if [ "$k" == "" ]
then
k=6
else
int='^[1-9][0-9]*$'
if ! [[ $k =~ $int ]]
then
echo "error: -k [1:10] (pick up a value between 1 and 10), [k=6 is recommended]"
exit 1
elif [[ $k -gt "10" ]]
then
echo "error: -k [1:10] (pick up a value between 1 and 10), [k=6 is recommended]"
exit 1
fi
fi
int='^[0-9]+$'
if ! [[ $nbrRead =~ $int ]] || [ $nbrRead -eq "0" ]
then
echo "error: value of 'n' should be greater than 0 -n [1:N]"
exit 1
fi
if [ -f "$prevDir/$inPath" ]
then
inPath=$prevDir/$inPath
elif [ -f "$inPath" ]
then
inPath=$inPath
else
echo "error: input path file is incorrect"
exit 1
fi
if ! touch $prevDir/$outPath > /dev/null 2>&1
then
if ! touch $outPath > /dev/null 2>&1
then
echo "error: incorrect output path"
exit 1
else
outPath=$outPath
fi
else
outPath=$prevDir/$outPath
fi
#launch
echo -n "-> Launching... "
cd ./simulator
julia simulator_v1.jl $nbrRead $inPath $outPath $k
cd ..
cd $prevDir