-
Notifications
You must be signed in to change notification settings - Fork 2
/
genotypes_loader.module
150 lines (141 loc) · 4.5 KB
/
genotypes_loader.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/**
* @file
* A module for loading genotypes from various formats into KnowPulse
*/
require_once('api/genotypes_loader.api.inc');
require_once('includes/genotypes_loader.genotype_matrix.inc');
require_once('includes/genotypes_loader.vcf.inc');
require_once('includes/genotypes_loader.legacy.inc');
require_once('includes/genotypes_loader.admin.inc');
/**
* Implements hook_menu().
*/
function genotypes_loader_menu() {
$items = array();
$items['admin/tripal/extension/genotypes_loader'] = array(
'title' => 'Genotypes Loader',
'description' => 'Settings related to the genotypes loader.',
'page callback' => 'drupal_get_form',
'page arguments' => array('genotypes_loader_admin_settings_form'),
'access arguments' => array('administer tripal'),
'file' => 'includes/genotypes_loader.admin.inc',
);
/* Currently not working
$items['admin/tripal/extension/genotypes_loader/load'] = array(
'title' => 'Load',
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
'page arguments' => array('genotypes_loader_submit_loading_job_form'),
'access arguments' => array('administer tripal'),
'weight' => 3,
'file' => 'includes/genotypes_loader.form.inc'
);
*/
// Add our own autocomplete for cvterms using the tripal function.
// This ensures compatibility with both Tripal 2/3.
$items['ajax/genotypes_loader/cvterm/%'] = array(
'page callback' => 'tripal_autocomplete_cvterm',
'page arguments' => array(3),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* The schema for the custom genotype_call table.
*/
function genotypes_loader_genotype_call_schema_template() {
$version = variable_get('pgsql_version', '9.2');
return array(
'description' => 'A more compact way to store genotype calls.',
'fields' => array(
'genotype_call_id' => array(
'pgsql_type' => 'bigserial',
'views_type' => 'int',
),
'variant_id' => array(
'name' => 'variant_id',
'title' => 'Variant ID',
'description' => 'Links to the feature describing the loci with variation.',
'pgsql_type' => 'bigint',
'views_type' => 'int',
'not null' => TRUE,
),
'marker_id' => array(
'name' => 'marker_id',
'title' => 'Marker ID',
'description' => 'Links to the feature describing the marker.',
'pgsql_type' => 'bigint',
'views_type' => 'int',
'not null' => TRUE,
),
'genotype_id' => array(
'name' => 'genotype_id',
'title' => 'Genotype ID',
'description' => 'Links to the allele call.',
'pgsql_type' => 'bigint',
'views_type' => 'int',
'not null' => TRUE,
),
'project_id' => array(
'name' => 'project_id',
'title' => 'Project ID',
'description' => 'Links to the project grouping calls from a single analysis.',
'pgsql_type' => 'bigint',
'views_type' => 'int',
'not null' => TRUE,
),
'stock_id' => array(
'name' => 'stock_id',
'title' => 'Stock ID',
'description' => 'Links to the DNA stock assayed by the marker.',
'pgsql_type' => 'bigint',
'views_type' => 'int',
'not null' => TRUE,
),
'meta_data' => array(
'name' => 'meta_data',
'title' => 'Meta data',
'description' => 'JSON storage of any addition meta-data for the call.',
'pgsql_type' => ($version >= '9.4') ? 'jsonb' : 'json',
'views_type' => 'text',
),
),
'primary key' => array('genotype_call_id'),
'unique keys' => array(),
'foreign keys' => array(
'feature' => array(
'table' => 'feature',
'columns' => array(
'variant_id' => 'feature_id',
'marker_id' => 'feature_id'
),
),
'genotype' => array(
'table' => 'genotype',
'columns' => array(
'genotype_id' => 'genotype_id'
),
),
'project' => array(
'table' => 'project',
'columns' => array(
'project_id' => 'project_id'
),
),
'stock' => array(
'table' => 'stock',
'columns' => array(
'stock_id' => 'stock_id'
),
),
),
'indexes' => array(
'genotypecall_variant_id' => array('variant_id'),
'genotypecall_marker_id' => array('marker_id'),
'genotypecall_project_id' => array('project_id'),
'genotypecall_stock_id' => array('stock_id'),
),
);
}