<?php $feature = $variables['node']->feature; if ($feature->type_id->name == 'polypeptide') { foreach ($feature->feature_relationship->subject_id as $rel) { if ($rel->object_id->type_id->name == 'mRNA') { $mrna_feat = chado_expand_var($rel->object_id, 'table', 'feature_relationship'); if (count($mrna_feat->feature_relationship->subject_id) == 0) { // In some cases we might only have mRNA with no genes (brassica napus or transcriptomes $target_id = $mrna_feat->uniquename; echo '<a href="' . getenv('ENABLE_AUREME_LINKS') . $target_id . '">View data from metabolic model for ' . $feature->uniquename . '</a>'; break; } foreach ($mrna_feat->feature_relationship->subject_id as $rel_g) { if ($rel_g->type_id->name == 'gene') { $target_id = $rel_g->uniquename; echo '<a href="' . getenv('ENABLE_AUREME_LINKS') . $target_id . '">View data from metabolic model for ' . $feature->uniquename . '</a>'; break; } } } } } else if ($feature->type_id->name == 'mRNA') { if (count($feature->feature_relationship->subject_id) == 0) { // In some cases we might only have mRNA with no genes (brassica napus or transcriptomes $target_id = $feature->uniquename; echo '<a href="' . getenv('ENABLE_AUREME_LINKS') . $target_id . '">View data from metabolic model for ' . $feature->uniquename . '</a>'; } foreach ($feature->feature_relationship->subject_id as $rel) { if ($rel->object_id->type_id->name == 'gene') { $target_id = $rel->object_id->uniquename; echo '<a href="' . getenv('ENABLE_AUREME_LINKS') . $target_id . '">View data from metabolic model for ' . $feature->uniquename . '</a>'; break; } } } else if ($feature->type_id->name == 'gene') { echo '<a href="' . getenv('ENABLE_AUREME_LINKS') . $feature->uniquename . '">View data from metabolic model for ' . $feature->uniquename . '</a>'; }