-
Notifications
You must be signed in to change notification settings - Fork 3
/
assemble.pl
93 lines (82 loc) · 2.34 KB
/
assemble.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
#!/usr/bin/env perl
if ($#ARGV < 0) {
print "usage: assemble.pl readsFile [-vertexSize v] [-exeDir e]\n";
exit(0);
}
$vertexSize = 20;
$machtype = $ENV{"MACHTYPE"};
$srcDir = $ENV{"MCSRC"};
$exeDir = "$srcDir/assembly/$machtype";
$readsFile = shift @ARGV;
$curdir = "";
if (! -e $readsFile ){
print "$readsFile does not exist\n";
exit(1);
}
while ($#ARGV >= 0) {
$option = shift @ARGV;
if ($option eq "-vertexSize") {
$vertexSize = shift @ARGV;
}
if ($option eq "-dir") {
$curdir = shift @ARGV;
}
}
if ($curdir != "") {
chdir($curdir);
}
# create all the commands at the top of the script so
# I don't have to look all over the place to find them
$buildVertexCmd =
"$exeDir/countSpectrum $readsFile $readsFile.v -tupleSize $vertexSize -printPos";
$sortVertexCmd =
"$exeDir/sortVertexList $readsFile.v $readsFile $vertexSize $readsFile.sv";
$buildGraphCmd =
"$exeDir/debruijn $readsFile $readsFile.sv $readsFile.dot -vertexSize $vertexSize";
$edgesToOverlapListCmd =
"$exeDir/edgesToOverlapList $readsFile.edge $vertexSize $readsFile.ovp";
$printReadIntervalsCmd =
"$exeDir/printReadIntervals $readsFile.ovp $readsFile.edge $readsFile $vertexSize $readsFile.intv $readsFile.path";
$printContigsCmd = "$exeDir/printContigs $readsFile";
$removeFilesCmd = "$srcDir/assembly/CleanUpIntermediates.pl $readsFile";
print "$buildVertexCmd\n";
$res = system($buildVertexCmd);
if ($res != 0) {
print "building vertices failed: $res\n";
exit(1);
}
print "sorting vertices\n";
$res = system($sortVertexCmd);
if ($res != 0) {
print "sorting vertices failed: $res\n";
print "$sortVertexCmd\n";
exit(1);
}
print "building graph\n";
$res = system($buildGraphCmd);
if ($res != 0) {
print "building the graph failed: $res\n";
print "$buildGraphCmd\n";
exit(1);
}
print "mapping read intervals\n";
$res = system($edgesToOverlapListCmd);
if ($res != 0) {
print "creating the overlap list failed: $res\n";
exit(1);
}
$res = system($printReadIntervalsCmd);
if ($res != 0) {
print "printing the read intervals failed: $res\n";
exit(1);
}
$res = system($printContigsCmd);
if ($res != 0) {
print "printing contigs failed: $res\n";
exit(1);
}
$res = system($removeFilesCmd);
if ($res != 0) {
print "removing extra files failed\n";
exit(1);
}