sequenceserver 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sequenceserver might be problematic. Click here for more details.

@@ -0,0 +1,112 @@
1
+ /*
2
+ SequenceServer's BLAST module/method
3
+
4
+ Adds `blast` method to `SS`.
5
+
6
+ blast():
7
+ not implemented
8
+
9
+ `blast` defines the following methods:
10
+ init():
11
+ initialize `blast` object
12
+
13
+ This module defines the following events:
14
+
15
+ sequence_type_changed:
16
+ When the type (nucleotide or protein) of the input sequence changes.
17
+
18
+ blast_valid:
19
+ If the current user input is sufficient to launch a BLAST
20
+
21
+ blast_invalid:
22
+ If the current user input is not sufficient to launch a BLAST
23
+
24
+ TODO: should (probably) access UI objects through some sort of interface
25
+ */
26
+ SS.blast = (function () {
27
+ /* private methods */
28
+
29
+ /*
30
+ check if blast is valid (sufficient input to blast or not)
31
+ */
32
+ var is_valid = function () {
33
+ // must enter a query
34
+ if (!$('#sequence').val()) {
35
+ return false;
36
+ }
37
+
38
+ // must select a blast method
39
+ if (!$('.blastmethods input:checked').val()) {
40
+ return false;
41
+ }
42
+
43
+ // must select atleast one database
44
+ if (!$('.databases input:checked').val()) {
45
+ return false;
46
+ }
47
+
48
+ // everything good
49
+ return true;
50
+ }
51
+
52
+ /*
53
+ signal blast's validity (sufficient input to blast or not)
54
+ */
55
+ var signal_blast_validity = function () {
56
+ $('#sequence, .blastmethods, .databases').change(function () {
57
+ if (is_valid()) {
58
+ $('form').trigger('blast_valid');
59
+ }
60
+ else {
61
+ $('form').trigger('blast_invalid');
62
+ }
63
+ });
64
+ }
65
+
66
+ /*
67
+ determine input sequence type, store it, and trigger
68
+ 'sequence_type_changed' event if the input sequence has changed
69
+ (TODO: the method is doing too much; split it)
70
+ */
71
+ var signal_sequence_type_changed = function () {
72
+ var prev_seq = prev_seq_type = '';
73
+
74
+ (function poll () {
75
+ setTimeout(function (){
76
+ var seq, seq_type;
77
+ seq = $('#sequence').val();
78
+
79
+ //act only if user input has changed
80
+ if (seq != prev_seq){
81
+ prev_seq = seq;
82
+ $('#sequence').change();
83
+
84
+ //get input sequence type from the server
85
+ $.post('', {sequence: seq}, function(seq_type){
86
+ if (seq_type != prev_seq_type){
87
+ prev_seq_type = seq_type;
88
+
89
+ //store sequence type and notify listeners
90
+ $('#sequence').data('sequence_type', seq_type).trigger('sequence_type_changed');
91
+ }
92
+ });
93
+ }
94
+ poll();
95
+ }, 100)
96
+ }());
97
+ };
98
+
99
+
100
+ /* public interface */
101
+
102
+ var blast = function () {
103
+ return undefined;
104
+ }
105
+
106
+ blast.init = function () {
107
+ signal_sequence_type_changed();
108
+ signal_blast_validity();
109
+ }
110
+
111
+ return blast;
112
+ }());
@@ -59,14 +59,7 @@
59
59
  following methods:
60
60
 
61
61
  main():
62
- SequenceServer's main event loop. It watches for changes in user
63
- input and triggers appropriate SequenceServer specific events.
64
-
65
-
66
- SequenceServer defines the following events:
67
-
68
- sequence_type_changed:
69
- When the type (nucleotide or protein) of the input sequence changes.
62
+ Initializes SequenceServer's various modules.
70
63
  */
71
64
 
72
65
  //define global SS object
@@ -78,53 +71,26 @@ if (!SS) {
78
71
  //SS module
79
72
  (function () {
80
73
 
81
- /* private methods */
82
-
83
- /* determine input sequence type, store it, and trigger
84
- sequence_type_changed' event if the input sequence has changed
85
- (TODO: the method is doing too much; split it)
86
- */
87
- var check_sequence_type = function () {
88
- var prev_seq = prev_seq_type = '';
89
-
90
- (function poll () {
91
- setTimeout(function (){
92
- var seq, seq_type;
93
- seq = $('#sequence').val();
94
-
95
- //act only if user input has changed
96
- if (seq != prev_seq){
97
- prev_seq = seq;
98
-
99
- //get input sequence type from the server
100
- $.post('', {sequence: seq}, function(seq_type){
101
- if (seq_type != prev_seq_type){
102
- prev_seq_type = seq_type;
103
-
104
- //store sequence type and notify listeners
105
- $('#sequence').data('sequence_type', seq_type).trigger('sequence_type_changed');
106
- }
107
- });
108
- }
109
- poll();
110
- }, 100)
111
- }());
112
- };
113
-
114
-
115
- /* public methods */
116
-
117
- /* setup listeners for user input changes that trigger appropriate
118
- SequenceServer events
74
+ /*
75
+ ask each module to initialize itself
119
76
  */
120
77
  SS.main = function () {
121
- check_sequence_type();
78
+ SS.blast.init();
122
79
  }
123
80
  }()); //end SS module
124
81
 
125
82
  $(document).ready(function(){
126
83
  // start SequenceServer's event loop
127
84
  SS.main();
85
+ $('input:submit').disable();
86
+
87
+ $('form').on('blast_valid', function () {
88
+ $('input:submit').enable();
89
+ });
90
+
91
+ $('form').on('blast_invalid', function () {
92
+ $('input:submit').disable();
93
+ });
128
94
 
129
95
  $('#sequence').bind('sequence_type_changed', function(){
130
96
  var seq_type = $(this).data('sequence_type');
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  # meta
3
3
  s.name = 'sequenceserver'
4
- s.version = '0.7.2'
4
+ s.version = '0.7.3'
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
@@ -11,7 +11,8 @@
11
11
  <script type="text/javascript" src="<%= uri('/js/jquery.js') %>"></script>
12
12
  <script type="text/javascript" src="<%= uri('/js/jquery.enablePlaceholder.min.js') %>"></script>
13
13
  <script type="text/javascript" src="<%= uri('/js/jquery.activity.js') %>"></script>
14
- <script type="text/javascript" src="<%= uri('/js/search.js') %>"></script>
14
+ <script type="text/javascript" src="<%= uri('/js/sequenceserver.js') %>"></script>
15
+ <script type="text/javascript" src="<%= uri('/js/sequenceserver.blast.js') %>"></script>
15
16
 
16
17
  <%# without a space after erb's closing tag, a / gets appended to css' path %>
17
18
  <link rel="stylesheet" media="screen" type="text/css" href="<%= uri('/css/bootstrap.min.css') %>" />
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: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 2
10
- version: 0.7.2
9
+ - 3
10
+ version: 0.7.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Anurag Priyam
@@ -89,8 +89,9 @@ files:
89
89
  - public/css/custom.css
90
90
  - public/js/jquery.js
91
91
  - public/js/jquery.enablePlaceholder.min.js
92
- - public/js/search.js
92
+ - public/js/sequenceserver.js
93
93
  - public/js/jquery.activity.js
94
+ - public/js/sequenceserver.blast.js
94
95
  - public/js/bootstrap-modal.js
95
96
  - public/js/bootstrap-alerts.js
96
97
  - tests/test_sequencehelpers.rb