par gui » 29 mars 2010, 14:53
par stealth35 » 29 mars 2010, 14:42
$test->execute(); //fais print_r($test->tab);
par gui » 29 mars 2010, 14:41
<?php ini_set ('max_execution_time', 0); // Aucune limite d'execution require_once("./selection.php"); $test=new selection(); $test->execute(); ?>
par stealth35 » 29 mars 2010, 14:20
$this->subsequence($sequence)
par stealth35 » 29 mars 2010, 14:17
$selection = new Selection(); $selection->execute();
par gui » 29 mars 2010, 14:15
par stealth35 » 29 mars 2010, 14:06
par gui » 29 mars 2010, 14:03
class selection { public function __construct($way="/home/guillaume/Desktop/Seq-matrice/sequences.fasta") { $this->way=$way; $this->b=10; $this->tab = array(); //$this->i=0; } public function execute() { if(file_exists($this->way)) { $lignes= file ($this->way); //print_r($lignes); $cpt=0; foreach($lignes as $ligne) { if(strpos($ligne,'>')!== false){ if($cpt>0) { echo "$sequence<br \>"; $sequence=trim($sequence," "); $this->subsequence($sequence); // L'appel se fait à ce niveau $sequence=""; } $this->id=$ligne; $sequence=""; $cpt++; } else{ $sequence.=$ligne; $sequence=trim($sequence); } } if($sequence!="") { echo "$sequence<br \>"; echo "$this->id<br \>"; #echo "$sequence<br \>"; $this->subsequence($sequence); //Ou bien à ce niveau } } else { die("impossible d'ouvrir le fichier FASTA"); } } public function subsequence($sequence) { $arr=array(); $jen="/home/guillaume/Desktop/Seq-matrice/data.fasta"; $pro=fopen($jen,"w+"); fwrite($pro,$this->id); fwrite($pro,$sequence."\n"); fclose($pro); chmod($jen,0777); for($a=0;$a<=strlen($sequence)-$this->b;$a++){ $this->files=substr($sequence,$a,$this->b); $align=array(0=>$this->files); //print_r($align); #msf $msa=new Msa($align); $msa->toMSF("/opt/lampp/htdocs/profils/test.msa"); $file="/opt/lampp/htdocs/profils/test.msa"; $msf=file_get_contents("$file"); #pfmake $pfmake=new pfMake($file); $pfmake->setAlignmentMode(-1); $pfmake->setLinearMode(); $pfmake->execute(); $pfmake->autoscale($db=0); $prf=$pfmake->getProfile(); //echo $prf; $profil=file_get_contents("$prf"); #echo $profil; # pfsearch $pfsearch=new pfSearch($prf,$jen); $pfsearch->execute(); $pr=$pfsearch->getResult(); #$prr=$pfsearch=file_get_contents($pr); #echo $pr; $this->tab[$this->i]=array ($msf,$profil,$pr); // Voilà donc le tableau récapitulatif avec ou sans $this->i c'est la même print_r ($this->tab); //$this->i++; } #Recherche séquence significative $score=new score(); $score->execute(); $mx=$score->getResult(); #Renvoie clé de $mx (valeur maximale) function recursive_array_search($needle,$haystack) { foreach($haystack as $key=>$value) { $current_key=$key; if($needle===$value OR (is_array($value) && recursive_array_search($needle,$value))) { return $current_key; } } return false ; // A ce niveau le script me retoune "false" } $found = recursive_array_search($mx,$tab); var_dump($found); } }
par stealth35 » 29 mars 2010, 13:50
par gui » 29 mars 2010, 13:48
$this->tab[$this->i]=array ($msf,$profil,$pr);
$this->tab[]=array ($msf,$profil,$pr);
par stealth35 » 29 mars 2010, 13:35
par gui » 29 mars 2010, 12:17
public function __construct() { $this->tab = array(); $this->i=0;
$this->tab[$this->i]=array ($msf,$profil,$pr); print_r ($this->tab); $this->i++;
par gui » 29 mars 2010, 11:17
par stealth35 » 29 mars 2010, 11:16
par gui » 29 mars 2010, 11:06