forked from htgt/CRISPR-Analyser
/
20140906.patch
76 lines (71 loc) · 3.75 KB
/
20140906.patch
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
diff --git a/src/ots_server.cpp b/src/ots_server.cpp
index 12f6d93..f85b127 100644
--- a/src/ots_server.cpp
+++ b/src/ots_server.cpp
@@ -193,6 +193,8 @@ protected:
response.setConnectionAlive(false);
response.setCacheDisabled();
response.setContentType(content_type);
+ response.setHeaderValue("Access-Control-Allow-Origin", "*");
+ response.setHeaderValue("Cache-Control", "no-cache, must-revalidate");
response.addContent(result);
response.write();
}
@@ -320,7 +322,7 @@ protected:
int usage() {
fprintf(stderr, "\n");
fprintf(stderr, "Program: ots_server\n");
- fprintf(stderr, "Contact: Alex Hodgkins <ah19@sanger.ac.uk>\n");
+ fprintf(stderr, "Contact: Alex Hodgkins <ah19@sanger.ac.uk>, Liang Cai\n");
fprintf(stderr, "Description: A server version of the crispr_analyser that responds to JSON requests\n");
fprintf(stderr, "\n");
fprintf(stderr, "Usage: ots_server [options]\n");
@@ -329,7 +331,8 @@ int usage() {
fprintf(stderr, " -p INT The port to run the server on\n");
fprintf(stderr, " -l FILE The file containing the human CRISPR index\n");
fprintf(stderr, " -m FILE The file containing the mouse CRISPR index\n");
- fprintf(stderr, " -s Load the default mouse/crispr indexes (sanger only)\n");
+ fprintf(stderr, " -g FILE The file containing the dog CRISPR index\n");
+ fprintf(stderr, " -s Load the default mouse/crispr indexes (fb.actin only)\n");
fprintf(stderr, " -d Daemon mode\n");
fprintf(stderr, "\n");
@@ -342,14 +345,15 @@ int main(int argc, char * argv[]) {
bool default_opts = false;
bool daemon = false;
- string human_index, mouse_index;
+ string human_index, mouse_index, dog_index;
int c = -1;
- while ( (c = getopt(argc, argv, "t:p:l:m:sd")) != -1 ) {
+ while ( (c = getopt(argc, argv, "t:p:l:m:g:sd")) != -1 ) {
switch ( c ) {
case 't': num_threads = optarg; break;
case 'p': port = optarg; break;
case 'l': human_index = optarg; break;
case 'm': mouse_index = optarg; break;
+ case 'g': dog_index = optarg; break;
case 's': default_opts = true; break;
case 'd': daemon = true; break;
case '?': return usage();
@@ -357,12 +361,13 @@ int main(int argc, char * argv[]) {
}
if ( default_opts ) {
- human_index = "/lustre/scratch109/sanger/team87/crispr_indexes/GRCh37_index.bin";
- mouse_index = "/lustre/scratch109/sanger/team87/crispr_indexes/GRCm38_index.bin";
+ human_index = "/home/liang/htgt-crispr/CRISPR-Analyser/crisprs_human.bin";
+ mouse_index = "/home/liang/htgt-crispr/CRISPR-Analyser/crisprs_mouse.bin";
+ dog_index = "/home/liang/htgt-crispr/CRISPR-Analyser/crisprs_cf3.bin";
}
else {
- if ( human_index.empty() && mouse_index.empty() ) {
- cerr << "You must specify at least 1 index to load, or use -s to use the default indexes in /lustre" << endl;
+ if ( human_index.empty() && mouse_index.empty() && dog_index.empty() ) {
+ cerr << "You must specify at least 1 index to load, or use -s to use the default indexes" << endl;
return usage();
}
}
@@ -397,6 +402,7 @@ int main(int argc, char * argv[]) {
if ( ! human_index.empty() ) server.load_index("human", human_index);
if ( ! mouse_index.empty() ) server.load_index("mouse", mouse_index);
+ if ( ! dog_index.empty() ) server.load_index("dog", dog_index);
server.setOption("document_root", "html");
server.setOption("listening_ports", port);