-
Notifications
You must be signed in to change notification settings - Fork 2
/
Change_Settings.pl
executable file
·379 lines (364 loc) · 8.98 KB
/
Change_Settings.pl
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# !/usr/bin/perl -w
#
# Change_Settings.pl
# Written by: David Crabb
# Eric Triplett's Group
# University of Florida
# Last Modified: May 17,2010
###########################################################################
#
# Parameters:
# -run the script, and it will prompt you for changes
#
###########################################################################
### DEFAULTS ###
$LEN = 100;
$QUAL = 20;
$PRO = 1;
$DOM = 80;
$PHY = 80;
$CLA = 90;
$ORD = 90;
$FAM = 90;
$GEN = 95;
$SPE = 99;
if(open(SETTING, "backbone/settings.txt")) #tries to open file
{
read_Settings();
close SETTING;
}
do
{
print "\n Please enter the letter of the setting you would like to change,
then you will be given information about the setting and you will be
prompted for a value.
Trim2
-l minimum length of sequences (CURRENT: $LEN)
-q minimum quality of sequences (CURRENT: $QUAL)
Megablast
-n number of processors in your computer (CURRENT: $PRO)
Classification
-d minimum % similarity for Domain (CURRENT: $DOM%)
-p minimum % similarity for Phylum (CURRENT: $PHY%)
-c minimum % similarity for Class (CURRENT: $CLA%)
-o minimum % similarity for Order (CURRENT: $ORD%)
-f minimum % similarity for Family (CURRENT: $FAM%)
-g minimum % similarity for Genus (CURRENT: $GEN%)
-s minimum % similarity for Species (CURRENT: $SPE%)
Defaults
-z restore all settings to defaults
Type \"quit\" and press enter to quit.
Please enter the letter and press enter:";
chomp($input = <>); #takes user input
if($input eq "l" || $input eq "-l")
{
change_length();
}
elsif($input eq "q" || $input eq "-q")
{
change_quality();
}
elsif($input eq "n" || $input eq "-n")
{
change_processors();
}
elsif($input eq "d" || $input eq "-d")
{
change_tax("Domain", $DOM);
}
elsif($input eq "p" || $input eq "-p")
{
change_tax("Phylum", $PHY);
}
elsif($input eq "c" || $input eq "-c")
{
change_tax("Class", $CLA);
}
elsif($input eq "o" || $input eq "-o")
{
change_tax("Order", $ORD);
}
elsif($input eq "f" || $input eq "-f")
{
change_tax("Family", $FAM);
}
elsif($input eq "g" || $input eq "-g")
{
change_tax("Genus", $GEN);
}
elsif($input eq "s" || $input eq "-s")
{
change_tax("Species", $GEN);
}
elsif($input eq "z" || $input eq "-z")
{
restore_defaults();
}
} until $input eq "quit" || $input eq "Quit";
system('clear');
############################################### SUBROUTINES ###############################################
sub save() #Saves all settings to file
{
open OUTPUT, ">backbone/settings.txt" or die $!;
print OUTPUT "$LEN\n$QUAL\n$PRO\n$DOM\n$PHY\n$CLA\n$ORD\n$FAM\n$GEN\n$SPE\n";
close OUTPUT;
}
sub change_length() #Change minimum length for trimming (trim2.pl)
{
system("clear");
print" Trim2 throws out sequences that are too short. The default setting
is to throw out sequences that are less than 100 bases long. The
current setting is $LEN".".\n\n\tPlease type the length you want to be the new minimum or \"n\" if
you don't want to change anything and press enter:";
my $newLen = "";
my $loop = "true";
while($loop eq "true")
{
chomp($newLen = <>);
if($newLen eq "n")
{
$loop = "false";
}
elsif($newLen =~ /[a-zA-Z]/ || $newLen < 1)
{
print "\n\tPlease type a positive number only or \"n\"if you don't want to change anything:"
}
else
{
$loop = "false";
print "You have chosen the new minimum length to be $newLen.\nSaving...";
$LEN = $newLen;
save();
print "done.\n\n";
}
}
}
sub change_quality()
{
system("clear");
print" Trim2 throws out sequences that are too short. Trim2 utilizes quality
scores to measure the quality of each nucleotide base. It trims
sequences based on average quality scores. The higher the minimum
quality, the more strict the program will be with sequences. The
current setting is $QUAL".".\n\n\tPlease type the length you want to be the new minimum or \"n\" if
you don't want to change anything and press enter:";
my $newQual = "";
my $loop = "true";
while($loop eq "true")
{
chomp($newQual = <>);
if($newQual eq "n")
{
$loop = "false";
}
elsif($newQual =~ /[a-zA-Z]/ || $newQual < 1)
{
print "\n\tPlease type a positive number only or \"n\"if you don't want to change anything:"
}
else
{
$loop = "false";
print "You have chosen the new minimum quality to be $newQual.\nSaving...";
$QUAL = $newQual;
save();
print "done.\n\n";
}
}
}
sub change_processors()
{
system("clear");
print " Megablast runs significantly quicker if it can use more processors.
Using all of your processors would make Megablast and therefore PANGEA
run at its optimum speed. The current setting is $PRO processors.\n\n\t Please type the number of processors you want to use or \"n\" if
you don't want to change anything and press enter:";
my $newPro = "";
my $loop = "true";
while($loop eq "true")
{
chomp($newPro = <>);
if($newPro eq "n")
{
$loop = "false";
}
elsif($newPro =~ /[a-zA-Z]/ || $newPro < 1)
{
print "\n\tPlease type a positive number only or \"n\"if you don't want to change anything:"
}
else
{
$loop = "false";
print "You have chosen the new number of processors to be $newPro.\nSaving...";
$PRO = $newPro;
save();
print "done.\n\n";
}
}
}
sub change_tax()
{
system("clear");
$tax = shift;
print "\tSequences are classified at different taxonomic levels based on
their percent similarties to existing sequences. The current
thresholds are:
Domain\t$DOM
Phylum\t$PHY
Class\t$CLA
Order\t$ORD
Family\t$FAM
Genus\t$GEN
Species\t$SPE
Please enter a percent similarity that is less than or equal
to more specific classifications and greater than or equal
to less specific classifications or enter \"n\" if you don't
want to change anything and press enter:";
$loop = "true";
while($loop eq "true")
{
chomp($newTax = <>);
if($newTax eq "n")
{
$loop = "false";
}
elsif($newTax =~ /[a-zA-Z]/ || $newTax < 1)
{
print "\n\tPlease type a positive number only or \"n\"if you don't want to change anything:";
}
else
{
if($tax eq "Domain")
{
if($newTax <= $PHY)
{
print "The new Domain threshold is $newTax.\nSaving...";
$DOM = $newTax;
save();
$loop = "false";
print "done.\n";
}
else
{
print "\n\tMust be less than or equal to the phylum threshold:";
}
}
elsif($tax eq "Phylum")
{
if($newTax >= $DOM && $newTax <= $CLA)
{
print "The new Phylum threshold is $newTax.\nSaving...";
$PHY = $newTax;
save();
$loop = "false";
print "done.\n";
}
else
{
print "\n\tMust be greater than or equal to the domain threshold and\n\tless than or equal to the class threshold:";
}
}
elsif($tax eq "Class")
{
if($newTax >= $PHY && $newTax <= $ORD)
{
print "The new Class threshold is $newTax.\nSaving...";
$CLA = $newTax;
save();
$loop = "false";
print "done.\n";
}
else
{
print "\n\tMust be greater than or equal to the phylum threshold and\n\tless than or equal to the order threshold:";
}
}
elsif($tax eq "Order")
{
if($newTax >= $CLA && $newTax <= $FAM)
{
print "The new Order threshold is $newTax.\nSaving...";
$ORD = $newTax;
save();
$loop = "false";
print "done.\n";
}
else
{
print "\n\tMust be greater than or equal to the class threshold and\n\tless than or equal to the family threshold:";
}
}
elsif($tax eq "Family")
{
if($newTax >= $ORD && $newTax <= $GEN)
{
print "The new Family threshold is $newTax.\nSaving...";
$FAM = $newTax;
save();
$loop = "false";
print "done.\n";
}
else
{
print "\n\tMust be greater than or equal to the order threshold and\n\tless than or equal to the genus threshold:";
}
}
elsif($tax eq "Genus")
{
if($newTax >= $FAM && $newTax <= $SPE)
{
print "The new Genus threshold is $newTax.\nSaving...";
$GEN = $newTax;
save();
$loop = "false";
print "done.\n";
}
else
{
print "\n\tMust be greater than or equal to the family threshold and\n\tless than or equal to the species threshold:";
}
}
elsif($tax eq "Species")
{
if($newTax >= $GEN)
{
print "The new Species threshold is $newTax.\nSaving...";
$SPE = $newTax;
save();
$loop = "false";
print "done.\n";
}
else
{
print "\n\tMust be greater than or equal to the genus threshold:";
}
}
}
}
}
sub restore_defaults() #restore defaults to all values
{
$LEN = 100;
$QUAL = 20;
$PRO = 1;
$DOM = 80;
$PHY = 80;
$CLA = 90;
$ORD = 90;
$FAM = 90;
$GEN = 95;
$SPE = 99;
unlink("backbone/settings.txt");
}
sub read_Settings() #read previous settings file
{
chomp($LEN = <SETTING>);
chomp($QUAL = <SETTING>);
chomp($PRO = <SETTING>);
chomp($DOM = <SETTING>);
chomp($PHY = <SETTING>);
chomp($CLA = <SETTING>);
chomp($ORD = <SETTING>);
chomp($FAM = <SETTING>);
chomp($GEN = <SETTING>);
chomp($SPE = <SETTING>);
}