Skip to content
Snippets Groups Projects
tripal_orthology_links.tpl.php 1.57 KiB
Newer Older
<?php
$feature = $variables['node']->feature;

Anthony Bretaudeau's avatar
Anthony Bretaudeau committed
if (preg_match('/v2.1b/', $feature->analysisfeature[0]->analysis_id->name) >= 1) {
    echo "";
}
else if ($feature->type_id->name == 'polypeptide') {
    $target_id = $feature->uniquename;
    echo '<a href="' . getenv('ENABLE_ORTHOLOGY_LINKS') . 'chado_gene_phylotree?gene_name=' . $target_id . '">View orthology data for ' . $feature->uniquename . '</a>';
}
else if ($feature->type_id->name == 'mRNA') {
    foreach ($feature->feature_relationship->object_id as $rel) {
        if ($rel->subject_id->type_id->name == 'polypeptide') {
            $target_id = $rel->subject_id->uniquename;
            echo '<a href="' . getenv('ENABLE_ORTHOLOGY_LINKS') . 'chado_gene_phylotree?gene_name=' . $target_id . '">View orthology data for ' . $feature->uniquename . '</a>';
            break;
        }
    }
}
else if ($feature->type_id->name == 'gene') {
    foreach ($feature->feature_relationship->object_id as $rel) {
        if ($rel->subject_id->type_id->name == 'mRNA') {
            $mrna_feat = chado_expand_var($rel->subject_id, 'table', 'feature_relationship');
            foreach ($mrna_feat->feature_relationship->object_id as $rel_g) {
                if ($rel_g->subject_id->type_id->name == 'polypeptide') {
                    $target_id = $rel_g->subject_id->uniquename;
                    echo '<p><a href="' . getenv('ENABLE_ORTHOLOGY_LINKS') . 'chado_gene_phylotree?gene_name=' . $target_id . '">View orthology data for ' . $rel_g->subject_id->uniquename . '</a></p>';
                    break;
                }
            }
        }
    }
}