function phylotree_feature_summary
2.x tripal_phylogeny.chado_node.inc | phylotree_feature_summary($phylotree_id) |
3.x tripal_phylogeny.chado_node.inc | phylotree_feature_summary($phylotree_id) |
Phylotree feature summary.
Get an array of feature counts by organism. key = organism abbreviation. value = number of features for this phylotree having this organism.
Parameters
int phylotree_id:
Return value
array
Related topics
File
- tripal_phylogeny/
includes/ tripal_phylogeny.chado_node.inc, line 763 - Implements the phylotree node content type
Code
function phylotree_feature_summary($phylotree_id) {
$sql = "
SELECT o.abbreviation, COUNT(o.organism_id) AS count
FROM {phylonode} n
LEFT OUTER JOIN {feature} f ON n.feature_id = f.feature_id
LEFT OUTER JOIN {organism} o ON f.organism_id = o.organism_id
WHERE n.phylotree_id = :phylotree_id
AND n.feature_id IS NOT NULL
GROUP BY o.organism_id
";
$args = array(':phylotree_id' => $phylotree_id);
$result = chado_query($sql, $args);
$summary = array();
foreach ($result as $r) {
$summary[$r->abbreviation] = $r->count;
}
return $summary;
}