tripal_feature.views_default.inc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <?php
  2. /**
  3. *
  4. * @ingroup tripal_feature_views
  5. */
  6. function tripal_feature_views_default_views() {
  7. $views = array();
  8. if (!module_exists('tripal_views')) {
  9. return $views;
  10. }
  11. // Main default view
  12. $view = new view;
  13. $view->name = 'feature_listing';
  14. $view->description = 'A listing of chado sequence features.';
  15. $view->tag = 'chado default';
  16. $view->base_table = 'feature';
  17. $view->core = 0;
  18. $view->api_version = '2';
  19. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  20. $handler = $view->new_display('default', 'features_all', 'default');
  21. $handler->override_option('fields', array(
  22. 'uniquename' => array(
  23. 'label' => 'Unique Name',
  24. 'alter' => array(
  25. 'alter_text' => 0,
  26. 'text' => '',
  27. 'make_link' => 0,
  28. 'path' => 'node/[nid]',
  29. 'link_class' => '',
  30. 'alt' => '',
  31. 'prefix' => '',
  32. 'suffix' => '',
  33. 'target' => '',
  34. 'help' => '',
  35. 'trim' => 0,
  36. 'max_length' => '',
  37. 'word_boundary' => 1,
  38. 'ellipsis' => 1,
  39. 'html' => 0,
  40. 'strip_tags' => 0,
  41. ),
  42. 'empty' => '',
  43. 'hide_empty' => 0,
  44. 'empty_zero' => 0,
  45. 'link_to_node' => 0,
  46. 'exclude' => 0,
  47. 'id' => 'uniquename',
  48. 'table' => 'feature',
  49. 'field' => 'uniquename',
  50. 'relationship' => 'none',
  51. 'override' => array(
  52. 'button' => 'Override',
  53. ),
  54. ),
  55. 'name' => array(
  56. 'label' => 'Name',
  57. 'alter' => array(
  58. 'alter_text' => 0,
  59. 'text' => '',
  60. 'make_link' => 0,
  61. 'path' => '',
  62. 'link_class' => '',
  63. 'alt' => '',
  64. 'prefix' => '',
  65. 'suffix' => '',
  66. 'target' => '',
  67. 'help' => '',
  68. 'trim' => 0,
  69. 'max_length' => '',
  70. 'word_boundary' => 1,
  71. 'ellipsis' => 1,
  72. 'html' => 0,
  73. 'strip_tags' => 0,
  74. ),
  75. 'empty' => '',
  76. 'hide_empty' => 0,
  77. 'empty_zero' => 0,
  78. 'link_to_node' => 1,
  79. 'exclude' => 0,
  80. 'id' => 'name',
  81. 'table' => 'feature',
  82. 'field' => 'name',
  83. 'relationship' => 'none',
  84. 'override' => array(
  85. 'button' => 'Override',
  86. ),
  87. ),
  88. 'name_1' => array(
  89. 'label' => 'Type',
  90. 'alter' => array(
  91. 'alter_text' => 0,
  92. 'text' => '',
  93. 'make_link' => 0,
  94. 'path' => '',
  95. 'link_class' => '',
  96. 'alt' => '',
  97. 'prefix' => '',
  98. 'suffix' => '',
  99. 'target' => '',
  100. 'help' => '',
  101. 'trim' => 0,
  102. 'max_length' => '',
  103. 'word_boundary' => 1,
  104. 'ellipsis' => 1,
  105. 'html' => 0,
  106. 'strip_tags' => 0,
  107. ),
  108. 'empty' => '',
  109. 'hide_empty' => 0,
  110. 'empty_zero' => 0,
  111. 'exclude' => 0,
  112. 'id' => 'name_1',
  113. 'table' => 'cvterm',
  114. 'field' => 'name',
  115. 'relationship' => 'none',
  116. ),
  117. 'common_name' => array(
  118. 'label' => 'Common Name',
  119. 'alter' => array(
  120. 'alter_text' => 0,
  121. 'text' => '',
  122. 'make_link' => 0,
  123. 'path' => '',
  124. 'link_class' => '',
  125. 'alt' => '',
  126. 'prefix' => '',
  127. 'suffix' => '',
  128. 'target' => '',
  129. 'help' => '',
  130. 'trim' => 0,
  131. 'max_length' => '',
  132. 'word_boundary' => 1,
  133. 'ellipsis' => 1,
  134. 'html' => 0,
  135. 'strip_tags' => 0,
  136. ),
  137. 'empty' => '',
  138. 'hide_empty' => 0,
  139. 'empty_zero' => 0,
  140. 'link_to_node' => 1,
  141. 'exclude' => 0,
  142. 'id' => 'common_name',
  143. 'table' => 'organism',
  144. 'field' => 'common_name',
  145. 'relationship' => 'none',
  146. 'override' => array(
  147. 'button' => 'Override',
  148. ),
  149. ),
  150. 'seqlen' => array(
  151. 'label' => 'Sequence Length',
  152. 'alter' => array(
  153. 'alter_text' => 0,
  154. 'text' => '',
  155. 'make_link' => 0,
  156. 'path' => '',
  157. 'link_class' => '',
  158. 'alt' => '',
  159. 'prefix' => '',
  160. 'suffix' => '',
  161. 'target' => '',
  162. 'help' => '',
  163. 'trim' => 0,
  164. 'max_length' => '',
  165. 'word_boundary' => 1,
  166. 'ellipsis' => 1,
  167. 'html' => 0,
  168. 'strip_tags' => 0,
  169. ),
  170. 'empty' => '',
  171. 'hide_empty' => 0,
  172. 'empty_zero' => 0,
  173. 'set_precision' => FALSE,
  174. 'precision' => 0,
  175. 'decimal' => '.',
  176. 'separator' => ',',
  177. 'prefix' => '',
  178. 'suffix' => '',
  179. 'exclude' => 0,
  180. 'id' => 'seqlen',
  181. 'table' => 'feature',
  182. 'field' => 'seqlen',
  183. 'relationship' => 'none',
  184. ),
  185. 'is_obsolete' => array(
  186. 'label' => 'Is Obsolete',
  187. 'alter' => array(
  188. 'alter_text' => 0,
  189. 'text' => '',
  190. 'make_link' => 0,
  191. 'path' => '',
  192. 'absolute' => 0,
  193. 'link_class' => '',
  194. 'alt' => '',
  195. 'rel' => '',
  196. 'prefix' => '',
  197. 'suffix' => '',
  198. 'target' => '',
  199. 'help' => '',
  200. 'trim' => 0,
  201. 'max_length' => '',
  202. 'word_boundary' => 1,
  203. 'ellipsis' => 1,
  204. 'html' => 0,
  205. 'strip_tags' => 0,
  206. ),
  207. 'empty' => '',
  208. 'hide_empty' => 0,
  209. 'empty_zero' => 0,
  210. 'hide_alter_empty' => 1,
  211. 'type' => 'separator',
  212. 'not' => 0,
  213. 'separator' => ', ',
  214. 'exclude' => 0,
  215. 'id' => 'is_obsolete',
  216. 'table' => 'feature',
  217. 'field' => 'is_obsolete',
  218. 'relationship' => 'none',
  219. ),
  220. 'timeaccessioned' => array(
  221. 'label' => 'Accessioned On',
  222. 'alter' => array(
  223. 'alter_text' => 0,
  224. 'text' => '',
  225. 'make_link' => 0,
  226. 'path' => '',
  227. 'absolute' => 0,
  228. 'link_class' => '',
  229. 'alt' => '',
  230. 'rel' => '',
  231. 'prefix' => '',
  232. 'suffix' => '',
  233. 'target' => '',
  234. 'help' => '',
  235. 'trim' => 0,
  236. 'max_length' => '',
  237. 'word_boundary' => 1,
  238. 'ellipsis' => 1,
  239. 'html' => 0,
  240. 'strip_tags' => 0,
  241. ),
  242. 'empty' => '',
  243. 'hide_empty' => 0,
  244. 'empty_zero' => 0,
  245. 'hide_alter_empty' => 1,
  246. 'date_format' => 'large',
  247. 'custom_date_format' => '',
  248. 'type' => 'separator',
  249. 'separator' => ', ',
  250. 'exclude' => 0,
  251. 'id' => 'timeaccessioned',
  252. 'table' => 'feature',
  253. 'field' => 'timeaccessioned',
  254. 'relationship' => 'none',
  255. ),
  256. ));
  257. $handler->override_option('sorts', array(
  258. 'common_name' => array(
  259. 'order' => 'ASC',
  260. 'id' => 'common_name',
  261. 'table' => 'organism',
  262. 'field' => 'common_name',
  263. 'relationship' => 'none',
  264. ),
  265. 'name' => array(
  266. 'order' => 'ASC',
  267. 'id' => 'name',
  268. 'table' => 'cvterm',
  269. 'field' => 'name',
  270. 'relationship' => 'none',
  271. ),
  272. 'name_1' => array(
  273. 'order' => 'ASC',
  274. 'id' => 'name_1',
  275. 'table' => 'feature',
  276. 'field' => 'name',
  277. 'relationship' => 'none',
  278. ),
  279. ));
  280. $handler->override_option('filters', array(
  281. 'common_name' => array(
  282. 'operator' => '=',
  283. 'value' => array(),
  284. 'group' => '0',
  285. 'exposed' => TRUE,
  286. 'expose' => array(
  287. 'use_operator' => 0,
  288. 'operator' => 'common_name_op',
  289. 'identifier' => 'organism',
  290. 'label' => 'Organism Common Name',
  291. 'remember' => 0,
  292. ),
  293. 'case' => 1,
  294. 'id' => 'common_name',
  295. 'table' => 'organism',
  296. 'field' => 'common_name',
  297. 'relationship' => 'none',
  298. 'values_form_type' => 'select',
  299. 'multiple' => 1,
  300. 'optional' => 0,
  301. 'override' => array(
  302. 'button' => 'Override',
  303. ),
  304. 'agg' => array(
  305. 'records_with' => 1,
  306. 'aggregates_with' => 1,
  307. ),
  308. ),
  309. 'type_id' => array(
  310. 'operator' => '=',
  311. 'value' => array(),
  312. 'group' => '0',
  313. 'exposed' => TRUE,
  314. 'expose' => array(
  315. 'use_operator' => 0,
  316. 'operator' => 'type_id_op',
  317. 'identifier' => 'type_id',
  318. 'label' => 'Type',
  319. 'remember' => 0,
  320. ),
  321. 'case' => 1,
  322. 'id' => 'type_id',
  323. 'table' => 'feature',
  324. 'field' => 'type_id',
  325. 'relationship' => 'none',
  326. 'values_form_type' => 'select',
  327. 'multiple' => 1,
  328. 'optional' => 0,
  329. 'show_all' => 0,
  330. 'agg' => array(
  331. 'records_with' => 1,
  332. 'aggregates_with' => 1,
  333. ),
  334. ),
  335. 'name_1' => array(
  336. 'operator' => '~',
  337. 'value' => '',
  338. 'group' => '0',
  339. 'exposed' => TRUE,
  340. 'expose' => array(
  341. 'use_operator' => 0,
  342. 'operator' => 'name_1_op',
  343. 'identifier' => 'name',
  344. 'label' => 'Name Contains',
  345. 'bef_filter_description' => '',
  346. 'remember' => 0,
  347. ),
  348. 'case' => 0,
  349. 'id' => 'name_1',
  350. 'table' => 'feature',
  351. 'field' => 'name',
  352. 'relationship' => 'none',
  353. 'agg' => array(
  354. 'records_with' => 1,
  355. 'aggregates_with' => 1,
  356. ),
  357. ),
  358. 'search_results' => array(
  359. 'operator' => '=',
  360. 'value' => '',
  361. 'group' => '0',
  362. 'exposed' => FALSE,
  363. 'expose' => array(
  364. 'operator' => FALSE,
  365. 'label' => '',
  366. ),
  367. 'id' => 'search_results',
  368. 'table' => 'views',
  369. 'field' => 'search_results',
  370. 'relationship' => 'none',
  371. 'apply_button' => 'Show',
  372. 'no_results_text' => 'Click "Show" to see a list of all features matching the entered criteria. If you leave a any of the criteria blank then the features will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all features will be listed.',
  373. ),
  374. ));
  375. $handler->override_option('access', array(
  376. 'type' => 'perm',
  377. 'perm' => 'access chado_feature content',
  378. ));
  379. $handler->override_option('cache', array(
  380. 'type' => 'none',
  381. ));
  382. $handler->override_option('title', 'Sequence Features');
  383. $handler->override_option('header', 'Click "Show" to see a list of all features matching the entered criteria. If you leave a any of the criteria blank then the features will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all features will be listed.');
  384. $handler->override_option('header_format', '2');
  385. $handler->override_option('header_empty', 0);
  386. $handler->override_option('empty', 'No features matched the supplied criteria.');
  387. $handler->override_option('empty_format', '2');
  388. $handler->override_option('items_per_page', 50);
  389. $handler->override_option('use_pager', '1');
  390. $handler->override_option('style_plugin', 'table');
  391. $handler->override_option('style_options', array(
  392. 'grouping' => '',
  393. 'override' => 1,
  394. 'sticky' => 0,
  395. 'order' => 'asc',
  396. 'columns' => array(
  397. 'accession' => 'accession',
  398. 'accession_link' => 'accession_link',
  399. 'name' => 'name',
  400. 'uniquename' => 'uniquename',
  401. 'name_1' => 'name_1',
  402. 'common_name' => 'common_name',
  403. 'seqlen' => 'seqlen',
  404. 'is_obsolete' => 'is_obsolete',
  405. 'is_analysis' => 'is_analysis',
  406. 'nid' => 'nid',
  407. ),
  408. 'info' => array(
  409. 'accession' => array(
  410. 'sortable' => 1,
  411. 'separator' => '',
  412. ),
  413. 'accession_link' => array(
  414. 'sortable' => 1,
  415. 'separator' => '',
  416. ),
  417. 'name' => array(
  418. 'sortable' => 1,
  419. 'separator' => '',
  420. ),
  421. 'uniquename' => array(
  422. 'sortable' => 1,
  423. 'separator' => '',
  424. ),
  425. 'name_1' => array(
  426. 'sortable' => 1,
  427. 'separator' => '',
  428. ),
  429. 'common_name' => array(
  430. 'sortable' => 1,
  431. 'separator' => '',
  432. ),
  433. 'seqlen' => array(
  434. 'sortable' => 1,
  435. 'separator' => '',
  436. ),
  437. 'is_obsolete' => array(
  438. 'sortable' => 1,
  439. 'separator' => '',
  440. ),
  441. 'is_analysis' => array(
  442. 'sortable' => 1,
  443. 'separator' => '',
  444. ),
  445. 'nid' => array(
  446. 'separator' => '',
  447. ),
  448. ),
  449. 'default' => '-1',
  450. ));
  451. $default_handler = $handler;
  452. $handler = $view->new_display('page', 'Page', 'page_1');
  453. $handler->override_option('path', 'chado/features');
  454. $handler->override_option('menu', array(
  455. 'type' => 'normal',
  456. 'title' => 'Features',
  457. 'description' => 'A feature is a biological sequence or a section of a biological sequence, or a collection of such sections. Examples include genes, exons, transcripts, regulatory regions, polypeptides, protein domains, chromosome sequences, sequence variations, cross-genome match regions such as hits and HSPs and so on.',
  458. 'weight' => '10',
  459. 'name' => 'navigation',
  460. ));
  461. $handler->override_option('tab_options', array(
  462. 'type' => 'none',
  463. 'title' => '',
  464. 'description' => '',
  465. 'weight' => 0,
  466. 'name' => 'navigation',
  467. ));
  468. // Add code specific to a local chado installation
  469. // NOTE: Edit $handler above to $default_handler for the default display
  470. if (tripal_core_chado_schema_exists()) {
  471. // Add nid field
  472. $fields = $view->get_items('field', 'default');
  473. $new_fields = array(
  474. 'nid' => array(
  475. 'label' => 'Nid',
  476. 'alter' => array(
  477. 'alter_text' => 0,
  478. 'text' => '',
  479. 'make_link' => 0,
  480. 'path' => '',
  481. 'absolute' => 0,
  482. 'link_class' => '',
  483. 'alt' => '',
  484. 'rel' => '',
  485. 'prefix' => '',
  486. 'suffix' => '',
  487. 'target' => '',
  488. 'help' => '',
  489. 'trim' => 0,
  490. 'max_length' => '',
  491. 'word_boundary' => 1,
  492. 'ellipsis' => 1,
  493. 'html' => 0,
  494. 'strip_tags' => 0,
  495. ),
  496. 'empty' => '',
  497. 'hide_empty' => 0,
  498. 'empty_zero' => 0,
  499. 'hide_alter_empty' => 1,
  500. 'link_to_node' => 0,
  501. 'exclude' => 1,
  502. 'id' => 'nid',
  503. 'table' => 'node',
  504. 'field' => 'nid',
  505. 'relationship' => 'none',
  506. )
  507. );
  508. $fields = $new_fields + $fields;
  509. // Adds feature => Node relationship
  510. $default_handler->override_option('relationships', array(
  511. 'nid' => array(
  512. 'label' => 'Feature to Node',
  513. 'required' => 0,
  514. 'id' => 'nid',
  515. 'table' => 'chado_feature',
  516. 'field' => 'nid',
  517. 'relationship' => 'none',
  518. ),
  519. ));
  520. // Change analysis.name to have a link to the node
  521. $fields['name']['alter']['link_to_node'] = 1;
  522. $default_handler->override_option('fields', $fields);
  523. // Only show records with published nodes
  524. /**
  525. $filters = $view->get_items('filter', 'default');
  526. $filters['status'] = array(
  527. 'operator' => '=',
  528. 'value' => '1',
  529. 'group' => '0',
  530. 'exposed' => FALSE,
  531. 'expose' => array(
  532. 'operator' => FALSE,
  533. 'label' => '',
  534. ),
  535. 'id' => 'status',
  536. 'table' => 'node',
  537. 'field' => 'status',
  538. 'relationship' => 'none',
  539. );
  540. $default_handler->override_option('filters', $filters);
  541. */
  542. }
  543. $views[$view->name] = $view;
  544. return $views;
  545. }