-
Notifications
You must be signed in to change notification settings - Fork 3
/
gene_list_administration.php
executable file
·300 lines (242 loc) · 14.6 KB
/
gene_list_administration.php
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<?php
$body_class = "no-sidebar"; // This page does not have a sidebar
require 'php_header.php'; // Require the PHP header housing required PHP functions
require 'html_header.php'; // Require the HTML header housing the HTML structure of the page
?>
</div>
<!-- Main -->
<div class="wrapper">
<div class="container" id="main">
<!-- Content -->
<article id="content">
<header>
<h2>Need to make some changes?</h2>
<p>The gene list administration options below let you add, remove and modify genes in gene lists to your heart's content.</p>
</header>
<?php
// If the user is an administrator
if (!is_user_administrator()) {
error("You do not have permission to view this page.");
echo "<a href=\"home\" class=\"button\">Home</a>";
} else {
// Fetch list of gene lists
$gene_lists = fetch_gene_lists();
if ($gene_lists === false) {
error("Could not fetch gene lists.");
} else {
#############################################
# SUCCESS/ERROR MESSAGES
#############################################
// If a non-fatal error occurred that the user needs to be shown, show it
if (isset($_SESSION["gene_list_admin_error"])) {
error($_SESSION["gene_list_admin_error"]);
unset($_SESSION["gene_list_admin_error"]);
}
if_set_display_error("gene_list_admin_cant_fetch_gene_lists", "Couldn't determine existing gene lists, please try again.");
if_set_display_error("gene_list_admin_add_genes_no_lists_selected", "You must select one or more gene lists to add your gene(s) to.");
if_set_display_error("gene_list_admin_add_genes_cant_find_gene_list_id", "Could not find the gene list id for one of gene lists you selected.");
if_set_display_error("gene_list_admin_add_genes_no_genes", "You did not submit any genes to add to the gene list(s).");
if_set_display_error("gene_list_admin_add_genes_all_failed_validation", "All of the genes you submitted failed validation so no changes were made.");
if_set_display_error("gene_list_admin_add_genes_could_not_add_gene", "There was a problem adding one or more genes to the database.");
if_set_display_error("gene_list_admin_add_genes_no_genes_added", "No genes were added to any lists.");
if_set_display_error("gene_list_admin_add_genes_problem_validating_genes", "There was a problem validating genes entered.");
if_set_display_error("gene_list_admin_delete_genes_no_lists_selected", "You must select one or more gene lists to delete your gene(s) from.");
if_set_display_error("gene_list_admin_delete_genes_cant_find_gene_list_id", "Could not find the gene list id for one of the gene lists you specified.");
if_set_display_error("gene_list_admin_delete_genes_no_genes", "You did not submit any genes to add to the gene list(s).");
if_set_display_error("gene_list_admin_delete_genes_all_failed_validation", "All of the genes you submitted failed validation so no changes were made.");
if_set_display_error("gene_list_admin_delete_genes_no_genes_deleted", "Could not delete any of the genes you entered from any of the gene lists you selected.");
if_set_display_error("gene_list_admin_add_gene_list_empty", "The gene list name you submitted is empty.");
if_set_display_error("gene_list_admin_add_gene_list_already_exists", "The new gene list name you submitted already exists.");
if_set_display_error("gene_list_admin_add_gene_list_cant_add_gene_list", "Could not add your gene list to the database.");
if_set_display_error("gene_list_admin_delete_gene_list_no_such_list", "The gene list you submitted does not exist.");
if_set_display_error("gene_list_admin_delete_gene_list_cant_delete_gene_list", "There was a problem removing the gene list.");
if_set_display_error("gene_list_admin_rename_gene_list_empty", "The new gene list name you submitted is empty.");
if_set_display_error("gene_list_admin_rename_gene_list_already_exists", "The new gene list name you submitted already exists.");
if_set_display_error("gene_list_admin_rename_gene_list_old_list_doesnt_exist", "The gene list you specified to rename does not exist.");
if_set_display_error("gene_list_admin_rename_gene_list_cant_rename_gene_list", "Could not rename your gene list in the database.");
if (isset($_SESSION["gene_list_admin_add_genes_success"])) { if_set_display_success("gene_list_admin_add_genes_success", "Successfully made a total of ".$_SESSION["gene_list_admin_add_genes_success"]." connections between genes and lists."); }
if (isset($_SESSION["gene_list_admin_delete_genes_success"])) { if_set_display_success("gene_list_admin_delete_genes_success", "Successfully deleted a total of ".$_SESSION["gene_list_admin_delete_genes_success"]." connections between genes and lists."); }
if (isset($_SESSION["gene_list_admin_add_gene_list_success"])) { if_set_display_success("gene_list_admin_add_gene_list_success", "Successfully added your gene list ".$_SESSION["gene_list_admin_add_gene_list_success"]."."); }
if (isset($_SESSION["gene_list_admin_delete_gene_list_success"])) { if_set_display_success("gene_list_admin_delete_gene_list_success", "Successfully deleted your gene list ".$_SESSION["gene_list_admin_delete_gene_list_success"]."."); }
if (isset($_SESSION["gene_list_admin_rename_gene_list_success"])) { if_set_display_success("gene_list_admin_rename_gene_list_success", "Successfully renamed gene list ".$_SESSION["gene_list_admin_rename_gene_list_success"]."."); }
#############################################
# VIEW LIST OF GENES
#############################################
if (isset($_GET["view_genes_in_gene_list"])) {
success("Showing genes for list \"".$_GET["view_genes_in_gene_list"]."\"");
list_of_genes_table($_GET["view_genes_in_gene_list"]);
}
#############################################
# GENE LIST MANAGEMENT FORMS
#############################################
#############################################
# Add gene(s) to list(s) form
#############################################
echo "<div class=\"row\">";
echo "<section class=\"6u 12u(narrower)\">";
echo "<h2>Add gene(s) to list(s)</h2>";
echo "<p>Select one or more gene lists for addition then type the genes you would like to add separated by semicolons below. Your list of genes will be validated against Ensembl 75 to make sure all genes you input can be queried in Seave.</p>";
echo "<form action=\"actions/action_gene_list_administration\" method=\"post\">";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<select name=\"add_to_gene_list[]\" size=\"10\" multiple=\"multiple\">";
foreach (array_keys($gene_lists) as $gene_list) { # Go through every gene list
echo "<option value=\"".$gene_list."\">".$gene_list." (".$gene_lists[$gene_list].")</option>";
}
echo "</select>";
echo "</div>";
echo "<div class=\"12u\">";
echo "<input type=\"text\" name=\"genes_to_add\" placeholder=\"e.g. BRCA1;PIK3CA;TP53\">";
echo "</div>";
echo "</div>";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<ul class=\"actions\">";
echo "<li><input type=\"submit\" value=\"Add gene(s)\" /></li>";
echo "</ul>";
echo "</div>";
echo "</div>";
echo "</form>";
echo "</section>";
#############################################
# Delete gene(s) from list(s)
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h2>Delete gene(s) from list(s)</h2>";
echo "<p>Select one or more gene lists for deletion then type the genes you would like to delete separated by semicolons below. Seave will make sure the genes you enter exist and then remove them from all selected lists if they are present.</p>";
echo "<form action=\"actions/action_gene_list_administration\" method=\"post\">";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<select name=\"delete_from_gene_list[]\" size=\"10\" multiple=\"multiple\">";
foreach (array_keys($gene_lists) as $gene_list) { # Go through every gene list
echo "<option value=\"".$gene_list."\">".$gene_list." (".$gene_lists[$gene_list].")</option>";
}
echo "</select>";
echo "</div>";
echo "<div class=\"12u\">";
echo "<input type=\"text\" name=\"genes_to_delete\" placeholder=\"e.g. BRCA1;PIK3CA;TP53\">";
echo "</div>";
echo "</div>";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<ul class=\"actions\">";
echo "<li><input type=\"submit\" value=\"Delete gene(s)\" /></li>";
echo "</ul>";
echo "</div>";
echo "</div>";
echo "</form>";
echo "</section>";
echo "</div>";
#############################################
# Add gene list
#############################################
echo "<div class=\"row\">";
echo "<section class=\"6u 12u(narrower)\">";
echo "<h2 style=\"padding-top:10px;\">Add gene list</h2>";
echo "<p>Type in a new gene list name in the box below. Your new gene list name cannot already exist in Seave.</p>";
echo "<form action=\"actions/action_gene_list_administration\" method=\"get\">";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<input type=\"text\" name=\"add_gene_list_name\" placeholder=\"Gene list name\">";
echo "</div>";
echo "</div>";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<ul class=\"actions\">";
echo "<li><input type=\"submit\" value=\"Add gene list\"></li>";
echo "</ul>";
echo "</div>";
echo "</div>";
echo "</form>";
echo "</section>";
#############################################
# Delete gene list
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h2 style=\"padding-top:10px;\">Delete gene list</h2>";
echo "<p>Select a gene list to delete from the dropdown below.</p>";
echo "<form action=\"actions/action_gene_list_administration\" method=\"get\">";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<select name=\"delete_gene_list\">";
foreach (array_keys($gene_lists) as $gene_list) { # Go through every gene list
echo "<option value=\"".$gene_list."\">".$gene_list." (".$gene_lists[$gene_list].")</option>";
}
echo "</select>";
echo "</div>";
echo "</div>";
echo "<p style=\"color: red;\">Warning: once a gene list is deleted it cannot be restored.</p>";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<ul class=\"actions\">";
echo "<li><input type=\"submit\" value=\"Delete gene list\"></li>";
echo "</ul>";
echo "</div>";
echo "</div>";
echo "</form>";
echo "</section>";
echo "</div>";
#############################################
# Rename gene list
#############################################
echo "<div class=\"row\">";
echo "<section class=\"6u 12u(narrower)\">";
echo "<h2 style=\"padding-top:10px;\">Rename gene list</h2>";
echo "<p>Select a gene list you would like to rename from the dropdown then type the new name for the list in the box below. Your new list name cannot already exist in Seave.</p>";
echo "<form action=\"actions/action_gene_list_administration\" method=\"get\">";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<select name=\"rename_gene_list\">";
foreach (array_keys($gene_lists) as $gene_list) { # Go through every gene list
echo "<option value=\"".$gene_list."\">".$gene_list." (".$gene_lists[$gene_list].")</option>";
}
echo "</select>";
echo "</div>";
echo "<div class=\"12u\">";
echo "<input type=\"text\" name=\"new_gene_list_name\" placeholder=\"New gene list name\">";
echo "</div>";
echo "</div>";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<ul class=\"actions\">";
echo "<li><input type=\"submit\" value=\"Rename gene list\"></li>";
echo "</ul>";
echo "</div>";
echo "</div>";
echo "</form>";
echo "</section>";
#############################################
# View gene list
#############################################
echo "<section class=\"6u 12u(narrower)\">";
echo "<h2 style=\"padding-top:10px;\">View genes in gene list</h2>";
echo "<p>Select a gene list to view the genes for from the dropdown below.</p>";
echo "<form action=\"gene_list_administration\" method=\"get\">";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<select name=\"view_genes_in_gene_list\">";
foreach (array_keys($gene_lists) as $gene_list) { # Go through every gene list
echo "<option value=\"".$gene_list."\">".$gene_list." (".$gene_lists[$gene_list].")</option>";
}
echo "</select>";
echo "</div>";
echo "</div>";
echo "<div class=\"row 50%\">";
echo "<div class=\"12u\">";
echo "<ul class=\"actions\">";
echo "<li><input type=\"submit\" value=\"View genes\"></li>";
echo "</ul>";
echo "</div>";
echo "</div>";
echo "</form>";
echo "</section>";
echo "</div>";
}
}
?>
</article>
</div>
</div>
<?php
require 'html_footer.php';
?>