tripal_search_feature.views.inc 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <?php
  2. /*************************************************************************
  3. * tripal_search_feature_views_data()
  4. */
  5. function tripal_search_feature_views_data() {
  6. global $db_url;
  7. $data = array();
  8. // if the chado database is not local to the drupal database
  9. // then we need to set the database name. This should always
  10. // be 'chado'.
  11. if(is_array($db_url) and array_key_exists('chado', $db_url)) {
  12. $database = 'chado';
  13. }
  14. // Basic table definition
  15. $data['feature_for_search']['table']['group'] = 'Tripal Search feature';
  16. $data['feature_for_search']['table']['base'] = array(
  17. 'field' => 'feature_for_search_id',
  18. 'title' => t('Chado Feature with searchable annotations'),
  19. 'help' => t('A materialized view for feature is generated to enable the search for different annotations'),
  20. );
  21. if ($database) {
  22. $data['feature_for_search']['table']['base']['database'] = $database;
  23. }
  24. // Table Field Definitions----------------------
  25. // Field: feature_id (integer)
  26. $data['feature_for_search']['feature_for_search_id'] = array(
  27. 'title' => t('feature_for_search ID'),
  28. 'help' => t('The primary key of feature_for_search'),
  29. 'field' => array(
  30. 'handler' => 'views_handler_field_numeric',
  31. 'click sortable' => TRUE,
  32. ),
  33. 'sort' => array(
  34. 'handler' => 'views_handler_sort',
  35. ),
  36. 'filter' => array(
  37. 'handler' => 'views_handler_filter_numeric',
  38. ),
  39. );
  40. // Field: feature_id (integer)
  41. $data['feature_for_search']['feature_id'] = array(
  42. 'title' => t('feature ID'),
  43. 'help' => t('The primary key of a feature'),
  44. 'field' => array(
  45. 'handler' => 'views_handler_field_numeric',
  46. 'click sortable' => TRUE,
  47. ),
  48. 'sort' => array(
  49. 'handler' => 'views_handler_sort',
  50. ),
  51. 'filter' => array(
  52. 'handler' => 'views_handler_filter_numeric',
  53. ),
  54. );
  55. // Field: name (character varying(1024))
  56. $data['feature_for_search']['feature_type'] = array(
  57. 'title' => t('feature_type'),
  58. 'help' => t('Type of the feature'),
  59. 'field' => array(
  60. 'handler' => 'views_handler_field',
  61. 'click sortable' => TRUE,
  62. ),
  63. 'sort' => array(
  64. 'handler' => 'views_handler_sort',
  65. ),
  66. 'filter' => array(
  67. 'handler' => 'views_handler_filter_feature_type_id',
  68. ),
  69. 'argument' => array(
  70. 'handler' => 'views_handler_argument_string',
  71. ),
  72. );
  73. // Field: name (character varying(255),)
  74. $data['feature_for_search']['feature_name'] = array(
  75. 'title' => t('feature_name'),
  76. 'help' => t('The optional human-readable common name for a feature, for display purposes.'),
  77. 'field' => array(
  78. 'handler' => 'views_handler_field',
  79. 'click sortable' => TRUE,
  80. ),
  81. 'sort' => array(
  82. 'handler' => 'views_handler_sort',
  83. ),
  84. 'filter' => array(
  85. 'handler' => 'views_handler_filter_string',
  86. ),
  87. 'argument' => array(
  88. 'handler' => 'views_handler_argument_string',
  89. ),
  90. );
  91. // Field: uniquename (text)
  92. $data['feature_for_search']['feature_uniquename'] = array(
  93. 'title' => t('feature_uniquename'),
  94. '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.'),
  95. 'field' => array(
  96. 'handler' => 'views_handler_field',
  97. 'click sortable' => TRUE,
  98. ),
  99. 'sort' => array(
  100. 'handler' => 'views_handler_sort',
  101. ),
  102. 'filter' => array(
  103. 'handler' => 'views_handler_filter_string',
  104. ),
  105. 'argument' => array(
  106. 'handler' => 'views_handler_argument_string',
  107. ),
  108. );
  109. // Field: is_obsolete (boolean)
  110. $data['feature_for_search']['feature_is_obsolete'] = array(
  111. 'title' => t('feature_is_obsolete'),
  112. '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.'),
  113. 'field' => array(
  114. 'handler' => 'views_handler_field',
  115. 'click sortable' => TRUE,
  116. ),
  117. 'sort' => array(
  118. 'handler' => 'views_handler_sort',
  119. ),
  120. 'filter' => array(
  121. 'handler' => 'views_handler_filter_boolean_operator_string',
  122. ),
  123. );
  124. // Field: common name (varchar 255)
  125. $data['feature_for_search']['organism_common_name'] = array(
  126. 'title' => 'organism_common_name',
  127. 'help' => 'The common name of the organism.',
  128. 'field' => array(
  129. 'handler' => 'views_handler_field',
  130. 'click sortable' => TRUE,
  131. ),
  132. 'sort' => array(
  133. 'handler' => 'views_handler_sort',
  134. ),
  135. 'filter' => array(
  136. 'handler' => 'views_handler_filter_organism_common_name',
  137. ),
  138. 'argument' => array(
  139. 'handler' => 'views_handler_argument_string',
  140. ),
  141. );
  142. // Field: seqlen (integer)
  143. $data['feature_for_search']['feature_seqlen'] = array(
  144. 'title' => t('feature_seqlen'),
  145. '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.'),
  146. 'field' => array(
  147. 'handler' => 'views_handler_field_numeric',
  148. 'click sortable' => TRUE,
  149. ),
  150. 'sort' => array(
  151. 'handler' => 'views_handler_sort',
  152. ),
  153. 'filter' => array(
  154. 'handler' => 'views_handler_filter_numeric',
  155. ),
  156. );
  157. // Field: name (character varying(1024))
  158. $data['feature_for_search']['go_term'] = array(
  159. 'title' => t('go_term'),
  160. 'help' => t('GO Terms associated with a feature'),
  161. 'field' => array(
  162. 'handler' => 'views_handler_field',
  163. 'click sortable' => TRUE,
  164. ),
  165. 'sort' => array(
  166. 'handler' => 'views_handler_sort',
  167. ),
  168. 'filter' => array(
  169. 'handler' => 'views_handler_filter_string',
  170. ),
  171. 'argument' => array(
  172. 'handler' => 'views_handler_argument_string',
  173. ),
  174. );
  175. // Field: name (character varying(255),)
  176. $data['feature_for_search']['unigene'] = array(
  177. 'title' => t('unigene'),
  178. 'help' => t('Unigene analysis name.'),
  179. 'field' => array(
  180. 'handler' => 'views_handler_field',
  181. 'click sortable' => TRUE,
  182. ),
  183. 'sort' => array(
  184. 'handler' => 'views_handler_sort',
  185. ),
  186. 'filter' => array(
  187. 'handler' => 'views_handler_filter_analysis_name',
  188. ),
  189. 'argument' => array(
  190. 'handler' => 'views_handler_argument_string',
  191. ),
  192. );
  193. // Field: value (text,)
  194. $data['feature_for_search']['blast_value'] = array(
  195. 'title' => t('value'),
  196. 'help' => t(''),
  197. 'field' => array(
  198. 'handler' => 'views_handler_field',
  199. 'click sortable' => TRUE,
  200. ),
  201. 'sort' => array(
  202. 'handler' => 'views_handler_sort',
  203. ),
  204. 'filter' => array(
  205. 'handler' => 'views_handler_filter_string',
  206. ),
  207. 'argument' => array(
  208. 'handler' => 'views_handler_argument_string',
  209. ),
  210. );
  211. // Field: value (text,)
  212. $data['feature_for_search']['kegg_value'] = array(
  213. 'title' => t('value'),
  214. 'help' => t(''),
  215. 'field' => array(
  216. 'handler' => 'views_handler_field',
  217. 'click sortable' => TRUE,
  218. ),
  219. 'sort' => array(
  220. 'handler' => 'views_handler_sort',
  221. ),
  222. 'filter' => array(
  223. 'handler' => 'views_handler_filter_string',
  224. ),
  225. 'argument' => array(
  226. 'handler' => 'views_handler_argument_string',
  227. ),
  228. );
  229. // Field: value (text,)
  230. $data['feature_for_search']['interpro_value'] = array(
  231. 'title' => t('value'),
  232. 'help' => t(''),
  233. 'field' => array(
  234. 'handler' => 'views_handler_field',
  235. 'click sortable' => TRUE,
  236. ),
  237. 'sort' => array(
  238. 'handler' => 'views_handler_sort',
  239. ),
  240. 'filter' => array(
  241. 'handler' => 'views_handler_filter_string',
  242. ),
  243. 'argument' => array(
  244. 'handler' => 'views_handler_argument_string',
  245. ),
  246. );
  247. return $data;
  248. }
  249. /*************************************************************************
  250. * tripal_search_feature_views_handlers
  251. */
  252. function tripal_search_feature_views_handlers() {
  253. return array(
  254. 'info' => array(
  255. 'path' => drupal_get_path('module', 'tripal_search_feature'),
  256. ),
  257. 'handlers' => array(
  258. 'views_handler_filter_organism_common_name' => array(
  259. 'parent' => 'views_handler_filter_string'
  260. ),
  261. 'views_handler_filter_analysis_name' => array(
  262. 'parent' => 'views_handler_filter_string'
  263. ),
  264. 'views_handler_filter_feature_type_id' => array(
  265. 'parent' => 'views_handler_filter_numeric'
  266. ),
  267. ),
  268. );
  269. }