Prechádzať zdrojové kódy

Added a new search function for the features. This search module needs Drupal Views to work and includes a default 'EST/Unigene Search' view when installed.

ccheng 14 rokov pred
rodič
commit
7d4327e01d

+ 35 - 0
theme_tripal/css/tripal_search_feature.css

@@ -0,0 +1,35 @@
+.view-est-search .views-exposed-form {
+	margin: 10px;
+	padding:10px;
+	background: #FFFFFF;
+	border: 1px solid #CCCCCC;
+}
+
+.view-est-search .tripal-search-feature-exposed-widget {
+	clear:both;
+	padding: 5px;
+}
+
+.view-est-search .tripal-search-feature-form-labels {
+	float:left;
+}
+
+.view-est-search .views-operator {
+	float:left;
+	clear:none;
+	margin-left: 5px;
+}
+
+.view-est-search .views-widget {
+	float:left;
+	clear:none;
+	margin-left: 5px;
+}
+
+.view-est-search .view-content .views-table {
+	margin-left: 10px;
+}
+ 
+ .tripal-search-feature-exposed-widgets-fields legend{
+   color:green;
+ }

+ 9 - 0
theme_tripal/js/tripal_search_feature.js

@@ -0,0 +1,9 @@
+//
+// Copyright 2009 Clemson University
+//
+
+if (Drupal.jsEnabled) {
+
+   $(document).ready(function(){   
+   });
+}

+ 195 - 0
theme_tripal/views-exposed-form--est_search.tpl.php

@@ -0,0 +1,195 @@
+<?php
+// $Id: views-exposed-form.tpl.php,v 1.4.4.1 2009/11/18 20:37:58 merlinofchaos Exp $
+/**
+ * @file views-exposed-form.tpl.php
+ *
+ * This template handles the layout of the views exposed filter form.
+ *
+ * Variables available:
+ * - $widgets: An array of exposed form widgets. Each widget contains:
+ * - $widget->label: The visible label to print. May be optional.
+ * - $widget->operator: The operator for the widget. May be optional.
+ * - $widget->widget: The widget itself.
+ * - $button: The submit button for the form.
+ *
+ * @ingroup views_templates
+ */
+?>
+<?php if (!empty($q)): ?>
+  <?php
+    // This ensures that, if clean URLs are off, the 'q' is added first so that
+    // it shows up first in the URL.
+    print $q;
+
+  ?>
+<?php endif;     //dsm($widgets);?>
+<div class="views-exposed-form">
+  <div class="views-exposed-widgets clear-block">
+    
+    <?php 
+    	$feature_type_id =  $widgets['filter-feature_type']; 
+    	$orgnism_common_name =  $widgets['filter-organism_common_name'];
+    	$analysis_name =  $widgets['filter-unigene'];
+    	$feature_name =  $widgets['filter-name'];
+    	$feature_seqlen =  $widgets['filter-feature_seqlen'];
+    	$cvterm_name =  $widgets['filter-go_term'];
+    	$blast_value =  $widgets['filter-blast_value'];
+    	$interpro_value =  $widgets['filter-interpro_value'];
+    	$kegg_value =  $widgets['filter-kegg_value'];
+    ?>
+    
+    <div id="tripal-search-feature-exposed-widgets">
+    <div> Search ESTs or unigene contigs by name, assembly, sequence type, length, or their putative function. <br><br></div>
+			<fieldset class="tripal-search-feature-exposed-widgets-fields">
+				<legend>Search by Name</legend>
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $orgnism_common_name->id; ?>"><?php print $orgnism_common_name->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($orgnism_common_name->operator)): ?>
+					<div class="views-operator">
+					<?php print $orgnism_common_name->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+					<?php print $orgnism_common_name->widget; ?>
+					</div>
+				</div>
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $feature_name->id; ?>"><?php print $feature_name->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($feature_name->operator)): ?>
+					<div class="views-operator">
+					<?php print $feature_name->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+						<?php print $feature_name->widget; ?>
+					</div>
+				</div>
+			</fieldset>
+
+			<fieldset class="tripal-search-feature-exposed-widgets-fields">
+				<legend>Search by Assembly</legend>
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $feature_type_id->id; ?>"><?php print $feature_type_id->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($feature_type_id->operator)): ?>
+					<div class="views-operator">
+					<?php print $feature_type_id->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+					<?php print $feature_type_id->widget; ?>
+					</div>
+				</div>
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $analysis_name->id; ?>"><?php print $analysis_name->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($analysis_name->operator)): ?>
+					<div class="views-operator">
+					<?php print $analysis_name->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+						<?php print $analysis_name->widget; ?>
+					</div>
+				</div>
+			</fieldset>
+
+			<fieldset class="tripal-search-feature-exposed-widgets-fields">
+				<legend>Search by Sequence</legend>
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $feature_seqlen->id; ?>"><?php print $feature_seqlen->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($feature_seqlen->operator)): ?>
+					<div class="views-operator">
+					<?php print $feature_seqlen->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+					<?php print $feature_seqlen->widget; ?>
+					</div>
+				</div>
+			</fieldset>
+
+			<fieldset class="tripal-search-feature-exposed-widgets-fields">
+				<legend>Search by Putative Function</legend>
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $cvterm_name->id; ?>"><?php print $cvterm_name->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($cvterm_name->operator)): ?>
+					<div class="views-operator">
+					<?php print $cvterm_name->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+					<?php print $cvterm_name->widget; ?>
+					</div>
+				</div>
+
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $blast_value->id; ?>"><?php print $blast_value->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($blast_value->operator)): ?>
+					<div class="views-operator">
+					<?php print $blast_value->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+						<?php print $blast_value->widget; ?>
+					</div>
+				</div>
+				
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $kegg_value->id; ?>"><?php print $kegg_value->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($kegg_value->operator)): ?>
+					<div class="views-operator">
+					<?php print $kegg_value->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+						<?php print $kegg_value->widget; ?>
+					</div>
+				</div>
+				
+				<div class="tripal-search-feature-exposed-widget">
+					<div class="tripal-search-feature-form-labels">
+						<label for="<?php print $interpro_value->id; ?>"><?php print $interpro_value->label; ?>
+						</label>
+					</div>
+					<?php if (!empty($interpro_value->operator)): ?>
+					<div class="views-operator">
+					<?php print $interpro_value->operator; ?>
+					</div>
+					<?php endif; ?>
+					<div class="views-widget">
+						<?php print $interpro_value->widget; ?>
+					</div>
+				</div>
+			</fieldset>
+
+		</div>
+    
+    <div class="tripal-search-feature-exposed-widget">
+    	<input TYPE="Button" value="Reset" onClick="window.location = '<?php global $base_url; print "$base_url/est_search"?>';">
+      <?php $button = preg_replace("'Apply'", "Search", $button); print $button ?>
+    </div>
+  </div>
+</div>

