-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdivseek_search.module
91 lines (80 loc) · 2.5 KB
/
divseek_search.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* @file
* General functions relating to this module.
* This file will not include the searches themselves.
*/
require_once 'includes/GermplasmAccessionSearch.inc';
require_once 'includes/TraitSearch.inc';
require_once 'includes/GeneticMapSearch.inc';
require_once 'includes/TraitQtlMarkerSearch.inc';
require_once 'includes/GeneticMarkerSearch.inc';
require_once 'includes/form_elements.inc';
require_once 'includes/mviews.inc';
/**
* Implement hook_chado_custom_search().
*
* This hook simply lists the machine name of the searches so that we can find
* the info hook. We've done this for performance reasons.
*/
function divseek_search_chado_custom_search() {
$searches = [];
$searches['GermplasmAccessionSearch'] = 'Germplasm Accessions';
$searches['TraitSearch'] = 'Phenotypic Traits';
$searches['GeneticMapSearch'] = 'Genetic Maps';
$searches['TraitQtlMarkerSearch'] = 'Trait QTL Marker Discovery Tool';
$searches['GeneticMarkerSearch'] = 'Genetic Markers';
return $searches;
}
/**
* Implements hook_menu().
*/
function divseek_search_menu() {
$items = [];
$items['data/divseeksearch/trait/heatmap/%/%'] = array(
'title' => t('Heatmap Trait data'),
'page callback' => 'divseek_search_get_heatmap_data',
'page arguments' => [4, 5],
'access arguments' => array('access content'),
'file' => 'includes/heatmap_callbacks.inc',
);
return $items;
}
/**
* Implements hook_theme().
*/
function divseek_search_theme() {
return array(
'divseek_search_inline_form_element' => array(
'render element' => 'element',
),
);
}
function divseek_search_flush_caches() {
divseek_search_mview_phenotype_means();
divseek_search_cache_options();
}
/**
* Save options used in search form using variable_get/set().
*/
function divseek_search_cache_options() {
$sql= "SELECT value, value
FROM chado.featureprop
WHERE type_id IN (
SELECT cvterm_id FROM chado.cvterm WHERE name='marker_type'
)
AND feature_id IN (
SELECT feature_id FROM chado.feature WHERE type_id IN (
SELECT cvterm_id FROM chado.cvterm WHERE name='genetic_marker'
)
)
GROUP BY value";
$options = chado_query($sql)->fetchAllKeyed(0,0);
variable_set('divseek_search_marker_types', serialize($options));
}
/**
* Alter the Genotype Matrix.
*/
function divseek_search_form_nd_genotypes_matrix_filter_form_alter(&$form, &$form_state, $form_id) {
$form['#attached']['css'][] = drupal_get_path('module', 'divseek_search') . '/css/genotype-matrix.css';
}