コード例 #1
0
ファイル: test.php プロジェクト: acomjean/biophp
	array('c', 'GO annotation cutoff', 1000, 'cutoff'),
	array('n', 'Number of pairs to fetch', 100, 'number'),
));

foreach ($opts as $k=>$v) {
	echo "  $k : $v\n";
}

echo "- Testing \biophp\constants\species\spToTaxid\n";
$taxid = \biophp\constants\species::spToTaxid('human');
echo "  The taxonomy id of human is: $taxid \n";
echo "- Testing \biophp\constants\genes\idToXref\n";*/
$genes = \biophp\constants\gene::convert(1, 'id', 'ensemblGene');
echo "  The ensembl gene id of entrez gene id 1 is: {$genes}\n";
echo "  The entrez gene id of ENSG00000183044 is " . \biophp\constants\gene::convert('ENSG00000183044', 'EnsemblGene', 'id') . "\n";
$genes = \biophp\constants\gene::convert(array(1, 10, 100, 101, 102, 103, 104, 107, 108, 109, 111, 112, 113, 115, 116, 117, 118, 119, 12, 120, 123, 124, 126, 127, 128, 13, 130, 131, 132, 134, 135, 136, 14, 140, 141, 142, 143, 146, 148, 15, 150, 151, 152, 153, 154), 'id', 'symbol', true);
//print_r (\biophp\constants\gene::convert($genes, 'synonyms', 'id', true));
print_r($genes);
print_r(\biophp\math\gsea::hg(array("ADORA2A", "ADORA2B", "ADRA1A", "ADRA1D", "ADRB1", "ADRB2", "ADCYAP1R1", "ADORA1", "ADORA3", "ADRA2A", "ADRA2B", "ADRA2C", "ADCY3", "ADCY9", "ADCY1", "ADCY2", "ADCY7", "ADCY6", "ADCY5", "ADA", "ADK", "ADH1A", "ADH1C", "ADH4", "ADH5", "ADH6", "ADH7", "PARP1", "PARP4", "ADAM10", "ADAR", "NAT2", "AANAT", "A1BG", "AADAC", "AAMP", "ADAM8", "ADARB1", "ADCYAP1", "ADD1", "ADD2", "ADD3", "ADPRH", "SERPINA3"), "symbol", "c2.cp.kegg", "symbol", 0.05, 10, false));
print_r(\biophp\math\gsea::ks(array(1, 2, 3, 4, 5), "id", array(4, 5), "id", 1000));
/*
echo "- Testing Naive Bayes\n";
$trainingSet = array(
	array(
		'data' => array('Outlook'=>'Sunny', 'Temp'=>'Hot', 'Hum'=>'High', 'Windy'=>'Weak'),
		'class' => 'No'
	),
	array(
		'data' => array('Outlook'=>'Sunny', 'Temp'=>'Hot', 'Hum'=>'High', 'Windy'=>'Strong'),
		'class' => 'No'
	),
コード例 #2
0
ファイル: kinase.class.php プロジェクト: acomjean/biophp
 /**
  * @desc: tell whether a given xref id is a kinase 
  * @param: $xref, the xref id
  * @param: $xrefdb, the xref db, same as it in constants.genes
  * @param: $species, the species
  *         Supported species: human, mouse. Default: human
  * @return: true|false
  */
 public static function isKinaseByXref($xref, $xrefdb, $species = 'human')
 {
     require_once __DIR__ . "/gene.class.php";
     $id = \biophp\constants\gene::xref2Id($xref, $xrefdb, $xrefdb == 'Symbol+Synonyms');
     return self::isKinaseById($id, $species);
 }
コード例 #3
0
ファイル: gsea.class.php プロジェクト: acomjean/biophp
 /**
  * @desc: do the KS-like gsea without permutation
  * @param: $genelist, The sorted gene list
  * @param: $informat, The gene id format of the input gene list
  *         Default: id
  * @param: $ref, An array of ref genes
  * @param: $refformat, Similar as $informat, the gene format of $ref
  * @param: $corr, The correlation of gene in $genelist with the phenotype
  *         Default: array(1,1,...)
  * @param: $weight: The weight of GSEA algorithm
  * @return: The enrichment score
  */
 public static function es($genelist, $informat = "id", $ref = array(), $refformat = "id", $corr = array(), $weight = 1)
 {
     if ($informat != "id") {
         $genelist = \biophp\constants\gene::convert($genelist, $informat, "id");
     }
     if ($refformat != "id") {
         $ref = \biophp\constants\gene::convert($ref, $refformat, "id");
     }
     $NR = sizeof(array_intersect($genelist, $ref));
     $N = sizeof($genelist);
     $Nh = sizeof($ref);
     $ref = array_fill_keys($ref, 1);
     if (empty($corr)) {
         $corr = array_fill(0, $N, 1);
     }
     $es = -1;
     $phit = 0;
     $pmiss = 0;
     foreach ($genelist as $i => $g) {
         if (isset($ref[$g])) {
             $phit += pow($corr[$i], $weight) / $NR;
         } else {
             $pmiss += 1 / ($N - $Nh);
         }
         if ($phit - $pmiss > $es) {
             $es = $phit - $pmiss;
         }
     }
     return $es;
 }