+ 50 - 0
theme_tripal/views-view-table--est_search.tpl.php

@@ -0,0 +1,50 @@
+<?php
+// $Id: views-view-table.tpl.php,v 1.8 2009/01/28 00:43:43 merlinofchaos Exp $
+/**
+ * @file views-view-table.tpl.php
+ * Template to display a view as a table.
+ *
+ * - $title : The title of this group of rows.  May be empty.
+ * - $header: An array of header labels keyed by field id.
+ * - $fields: An array of CSS IDs to use for each field id.
+ * - $class: A class or classes to apply to the table, based on settings.
+ * - $row_classes: An array of classes to apply to each row, indexed by row
+ *   number. This matches the index in $rows.
+ * - $rows: An array of row items. Each row is an array of content.
+ *   $rows are keyed by row number, fields within rows are keyed by field ID.
+ * @ingroup views_templates
+ */
+?>
+<i>&nbsp;&nbsp;&nbsp;Note: To get complete annotation for a sequence, click on the sequence name.</i>
+<table class="tripal_search_feature-table  tripal-table tripal-table-horz <?php print $class; ?>">
+  <?php if (!empty($title)) : ?>
+    <caption><?php print $title; ?></caption>
+  <?php endif; ?>
+  <thead>
+    <tr class="tripal_search_feature-table-odd-row tripal-table-odd-row">
+      <?php foreach ($header as $field => $label): ?>
+        <th class="views-field views-field-<?php print $fields[$field]; ?>">
+          <?php print $label; ?>
+        </th>
+      <?php endforeach; ?>
+    </tr>
+  </thead>
+  <tbody>
+    <?php foreach ($rows as $count => $row): 
+    			$rowclass = "";
+    			if ($count % 2 == 0) {
+    				$rowclass = "tripal_search_feature-table-even-row tripal-table-even-row";
+    			} else {
+    				$rowclass = "tripal_search_feature-table-odd-row tripal-table-odd-row";
+    			}
+    ?>
+      <tr class="<?php print $rowclass?> <?php print implode(' ', $row_classes[$count]); ?>">
+        <?php foreach ($row as $field => $content): ?>
+          <td class="views-field views-field-<?php print $fields[$field]; ?>">
+            <?php print $content; ?>
+          </td>
+        <?php endforeach; ?>
+      </tr>
+    <?php endforeach; ?>
+  </tbody>
+</table>

+ 654 - 0
tripal_search_feature/exported_est_search_view.txt

