sequenceserver 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env ruby
2
+ # test_ssequencehelpers.rb
3
+
4
+ # ensure 'lib/' is in the load path
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+
7
+ require 'sequenceserver'
8
+ require 'sequenceserver/sequencehelpers'
9
+ require 'test/unit'
10
+
11
+
12
+
13
+ class Tester < Test::Unit::TestCase
14
+ include SequenceServer::SequenceHelpers
15
+ def test_guess_sequence_type_nucleotide
16
+ #must 'correctly detect nucleotide sequence, even when it includes crap' do
17
+ ['AAAAAAAAAAAAAAAAAAAAAT',
18
+ ' CAGATGCRRCAAAGCAAACGGCAA 34523453 652352',
19
+ 'ACCNNNNNNXXXXCAUUUUUU',
20
+ "ACGT\n\t\t\nACCACGGACCACGAAAGCG" ].each do |seq|
21
+ assert_equal(:nucleotide, guess_sequence_type(seq), message="for #{seq}")
22
+ end
23
+ end
24
+
25
+ def test_guess_sequence_type_aminoacid
26
+ #must 'correctly detect aminoacid sequence, even when it includes a lot of crap' do
27
+ ['ADSACGHKSJLFCVMGTL',
28
+ ' 345 KSSYPHYSPPPPHS 345 23453 652352',
29
+ 'GEYSNLNNNNNNXXXXSSSSSSSSSSSSSSSSSSSSSSS',
30
+ "EE\n\t\t\n \t\t\EEQRRQQSARTSRRQR" ].each do |seq|
31
+ assert_equal(:protein, guess_sequence_type(seq) , message="for #{seq}")
32
+ end
33
+ end
34
+
35
+ def test_guess_sequence_type_impossible
36
+ assert_equal(nil, guess_sequence_type('ACSFGT'), message='too little sequence')
37
+ end
38
+
39
+ ## Tests for type_of_sequences (multi-fasta kind of thing the user would enter)
40
+ def test_type_of_sequences
41
+ aa_multifasta = ">SDFDSF\nACGTGSDLKJGNLDKSJFLSDKJFLSDKOIU\n>asdfas\nasfasdfffffffffffffffffffff\n>alksjflkasdj slakdjf\nasdfasdfasdfljaslkdjf"
42
+ aa_multifasta_including_short_seq_missing_lead = "ACGTGSDLKJGNLDKSJFLSDKJFLSDKOIU\n>asdfas\nasf\n>alksjflkasdj slakdjf\nasdfasdfasdfljaslkdjf"
43
+ aa_singlesequence = "ACGTGSDLKJGNLDKSJFLSDKJFLSDKOIU\n"
44
+ nt_multifasta = ">asdf\nAAAAAAAAAAAAAAAAAAAAT\n>sfaslkj\nCAGATGCRRCAAAGCAAACGGCAA\n>asssssjlkj\nACCCANNNNNNXXXXCAUUUUUU"
45
+ aa_nt_mix = ">alksjflkasdj slakdjf\nasdfasdfasdfljaslkdjf\n>ffffffassdf\nACGCNAGTGCCCCCCCCGANATGGGTGGTTXXXXXGGTG"
46
+
47
+ assert_equal(:protein, type_of_sequences(aa_multifasta), 'aa_multifasta')
48
+ assert_equal(:protein, type_of_sequences(aa_multifasta_including_short_seq_missing_lead ), 'aa_multifasta_short_seq_and_no_>')
49
+ assert_equal(:protein, type_of_sequences(aa_singlesequence), 'single AA sequence')
50
+ assert_equal(:nucleotide, type_of_sequences(nt_multifasta), 'nt_multifasta')
51
+ assert_raise(ArgumentError, 'mixed aa and nt should raise') { type_of_sequences(aa_nt_mix) }
52
+ end
53
+
54
+ def test_sequence_type_to_blast_methods
55
+ assert_equal ['blastp', 'tblastn'], blast_methods_for(:protein), 'blasts_for_protein'
56
+ assert_equal ['blastn','tblastx','blastx'], blast_methods_for(:nucleotide), 'blasts_for_nucleotide'
57
+ assert_equal ['blastp', 'tblastn','blastn','tblastx','blastx'], blast_methods_for(nil), 'blasts_for_nil'
58
+ end
59
+
60
+ def test_composition
61
+ expected_comp = {"a"=>2, "d"=>3, "f"=>7, "s"=>3, "A"=>1}
62
+ assert_equal(expected_comp, composition('asdfasdfffffAsdf'))
63
+ end
64
+
65
+ def test_construct_standard_sequence_hyperlink
66
+ assert_equal "/get_sequence/?id=one&db=abc def", construct_standard_sequence_hyperlink({:sequence_id => 'one', :databases => %w(abc def)})
67
+ assert_equal nil, construct_standard_sequence_hyperlink({:sequence_id => ' one', :databases => %w(abc def)})
68
+ assert_equal "/get_sequence/?id=MAL13P1.218&db=abc def", construct_standard_sequence_hyperlink({:sequence_id => 'lcl|MAL13P1.218', :databases => %w(abc def)})
69
+ end
70
+ end
71
+
72
+ class AppTester < Test::Unit::TestCase
73
+ def test_process_advanced_blast_options
74
+ # dirty hack, required to work around Sinatra's overriden `new` method that
75
+ # may return instance of any Rack class
76
+ app = SequenceServer::App.allocate
77
+ app.send(:initialize)
78
+
79
+ assert_nothing_raised {app.validate_advanced_parameters('')}
80
+ assert_nothing_raised {app.validate_advanced_parameters('-word_size 5')}
81
+ assert_raise(ArgumentError, 'security advanced option parser'){app.validate_advanced_parameters('-word_size 5; rm -rf /')}
82
+ assert_raise(ArgumentError, 'conflicting advanced option'){app.validate_advanced_parameters('-db roar')}
83
+ end
84
+ end
85
+
data/views/500.erb ADDED
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <title>SequenceServer</title>
6
+ <meta name="author" content="Anurag Priyam" />
7
+ <meta name="author" content="Yannick Wurm" />
8
+ <meta name="author" content="Cedric Wurm" />
9
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
10
+
11
+ <%# without a space after erb's closing tag, a / gets appended to css' path %>
12
+ <link rel="stylesheet" media="screen" type="text/css" href=<%= uri('/css/beige.css') %> />
13
+ </head>
14
+
15
+ <body>
16
+ <div class="container">
17
+ <h1>Oops! Something went wonky!</h1>
18
+ <p>Apologies, there was an error with your request:
19
+ <strong><%=request.env['sinatra.error'].message %> </strong></p>
20
+ <p>If the error persists please contact the administrator</p>
21
+ </div>
22
+ </body>
data/views/search.erb ADDED
@@ -0,0 +1,221 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>SequenceServer</title>
5
+ <meta name="author" content="Anurag Priyam" />
6
+ <meta name="author" content="Ben J. Woodcroft" />
7
+ <meta name="author" content="Yannick Wurm" />
8
+ <meta name="author" content="Cedric Wurm" />
9
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
10
+ <script type="text/javascript" src="<%= uri('/js/jquery.js') %>"></script>
11
+ <script type="text/javascript" src="<%= uri('/js/jquery.enablePlaceholder.min.js') %>"></script>
12
+ <script type="text/javascript" src="<%= uri('/js/search.js') %>"></script>
13
+
14
+ <%# without a space after erb's closing tag, a / gets appended to css' path %>
15
+ <link rel="stylesheet" media="screen" type="text/css" href="<%= uri('/css/bootstrap.min.css') %>" />
16
+ <link rel="stylesheet" media="screen" type="text/css" href="<%= uri('/css/custom.css') %>" />
17
+ </head>
18
+
19
+ <body>
20
+ <div class="container">
21
+ <div class="page">
22
+ <div class="page-header" id="banner">
23
+ <h1>BLAST Sequence(s)</h1>
24
+ </div>
25
+
26
+ <form method="post" action="<%= uri('/#result') %>">
27
+ <div class="row">
28
+ <div class="span12">
29
+ <div class="offset-left sequence">
30
+ <div class="clearfix">
31
+ <textarea name="sequence" id="sequence" rows="11" placeholder="Paste your sequence(s) here..." ></textarea>
32
+ </div>
33
+ </div>
34
+ </div>
35
+
36
+ <div class="span4">
37
+ <div class="offset-right box blastmethods">
38
+ <div class="clearfix">
39
+ <fieldset>
40
+ <legend><h4>Blast methods</h4></legend>
41
+ <ul class="inputs-list">
42
+ <li>
43
+ <label title="Protein query; protein database.">
44
+ <input type="radio" name="method" value="blastp" id="blastp"/>
45
+ <span>blastp</span>
46
+ </label>
47
+ </li>
48
+ <li>
49
+ <label title="Protein query; six frame translated nucleotide database.">
50
+ <input type="radio" name="method" value="tblastn" id="tblastn"/>
51
+ <span>tblastn</span>
52
+ </label>
53
+ </li>
54
+ <li>
55
+ <label title="Nucleotide query; nucleotide database.">
56
+ <input type="radio" name="method" value="blastn" id="blastn"/>
57
+ <span>blastn</span>
58
+ </label>
59
+ </li>
60
+ <li>
61
+ <label title="Translated nucleotide query; protein database">
62
+ <input type="radio" name="method" value="blastx" id="blastx"/>
63
+ <span>blastx</span>
64
+ </label>
65
+ </li>
66
+ <li>
67
+ <label title="Six-frame translated nucleotide query; six-frame translated nucleotide database">
68
+ <input type="radio" name="method" value="tblastx" id="tblastx"/>
69
+ <span>tblastx</span>
70
+ </label>
71
+ </li>
72
+ </ul>
73
+ </fieldset>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
78
+
79
+ <div class="row">
80
+ <div class="span8">
81
+ <div class="offset-left box databases nucleotide">
82
+ <div class="clearfix">
83
+ <fieldset>
84
+ <legend><h4>Nucleotide databases</h4></legend>
85
+ <ul class="inputs-list">
86
+ <% settings.databases['nucleotide'].each_with_index do |db, i| %>
87
+ <li>
88
+ <label>
89
+ <input type="checkbox" id="ndb<%=i%>" name="db[nucleotide][]" value="<%=i%>"/>
90
+ <span> <%= db.title or db.name %></span>
91
+ </label>
92
+ </li>
93
+ <% end %>
94
+ </ul>
95
+ </fieldset>
96
+ </div>
97
+ </div>
98
+ </div>
99
+
100
+ <div class="span8">
101
+ <div class="offset-right box databases protein">
102
+ <div class="clearfix">
103
+ <fieldset>
104
+ <legend><h4>Protein databases</h4></legend>
105
+ <ul class="inputs-list">
106
+ <% settings.databases['protein'].each_with_index do |db, i| %>
107
+ <li>
108
+ <label>
109
+ <input type="checkbox" id="pdb<%=i%>" name="db[protein][]" value="<%=i%>"/>
110
+ <span> <%= db.title or db.name %></span>
111
+ </label>
112
+ </li>
113
+ <% end %>
114
+ </ul>
115
+ </fieldset>
116
+ </div>
117
+ </div>
118
+ </div>
119
+ </div>
120
+
121
+ <div class="row">
122
+ <div class="span12">
123
+ <div class="offset-left box advanced">
124
+ <div class="clearfix">
125
+ <label class="span4" for="advanced"><h4 title="Click to show/hide advanced options.">Advanced Parameters:</h4></label>
126
+ <input class="span8" type="text" name="advanced" id="advanced" title="View, and enter advanced parameters." placeholder="eg: -evalue 1.0e-5 -num_alignments 100"/>
127
+ </div>
128
+ <pre class="help">
129
+ <%= ERB::Util.h %q|
130
+ -evalue <Real>
131
+ Expectation value (E) threshold for saving hits
132
+ Default = `10'
133
+ -word_size <Integer, >=2>
134
+ Word size for wordfinder algorithm
135
+ -gapopen <Integer>
136
+ Cost to open a gap
137
+ -gapextend <Integer>
138
+ Cost to extend a gap
139
+ -matrix <String>
140
+ Scoring matrix name (normally BLOSUM62)
141
+ -threshold <Real, >=0>
142
+ Minimum word score such that the word is added to the BLAST lookup table
143
+ -comp_based_stats <String>
144
+ Use composition-based statistics for blastp / tblastn:
145
+ D or d: default (equivalent to 2)
146
+ 0 or F or f: no composition-based statistics
147
+ 1: Composition-based statistics as in NAR 29:2994-3005, 2001
148
+ 2 or T or t : Composition-based score adjustment as in Bioinformatics
149
+ 21:902-911,
150
+ 2005, conditioned on sequence properties
151
+ 3: Composition-based score adjustment as in Bioinformatics 21:902-911,
152
+ 2005, unconditionally
153
+ For programs other than tblastn, must either be absent or be D, F or 0
154
+ Default = `2'
155
+ -num_descriptions <Integer, >=0>
156
+ Number of database sequences to show one-line descriptions for
157
+ Default = `500'
158
+ -num_alignments <Integer, >=0>
159
+ Number of database sequences to show alignments for
160
+ Default = `250'
161
+ *** Query filtering options
162
+ -seg <String>
163
+ Filter query sequence with SEG (Format: 'yes', 'window locut hicut', or
164
+ 'no' to disable)
165
+ Default = `no'
166
+ -soft_masking <Boolean>
167
+ Apply filtering locations as soft masks
168
+ Default = `false'
169
+ -lcase_masking
170
+ Use lower case filtering in query and subject sequence(s)?
171
+ *** Restrict search or results
172
+ -gilist <String>
173
+ Restrict search of database to list of GI's
174
+ * Incompatible with: negative_gilist, seqidlist, remote, subject,
175
+ subject_loc
176
+ -seqidlist <String>
177
+ Restrict search of database to list of SeqId's
178
+ * Incompatible with: gilist, negative_gilist, remote, subject,
179
+ subject_loc
180
+ -negative_gilist <String>
181
+ Restrict search of database to everything except the listed GIs
182
+ * Incompatible with: gilist, seqidlist, remote, subject, subject_loc
183
+ -entrez_query <String>
184
+ Restrict search with the given Entrez query
185
+ * Requires: remote
186
+ -db_soft_mask <String>
187
+ Filtering algorithm ID to apply to the BLAST database as soft masking
188
+ * Incompatible with: subject, subject_loc
189
+ -culling_limit <Integer, >=0>
190
+ If the query range of a hit is enveloped by that of at least this many
191
+ higher-scoring hits, delete the hit
192
+ * Incompatible with: best_hit_overhang, best_hit_score_edge
193
+ -best_hit_overhang <Real, (>0 and <0.5)>
194
+ Best Hit algorithm overhang value (recommended value: 0.1)
195
+ * Incompatible with: culling_limit
196
+ -best_hit_score_edge <Real, (>0 and <0.5)>
197
+ Best Hit algorithm score edge value (recommended value: 0.1)
198
+ * Incompatible with: culling_limit
199
+ -max_target_seqs <Integer, >=1>
200
+ Maximum number of aligned sequences to keep | %>
201
+ </pre>
202
+ </div>
203
+ </div>
204
+
205
+ <div class="span4">
206
+ <input type="submit" class="btn large primary" value="BLAST!"/>
207
+ </div>
208
+ </div>
209
+ </form>
210
+
211
+ <div id="result" class="offset-left offset-right">
212
+ <%= @blast %>
213
+ </div>
214
+
215
+ <div id="underbar">
216
+ <p>&copy; <a href='http://www.sequenceserver.com'>sequenceserver.com</a></p>
217
+ </div>
218
+ </div> <!-- /page -->
219
+ </div> <!-- /container -->
220
+ </body>
221
+ </html>
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sequenceserver
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 7
10
+ version: 0.6.7
11
+ platform: ruby
12
+ authors:
13
+ - Anurag Priyam
14
+ - Ben J Woodcroft
15
+ - Yannick Wurm
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-12-13 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: sinatra
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 15
31
+ segments:
32
+ - 1
33
+ - 0
34
+ version: "1.0"
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: ptools
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ description: |
52
+ SequenceServer lets you rapidly set up a BLAST+ server with an intuitive user interface for use locally or over the web.
53
+
54
+ email: anurag08priyam@gmail.com
55
+ executables:
56
+ - sequenceserver
57
+ - database_formatter
58
+ extensions: []
59
+
60
+ extra_rdoc_files: []
61
+
62
+ files:
63
+ - lib/sequenceserver.rb
64
+ - lib/sequenceserver/sequencehelpers.rb
65
+ - lib/sequenceserver/customisation.rb
66
+ - lib/sequenceserver/helpers.rb
67
+ - lib/sequenceserver/sinatralikeloggerformatter.rb
68
+ - lib/sequenceserver/blast.rb
69
+ - lib/sequenceserver/database.rb
70
+ - views/search.erb
71
+ - views/500.erb
72
+ - public/blastResult.js
73
+ - public/css/bootstrap.min.css
74
+ - public/css/custom.css
75
+ - public/js/jquery.js
76
+ - public/js/jquery.enablePlaceholder.min.js
77
+ - public/js/search.js
78
+ - tests/test_sequencehelpers.rb
79
+ - tests/database/protein/Sinvicta2-2-3.prot.subset.fasta.pin
80
+ - tests/database/protein/Sinvicta2-2-3.prot.subset.fasta
81
+ - tests/database/protein/Sinvicta2-2-3.prot.subset.fasta.psq
82
+ - tests/database/protein/Sinvicta2-2-3.prot.subset.fasta.phr
83
+ - tests/database/nucleotide/Sinvicta2-2-3.cdna.subset.fasta
84
+ - tests/database/nucleotide/Sinvicta2-2-3.cdna.subset.fasta.nsq
85
+ - tests/database/nucleotide/Sinvicta2-2-3.cdna.subset.fasta.nin
86
+ - tests/database/nucleotide/Sinvicta2-2-3.cdna.subset.fasta.nhr
87
+ - config.ru
88
+ - example.config.yml
89
+ - LICENSE.txt
90
+ - README.txt
91
+ - Gemfile
92
+ - sequenceserver.gemspec
93
+ - bin/sequenceserver
94
+ - bin/database_formatter
95
+ homepage: http://sequenceserver.com
96
+ licenses:
97
+ - SequenceServer (custom)
98
+ post_install_message: |+
99
+
100
+ ------------------------------------------------------------------------
101
+ Thank you for installing SequenceServer :)!
102
+
103
+ To launch SequenceServer execute 'sequenceserver' from command line.
104
+
105
+ $ sequenceserver
106
+
107
+
108
+ Visit http://sequenceserver.com for more.
109
+ ------------------------------------------------------------------------
110
+
111
+ rdoc_options: []
112
+
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 3
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
132
+ version: "0"
133
+ requirements: []
134
+
135
+ rubyforge_project:
136
+ rubygems_version: 1.8.11
137
+ signing_key:
138
+ specification_version: 3
139
+ summary: iPod of BLAST searching
140
+ test_files: []
141
+