sequenceserver 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,60 +1,104 @@
1
1
  module SequenceServer
2
2
  module Customisation
3
- ## When not commented out, this method is used to take a
4
- ## sequence ID, and return a hyperlink that
5
- ## replaces the hit in the BLAST output.
6
- ##
7
- ## Return the hyperlink to link to, or nil
8
- ## to not not include a hyperlink.
9
- ##
10
- ## When this method
11
- ## is commented out, the default link is used. The default
12
- ## is a link to the full sequence of
13
- ## the hit is displayed (if makeblastdb has been run with
14
- ## -parse_seqids), or no link at all otherwise.
15
- # def construct_custom_sequence_hyperlink(options)
16
- # ## Example:
17
- # ## sequence_id comes in like "psu|MAL13P1.200 | organism=Plasmodium_falciparum_3D7 | product=mitochondrial"
18
- # ## output: "http://apiloc.bio21.unimelb.edu.au/apiloc/gene/MAL13P1.200"
19
- # matches = options[:sequence_id].match(/^\s*psu\|(\S+) /)
20
- # if matches #if the sequence_id conforms to our expectations
21
- # # All is good. Return the hyperlink.
22
- # return "http://apiloc.bio21.unimelb.edu.au/apiloc/gene/#{matches[1]}"
23
- # else
24
- # # Parsing the sequence_id didn't work. Don't include a hyperlink for this
25
- # # sequence_id, but log that there has been a problem.
26
- # settings.log.warn "Unable to parse sequence id `#{options[:sequence_id]}'"
27
- # # Return nil so no hyperlink is generated.
28
- # return nil
29
- # end
30
- # end
31
3
 