@@ -0,0 +1,654 @@
+$view = new view;
+$view->name = 'est_search';
+$view->description = 'EST Search';
+$view->tag = '';
+$view->view_php = '';
+$view->base_table = 'feature_for_search';
+$view->is_cacheable = FALSE;
+$view->api_version = 2;
+$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+$handler = $view->new_display('default', 'Defaults', 'default');
+$handler->override_option('fields', array(
+  'counter' => array(
+    'label' => '#',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'counter_start' => '1',
+    'exclude' => 0,
+    'id' => 'counter',
+    'table' => 'views',
+    'field' => 'counter',
+    'relationship' => 'none',
+  ),
+  'feature_id' => array(
+    'label' => 'feature ID',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'set_precision' => FALSE,
+    'precision' => 0,
+    'decimal' => '.',
+    'separator' => '',
+    'prefix' => '',
+    'suffix' => '',
+    'exclude' => 1,
+    'id' => 'feature_id',
+    'table' => 'feature_for_search',
+    'field' => 'feature_id',
+    'relationship' => 'none',
+  ),
+  'feature_name' => array(
+    'label' => 'Sequence',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 1,
+      'path' => 'ID[feature_id]',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'exclude' => 0,
+    'id' => 'feature_name',
+    'table' => 'feature_for_search',
+    'field' => 'feature_name',
+    'relationship' => 'none',
+  ),
+  'organism_common_name' => array(
+    'label' => 'Organism',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'exclude' => 0,
+    'id' => 'organism_common_name',
+    'table' => 'feature_for_search',
+    'field' => 'organism_common_name',
+    'relationship' => 'none',
+  ),
+  'feature_seqlen' => array(
+    'label' => 'Length',
+    'alter' => array(
+      'alter_text' => 1,
+      'text' => '[feature_seqlen] bp',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'set_precision' => FALSE,
+    'precision' => 0,
+    'decimal' => '.',
+    'separator' => ',',
+    'prefix' => '',
+    'suffix' => '',
+    'exclude' => 0,
+    'id' => 'feature_seqlen',
+    'table' => 'feature_for_search',
+    'field' => 'feature_seqlen',
+    'relationship' => 'none',
+  ),
+  'feature_type' => array(
+    'label' => 'Type',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'exclude' => 0,
+    'id' => 'feature_type',
+    'table' => 'feature_for_search',
+    'field' => 'feature_type',
+    'relationship' => 'none',
+  ),
+  'go_term' => array(
+    'label' => 'GO Term',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'exclude' => 0,
+    'id' => 'go_term',
+    'table' => 'feature_for_search',
+    'field' => 'go_term',
+    'relationship' => 'none',
+  ),
+  'blast_value' => array(
+    'label' => 'Blast',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 1,
+      'max_length' => '200',
+      'word_boundary' => 0,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'exclude' => 0,
+    'id' => 'blast_value',
+    'table' => 'feature_for_search',
+    'field' => 'blast_value',
+    'relationship' => 'none',
+  ),
+  'kegg_value' => array(
+    'label' => 'KEGG',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 1,
+      'max_length' => '200',
+      'word_boundary' => 0,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'exclude' => 0,
+    'id' => 'kegg_value',
+    'table' => 'feature_for_search',
+    'field' => 'kegg_value',
+    'relationship' => 'none',
+  ),
+  'interpro_value' => array(
+    'label' => 'Interpro',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'target' => '',
+      'help' => '',
+      'trim' => 1,
+      'max_length' => '200',
+      'word_boundary' => 0,
+      'ellipsis' => 1,
+      'html' => 0,
+      'strip_tags' => 0,
+    ),
+    'empty' => '',
+    'hide_empty' => 0,
+    'empty_zero' => 0,
+    'exclude' => 0,
+    'id' => 'interpro_value',
+    'table' => 'feature_for_search',
+    'field' => 'interpro_value',
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('arguments', array(
+  'null' => array(
+    'default_action' => 'default',
+    'style_plugin' => 'default_summary',
+    'style_options' => array(),
+    'wildcard' => 'all',
+    'wildcard_substitution' => 'All',
+    'title' => '',
+    'breadcrumb' => '',
+    'default_argument_type' => 'fixed',
+    'default_argument' => '',
+    'validate_type' => 'php',
+    'validate_fail' => 'empty',
+    'must_not_be' => 0,
+    'id' => 'null',
+    'table' => 'views',
+    'field' => 'null',
+    'validate_user_argument_type' => 'uid',
+    'validate_user_roles' => array(
+      '2' => 0,
+      '3' => 0,
+      '5' => 0,
+      '4' => 0,
+    ),
+    'relationship' => 'none',
+    'default_options_div_prefix' => '',
+    'default_argument_fixed' => '',
+    'default_argument_user' => 0,
+    'default_argument_php' => '',
+    'validate_argument_node_type' => array(
+      'iframe' => 0,
+      'news' => 0,
+      'chado_analysis' => 0,
+      'chado_analysis_blast' => 0,
+      'chado_analysis_interpro' => 0,
+      'chado_analysis_kegg' => 0,
+      'chado_analysis_unigene' => 0,
+      'chado_feature' => 0,
+      'chado_library' => 0,
+      'chado_organism' => 0,
+      'calendar_event' => 0,
+      'page' => 0,
+      'story' => 0,
+    ),
+    'validate_argument_node_access' => 0,
+    'validate_argument_nid_type' => 'nid',
+    'validate_argument_vocabulary' => array(
+      '17' => 0,
+      '13' => 0,
+      '14' => 0,
+      '15' => 0,
+      '16' => 0,
+      '9' => 0,
+      '10' => 0,
+      '11' => 0,
+      '12' => 0,
+      '5' => 0,
+      '6' => 0,
+      '7' => 0,
+      '8' => 0,
+    ),
+    'validate_argument_type' => 'tid',
+    'validate_argument_transform' => 0,
+    'validate_user_restrict_roles' => 0,
+    'validate_argument_php' => 'if (count($view->exposed_input)) {
+return TRUE;
+}',
+  ),
+));
+$handler->override_option('filters', array(
+  'feature_name' => array(
+    'operator' => 'contains',
+    'value' => '',
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 1,
+      'operator' => 'feature_name_op',
+      'identifier' => 'feature_name',
+      'label' => 'sequence name',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'case' => 0,
+    'id' => 'feature_name',
+    'table' => 'feature_for_search',
+    'field' => 'feature_name',
+    'relationship' => 'none',
+  ),
+  'feature_seqlen' => array(
+    'operator' => '>=',
+    'value' => array(
+      'value' => '',
+      'min' => '',
+      'max' => '',
+    ),
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 1,
+      'operator' => 'feature_seqlen_op',
+      'identifier' => 'feature_seqlen',
+      'label' => 'sequence length (bp)',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'id' => 'feature_seqlen',
+    'table' => 'feature_for_search',
+    'field' => 'feature_seqlen',
+    'relationship' => 'none',
+  ),
+  'feature_type' => array(
+    'operator' => '=',
+    'value' => '260',
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 0,
+      'operator' => 'feature_type_op',
+      'identifier' => 'feature_type',
+      'label' => 'type of sequence',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'case' => 0,
+    'id' => 'feature_type',
+    'table' => 'feature_for_search',
+    'field' => 'feature_type',
+    'relationship' => 'none',
+  ),
+  'go_term' => array(
+    'operator' => 'contains',
+    'value' => '',
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 1,
+      'operator' => 'go_term_op',
+      'identifier' => 'go_term',
+      'label' => 'GO term',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'case' => 0,
+    'id' => 'go_term',
+    'table' => 'feature_for_search',
+    'field' => 'go_term',
+    'relationship' => 'none',
+  ),
+  'organism_common_name' => array(
+    'operator' => '=',
+    'value' => 'chickpea',
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 0,
+      'operator' => 'organism_common_name_op',
+      'identifier' => 'organism_common_name',
+      'label' => 'organism',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'case' => 0,
+    'id' => 'organism_common_name',
+    'table' => 'feature_for_search',
+    'field' => 'organism_common_name',
+    'relationship' => 'none',
+  ),
+  'unigene' => array(
+    'operator' => '=',
+    'value' => 'Cicer arietinum unigene v1',
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 0,
+      'operator' => 'unigene_op',
+      'identifier' => 'unigene',
+      'label' => 'belongs to unigene',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'case' => 0,
+    'id' => 'unigene',
+    'table' => 'feature_for_search',
+    'field' => 'unigene',
+    'relationship' => 'none',
+  ),
+  'interpro_value' => array(
+    'operator' => 'contains',
+    'value' => '',
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 1,
+      'operator' => 'interpro_value_op',
+      'identifier' => 'interpro_value',
+      'label' => 'interpro description',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'case' => 0,
+    'id' => 'interpro_value',
+    'table' => 'feature_for_search',
+    'field' => 'interpro_value',
+    'relationship' => 'none',
+  ),
+  'blast_value' => array(
+    'operator' => 'contains',
+    'value' => '',
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 1,
+      'operator' => 'blast_value_op',
+      'identifier' => 'blast_value',
+      'label' => 'blast description',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'case' => 0,
+    'id' => 'blast_value',
+    'table' => 'feature_for_search',
+    'field' => 'blast_value',
+    'relationship' => 'none',
+  ),
+  'kegg_value' => array(
+    'operator' => 'contains',
+    'value' => '',
+    'group' => '0',
+    'exposed' => TRUE,
+    'expose' => array(
+      'use_operator' => 1,
+      'operator' => 'kegg_value_op',
+      'identifier' => 'kegg_value',
+      'label' => 'kegg description',
+      'optional' => 1,
+      'remember' => 0,
+    ),
+    'case' => 0,
+    'id' => 'kegg_value',
+    'table' => 'feature_for_search',
+    'field' => 'kegg_value',
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('access', array(
+  'type' => 'none',
+));
+$handler->override_option('cache', array(
+  'type' => 'none',
+));
+$handler->override_option('title', 'EST Unigene Search');
+$handler->override_option('css_class', 'tripal-search-feature');
+$handler->override_option('empty', '<?php 
+$view = views_get_current_view();
+  if (count($view->exposed_input)) {
+    drupal_set_message("Your search returns no results. Please adjust your search criteria and try again.");
+} 
+?>');
+$handler->override_option('empty_format', '3');
+$handler->override_option('use_pager', '1');
+$handler->override_option('style_plugin', 'table');
+$handler->override_option('style_options', array(
+  'grouping' => '',
+  'override' => 1,
+  'sticky' => 0,
+  'order' => 'asc',
+  'columns' => array(
+    'feature_id' => 'feature_id',
+    'feature_name' => 'feature_name',
+    'feature_seqlen' => 'feature_seqlen',
+    'feature_type' => 'feature_type',
+    'go_term' => 'go_term',
+    'organism_common_name' => 'organism_common_name',
+    'unigene' => 'unigene',
+    'blast_value' => 'blast_value',
+    'kegg_value' => 'kegg_value',
+    'interpro_value' => 'interpro_value',
+  ),
+  'info' => array(
+    'feature_id' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'feature_name' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'feature_seqlen' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'feature_type' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'go_term' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'organism_common_name' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'unigene' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'blast_value' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'kegg_value' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+    'interpro_value' => array(
+      'sortable' => 1,
+      'separator' => '',
+    ),
+  ),
+  'default' => '-1',
+));
+$handler = $view->new_display('page', 'Page', 'page_1');
+$handler->override_option('path', 'est_search');
+$handler->override_option('menu', array(
+  'type' => 'normal',
+  'title' => 'EST Unigene Search',
+  'description' => 'Advanced Search for EST and unigenes',
+  'weight' => '0',
+  'name' => 'primary-links',
+));
+$handler->override_option('tab_options', array(
+  'type' => 'none',
+  'title' => '',
+  'description' => '',
+  'weight' => 0,
+  'name' => 'navigation',
+));

+ 13 - 0
tripal_search_feature/tripal_search_feature.info

@@ -0,0 +1,13 @@
+; $Id$
+package = Tripal
+name = Tripal Search Feature
+version = 6.x-0.2b-m0.2
+description = A module to provide advanced search functionalities for the features
+core = 6.x
+
+dependencies[] = tripal_core
+dependencies[] = tripal_organism
+dependencies[] = tripal_cv
+dependencies[] = tripal_feature
+dependencies[] = tripal_analysis
+dependencies[] = views

+ 146 - 0
tripal_search_feature/tripal_search_feature.install

@@ -0,0 +1,146 @@
+<?php
+
+/*******************************************************************************
+*  Implementation of hook_install();
+*/
+function tripal_search_feature_install(){
+
+   // create the module's data directory
+   tripal_create_moddir('tripal_search_feature');
+	
+	// Create a sequence as the primiry key for the feature_for_search
+	$sql = "DROP SEQUENCE IF EXISTS feature_for_search_id; CREATE SEQUENCE feature_for_search_id";
+	chado_query($sql);	
+
+	$view_name = 'feature_for_search';
+   // Drop the MView table if it exists
+   $mview_id = tripal_mviews_get_mview_id($view_name);
+   if($mview_id){
+      tripal_mviews_action("delete",$mview_id);
+   }
+
+   $schema = " feature_for_search_id integer, 
+   							  feature_id integer,
+   							  feature_type character varying(1024),
+   							  feature_name character varying(1024),
+   							  feature_uniquename text,
+   							  feature_is_obsolete boolean,
+   							  organism_common_name character varying(255),
+   							  feature_seqlen integer,
+   							  go_term character varying(1024),
+   							  unigene character varying(255),
+   							  blast_value text,
+   							  kegg_value text,
+   							  interpro_value text
+   							  ";
+   
+   $index = "feature_id, go_term, blast_value, kegg_value, interpro_value";
+   
+   $sql = "SELECT nextval ('feature_for_search_id') AS feature_for_search_id, T.* FROM (
+						SELECT F.feature_id AS feature_id, 
+										(SELECT name FROM cvterm WHERE F.type_id = cvterm_id) AS feature_type,
+										F.name AS feature_name, 
+										F.uniquename AS feature_uniquename,
+										F.is_obsolete AS feature_is_obsolete,
+										O.common_name AS organism_common_name, 
+										F.seqlen AS feature_seqlen, 
+										C.name AS go_term,
+										UNIGENE.name AS unigene_name,
+										BLAST.value AS blast_value, 
+										KEGG.value AS KEGG_value, 
+										INTERPRO.value AS interpro_value 
+						FROM feature F
+						LEFT JOIN organism O ON F.organism_id = O.organism_id 
+						LEFT JOIN feature_cvterm FC ON F.feature_id = FC.feature_id 
+						LEFT JOIN cvterm C ON FC.cvterm_id = C.cvterm_id 
+						LEFT JOIN (SELECT * FROM analysisfeatureprop AFP
+													INNER JOIN analysisfeature AF ON AF.analysisfeature_id = AFP.analysisfeature_id
+													WHERE type_id = (SELECT cvterm_id FROM cvterm 
+																								WHERE name = 'analysis_blast_besthit_description' 
+																								AND cv_id = (SELECT cv_id FROM cv WHERE name = 'tripal')
+																								)
+													) BLAST ON BLAST.feature_id = F.feature_id
+						LEFT JOIN (SELECT * FROM analysisfeatureprop AFP
+													INNER JOIN analysisfeature AF ON AF.analysisfeature_id = AFP.analysisfeature_id
+													WHERE type_id = (SELECT cvterm_id FROM cvterm 
+																								WHERE name = 'analysis_kegg_output_keywords' 
+																								AND cv_id = (SELECT cv_id FROM cv WHERE name = 'tripal')
+																								)			
+													) KEGG ON KEGG.feature_id = F.feature_id
+						LEFT JOIN (SELECT * FROM analysisfeatureprop AFP
+													INNER JOIN analysisfeature AF ON AF.analysisfeature_id = AFP.analysisfeature_id
+													WHERE type_id = (SELECT cvterm_id FROM cvterm
+																								WHERE name = 'analysis_interpro_output_keywords' 
+																								AND cv_id = (SELECT cv_id FROM cv WHERE name = 'tripal')
+																								)
+													) INTERPRO ON INTERPRO.feature_id = F.feature_id 
+						LEFT JOIN (SELECT * FROM analysisfeature AF 
+													INNER JOIN analysis A ON A.analysis_id = AF.analysis_id 
+													INNER JOIN analysisprop AP ON AF.analysis_id = AP.analysis_id
+													WHERE AP.type_id = (SELECT cvterm_id FROM cvterm
+																								WHERE name = 'analysis_type' 
+																								AND cv_id = (SELECT cv_id FROM cv WHERE name = 'tripal')
+																								)
+													AND value = 'tripal_analysis_unigene') UNIGENE ON F.feature_id = UNIGENE.feature_id
+						) T";
+   
+      // Create the MView
+      tripal_add_mview(
+      // view name
+      $view_name,
+      // tripal module name
+      ' tripal_search_feature',
+      // table name
+      $view_name,
+      // table schema definition
+		$schema,
+      // columns for indexing
+      $index,
+      // SQL statement to populate the view
+      $sql,
+      // special index
+      ''
+   );
+
+   // add a job to the job queue so this view gets updated automatically next
+   // time the job facility is run
+   $mview_id = tripal_mviews_get_mview_id($view_name);
+   if($mview_id){
+      tripal_mviews_action('update',$mview_id);
+   }
+
+}
+
+/*******************************************************************************
+ * Implementation of hook_uninstall()
+ */
+function tripal_search_feature_uninstall(){
+	$view_name = 'feature_for_search';
+	// Drop the MView table if it exists
+	$mview_id = tripal_mviews_get_mview_id($view_name);
+	if($mview_id){
+		tripal_mviews_action("delete",$mview_id);
+	}
+	 
+	// Drop the sequence
+	$sql = "DROP SEQUENCE IF EXISTS feature_for_search_id";
+	chado_query($sql);
+}
+
+/*******************************************************************************
+ * Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled
+ * before installation
+ */
+function tripal_search_feature_requirements($phase) {
+   $requirements = array();
+   if ($phase == 'install') {
+      if (!function_exists('tripal_create_moddir')) {
+         $requirements ['tripal_search_feature'] = array(
+            'title' => "tripal_search_feature",
+            'value' => "error. Some required modules are just being installed. Please try again.",
+            'severity' => REQUIREMENT_ERROR,
+         );
+      }
+   }
+   return $requirements;
+}

+ 56 - 0
tripal_search_feature/tripal_search_feature.module

@@ -0,0 +1,56 @@
+<?php
+
+/*************************************************************************
+ * tripal_search_feature_init
+ */ 
+function tripal_search_feature_init(){
+	drupal_add_css(drupal_get_path('theme', 'tripal').'/css/tripal_search_feature.css');
+	drupal_add_js(drupal_get_path('theme', 'tripal').'/js/tripal_search_feature.js');
+}
+
+/*************************************************************************
+ * tripal_search_feature_views_api
+ */ 
+function tripal_search_feature_views_api() {
+   return array(
+      'api' => 2.0,
+   );
+}
+
+// A function to rewrite the SQL statement before submitting the query
+// Force GROUP BY feature_id and return only one row
+
+function  tripal_search_feature_views_pre_execute(&$view){
+	if ($view->name == 'est_search') {
+
+		// AGGREGATORS
+		$search = array('SELECT');
+		$replace = array('SELECT min(');
+		$view->build_info['query'] = str_replace($search, $replace, $view->build_info['query']);
+		$view->build_info['count_query']  = str_replace($search, $replace, $view->build_info['count_query']);
+		 
+		$search = array(',');
+		$replace = array(', min(');
+		$view->build_info['query'] = str_replace($search, $replace, $view->build_info['query']);
+		$view->build_info['count_query']  = str_replace($search, $replace, $view->build_info['count_query']);
+		 
+		$search = array(' AS ');
+		$replace = array(') AS ');
+		$view->build_info['query'] = str_replace($search, $replace, $view->build_info['query']);
+		$view->build_info['count_query']  = str_replace($search, $replace, $view->build_info['count_query']);
+
+		// GROUP BY
+		if (preg_match("'ORDER BY'",  $view->build_info['query'])) {
+			$search = array('ORDER BY');
+			$replace = array('GROUP BY feature_for_search.feature_id ORDER BY');
+			$view->build_info['query'] = str_replace($search, $replace, $view->build_info['query']);
+		} else {
+			$view->build_info['query']  .= " GROUP BY feature_for_search.feature_id";
+		}
+		$view->build_info['count_query'] .= " GROUP BY feature_for_search.feature_id";
+		 
+		//drupal_set_message($view->build_info['query']);
+		//drupal_set_message($view->build_info['count_query']);
+		 
+	}
+}

+ 288 - 0
tripal_search_feature/tripal_search_feature.views.inc

@@ -0,0 +1,288 @@
+<?php
+
+/*************************************************************************
+ * tripal_search_feature_views_data()
+ */
+
+function tripal_search_feature_views_data()  {
+	global $db_url;
+	$data = array();
+	
+	// if the chado database is not local to the drupal database
+	// then we need to set the database name.  This should always
+	// be 'chado'.
+	if(is_array($db_url) and array_key_exists('chado', $db_url)) {
+		$database = 'chado';
+	}
+	
+ 	// Basic table definition
+	$data['feature_for_search']['table']['group'] = 'Tripal Search feature';
+	$data['feature_for_search']['table']['base'] = array(
+		'field' => 'feature_for_search_id',
+		'title' => t('Chado Feature with searchable annotations'),
+		'help'  => t('A materialized view for feature is generated to enable the search for different annotations'),
+	);
+ 	if ($database) {
+ 		$data['feature_for_search']['table']['base']['database'] = $database;
+	}
+	
+	// Table Field Definitions----------------------
+	// Field: feature_id (integer)
+	$data['feature_for_search']['feature_for_search_id'] = array(
+		'title' => t('feature_for_search ID'),
+		'help' => t('The primary key of feature_for_search'),
+		'field' => array(
+			'handler' => 'views_handler_field_numeric',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_numeric',
+		),
+	);
+			
+	// Field: feature_id (integer)
+	$data['feature_for_search']['feature_id'] = array(
+		'title' => t('feature ID'),
+		'help' => t('The primary key of a feature'),
+		'field' => array(
+			'handler' => 'views_handler_field_numeric',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_numeric',
+		),
+	);
+	
+	// Field: name (character varying(1024))
+	$data['feature_for_search']['feature_type'] = array(
+		'title' => t('feature_type'),
+		'help' => t('Type of the feature'),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_feature_type_id',
+		),
+		'argument' => array(
+			'handler' => 'views_handler_argument_string',
+		),
+	);
+	
+	// Field: name (character varying(255),)
+	$data['feature_for_search']['feature_name'] = array(
+		'title' => t('feature_name'),
+		'help' => t('The optional human-readable common name for a feature, for display purposes.'),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_string',
+		),
+		'argument' => array(
+			'handler' => 'views_handler_argument_string',
+		),
+	);
+	
+		// Field: uniquename (text)
+	$data['feature_for_search']['feature_uniquename'] = array(
+		'title' => t('feature_uniquename'),
+		'help' => t('The unique name for a feature; may not be necessarily be particularly human-readable, although this is preferred. This name must be unique for this type of feature within this organism.'),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_string',
+		),
+		'argument' => array(
+			'handler' => 'views_handler_argument_string',
+		),
+	);
+	
+	// Field: is_obsolete (boolean)
+	$data['feature_for_search']['feature_is_obsolete'] = array(
+		'title' => t('feature_is_obsolete'),
+		'help' => t('Boolean indicating whether this feature has been obsoleted. Some chado instances may choose to simply remove the feature altogether, others may choose to keep an obsolete row in the table.'),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_boolean_operator_string',
+		),
+	);
+	
+	// Field: common name (varchar 255)
+  $data['feature_for_search']['organism_common_name'] = array(
+    'title' => 'organism_common_name',
+    'help' => 'The common name of the organism.',
+    'field' => array(
+       'handler' => 'views_handler_field',
+       'click sortable' => TRUE,
+     ),
+     'sort' => array(
+       'handler' => 'views_handler_sort',
+     ),
+     'filter' => array(
+       'handler' => 'views_handler_filter_organism_common_name',
+     ),
+     'argument' => array(
+       'handler' => 'views_handler_argument_string',
+     ),
+  );
+  
+  	// Field: seqlen (integer)
+	$data['feature_for_search']['feature_seqlen'] = array(
+		'title' => t('feature_seqlen'),
+		'help' => t('The length of the residue feature. See column:residues. This column is partially redundant with the residues column, and also with featureloc. This column is required because the location may be unknown and the residue sequence may not be manifested, yet it may be desirable to store and query the length of the feature. The seqlen should always be manifested where the length of the sequence is known.'),
+		'field' => array(
+			'handler' => 'views_handler_field_numeric',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_numeric',
+		),
+	);
+	
+		// Field: name (character varying(1024))
+	$data['feature_for_search']['go_term'] = array(
+		'title' => t('go_term'),
+		'help' => t('GO Terms associated with a feature'),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_string',
+		),
+		'argument' => array(
+			'handler' => 'views_handler_argument_string',
+		),
+	);
+		
+	// Field: name (character varying(255),)
+	$data['feature_for_search']['unigene'] = array(
+		'title' => t('unigene'),
+		'help' => t('Unigene analysis name.'),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_analysis_name',
+		),
+		'argument' => array(
+			'handler' => 'views_handler_argument_string',
+		),
+	);
+	
+		// Field: value (text,)
+	$data['feature_for_search']['blast_value'] = array(
+		'title' => t('value'),
+		'help' => t(''),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_string',
+		),
+		'argument' => array(
+			'handler' => 'views_handler_argument_string',
+		),
+	);
+	
+		// Field: value (text,)
+	$data['feature_for_search']['kegg_value'] = array(
+		'title' => t('value'),
+		'help' => t(''),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_string',
+		),
+		'argument' => array(
+			'handler' => 'views_handler_argument_string',
+		),
+	);
+	
+		// Field: value (text,)
+	$data['feature_for_search']['interpro_value'] = array(
+		'title' => t('value'),
+		'help' => t(''),
+		'field' => array(
+			'handler' => 'views_handler_field',
+			'click sortable' => TRUE,
+		),
+		'sort' => array(
+			'handler' => 'views_handler_sort',
+		),
+		'filter' => array(
+			'handler' => 'views_handler_filter_string',
+		),
+		'argument' => array(
+			'handler' => 'views_handler_argument_string',
+		),
+	);
+
+	return $data;
+}
+
+/*************************************************************************
+ * tripal_search_feature_views_handlers
+ */
+function tripal_search_feature_views_handlers() {
+ return array(
+   'info' => array(
+     'path' => drupal_get_path('module', 'tripal_search_feature'),
+   ),
+   'handlers' => array(
+   	'views_handler_filter_organism_common_name' => array(
+   		'parent' => 'views_handler_filter_string'
+   	),
+   	'views_handler_filter_analysis_name' => array(
+   		'parent' => 'views_handler_filter_string'
+   	),
+   	'views_handler_filter_feature_type_id' => array(
+   		'parent' => 'views_handler_filter_numeric'
+   	),
+   ),
+ );
+}

