<?php $feature = $variables['node']->feature; $aphidcyc_url = "http://aphidcyc.cycadsys.org/__species__/NEW-IMAGE?type=GENE&object=__feat_id__"; $orgs = array( 'pisum' => 'ACYPI', 'glycines' => 'APHGL', 'vitifoliae' => 'DAKVI', 'noxia' => 'DIUNO', 'cerasi' => 'MYZCE', 'persicae' => 'MYZPE_CLONE_O', 'padi' => 'RHOPA', 'citrus' => 'ACYPI', ); $current_org = strtolower($feature->organism_id->genus . ' ' . $feature->organism_id->species); foreach ($orgs as $needle => $url_chunk) { if (preg_match("/.*$needle.*/", $current_org) >= 1) { if ($needle == 'persicae' && preg_match('/G006/', $feature->analysisfeature[0]->analysis_id->name) >= 1) { $aphidcyc_url = str_replace('__species__', 'MYZPE_CLONE_G006', $aphidcyc_url); } else { $aphidcyc_url = str_replace('__species__', $url_chunk, $aphidcyc_url); } } } if (preg_match('/__species__/', $aphidcyc_url) >= 1) { echo 'No metabolic data available at <a href="http://aphidcyc.cycadsys.org">AphidCyc</a> for this feature.'; } else if (preg_match('/pisum/', $current_org) >= 1 && preg_match('/NCBI/', $feature->analysisfeature[0]->analysis_id->name) >= 1) { echo 'No metabolic data available at <a href="http://aphidcyc.cycadsys.org">AphidCyc</a> for this feature.'; } else if ($feature->type_id->name == 'polypeptide') { foreach ($feature->feature_relationship->subject_id as $rel) { if ($rel->object_id->type_id->name == 'mRNA' || $rel->object_id->type_id->name == 'transcript') { $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 $url = str_replace('__feat_id__', $mrna_feat->uniquename, $aphidcyc_url); echo '<a href="' . $url . '">View metabolic data for ' . $feature->uniquename . ' on AphidCyc</a>'; break; } foreach ($mrna_feat->feature_relationship->subject_id as $rel_g) { if ($rel_g->type_id->name == 'gene') { $url = str_replace('__feat_id__', $rel_g->uniquename, $aphidcyc_url); echo '<a href="' . $url . '">View metabolic data for ' . $feature->uniquename . ' on AphidCyc</a>'; break; } } } } } else if ($feature->type_id->name == 'mRNA' || $feature->type_id->name == 'transcript') { 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; $url = str_replace('__feat_id__', $feature->uniquename, $aphidcyc_url); echo '<a href="' . $url . '">View metabolic data for ' . $feature->uniquename . ' on AphidCyc</a>'; } foreach ($feature->feature_relationship->subject_id as $rel) { if ($rel->object_id->type_id->name == 'gene') { $url = str_replace('__feat_id__', $rel->object_id->uniquename, $aphidcyc_url); echo '<a href="' . $url . '">View metabolic data for ' . $feature->uniquename . ' on AphidCyc</a>'; break; } } } else if ($feature->type_id->name == 'gene') { $url = str_replace('__feat_id__', $feature->uniquename, $aphidcyc_url); echo '<a href="' . $url . '">View data from metabolic model for ' . $feature->uniquename . '</a>'; }