32
- ## Much like construct_custom_sequence_hyperlink, except
33
- ## instead of just a hyperlink being defined, the whole
34
- ## line as it appears in the blast results is generated.
35
- ##
36
- ## This is a therefore more flexible setup than is possible
37
- ## with construct_custom_sequence_hyperlink, because doing
38
- ## things such as adding two hyperlinks for the one hit
39
- ## are possible.
40
- ##
41
- ## When this method is commented out, the behaviour is that
42
- ## the construct_custom_sequence_hyperlink method is used,
43
- ## or failing that the default method of that is used.
44
- # def construct_custom_sequence_hyperlinking_line(options)
45
- # matches = options[:sequence_id].match(/^\s*psu\|(\S+) /)
46
- # if matches #if the sequence_id conforms to our expectations
47
- # # All is good. Return the hyperlink.
48
- # link1 = "http://apiloc.bio21.unimelb.edu.au/apiloc/gene/#{matches[1]}"
49
- # link2 = "http://google.com/?q=#{matches[1]}"
50
- # return "<a href='#{link1}'>ApiLoc page</a>, <a href='#{link2}'>Google search</a>"
51
- # else
52
- # # Parsing the sequence_id didn't work. Don't include a hyperlink for this
53
- # # sequence_id, but log that there has been a problem.
54
- # settings.log.warn "Unable to parse sequence id `#{options[:sequence_id]}'"
55
- # # Return nil so no hyperlink is generated.
56
- # return nil
57
- # end
58
- # end
4
+ # TODO: move this module to another file perhaps
5
+ module Uniprot
6
+ require 'yaml'
7
+ SINV = YAML.load_file('./ext/uniprot/sinv.yml')
8
+ end
9
+
10
+ def default_link(options)
11
+ case options[:sequence_id]
12
+ when /^lcl\|([^\s]*)/
13
+ id = $1
14
+ (@all_retrievable_ids ||= []) << id
15
+ "/get_sequence/?id=#{id}&db=#{options[:databases].join(' ')}" # several dbs... separate by ' '
16
+ end
17
+ end
18
+
19
+ # Hook into SequenceServer's BLAST result formatting process to insert
20
+ # links to Hymenopterabase Genome Browser, and/or Uniprot page
21
+ # corresponding to a 'hit'.
22
+ def construct_custom_sequence_hyperlinking_line(options)
23
+ line = "><a href='#{url(default_link(options))}'>#{options[:sequence_id]}</a>"
24
+ case options[:sequence_id]
25
+ when /^lcl\|(PB.*-RA) /
26
+ # pbar cds and protein
27
+ id = "#{$1}:#{options[:hit_coordinates].join('..')}"
28
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/pbarbatus_1/?name=#{id}"
29
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
30
+ when /^lcl\|pbar_(scf\d*) /
31
+ # pbar genomic
32
+ id = "#{$1}:#{options[:hit_coordinates].join('..')}"
33
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/pbarbatus_1/?name=#{id}"
34
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
35
+ when /lcl\|SI2.2.0/ # => sinv
36
+ sid = options[:sequence_id]
37
+
38
+ # construct Hymenopterabase genome browser link
39
+ bid = sid.match(/(Si_gnF.scaffold\d*)\[(\d*..\d*)\]/)[1..2].join(':')
40
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/sinvicta_1/?name=#{bid}"
41
+
42
+ # construct uniprot link
43
+ ukey = sid.match(/SI2.2.0_(\d*)/)[1]
44
+ uid = Uniprot::SINV["SINV_#{ukey}"]
45
+ uniprot = "http://www.uniprot.org/uniprot/#{uid}"
46
+
47
+ # construct the entire line
48
+ line << " [<a href='#{browser}'>Genome Browser</a>] [<a href='#{uniprot}'>Uniprot</a>]\n"
49
+ when /^lcl\|(Si_gnF.scaffold\d*) /
50
+ # sinv genomic
51
+ id = "#{$1}:#{options[:hit_coordinates].join('..')}"
52
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/sinvicta_1/?name=#{id}"
53
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
54
+ when /^lcl\|(LH\d*-RA) /
55
+ # lhum cds and protein
56
+ id = "#{$1}:#{options[:hit_coordinates].join('..')}"
57
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/lhumile_1/?name=#{id}"
58
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
59
+ when /^lcl\|(scf\d*) /
60
+ # lhum genomic
61
+ id = "#{$1}:#{options[:hit_coordinates].join('..')}"
62
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/lhumile_1/?name=#{id}"
63
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
64
+ when /^lcl\|(ACEP_\d*-RA) /
65
+ # acep cds and protein
66
+ id = $1.gsub(/EP_000/, '')
67
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/acephalotes_1/?name=#{id}"
68
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
69
+ when /^lcl\|Acep_(scaffold\d*) /
70
+ # acep genomic
71
+ id = $1
72
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/acephalotes_1/?name=#{id}:#{options[:hit_coordinates].join('..')}"
73
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
74
+ when /^lcl\|Cflo_(\d*)--/
75
+ # cflo cds and protein
76
+ id = "CFLO#{$1}-RA"
77
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/cfloridanus_1/?name=#{id}"
78
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
79
+ when /^lcl\|Cflo_gn3.3_((scaffold\d*)|(C\d*)) /
80
+ # cflo genomic
81
+ id = "#{$1}:#{options[:hit_coordinates].join('..')}"
82
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/cfloridanus_1/?name=#{id}"
83
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
84
+ when /^lcl\|Hsal_(\d*)--/
85
+ # hsal cds and protein
86
+ id = "HSAL#{$1}-RA"
87
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/hsaltator_1/?name=#{id}"
88
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
89
+ when /^lcl\|Hsal_gn3.3_((scaffold\d*)|(C\d*)) /
90
+ # hsal genomic
91
+ id = "#{$1}:#{options[:hit_coordinates].join('..')}"
92
+ browser = "http://genomes.arc.georgetown.edu/cgi-bin/gbrowse/hsaltator_1/?name=#{id}"
93
+ line << " [<a href='#{browser}'>Genome Browser</a>]\n"
94
+ else
95
+ # Parsing the sequence_id didn't work. Don't include a hyperlink for this
96
+ # sequence_id, but log that there has been a problem.
97
+ settings.log.warn "Unable to parse sequence id `#{options[:sequence_id]}'"
98
+ # Return nil so no hyperlink is generated.
99
+ return nil
100
+ end
101
+ line
102
+ end
59
103
  end
60
- end
104
+ end
@@ -94,7 +94,7 @@ module SequenceServer
94
94
  #
95
95
  # If `blastdbcmd` throws error, we assume sequence not found.