+ 31 - 0
tripal_search_feature/views_handler_filter_analysis_name.inc

@@ -0,0 +1,31 @@
+<?php
+class views_handler_filter_analysis_name extends views_handler_filter_string {
+	function value_form(&$form, &$form_state) {
+		$type_id = tripal_get_cvterm_id("analysis_type");
+		$sql = "SELECT name, A.analysis_id FROM {analysis} A INNER JOIN {analysisprop} AP ON A.analysis_id = AP.analysis_id WHERE type_id = $type_id AND value = 'tripal_analysis_unigene'";
+
+		$results = chado_query($sql);
+		$analyses = array();
+
+		while ($ana = db_fetch_object($results)) {
+			// check if the organisms is synced
+			if (db_result(db_query("SELECT * FROM {chado_analysis} WHERE analysis_id = $ana->analysis_id"))) {
+				$analyses[$ana->name] = t($ana->name);
+			}
+		}
+		$form['value'] = array(
+		'#type' => 'select',
+		'#title' => t('Organism'),
+		'#options' => $analyses,
+		'#default_value' => 0,
+		);
+
+		return $form;
+	}
+
+	function operator_options () {
+		return array(
+			'=' => t('Is equal to')
+		);
+	}
+}

+ 26 - 0
tripal_search_feature/views_handler_filter_feature_type_id.inc

