-
Notifications
You must be signed in to change notification settings - Fork 0
/
tripal_jbrowse_instance.install
91 lines (82 loc) · 2.33 KB
/
tripal_jbrowse_instance.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
<?php
function tripal_jbrowse_instance_schema() {
$schema['tripal_jbrowse_instance'] = [
'description' => t('Stores JBrowse links for features based on their organism configuration.'),
'fields' => [
'id' => ['type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE],
'organism_id' => ['type' => 'int'],
'title' => ['type' => 'varchar', 'length' => '255'],
'link' => ['type' => 'varchar', 'length' => '255'],
'tracks' => ['type' => 'varchar', 'length' => '255'],
'description' => ['type' => 'text'],
'show_in_organism_page' => [
'type' => 'int',
'default' => 0,
'not null' => TRUE,
'unsigned' => TRUE,
],
'regexp' => [
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
],
'default_location' => [
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
],
],
'unique keys' => [
'organism_id' => ['organism_id'],
],
'primary key' => ['id'],
];
return $schema;
}
function tripal_jbrowse_instance_install() {
tripal_jbrowse_instance_update_7100();
tripal_jbrowse_instance_update_7101();
}
/**
* Add the necessary terms to chado.
*/
function tripal_jbrowse_instance_update_7100() {
tripal_insert_cvterm([
'id' => 'operation:3208',
'name' => 'genome_visualisation',
'cv_name' => 'EDAM',
'definition' => 'Visualise, format or render a nucleic acid sequence that is part of (and in context of) a complete genome sequence.',
]);
}
/**
* Delete the old field genome_rendering
*/
function tripal_jbrowse_instance_update_7101() {
field_delete_field('edam__genome_rendering');
}
/**
* Add regexp field
*/
function tripal_jbrowse_instance_update_7102() {
if (!db_field_exists('tripal_jbrowse_instance', 'regexp')) {
$regexp = [
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
];
db_add_field('tripal_jbrowse_instance', 'regexp', $regexp);
}
}
/**
* Add default_location field
*/
function tripal_jbrowse_instance_update_7103() {
if (!db_field_exists('tripal_jbrowse_instance', 'default_location')) {
$default_location = [
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
];
db_add_field('tripal_jbrowse_instance', 'default_location', $default_location);
}
}