96
96
  blastdbcmd = settings.binaries['blastdbcmd']
97
- command = %x|#{blastdbcmd} -db #{db} -entry #{ids} 2> /dev/null|
97
+ %x|#{blastdbcmd} -db #{db} -entry '#{ids}' 2> /dev/null|
98
98
  end
99
99
 
100
100
  # Given a sequence_id and databases, apply the default (standard)
Binary file
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  # meta
3
3
  s.name = 'sequenceserver'
4
- s.version = '0.7.6'
4
+ s.version = '0.7.7'
5
5
  s.authors = ['Anurag Priyam', 'Ben J Woodcroft', 'Yannick Wurm']
6
6
  s.email = 'anurag08priyam@gmail.com'
7
7
  s.homepage = 'http://sequenceserver.com'
data/views/search.erb CHANGED
@@ -1,12 +1,13 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <title>SequenceServer: Custom BLAST Server</title>
4
+ <title>Fourmidable: BLAST ant genomes, proteomes, and transcriptomes.</title>
5
5
  <meta name="author" content="Anurag Priyam" />
6
6
  <meta name="author" content="Ben J. Woodcroft" />
7
7
  <meta name="author" content="Yannick Wurm" />
8
8
  <meta name="author" content="Cedric Wurm" />
9
- <meta name="description" content="Custom BLAST server provided by SequenceServer (http://www.sequenceserver.com)"/>
9
+ <meta name="description" content="BLAST search for ant genome sequences. A simple blast interface to search sequence of recently published ant genome."/>
10
+ <meta name="keywords" content="ant genomes, blast search, fire ant genome, harvester ant genome, leafcutter ant genome, camponotus genome, harpegnathos genome."/>
10
11
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
11
12
  <script type="text/javascript" src="<%= uri('/js/jquery.js') %>"></script>
12
13
  <script type="text/javascript" src="<%= uri('/js/jquery.enablePlaceholder.min.js') %>"></script>
@@ -17,13 +18,27 @@
17
18
  <%# without a space after erb's closing tag, a / gets appended to css' path %>
18
19
  <link rel="stylesheet" media="screen" type="text/css" href="<%= uri('/css/bootstrap.min.css') %>" />
19
20
  <link rel="stylesheet" media="screen" type="text/css" href="<%= uri('/css/custom.css') %>" />
21
+
22
+ <script type="text/javascript">
23
+ var _gaq = _gaq || [];
24
+ _gaq.push(['_setAccount', 'UA-471841-4']);
25
+ _gaq.push(['_setDomainName', 'none']);
26
+ _gaq.push(['_setAllowLinker', true]);
27
+ _gaq.push(['_trackPageview']);
28
+
29
+ (function() {
30
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
31
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
32
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
33
+ })();
34
+ </script>
20
35
  </head>
21
36
 
22
37
  <body>
23
38
  <div class="container">
24
39
  <div class="page">
25
40
  <div class="page-header" id="banner">
26
- <h1>BLAST Sequence(s)</h1>
41
+ <h1>BLAST Ant Genomes(s)</h1>
27
42
  </div>
28
43
 
29
44
  <form method="post" action="<%= uri('/#result') %>">
@@ -216,7 +231,8 @@
216
231
  </div>
217
232
 
218
233
  <div id="underbar">
219
- <p>&copy; <a href='http://www.sequenceserver.com'>SequenceServer: BLAST search made easy!</a></p>
234
+ <p><a href="http://www.isb-sib.ch"><img src="http://antgenomes.org/img/sib120x74.png" width="40" height="25" alt="SIBlogo"/></a> Hosted by the Swiss Institute of Bioinformatics. BLAST search by <a href="http://www.sequenceserver.com">SequenceServer</a>.</p>
235
+ <p>Please cite: <a href="http://www.biomedcentral.com/1471-2164/10/5/abstract">Wurm <em>et al</em> (2009) <strong>Fourmidable: a database for ant genomics.</strong> <em>BMC Genomics</em> 10:5</a> and the appropriate ant genome paper(s).</p>
220
236
  </div>
221
237
  </div> <!-- /page -->