@@ -0,0 +1,26 @@
+<?php
+class views_handler_filter_feature_type_id extends views_handler_filter_string {
+
+	function value_form(&$form, &$form_state) {
+
+		$sql = "SELECT distinct feature_type FROM {feature_for_search}";
+		$results = chado_query($sql);
+		$options = array ();
+		while($type = db_fetch_object($results)) {
+			$options[$type->feature_type] = $type->feature_type;
+		}
+
+		$form['value'] = array(
+		'#type' => 'select',
+		'#title' => t('Type of sequence'),
+		'#options' => $options,
+		);
+		return $form;
+	}
+
+	function operator_options () {
+		return array(
+			'=' => t('Is equal to')
+		);
+	}
+}

+ 30 - 0
tripal_search_feature/views_handler_filter_organism_common_name.inc

@@ -0,0 +1,30 @@
+<?php
+class views_handler_filter_organism_common_name extends views_handler_filter_string {
+
+	function value_form(&$form, &$form_state) {
+		$sql = "SELECT distinct common_name, organism_id FROM {organism}";
+		$results = chado_query($sql);
+		$organisms = array();
+		
+		while ($org = db_fetch_object($results)) {
+			// check if the organisms is synced
+			if (db_result(db_query("SELECT * FROM {chado_organism} WHERE organism_id = $org->organism_id"))) {
+				$organisms[$org->common_name] = t($org->common_name);
+			}
+		}
+		$form['value'] = array(
+		'#type' => 'select',
+		'#title' => t('Organism'),
+		'#options' => $organisms,
+		'#default_value' => 0,
+		);
+ 
+	return $form;
+	}
+	
+	function operator_options () {
+		return array(
+			'=' => t('Is equal to')
+		);
+	}
+}