-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_phrap.pl
More file actions
112 lines (62 loc) · 1.74 KB
/
Copy pathrun_phrap.pl
File metadata and controls
112 lines (62 loc) · 1.74 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
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
#!perl -w
use strict;
use warnings;
use Parallel::ForkManager;
my $forks = shift(@ARGV) or die;
my $manager = new Parallel::ForkManager($forks); #the number of forks must be adjusted by the user
#these may need to be adjusted by the user to specify the correct directory
my $phrap = 'phrap';
my $longfasta = 'shortphrap.pl';
#run phrap
my @out = glob('*.out');
foreach my $out (@out){
unlink(qq{$out});
}
my @short = glob('short*');
foreach my $short (@short){
unlink(qq{$short});
}
my @output = glob('*.output');
foreach my $output (@output) {
unlink(qq{$output});
}
my @contigs = glob('*.contigs');
foreach my $contigs (@contigs) {
unlink(qq{$contigs});
}
my @ace = glob('*.ace');
foreach my $ace (@ace) {
unlink(qq{$ace});
}
my @singlet = glob('*.singlets');
foreach my $singlet (@singlet) {
unlink(qq{$singlet});
}
my @problems = glob('*.problems');
foreach my $problems (@problems) {
unlink(qq{$problems});
}
my @log = glob('*.log');
foreach my $log (@log) {
unlink(qq{$log});
}
print "Running Phrap...\n";
my @fasta2 = glob('*.fasta');
foreach my $fasta2 (@fasta2) {
$manager -> start and next;
my $linecount = 0;
open(FILE, "<$fasta2");
$linecount++ while <FILE>;
close FILE;
if ($linecount < 10000) {
system(qq{$phrap $fasta2 -vector_bound 0 -forcelevel 10 -minscore 10 -minmatch 10 -new_ace});
}elsif ($linecount >= 10000) {
my $newfile = "short." . $fasta2;
my $newqual = $newfile . ".qual";
system(qq{perl $longfasta $fasta2 $newfile $newqual});
system(qq{$phrap $newfile -vector_bound 0 -forcelevel 10 -minscore 10 -minmatch 10 -new_ace});
}
$manager -> finish;
}
$manager -> wait_all_children;
print "Done! \n";