222
238
  </div> <!-- /container -->
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequenceserver
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 6
10
- version: 0.7.6
9
+ - 7
10
+ version: 0.7.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anurag Priyam
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-02-12 00:00:00 Z
20
+ date: 2012-02-16 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: bundler
@@ -84,12 +84,12 @@ files:
84
84
  - lib/sequenceserver/database.rb
85
85
  - views/search.erb
86
86
  - views/500.erb
87
+ - public/favicon.ico
87
88
  - public/blastResult.js
88
89
  - public/css/bootstrap.min.css
89
90
  - public/css/custom.css
90
91
  - public/js/jquery.js
91
92
  - public/js/jquery.enablePlaceholder.min.js
92
- - public/js/liveclip.jquery.js
93
93
  - public/js/sequenceserver.js
94
94
  - public/js/jquery.activity.js
95
95
  - public/js/sequenceserver.blast.js
@@ -1,246 +0,0 @@
1
- /**
2
- * jQuery Live Clipboard
3
- *
4
- * Copyright (c) 2009 Shinichi Tomita (shinichi.tomita@gmail.com)
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- * SOFTWARE.
20
- */
21
- (function($) {
22
-
23
- var namespace = 'liveclip';
24
- var relayEvents =
25
- 'click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,keypress,keyup'.split(',');
26
-
27
- /**
28
- * Adjust clipboard textarea size to cover parent clippable element.
29
- */
30
- function track() {
31
- var target = $(this);
32
- var clipboard = target.clipboard();
33
- var w = target.outerWidth(), h = target.outerHeight(), offset = target.offset();
34
- if (/^(auto|scroll)$/.test(target.css('overflow'))) w -= 20;
35
- if (clipboard) clipboard.css({ width : w, height : h, top : offset.top, left : offset.left });
36
- }
37
-
38
- /**
39
- * Finding and capture event target element, excluding clipboard textarea.
40
- * This is "pseudo" capturing, assuming no layered elements covering over the target.
41
- */
42
- function capture(el, e) {
43
- var captured = _capture(el);
44
- var clipboard = captured.clipboard();
45
- // if captured element has clipboard, return it.
46
- return captured !== el && clipboard ? clipboard : captured;
47
-
48
- function _capture(el) {
49
- var target = el;
50
- el.children().each(function() {
51
- var child = $(this);
52
- var w = child.width(), h = child.innerHeight(), offset = child.offset();
53
- if (e.pageX > offset.left && e.pageX < offset.left + w &&
54
- e.pageY > offset.top && e.pageY < offset.top + h) {
55
- target = _capture(child);
56
- }
57
- })
58
- return target;
59
- }
60
- }
61
-
62
- /**
63
- * Context menu event handler
64
- */
65
- function contextmenuHandler(e) {
66
- var clipboard = $(this);
67
- var target = clipboard.data(namespace + '-target');
68
- var options = target.data(namespace + '-clipboard-options');
69
-
70
- if (options.active && options.active.call(target) === false) {
71
- clipboard.attr('readonly', 'readonly');
72
- return;
73
- }
74
-
75
- if (options.paste || options.del) {
76
- clipboard.removeAttr('readonly');
77
- } else {
78
- clipboard.attr('readonly', 'readonly');
79
- }
80
-
81
- var val = options.copy ? options.copy.call(target) : '';
82
- clipboard.val(val);
83
- clipboard.get(0).select();
84
- if (options.paste || options.del) {
85
- val = clipboard.val();
86
- var watchPID = clipboard.data(namespace+'-watcher');
87
- if (watchPID) {
88
- clearInterval(watchPID);
89
- clipboard.removeData(namespace+'-watcher');
90
- }
91
- watchPID = setInterval(function() {
92
- var v = clipboard.val();
93
- if (v !== val) {
94
- try {
95
- if (v === '') {
96
- if (options.del) options.del.call(target)
97
- } else {
98
- if (options.paste) options.paste.call(target, v);
99
- clipboard.val('');
100
- }
101
- } catch(e) {}
102
- clearInterval(watchPID);
103
- clipboard.removeData(namespace+'-watcher');
104
- }
105
- }, 100);
106
- clipboard.data(namespace+'-watcher', watchPID);
107
- }
108
- }
109
-
110
-
111
- /**
112
- * Keyboard down event handler
113
- */
114
- function keydownHandler(e) {
115
- var clipboard = $(this);
116
- var target = clipboard.data(namespace + '-target');
117
- var options = target.data(namespace + '-clipboard-options');
118
-
119
- if (e.metaKey) {
120
- switch (e.keyCode) {
121
- case 67 : // Command + C
122
- var val = options.copy ? options.copy.call(target) : '';
123
- clipboard.val(val)
124
- clipboard.get(0).select();
125
- break;
126
- case 86 : // Command + V
127
- if (options.paste) {
128
- clipboard.get(0).select();
129
- setTimeout(function() {
130
- var data = clipboard.val();
131
- options.paste.call(target, data);
132
- clipboard.val('')
133
- }, 10);
134
- }
135
- break;
136
- case 88 : // Command + X
137
- var val = options.copy ? options.copy.call(target) : '';
138
- clipboard.val(val)
139
- clipboard.get(0).select();
140
- if (options.del) {
141
- setTimeout(function() {
142
- options.del.call(target)
143
- }, 10);
144
- }
145
- break;
146
- default :
147
- break;
148
- }
149
- } else if (e.keyCode==46) { // delete
150
- if (options.del) options.del.call(target);
151
- }
152
-
153
- }
154
-
155
-
156
- $.fn.extend({
157
-
158
- /**
159
- * Attach clipboard feature to block element
160
- * Get current clipboard proxy textarea
161
- */
162
- clipboard : function(options) {
163
- var elements = this;
164
-
165
- if (options) { // setter
166
-
167
- $(elements).each(function() {
168
- var target = $(this);
169
- var clipboard = target.data(namespace + '-clipboard');
170
- if (!clipboard) {
171
- clipboard = $('<textarea></textarea>')
172
- .addClass(namespace+'-clipboard')
173
- .addClass(options.cls ? options.cls : '')
174
- .css({
175
- cursor : 'default',
176
- position : 'absolute',
177
- fontSize : $.liveclip.debug ? '12px' : '1px',
178
- opacity : $.liveclip.debug ? .5 : .01
179
- })
180
- .appendTo(document.body)
181
- .bind('contextmenu', contextmenuHandler)
182
- .bind('keydown', keydownHandler);
183
- $.each(relayEvents, function(i, eventName) {
184
- clipboard.bind(eventName+'.'+namespace, function(e) {
185
- capture(target, e).trigger(e);
186
- });
187
- });
188
- if ($.liveclip.autoTrack) { target.bind('mouseover.'+namespace, track) }
189
- target.data(namespace+'-clipboard', clipboard);
190
- clipboard.data(namespace+'-target', target);
191
- }
192
- target.data(namespace+'-clipboard-options', options);
193
- track.call(target);
194
- });
195
- return this;
196
-
197
- } else { // getter
198
- return $(this).data(namespace + '-clipboard');
199
- }
200
-
201
- }
202
- ,
203
-
204
- /**
205
- * remove attached clipboard feature
206
- */
207
- removeClipboard : function() {
208
- $(this).each(function() {
209
- $(this).clipboard().remove();
210
- $(this).unbind('mouseover.'+namespace, track)
211
- .removeData(namespace + '-clipboard')
212
- .removeData(namespace + '-clipboard-options');
213
- });
214
- return this;
215
- }
216
-
217
- });
218
-
219
- $.liveclip = {
220
- debug : false,
221
- autoTrack : false
222
- }
223
-
224
- /**
225
- * Track all clipboard, aligning to target element position and size
226
- * If no target element available in document, removing clipboard.
227
- */
228
- $.trackClipboards = function() {
229
- $('body > textarea.'+namespace+'-clipboard').each(function() {
230
- var clipboard = $(this);
231
- var target = clipboard.data(namespace + '-target');
232
- if (target && target.parent()) {
233
- track.call(target);
234
- } else {
235
- clipboard.remove();
236
- }
237
- });
238
- }
239
-
240
- $(function() {
241
- if ($.liveclip.autoTrack) {
242
- $(document).mousemove($.trackClipboards);
243
- }
244
- })
245
-
246
- })(jQuery)