Эх сурвалжийг харах

Tripal: Tripal Genetic Update

laceysanderson 13 жил өмнө
parent
commit
c619c7ef27

+ 22 - 0
tripal_genetic/theme/tripal_feature_genotypes.tpl.php

@@ -0,0 +1,22 @@
+
+<?php
+$feature = $variables['node']->feature;
+$genotypes = $variables['tripal_feature']['genotypes'];
+?>
+
+<?php if(count($genotypes) > 0){ ?>
+<div id="tripal_feature-genotypes-box" class="tripal_feature-info-box tripal-info-box">
+  <div class="tripal_feature-info-box-title tripal-info-box-title">Genotypes</div>
+  <div class="tripal_feature-info-box-desc tripal-info-box-desc">
+    Genotypes of this <?php print $feature->type_id->name; ?> in various germplasm
+  </div>
+  <ul>
+    <?php foreach ($genotypes as $g) { 
+        $genotype = $g->description;
+        if (preg_match('/insufficient sequence/',$genotype)) { $genotype = "<font colour='grey'>".$genotype.'</font>'; }
+    ?>
+      <li><?php print $genotype; ?></li>
+    <?php } ?>
+  </ul>
+</div>
+<?php } ?>

+ 15 - 0
tripal_genetic/tripal_genetic.api.inc

@@ -5,6 +5,7 @@
  */
 function tripal_genetic_get_genotypes_by_feature_id ($feature_id) {
 
+  /**
   $sql = 'SELECT nd_experiment_id FROM nd_experiment_genotype WHERE genotype_id IN (SELECT genotype_id FROM feature_genotype WHERE feature_id=%d)';
   $resource = db_query($sql, $feature_id);
 
@@ -17,7 +18,21 @@ function tripal_genetic_get_genotypes_by_feature_id ($feature_id) {
   $object = tripal_core_expand_chado_vars($object, 'table', 'nd_experiment_genotype');
   $object = tripal_core_expand_chado_vars($object, 'table', 'feature_genotype');
   $object = tripal_core_expand_chado_vars($object, 'table', 'nd_experiment_stock');
+  */
+
+  $sql = 'SELECT genotype_id FROM genotype WHERE genotype_id IN (SELECT genotype_id FROM feature_genotype WHERE feature_id=%d)';
+  $resource = db_query($sql, $feature_id);
+
+  $values['genotype_id'] = array();
+  while ($r = db_fetch_object($resource)) {
+    $values['genotype_id'][] = $r->genotype_id;
+  }
   
+  if (!empty($values['genotype_id'])) {
+    $object = tripal_core_generate_chado_var('genotype',$values);  
+  } else {
+    $object = array();
+  }
   return $object;
 }
 

+ 1 - 1
tripal_genetic/tripal_genetic.module

@@ -51,5 +51,5 @@ function tripal_genetic_nodeapi (&$node, $op, $teaser, $page) {
  */
 function tripal_genetic_preprocess_tripal_feature_genotypes(&$variables){
     $feature = $variables['node']->feature;   
-    $variables['tripal_feature']['genotype_experiments'] = tripal_genetic_get_genotypes_by_feature_id($feature->feature_id);
+    $variables['tripal_feature']['genotypes'] = tripal_genetic_get_genotypes_by_feature_id($feature->feature_id);
 }