-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtripal_germplasm_importer.install
203 lines (190 loc) · 5.49 KB
/
tripal_germplasm_importer.install
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
/**
*
*/
/**
* Implement hook_enable()
*/
function tripal_germplasm_importer_enable(){
// ensure we have the cvs and cvterms
$CV = array(
'schema' => array(
'name' => 'schema',
'definition' => 'Schema.org. Schema.org is sponsored by Google, Microsoft, Yahoo and Yandex. The vocabularies are developed by an open community process.'
),
'stock_relationship' => array(
'name' => 'stock_relationship',
'definition' => 'A local vocabulary that contains types of relationships between stocks.'
),
'stock_property' => array(
'name' => 'stock_property',
'definition' => 'A local vocabulary that contains types of relationships between stocks.'
),
'local' => array(
'name' => 'local',
'definition' => 'Locally created terms.'
),
'stock_type' => array(
'name' => 'stock_type',
'definition' => 'A local vocabulary that contains a list of types for stocks.'
),
);
$CVTERM = array(
'stock_type' => array(
'name' => 'F1',
'definition' => 'The first generation of offsprint from a parental cross.',
'cv_name' => 'stock_type',
'accession' => 'F1',
'db_name' => 'tripal'
),
'cross_type' => array(
'name' => 'additionalType',
'definition' => '',
'cv_name' => 'schema',
'accession' => 'additionalType',
'db_name' => 'schema'
),
'maternal_parent' => array(
'name' => 'is_maternal_parent_of',
'definition' => '',
'cv_name' => 'stock_relationship',
'accession' => 'is_maternal_parent_of',
'db_name' => 'tripal'
),
'paternal_parent' => array(
'name' => 'is_paternal_parent_of',
'definition' => '',
'cv_name' => 'stock_relationship',
'accession' => 'is_paternal_parent_of',
'db_name' => 'tripal'
),
'season' => array(
'name' => 'crossingblock_season',
'definition' => 'Indicates that the current stock was the progeny of a cross made in the season specified.',
'cv_name' => 'stock_property',
'accession' => 'crossingblock_season',
'db_name' => 'tripal'
),
'year' => array(
'name' => 'crossingblock_year',
'definition' => 'Indicates that the current stock was the progeny of a cross made in the year specified.',
'cv_name' => 'stock_property',
'accession' => 'crossingblock_year',
'db_name' => 'tripal'
),
'cotyledon_colour' => array(
'name' => 'cotyledon_colour',
'definition' => 'The colour of the cotyledon',
'cv_name' => 'stock_property',
'accession' => 'cotyledon_colour',
'db_name' => 'tripal'
),
'seed_type' => array(
'name' => 'seed_type',
'definition' => 'Characteristics or observable phenotypes of the seed.',
'cv_name' => 'stock_property',
'accession' => 'seed_type',
'db_name' => 'tripal'
),
'seed_coat_colour' => array(
'name' => 'seed_coat_colour',
'definition' => 'The colour of the seed coat',
'cv_name' => 'stock_property',
'accession' => 'seed_coat_colour',
'db_name' => 'tripal'
),
'comment' => array(
'name' => 'comment',
'definition' => 'Comments, typically from users. ',
'cv_name' => 'schema',
'accession' => 'comment',
'db_name' => 'schema'
)
);
foreach ($CV as $cv_key => $cv_value){
tripal_insert_cv($cv_value['name'], $cv_value['definition']);
}
foreach($CVTERM as $cvterm_key => $cvterm_value){
tripal_insert_cvterm(array(
'name' => $cvterm_value['name'],
'id' => $cvterm_value['db_name'].':'.$cvterm_value['accession'],
'cv_name' => $cvterm_value['cv_name'],
'definition' => $cvterm_value['definition']
));
}
$table = 'stock_synonym';
$schema = array(
'table' => 'stock_synonym',
'description' => 'Linking table between stock and synonym.',
'fields' => array(
'stock_synonym_id' => array(
'type' => 'serial',
'not null' => TRUE,
),
'synonym_id' => array(
'size' => 'big',
'type' => 'int',
'not null' => TRUE,
),
'stock_id' => array(
'size' => 'big',
'type' => 'int',
'not null' => TRUE,
),
'pub_id' => array(
'size' => 'big',
'type' => 'int',
'not null' => TRUE,
),
'is_current' => array(
'type' => 'int',
'default' => 0,
),
'is_internal' => array(
'type' => 'int',
'default' => 0,
),
),
'primary key' => array(
'stock_synonym_id',
),
'indexes' => array(
'stock_synonym_idx1' => array(
0 => 'synonym_id',
),
'stock_synonym_idx2' => array(
0 => 'stock_id',
),
'stock_synonym_idx3' => array(
0 => 'pub_id',
),
),
'foreign keys' => array(
'synonym' => array(
'table' => 'synonym',
'columns' => array(
'synonym_id' => 'synonym_id',
),
),
'stock' => array(
'table' => 'stock',
'columns' => array(
'stock_id' => 'stock_id',
),
),
'pub' => array(
'table' => 'pub',
'columns' => array(
'pub_id' => 'pub_id',
),
),
),
);
chado_create_custom_table($table, $schema, TRUE, NULL, FALSE);
global $user;
// load required ontologies for this module, which includes:
// MCPD (Multi-Crop Passport Ontology)
// GCP germplasm ontology
require_once('includes/job.load_ontolgies.inc');
load_ontologies_job();
}