Example #1
0
print "<table><tr><td>\n<p><b>Name of sequences</b>\n<pre>\n";
foreach ($seq_name as $n => $name) {
    print "  {$n}\t{$name}\n";
}
print "</pre></td></tr></table>\n";
// DISPLAY SELECTED OLIGONUCLEOTIDE LENGTH
print "Length of oligoncleotides for comparison: " . $_POST["len"];
// NEXT LINES WILL PERFORM UPGMA CLUSTERING
// in each loop, array $data is reduced (one case per loop)
while (sizeof($data) > 1) {
    $min = min_array($data);
    // global variables are created: $x, $y, $min, $cases
    $comp[$x][$y] = $min;
    $data = new_array($data, $cases, $x, $y);
}
$min = min_array($data);
$comp[$x][$y] = $min;
// end of clustering
//  array $comp stores the important data
// $textcluster is the results of the cluster as text.
//     p.e.:  ((3,4),7),(((5,6),1),2)
$textcluster = "{$x},{$y}";
print "<p>Clustering method: UPGMA<BR>{$textcluster}<p>";
// $max is the distance in the last clustering step (the root of the dendrogram)
$max = $a[$x][$y];
// CREATE THE IMAGE WITH THE DENDROGRAM
create_dendrogram($textcluster, $comp, $max, $_POST["method"], $_POST["len"]);
// SHOW DENDROGRAM
print "<img src=image.png?" . date("U") . " border=1>";
// SHOW TIME REQUIRED FOR COMPUTING
$timetotal = date("U") - $timestart;
Example #2
0
 function actividad()
 {
     if ($this->colaLibre($this->finColas["vigilancia"])) {
         $this->escanearFlotas();
     }
     if ($this->colaLibre($this->finColas["vigilancia"]) && !$this->colaLibre($this->finColas["defensa"])) {
         //Si esta condiciĆ³n se cumple, hay ataque inminente
         $this->escanearFlota();
         $this->defensa();
     } else {
         //Si no se cumple, actividad normal
         /*
         if($this->colaLibre($this->finColas["granjeo"])){
         	$this->escanearFlota();
         	$this->granjeo();
         }
         
         if($this->colaLibre($this->finColas["hangar"])){
         	$this->escanearHangar();
         	$this->aumentarFlota();
         }
         */
     }
     $this->finCola = min_array($this->finColas);
 }