-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.php
114 lines (80 loc) · 2.71 KB
/
main.php
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
<?php
// Include Interface
include_once 'FileHandler.php';
/**
* Includes all the classes in the current directory
*/
foreach (glob("*.php") as $filename)
{
include_once $filename;
}
$coverageFile = $argv[1];
$entropyFile = $argv[2];
$maxLines = 0;
// ------------------- Setup Intervals ---------------------- //
/** @var IntervalsHandler $intervalsHandler
*
* Setup the Interval Handler class
*/
$intervalsHandler = new IntervalsHandler();
/** @var Parser $parser
* Goes line by line to create the intervals
*/
$parser = new Parser('Files/'.$coverageFile, $intervalsHandler, $maxLines);
// ------------------- Step 1: Mean, StdDev, Median Depth ---------------------- //
/**
* Handler for calculating the mean
*/
$meanHandler = new MeanHandler($intervalsHandler);
/**
* Goes through each line of the file and gives it to the
* MeanHandler to compute the mean for each interval
*/
$parser = new Parser('Files/'.$coverageFile, $meanHandler, $maxLines);
/**
* Handler for calculating the Standard Deviation
*/
$standardDeviationHandler = new StandardDeviationHandler($intervalsHandler);
/**
* Goes through each line of the file and gives it to the
* StandardDeviationHandler to compute the mean for each interval
*/
$parser = new Parser('Files/'.$coverageFile, $standardDeviationHandler, $maxLines);
/**
* Handler for calculating the Median Depth
*/
$medianHandler = new MedianHandler($intervalsHandler);
/**
* Goes through each line of the file and gives it to the
* Median Handler to compute the mean for each interval
*/
$parser = new Parser('Files/'.$coverageFile, $medianHandler, $maxLines);
/**
* Handler for calculating the Median Depth
*/
$maxDepthHandler = new MaxDepthHandler($intervalsHandler);
/**
* Goes through each line of the file and gives it to the
* MaxDepth Handler to compute the mean for each interval
*/
$parser = new Parser('Files/'.$coverageFile, $maxDepthHandler, $maxLines);
$intervalsHandler->createSubIntervalsFile('Files/'.$coverageFile.'_subInterval.bed');
// --------------------- Step 2: Entropy ---------------------
//print_r($intervals);
/**
* Sets up the class for getting the max depth value for each sub interval
*/
$entropyParsingHandler = new EntropyStep2ParsingHandler($intervalsHandler);
/**
* Goes though each line of the file
*/
$parser = new Parser('Files/'.$entropyFile, $entropyParsingHandler, 60);
$intervalsHandler->calculateEntropy();
$intervalsHandler->createResultFile('Files/'.$coverageFile.'_result.txt');
if($maxLines > 0)
{
print_r($intervalsHandler->getIntervalsArray());
//print_r($intervalsHandler->getSubIntervalsArray());
}
//print_r($intervalsHandler->getSubIntervalsArray());
//print_r($entropyIntervalHandler->getAllIntervals());