sequenceserver 1.0.0.pre.5 → 1.0.0
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.
- checksums.yaml +4 -4
- data/.bootstrap/README.mkd +2 -0
- data/.bootstrap/config.json +416 -0
- data/.gitignore +56 -0
- data/.mailmap +5 -0
- data/.rspec +2 -0
- data/.rubocop.yml +51 -0
- data/.travis.yml +18 -0
- data/COPYRIGHT.txt +13 -0
- data/Gruntfile.js +133 -0
- data/LICENSE.txt +638 -46
- data/{LICENSE.Apache.txt → LICENSE/Apache.txt} +0 -0
- data/LICENSE/d3.txt +26 -0
- data/Rakefile +13 -0
- data/bin/sequenceserver +27 -4
- data/lib/sequenceserver.rb +26 -13
- data/lib/sequenceserver/database.rb +19 -8
- data/lib/sequenceserver/exceptions.rb +9 -1
- data/package.json +29 -0
- data/public/css/custom.css +10 -2
- data/public/dist/css/sequenceserver.min.css +1 -1
- data/public/dist/css/sequenceserver.min.css.gz +0 -0
- data/public/dist/js/sequenceserver.min.js +1 -1
- data/public/dist/js/sequenceserver.min.js.gz +0 -0
- data/public/js/jquery.t.js +2 -2
- data/public/js/sequence.js +4 -1
- data/public/js/sequenceserver.js +23 -20
- data/sequenceserver.gemspec +3 -6
- data/spec/blast_spec.rb +297 -0
- data/spec/capybara_spec.rb +51 -0
- data/spec/config_spec.rb +87 -0
- data/spec/database/funky_ids/funky_ids.fa +12 -0
- data/spec/database/funky_ids/funky_ids.fa.nhr +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nin +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nog +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nsd +11 -0
- data/spec/database/funky_ids/funky_ids.fa.nsi +0 -0
- data/spec/database/funky_ids/funky_ids.fa.nsq +0 -0
- data/spec/database/sample/links.rb +23 -0
- data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta +6449 -0
- data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.phr +0 -0
- data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.pin +0 -0
- data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.pog +0 -0
- data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.psd +2378 -0
- data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.psi +0 -0
- data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.psq +0 -0
- data/spec/database/sample/si_uniprot_idmap.yml +14180 -0
- data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta +5486 -0
- data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nhr +0 -0
- data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nin +0 -0
- data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nog +0 -0
- data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nsd +946 -0
- data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nsi +0 -0
- data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nsq +0 -0
- data/spec/database/unformatted/Cardiocondyla_obscurior/Cobs1.4.proteins.fa +148303 -0
- data/spec/database/without_parse_seqids/without_parse_seqids.fa +10 -0
- data/spec/database/without_parse_seqids/without_parse_seqids.fa.phr +0 -0
- data/spec/database/without_parse_seqids/without_parse_seqids.fa.pin +0 -0
- data/spec/database/without_parse_seqids/without_parse_seqids.fa.psq +0 -0
- data/spec/database_spec.rb +129 -0
- data/spec/empty_config.yml +0 -0
- data/spec/routes_spec.rb +103 -0
- data/spec/sample.conf +2 -0
- data/spec/sample_reports/blastn_sample.asn +144 -0
- data/spec/sample_reports/blastp_sample.asn +1187 -0
- data/spec/sample_reports/blastx_sample.asn +1191 -0
- data/spec/sample_reports/no_hits_sample.asn +130 -0
- data/spec/sample_reports/tblastn_sample.asn +1107 -0
- data/spec/sample_reports/tblastx_sample.asn +2422 -0
- data/spec/sample_reports/with_hits_sample.asn +1489 -0
- data/spec/sequence_spec.rb +100 -0
- data/spec/sequenceserver_spec.rb +108 -0
- data/spec/spec_helper.rb +11 -0
- data/views/result.erb +55 -33
- data/views/search.erb +28 -23
- metadata +63 -151
- data/public/dist/js/webshims/shims/FlashCanvas/canvas2png.js +0 -1
- data/public/dist/js/webshims/shims/FlashCanvas/flashcanvas.js +0 -1
- data/public/dist/js/webshims/shims/FlashCanvas/flashcanvas.swf +0 -0
- data/public/dist/js/webshims/shims/FlashCanvasPro/canvas2png.js +0 -1
- data/public/dist/js/webshims/shims/FlashCanvasPro/flash10canvas.swf +0 -0
- data/public/dist/js/webshims/shims/FlashCanvasPro/flash9canvas.swf +0 -0
- data/public/dist/js/webshims/shims/FlashCanvasPro/flashcanvas.js +0 -1
- data/public/dist/js/webshims/shims/canvas-blob.js +0 -1
- data/public/dist/js/webshims/shims/color-picker.js +0 -2
- data/public/dist/js/webshims/shims/combos/1.js +0 -6
- data/public/dist/js/webshims/shims/combos/10.js +0 -2
- data/public/dist/js/webshims/shims/combos/11.js +0 -2
- data/public/dist/js/webshims/shims/combos/12.js +0 -6
- data/public/dist/js/webshims/shims/combos/13.js +0 -1
- data/public/dist/js/webshims/shims/combos/14.js +0 -1
- data/public/dist/js/webshims/shims/combos/15.js +0 -2
- data/public/dist/js/webshims/shims/combos/16.js +0 -7
- data/public/dist/js/webshims/shims/combos/17.js +0 -2
- data/public/dist/js/webshims/shims/combos/18.js +0 -3
- data/public/dist/js/webshims/shims/combos/2.js +0 -7
- data/public/dist/js/webshims/shims/combos/21.js +0 -2
- data/public/dist/js/webshims/shims/combos/22.js +0 -1
- data/public/dist/js/webshims/shims/combos/23.js +0 -6
- data/public/dist/js/webshims/shims/combos/25.js +0 -2
- data/public/dist/js/webshims/shims/combos/27.js +0 -1
- data/public/dist/js/webshims/shims/combos/28.js +0 -1
- data/public/dist/js/webshims/shims/combos/29.js +0 -1
- data/public/dist/js/webshims/shims/combos/3.js +0 -1
- data/public/dist/js/webshims/shims/combos/30.js +0 -2
- data/public/dist/js/webshims/shims/combos/31.js +0 -1
- data/public/dist/js/webshims/shims/combos/33.js +0 -1
- data/public/dist/js/webshims/shims/combos/34.js +0 -1
- data/public/dist/js/webshims/shims/combos/4.js +0 -1
- data/public/dist/js/webshims/shims/combos/5.js +0 -2
- data/public/dist/js/webshims/shims/combos/6.js +0 -2
- data/public/dist/js/webshims/shims/combos/7.js +0 -7
- data/public/dist/js/webshims/shims/combos/8.js +0 -7
- data/public/dist/js/webshims/shims/combos/9.js +0 -2
- data/public/dist/js/webshims/shims/combos/97.js +0 -1
- data/public/dist/js/webshims/shims/combos/98.js +0 -1
- data/public/dist/js/webshims/shims/combos/99.js +0 -1
- data/public/dist/js/webshims/shims/details.js +0 -1
- data/public/dist/js/webshims/shims/dom-extend.js +0 -1
- data/public/dist/js/webshims/shims/es5.js +0 -1
- data/public/dist/js/webshims/shims/es6.js +0 -1
- data/public/dist/js/webshims/shims/excanvas.js +0 -1
- data/public/dist/js/webshims/shims/filereader-xhr.js +0 -1
- data/public/dist/js/webshims/shims/form-combat.js +0 -1
- data/public/dist/js/webshims/shims/form-core.js +0 -1
- data/public/dist/js/webshims/shims/form-datalist-lazy.js +0 -1
- data/public/dist/js/webshims/shims/form-datalist.js +0 -1
- data/public/dist/js/webshims/shims/form-fixrangechange.js +0 -1
- data/public/dist/js/webshims/shims/form-inputmode.js +0 -1
- data/public/dist/js/webshims/shims/form-message.js +0 -1
- data/public/dist/js/webshims/shims/form-native-extend.js +0 -1
- data/public/dist/js/webshims/shims/form-number-date-api.js +0 -1
- data/public/dist/js/webshims/shims/form-number-date-ui.js +0 -1
- data/public/dist/js/webshims/shims/form-shim-extend.js +0 -1
- data/public/dist/js/webshims/shims/form-shim-extend2.js +0 -1
- data/public/dist/js/webshims/shims/form-validation.js +0 -1
- data/public/dist/js/webshims/shims/form-validators.js +0 -1
- data/public/dist/js/webshims/shims/forms-picker.js +0 -1
- data/public/dist/js/webshims/shims/geolocation.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-ar.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-ch-CN.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-cs.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-de.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-el.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-en.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-es.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-fa.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-fr.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-he.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-hi.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-hu.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-it.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-ja.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-lt.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-nl.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-pl.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-pt-BR.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-pt-PT.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-pt.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-ru.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-sv.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-zh-CN.js +0 -1
- data/public/dist/js/webshims/shims/i18n/formcfg-zh-TW.js +0 -1
- data/public/dist/js/webshims/shims/jme/alternate-media.js +0 -1
- data/public/dist/js/webshims/shims/jme/base.js +0 -1
- data/public/dist/js/webshims/shims/jme/controls.css +0 -1
- data/public/dist/js/webshims/shims/jme/jme.eot +0 -0
- data/public/dist/js/webshims/shims/jme/jme.svg +0 -36
- data/public/dist/js/webshims/shims/jme/jme.ttf +0 -0
- data/public/dist/js/webshims/shims/jme/jme.woff +0 -0
- data/public/dist/js/webshims/shims/jme/mediacontrols-lazy.js +0 -1
- data/public/dist/js/webshims/shims/jme/mediacontrols.js +0 -1
- data/public/dist/js/webshims/shims/jme/playlist.js +0 -1
- data/public/dist/js/webshims/shims/jpicker/images/AlphaBar.png +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/Bars.png +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/Maps.png +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/NoColor.png +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/bar-opacity.png +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/map-opacity.png +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/mappoint.gif +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/picker.gif +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/preview-opacity.png +0 -0
- data/public/dist/js/webshims/shims/jpicker/images/rangearrows.gif +0 -0
- data/public/dist/js/webshims/shims/jpicker/jpicker.css +0 -1
- data/public/dist/js/webshims/shims/matchMedia.js +0 -3
- data/public/dist/js/webshims/shims/mediacapture-picker.js +0 -1
- data/public/dist/js/webshims/shims/mediacapture.js +0 -1
- data/public/dist/js/webshims/shims/mediaelement-core.js +0 -1
- data/public/dist/js/webshims/shims/mediaelement-debug.js +0 -1
- data/public/dist/js/webshims/shims/mediaelement-jaris.js +0 -1
- data/public/dist/js/webshims/shims/mediaelement-native-fix.js +0 -1
- data/public/dist/js/webshims/shims/mediaelement-yt.js +0 -1
- data/public/dist/js/webshims/shims/moxie/flash/Moxie.cdn.swf +0 -0
- data/public/dist/js/webshims/shims/moxie/flash/Moxie.min.swf +0 -0
- data/public/dist/js/webshims/shims/moxie/js/moxie-html4.js +0 -3
- data/public/dist/js/webshims/shims/moxie/js/moxie-swf.js +0 -2
- data/public/dist/js/webshims/shims/picture.js +0 -1
- data/public/dist/js/webshims/shims/plugins/jquery.ui.position.js +0 -11
- data/public/dist/js/webshims/shims/range-ui.js +0 -1
- data/public/dist/js/webshims/shims/sizzle.js +0 -11
- data/public/dist/js/webshims/shims/sticky.js +0 -1
- data/public/dist/js/webshims/shims/styles/color-picker.png +0 -0
- data/public/dist/js/webshims/shims/styles/forms-ext.css +0 -1
- data/public/dist/js/webshims/shims/styles/forms-picker.css +0 -1
- data/public/dist/js/webshims/shims/styles/progress.gif +0 -0
- data/public/dist/js/webshims/shims/styles/progress.png +0 -0
- data/public/dist/js/webshims/shims/styles/shim-ext.css +0 -1
- data/public/dist/js/webshims/shims/styles/shim.css +0 -1
- data/public/dist/js/webshims/shims/styles/transparent.png +0 -0
- data/public/dist/js/webshims/shims/styles/widget.eot +0 -0
- data/public/dist/js/webshims/shims/styles/widget.svg +0 -12
- data/public/dist/js/webshims/shims/styles/widget.ttf +0 -0
- data/public/dist/js/webshims/shims/styles/widget.woff +0 -0
- data/public/dist/js/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/public/dist/js/webshims/shims/swfmini-embed.js +0 -1
- data/public/dist/js/webshims/shims/swfmini.js +0 -6
- data/public/dist/js/webshims/shims/track-ui.js +0 -1
- data/public/dist/js/webshims/shims/track.js +0 -1
- data/public/dist/js/webshims/shims/url.js +0 -1
- data/public/dist/js/webshims/shims/usermedia-core.js +0 -1
- data/public/dist/js/webshims/shims/usermedia-shim.js +0 -1
data/spec/blast_spec.rb
ADDED
@@ -0,0 +1,297 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Test BLAST module.
|
4
|
+
module SequenceServer
|
5
|
+
sample_reports = File.join(SequenceServer.root, 'spec', 'sample_reports')
|
6
|
+
|
7
|
+
with_hits = File.join(sample_reports, 'with_hits_sample.asn')
|
8
|
+
no_hits = File.join(sample_reports, 'no_hits_sample.asn')
|
9
|
+
|
10
|
+
describe 'Report' do
|
11
|
+
hits_report = BLAST::Report.new(with_hits)
|
12
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
13
|
+
|
14
|
+
it 'will return an Array of queries' do
|
15
|
+
hits_report.queries.should be_a Array
|
16
|
+
no_hits_report.queries.should be_a Array
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'will return a Hash of stats' do
|
20
|
+
hits_report.stats.should be_a Hash
|
21
|
+
no_hits_report.stats.should be_a Hash
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'contains all the necessary stats' do
|
25
|
+
hits_report.stats.length.should eql(7)
|
26
|
+
no_hits_report.stats.length.should eql(7)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'Query' do
|
31
|
+
hits_report = BLAST::Report.new(with_hits)
|
32
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
33
|
+
|
34
|
+
it 'will return queries with valid length' do
|
35
|
+
hits_report.queries.first.length.should be_a Fixnum
|
36
|
+
hits_report.queries.first.length.should satisfy { |n| n > 0 }
|
37
|
+
no_hits_report.queries.first.length.should be_a Fixnum
|
38
|
+
no_hits_report.queries.first.length.should satisfy { |n| n > 0 }
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'will return an Array of hits' do
|
42
|
+
hits_report.queries.first.hits.should be_a Array
|
43
|
+
no_hits_report.queries.first.hits.should be_a Array
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'Hits' do
|
48
|
+
hits_report = BLAST::Report.new(with_hits)
|
49
|
+
no_hits_report = BLAST::Report.new(no_hits)
|
50
|
+
|
51
|
+
it 'will have non zero length' do
|
52
|
+
hits_report.queries.last.hits.first.length.should satisfy { |n| n > 0 }
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'will return an Array of HSPs' do
|
56
|
+
hits_report.queries.first.hits.first.hsps.should be_a Array
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'will return an Array with atleast one HSP' do
|
60
|
+
hits_report.queries.first.hits.first.hsps.length.should be >= 1
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'will contain no element if no hits were obtained' do
|
64
|
+
no_hits_report.queries.first.hits.length.should eql(0)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Test general features of HSPs. Algorithm specific customizations are
|
69
|
+
# tested separetly.
|
70
|
+
describe 'HSPs' do
|
71
|
+
hits_report = BLAST::Report.new(with_hits)
|
72
|
+
|
73
|
+
# Currently using all 17 HSP parameters in BLAST Report + 1 to refer to the
|
74
|
+
# hit object it belongs to.
|
75
|
+
it 'have all the necessary values' do
|
76
|
+
hits_report.queries.last.hits.first.hsps.last.count.should eql(18)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Test Random HSPs to ensure that all the values from HSP struct are valid.
|
80
|
+
it 'have correct alignment values' do
|
81
|
+
hits_report.queries.last.hits.first.hsps.last.bit_score.should be_a Float
|
82
|
+
hits_report.queries.last.hits.first.hsps.last.score.should be_a Fixnum
|
83
|
+
|
84
|
+
hits_report.queries.first.hits.first.hsps.first.evalue.should be_a Float
|
85
|
+
hits_report.queries.first.hits.first.hsps.first.evalue
|
86
|
+
.should_not satisfy { |n| n < 0 }
|
87
|
+
|
88
|
+
hits_report.queries.first.hits.last.hsps.first.qstart.should be_a Fixnum
|
89
|
+
hits_report.queries.first.hits.last.hsps.first.qstart
|
90
|
+
.should_not satisfy { |n| n < 0 }
|
91
|
+
|
92
|
+
hits_report.queries.first.hits.last.hsps.first.qend.should be_a Fixnum
|
93
|
+
hits_report.queries.first.hits.last.hsps.first.qend
|
94
|
+
.should_not satisfy { |n| n < 0 }
|
95
|
+
|
96
|
+
hits_report.queries.last.hits.last.hsps.last.sstart.should be_a Fixnum
|
97
|
+
hits_report.queries.last.hits.last.hsps.last.sstart
|
98
|
+
.should_not satisfy { |n| n < 0 }
|
99
|
+
|
100
|
+
hits_report.queries.first.hits.first.hsps.last.send.should be_a Fixnum
|
101
|
+
hits_report.queries.first.hits.first.hsps.last.send
|
102
|
+
.should_not satisfy { |n| n < 0 }
|
103
|
+
|
104
|
+
hits_report.queries.first.hits.first.hsps.last.qframe.should be_a Fixnum
|
105
|
+
hits_report.queries.first.hits.first.hsps.last.sframe.should be_a Fixnum
|
106
|
+
|
107
|
+
hits_report.queries.first.hits.first.hsps.last.identity.should be_a Fixnum
|
108
|
+
hits_report.queries.first.hits.first.hsps.last.identity
|
109
|
+
.should_not satisfy { |n| n < 0 }
|
110
|
+
|
111
|
+
hits_report.queries.first.hits.first.hsps.last.gaps.should be_a Fixnum
|
112
|
+
hits_report.queries.first.hits.first.hsps.last.gaps
|
113
|
+
.should_not satisfy { |n| n < 0 }
|
114
|
+
|
115
|
+
hits_report.queries.first.hits.first.hsps.last.positives
|
116
|
+
.should be_a Fixnum
|
117
|
+
hits_report.queries.first.hits.first.hsps.last.positives
|
118
|
+
.should_not satisfy { |n| n < 0 }
|
119
|
+
|
120
|
+
hits_report.queries.first.hits.first.hsps.last.length.should be_a Fixnum
|
121
|
+
hits_report.queries.first.hits.first.hsps.last.length
|
122
|
+
.should satisfy { |n| n > 0 }
|
123
|
+
|
124
|
+
hits_report.queries.last.hits.last.hsps.first.qseq.should be_a String
|
125
|
+
hits_report.queries.last.hits.last.hsps.first.sseq.should be_a String
|
126
|
+
hits_report.queries.last.hits.last.hsps.first.midline.should be_a String
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'have correctly matched query, hit and midline alignments' do
|
130
|
+
hsp = hits_report.queries.last.hits.last.hsps.first
|
131
|
+
hsp.qseq.length.should eql(hsp.sseq.length)
|
132
|
+
hsp.sseq.length.should eql(hsp.midline.length)
|
133
|
+
hsp.midline.length.should eql(hsp.qseq.length)
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'have correct pretty printing' do
|
137
|
+
hsp = hits_report.queries.last.hits.last.hsps.first
|
138
|
+
pp = hsp.pp
|
139
|
+
|
140
|
+
pp.should_not be_empty
|
141
|
+
pp.should be_a_kind_of(String)
|
142
|
+
(pp.lines.count % 3).should eql(0)
|
143
|
+
|
144
|
+
pp.should match(/^Query/)
|
145
|
+
pp.should match(/Subject/)
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'have relevant stats' do
|
149
|
+
hsp = hits_report.queries.last.hits.last.hsps.last
|
150
|
+
stats = hsp.stats
|
151
|
+
|
152
|
+
stats.size.should be >= 4
|
153
|
+
stats.should include('Score', 'E value', 'Identities', 'Gaps')
|
154
|
+
|
155
|
+
stats['Score'].should be_a Array
|
156
|
+
stats['Identities'].should be_a Array
|
157
|
+
stats['Gaps'].should be_a Array
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Individually test different BLAST+ algorithms
|
162
|
+
#
|
163
|
+
describe 'BLASTN' do
|
164
|
+
let 'hsp' do
|
165
|
+
report = BLAST::Report.new(File.join(sample_reports,
|
166
|
+
'blastn_sample.asn'))
|
167
|
+
report.queries.first.hits.last.hsps.first
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'have correct query and subject frame' do
|
171
|
+
[1, -1].should include(hsp.qframe)
|
172
|
+
[1, -1].should include(hsp.sframe)
|
173
|
+
|
174
|
+
hsp.qframe_unit.should eq(1)
|
175
|
+
hsp.sframe_unit.should eq(1)
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'have correct qstart, qend, sstart, send' do
|
179
|
+
if hsp.sframe > 0
|
180
|
+
hsp.sstart.should be <= hsp.send
|
181
|
+
else
|
182
|
+
hsp.sstart.should be >= hsp.send
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'have relevant stats' do
|
187
|
+
hsp.stats.size.should eq(5)
|
188
|
+
hsp.stats.should include('Strand')
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe 'BLASTP' do
|
193
|
+
let 'hsp' do
|
194
|
+
report = BLAST::Report.new(File.join(sample_reports,
|
195
|
+
'blastp_sample.asn'))
|
196
|
+
report.queries.first.hits.last.hsps.first
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'have correct query and subject frame' do
|
200
|
+
hsp.qframe.should eql(0)
|
201
|
+
hsp.sframe.should eql(0)
|
202
|
+
|
203
|
+
hsp.qframe_unit.should eq(1)
|
204
|
+
hsp.sframe_unit.should eq(1)
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'have correct qstart, qend, sstart, send values' do
|
208
|
+
hsp.qstart.should be <= hsp.qend
|
209
|
+
hsp.sstart.should be <= hsp.send
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'have relevant stats' do
|
213
|
+
hsp.stats.size.should eq(5)
|
214
|
+
hsp.stats.should include('Positives')
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
describe 'BLASTX' do
|
219
|
+
let 'hsp' do
|
220
|
+
report = BLAST::Report.new(File.join(sample_reports,
|
221
|
+
'blastx_sample.asn'))
|
222
|
+
|
223
|
+
report.queries.first.hits.last.hsps.first
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'have correct query and subject frame' do
|
227
|
+
hsp.qframe.should_not eql(0)
|
228
|
+
hsp.sframe.should eql(0)
|
229
|
+
|
230
|
+
hsp.qframe_unit.should eq(3)
|
231
|
+
hsp.sframe_unit.should eq(1)
|
232
|
+
end
|
233
|
+
|
234
|
+
it 'have correct qstart, qend, sstart, send' do
|
235
|
+
hsp.qstart.should be <= hsp.qend
|
236
|
+
hsp.sstart.should be <= hsp.send
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'have relevant stats' do
|
240
|
+
hsp.stats.size.should eq(5)
|
241
|
+
hsp.stats.should include('Query frame')
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
describe 'TBLASTX' do
|
246
|
+
let 'hsp' do
|
247
|
+
report = BLAST::Report.new(File.join(sample_reports,
|
248
|
+
'tblastx_sample.asn'))
|
249
|
+
report.queries.first.hits.last.hsps.first
|
250
|
+
end
|
251
|
+
|
252
|
+
it 'have correct query and subject frame' do
|
253
|
+
hsp.qframe.should_not eql(0)
|
254
|
+
hsp.sframe.should_not eql(0)
|
255
|
+
|
256
|
+
hsp.qframe_unit.should eq(3)
|
257
|
+
hsp.sframe_unit.should eq(3)
|
258
|
+
end
|
259
|
+
|
260
|
+
it 'have correct qstart, qend, sstart, send' do
|
261
|
+
hsp.qstart.should be <= hsp.qend
|
262
|
+
hsp.sstart.should be <= hsp.send
|
263
|
+
end
|
264
|
+
|
265
|
+
it 'have relevant stats' do
|
266
|
+
hsp.stats.size.should eq(6)
|
267
|
+
hsp.stats.should include('Frame')
|
268
|
+
hsp.stats.should include('Positives')
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
describe 'TBLASTN' do
|
273
|
+
let 'hsp' do
|
274
|
+
report = BLAST::Report.new(File.join(sample_reports,
|
275
|
+
'tblastn_sample.asn'))
|
276
|
+
report.queries.first.hits.last.hsps.first
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'have correct query and subject frame' do
|
280
|
+
hsp.qframe.should eql(0)
|
281
|
+
hsp.sframe.should_not eql(0)
|
282
|
+
|
283
|
+
hsp.qframe_unit.should eq(1)
|
284
|
+
hsp.sframe_unit.should eq(3)
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'have correct qstart, qend, sstart, send' do
|
288
|
+
hsp.qstart.should be <= hsp.qend
|
289
|
+
hsp.sstart.should be <= hsp.send
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'have relevant stats' do
|
293
|
+
hsp.stats.size.should eq(5)
|
294
|
+
hsp.stats.should include('Hit frame')
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'capybara/rspec'
|
3
|
+
require 'capybara-webkit'
|
4
|
+
|
5
|
+
describe 'a browser', :js => true do
|
6
|
+
sequence = 'ATCGATCAGCTACGATCAGCATCGACTAGCATCGACTACGA'
|
7
|
+
sample_nucl_db = 'Sinvicta2-2-3.cdna.subset.fasta'
|
8
|
+
# sample_prot_db = 'Sinvicta2-2-3.prot'
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
Capybara.javascript_driver = :webkit
|
12
|
+
Capybara.default_wait_time = 5
|
13
|
+
|
14
|
+
options = { :database_dir => SequenceServer.root }
|
15
|
+
Capybara.app = SequenceServer.init(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'runs a simple blastn search' do
|
19
|
+
visit '/'
|
20
|
+
fill_in('sequence', :with => sequence)
|
21
|
+
check(sample_nucl_db)
|
22
|
+
click_button('method')
|
23
|
+
page.should have_content('Query')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'properly controls blast button' do
|
27
|
+
visit '/'
|
28
|
+
|
29
|
+
fill_in('sequence', :with => sequence)
|
30
|
+
page.evaluate_script("$('#method').is(':disabled')").should eq(true)
|
31
|
+
|
32
|
+
check(sample_nucl_db)
|
33
|
+
page.evaluate_script("$('#method').is(':disabled')").should eq(false)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'properly controls interaction with database listing' do
|
37
|
+
visit '/'
|
38
|
+
fill_in('sequence', :with => sequence)
|
39
|
+
check(sample_nucl_db)
|
40
|
+
page.evaluate_script("$('.protein .checkbox').first().hasClass('disabled')")
|
41
|
+
.should eq(true)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'shows a dropdown menu when other blast methods are available' do
|
45
|
+
visit '/'
|
46
|
+
fill_in('sequence', :with => sequence)
|
47
|
+
check(sample_nucl_db)
|
48
|
+
page.save_screenshot('screenshot.png')
|
49
|
+
page.has_css?('button.dropdown-toggle').should eq(true)
|
50
|
+
end
|
51
|
+
end
|
data/spec/config_spec.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'sequenceserver/config'
|
3
|
+
|
4
|
+
# Test Config class.
|
5
|
+
module SequenceServer
|
6
|
+
describe 'Config' do
|
7
|
+
let 'sample_config_file' do
|
8
|
+
File.join(SequenceServer.root, 'spec', 'sample.conf')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'behaves like a Hash' do
|
12
|
+
config = Config.new
|
13
|
+
|
14
|
+
config.should respond_to :[]
|
15
|
+
config.should respond_to :[]=
|
16
|
+
config.should respond_to :include?
|
17
|
+
|
18
|
+
config[:key] = 'value'
|
19
|
+
config[:key].should eq 'value'
|
20
|
+
config.include?(:key).should be_truthy
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'has reasonable defaults' do
|
24
|
+
config = Config.new
|
25
|
+
config[:num_threads].should eq 1
|
26
|
+
config[:host].should eq '0.0.0.0'
|
27
|
+
config[:port].should eq 4567
|
28
|
+
config.config_file.should eq File.expand_path('~/.sequenceserver.conf')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'symbolizes keys' do
|
32
|
+
config = Config.new('key' => 'value')
|
33
|
+
config.include?('key').should be_falsey
|
34
|
+
config.include?(:key).should be_truthy
|
35
|
+
config[:key].should eq 'value'
|
36
|
+
|
37
|
+
config = Config.new(:config_file => sample_config_file)
|
38
|
+
config.include?('num_threads').should be_falsey
|
39
|
+
config.include?(:num_threads).should be_truthy
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'changes database key, if present, to database_dir' do
|
43
|
+
# Does so for data Hash passed to Config.new.
|
44
|
+
config = Config.new(:database => 'database_dir')
|
45
|
+
config.include?(:database).should be_falsey
|
46
|
+
config[:database_dir].should eq 'database_dir'
|
47
|
+
|
48
|
+
# Does so for data parsed from config_file.
|
49
|
+
config = Config.new(:config_file => sample_config_file)
|
50
|
+
config.include?(:database).should be_falsey
|
51
|
+
config[:database_dir].should eq 'database_dir'
|
52
|
+
|
53
|
+
# If both database and database_dir key are present, database key is
|
54
|
+
# removed and database_dir key takes preecedence.
|
55
|
+
config = Config.new(:database => 'database',
|
56
|
+
:database_dir => 'database_dir')
|
57
|
+
config.include?(:database).should be_falsey
|
58
|
+
config[:database_dir].should eq 'database_dir'
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'parses config_file and merges with defaults, values from config_file' \
|
62
|
+
'taking preecedence' do
|
63
|
+
config = Config.new(:config_file => sample_config_file)
|
64
|
+
|
65
|
+
# config_file key becomes config.config_file
|
66
|
+
config.include?(:config_file).should be_falsey
|
67
|
+
config.config_file.should eq sample_config_file
|
68
|
+
|
69
|
+
# First check that a default value is present. Then check that a value
|
70
|
+
# from config file is present.
|
71
|
+
#
|
72
|
+
# We use num_threads key from config_file to test. The default value of
|
73
|
+
# num_threads is 1, but is set to 10 in config_file. If the final value
|
74
|
+
# is 10, we have ensured that config_file takes preecedence over
|
75
|
+
# default values.
|
76
|
+
config[:port].should eq 4567
|
77
|
+
config[:num_threads].should eq 10
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'merges arguments with defaults and values from config_file,' \
|
81
|
+
'arguments taking preecedence' do
|
82
|
+
config = Config.new(:config_file => sample_config_file,
|
83
|
+
:num_threads => 20)
|
84
|
+
config[:num_threads].should eq 20
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
>abc|def
|
2
|
+
GATGAACGCTGGCGGCGTGCCTAATACATGCAAGTCGAG
|
3
|
+
>abcdef#
|
4
|
+
GATGAACGCTGGCGGCGTGCCTAATACATGCAAGTCGAG
|
5
|
+
>abc#def
|
6
|
+
GATGAACGCTGGCGGCGTGCCTAATACATGCAAGTCGAG
|
7
|
+
>123#456
|
8
|
+
GATGAACGCTGGCGGCGTGCCTAATACATGCAAGTCGAG
|
9
|
+
>123456#
|
10
|
+
GATGAACGCTGGCGGCGTGCCTAATACATGCAAGTCGAG
|
11
|
+
>123456
|
12
|
+
GATGAACGCTGGCGGCGTGCCTAATACATGCAAGTCGAG
|