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.

Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/.bootstrap/README.mkd +2 -0
  3. data/.bootstrap/config.json +416 -0
  4. data/.gitignore +56 -0
  5. data/.mailmap +5 -0
  6. data/.rspec +2 -0
  7. data/.rubocop.yml +51 -0
  8. data/.travis.yml +18 -0
  9. data/COPYRIGHT.txt +13 -0
  10. data/Gruntfile.js +133 -0
  11. data/LICENSE.txt +638 -46
  12. data/{LICENSE.Apache.txt → LICENSE/Apache.txt} +0 -0
  13. data/LICENSE/d3.txt +26 -0
  14. data/Rakefile +13 -0
  15. data/bin/sequenceserver +27 -4
  16. data/lib/sequenceserver.rb +26 -13
  17. data/lib/sequenceserver/database.rb +19 -8
  18. data/lib/sequenceserver/exceptions.rb +9 -1
  19. data/package.json +29 -0
  20. data/public/css/custom.css +10 -2
  21. data/public/dist/css/sequenceserver.min.css +1 -1
  22. data/public/dist/css/sequenceserver.min.css.gz +0 -0
  23. data/public/dist/js/sequenceserver.min.js +1 -1
  24. data/public/dist/js/sequenceserver.min.js.gz +0 -0
  25. data/public/js/jquery.t.js +2 -2
  26. data/public/js/sequence.js +4 -1
  27. data/public/js/sequenceserver.js +23 -20
  28. data/sequenceserver.gemspec +3 -6
  29. data/spec/blast_spec.rb +297 -0
  30. data/spec/capybara_spec.rb +51 -0
  31. data/spec/config_spec.rb +87 -0
  32. data/spec/database/funky_ids/funky_ids.fa +12 -0
  33. data/spec/database/funky_ids/funky_ids.fa.nhr +0 -0
  34. data/spec/database/funky_ids/funky_ids.fa.nin +0 -0
  35. data/spec/database/funky_ids/funky_ids.fa.nog +0 -0
  36. data/spec/database/funky_ids/funky_ids.fa.nsd +11 -0
  37. data/spec/database/funky_ids/funky_ids.fa.nsi +0 -0
  38. data/spec/database/funky_ids/funky_ids.fa.nsq +0 -0
  39. data/spec/database/sample/links.rb +23 -0
  40. data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta +6449 -0
  41. data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.phr +0 -0
  42. data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.pin +0 -0
  43. data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.pog +0 -0
  44. data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.psd +2378 -0
  45. data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.psi +0 -0
  46. data/spec/database/sample/proteins/Solenopsis_invicta/Sinvicta2-2-3.prot.subset.fasta.psq +0 -0
  47. data/spec/database/sample/si_uniprot_idmap.yml +14180 -0
  48. data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta +5486 -0
  49. data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nhr +0 -0
  50. data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nin +0 -0
  51. data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nog +0 -0
  52. data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nsd +946 -0
  53. data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nsi +0 -0
  54. data/spec/database/sample/transcripts/Solenopsis_invicta/Sinvicta2-2-3.cdna.subset.fasta.nsq +0 -0
  55. data/spec/database/unformatted/Cardiocondyla_obscurior/Cobs1.4.proteins.fa +148303 -0
  56. data/spec/database/without_parse_seqids/without_parse_seqids.fa +10 -0
  57. data/spec/database/without_parse_seqids/without_parse_seqids.fa.phr +0 -0
  58. data/spec/database/without_parse_seqids/without_parse_seqids.fa.pin +0 -0
  59. data/spec/database/without_parse_seqids/without_parse_seqids.fa.psq +0 -0
  60. data/spec/database_spec.rb +129 -0
  61. data/spec/empty_config.yml +0 -0
  62. data/spec/routes_spec.rb +103 -0
  63. data/spec/sample.conf +2 -0
  64. data/spec/sample_reports/blastn_sample.asn +144 -0
  65. data/spec/sample_reports/blastp_sample.asn +1187 -0
  66. data/spec/sample_reports/blastx_sample.asn +1191 -0
  67. data/spec/sample_reports/no_hits_sample.asn +130 -0
  68. data/spec/sample_reports/tblastn_sample.asn +1107 -0
  69. data/spec/sample_reports/tblastx_sample.asn +2422 -0
  70. data/spec/sample_reports/with_hits_sample.asn +1489 -0
  71. data/spec/sequence_spec.rb +100 -0
  72. data/spec/sequenceserver_spec.rb +108 -0
  73. data/spec/spec_helper.rb +11 -0
  74. data/views/result.erb +55 -33
  75. data/views/search.erb +28 -23
  76. metadata +63 -151
  77. data/public/dist/js/webshims/shims/FlashCanvas/canvas2png.js +0 -1
  78. data/public/dist/js/webshims/shims/FlashCanvas/flashcanvas.js +0 -1
  79. data/public/dist/js/webshims/shims/FlashCanvas/flashcanvas.swf +0 -0
  80. data/public/dist/js/webshims/shims/FlashCanvasPro/canvas2png.js +0 -1
  81. data/public/dist/js/webshims/shims/FlashCanvasPro/flash10canvas.swf +0 -0
  82. data/public/dist/js/webshims/shims/FlashCanvasPro/flash9canvas.swf +0 -0
  83. data/public/dist/js/webshims/shims/FlashCanvasPro/flashcanvas.js +0 -1
  84. data/public/dist/js/webshims/shims/canvas-blob.js +0 -1
  85. data/public/dist/js/webshims/shims/color-picker.js +0 -2
  86. data/public/dist/js/webshims/shims/combos/1.js +0 -6
  87. data/public/dist/js/webshims/shims/combos/10.js +0 -2
  88. data/public/dist/js/webshims/shims/combos/11.js +0 -2
  89. data/public/dist/js/webshims/shims/combos/12.js +0 -6
  90. data/public/dist/js/webshims/shims/combos/13.js +0 -1
  91. data/public/dist/js/webshims/shims/combos/14.js +0 -1
  92. data/public/dist/js/webshims/shims/combos/15.js +0 -2
  93. data/public/dist/js/webshims/shims/combos/16.js +0 -7
  94. data/public/dist/js/webshims/shims/combos/17.js +0 -2
  95. data/public/dist/js/webshims/shims/combos/18.js +0 -3
  96. data/public/dist/js/webshims/shims/combos/2.js +0 -7
  97. data/public/dist/js/webshims/shims/combos/21.js +0 -2
  98. data/public/dist/js/webshims/shims/combos/22.js +0 -1
  99. data/public/dist/js/webshims/shims/combos/23.js +0 -6
  100. data/public/dist/js/webshims/shims/combos/25.js +0 -2
  101. data/public/dist/js/webshims/shims/combos/27.js +0 -1
  102. data/public/dist/js/webshims/shims/combos/28.js +0 -1
  103. data/public/dist/js/webshims/shims/combos/29.js +0 -1
  104. data/public/dist/js/webshims/shims/combos/3.js +0 -1
  105. data/public/dist/js/webshims/shims/combos/30.js +0 -2
  106. data/public/dist/js/webshims/shims/combos/31.js +0 -1
  107. data/public/dist/js/webshims/shims/combos/33.js +0 -1
  108. data/public/dist/js/webshims/shims/combos/34.js +0 -1
  109. data/public/dist/js/webshims/shims/combos/4.js +0 -1
  110. data/public/dist/js/webshims/shims/combos/5.js +0 -2
  111. data/public/dist/js/webshims/shims/combos/6.js +0 -2
  112. data/public/dist/js/webshims/shims/combos/7.js +0 -7
  113. data/public/dist/js/webshims/shims/combos/8.js +0 -7
  114. data/public/dist/js/webshims/shims/combos/9.js +0 -2
  115. data/public/dist/js/webshims/shims/combos/97.js +0 -1
  116. data/public/dist/js/webshims/shims/combos/98.js +0 -1
  117. data/public/dist/js/webshims/shims/combos/99.js +0 -1
  118. data/public/dist/js/webshims/shims/details.js +0 -1
  119. data/public/dist/js/webshims/shims/dom-extend.js +0 -1
  120. data/public/dist/js/webshims/shims/es5.js +0 -1
  121. data/public/dist/js/webshims/shims/es6.js +0 -1
  122. data/public/dist/js/webshims/shims/excanvas.js +0 -1
  123. data/public/dist/js/webshims/shims/filereader-xhr.js +0 -1
  124. data/public/dist/js/webshims/shims/form-combat.js +0 -1
  125. data/public/dist/js/webshims/shims/form-core.js +0 -1
  126. data/public/dist/js/webshims/shims/form-datalist-lazy.js +0 -1
  127. data/public/dist/js/webshims/shims/form-datalist.js +0 -1
  128. data/public/dist/js/webshims/shims/form-fixrangechange.js +0 -1
  129. data/public/dist/js/webshims/shims/form-inputmode.js +0 -1
  130. data/public/dist/js/webshims/shims/form-message.js +0 -1
  131. data/public/dist/js/webshims/shims/form-native-extend.js +0 -1
  132. data/public/dist/js/webshims/shims/form-number-date-api.js +0 -1
  133. data/public/dist/js/webshims/shims/form-number-date-ui.js +0 -1
  134. data/public/dist/js/webshims/shims/form-shim-extend.js +0 -1
  135. data/public/dist/js/webshims/shims/form-shim-extend2.js +0 -1
  136. data/public/dist/js/webshims/shims/form-validation.js +0 -1
  137. data/public/dist/js/webshims/shims/form-validators.js +0 -1
  138. data/public/dist/js/webshims/shims/forms-picker.js +0 -1
  139. data/public/dist/js/webshims/shims/geolocation.js +0 -1
  140. data/public/dist/js/webshims/shims/i18n/formcfg-ar.js +0 -1
  141. data/public/dist/js/webshims/shims/i18n/formcfg-ch-CN.js +0 -1
  142. data/public/dist/js/webshims/shims/i18n/formcfg-cs.js +0 -1
  143. data/public/dist/js/webshims/shims/i18n/formcfg-de.js +0 -1
  144. data/public/dist/js/webshims/shims/i18n/formcfg-el.js +0 -1
  145. data/public/dist/js/webshims/shims/i18n/formcfg-en.js +0 -1
  146. data/public/dist/js/webshims/shims/i18n/formcfg-es.js +0 -1
  147. data/public/dist/js/webshims/shims/i18n/formcfg-fa.js +0 -1
  148. data/public/dist/js/webshims/shims/i18n/formcfg-fr.js +0 -1
  149. data/public/dist/js/webshims/shims/i18n/formcfg-he.js +0 -1
  150. data/public/dist/js/webshims/shims/i18n/formcfg-hi.js +0 -1
  151. data/public/dist/js/webshims/shims/i18n/formcfg-hu.js +0 -1
  152. data/public/dist/js/webshims/shims/i18n/formcfg-it.js +0 -1
  153. data/public/dist/js/webshims/shims/i18n/formcfg-ja.js +0 -1
  154. data/public/dist/js/webshims/shims/i18n/formcfg-lt.js +0 -1
  155. data/public/dist/js/webshims/shims/i18n/formcfg-nl.js +0 -1
  156. data/public/dist/js/webshims/shims/i18n/formcfg-pl.js +0 -1
  157. data/public/dist/js/webshims/shims/i18n/formcfg-pt-BR.js +0 -1
  158. data/public/dist/js/webshims/shims/i18n/formcfg-pt-PT.js +0 -1
  159. data/public/dist/js/webshims/shims/i18n/formcfg-pt.js +0 -1
  160. data/public/dist/js/webshims/shims/i18n/formcfg-ru.js +0 -1
  161. data/public/dist/js/webshims/shims/i18n/formcfg-sv.js +0 -1
  162. data/public/dist/js/webshims/shims/i18n/formcfg-zh-CN.js +0 -1
  163. data/public/dist/js/webshims/shims/i18n/formcfg-zh-TW.js +0 -1
  164. data/public/dist/js/webshims/shims/jme/alternate-media.js +0 -1
  165. data/public/dist/js/webshims/shims/jme/base.js +0 -1
  166. data/public/dist/js/webshims/shims/jme/controls.css +0 -1
  167. data/public/dist/js/webshims/shims/jme/jme.eot +0 -0
  168. data/public/dist/js/webshims/shims/jme/jme.svg +0 -36
  169. data/public/dist/js/webshims/shims/jme/jme.ttf +0 -0
  170. data/public/dist/js/webshims/shims/jme/jme.woff +0 -0
  171. data/public/dist/js/webshims/shims/jme/mediacontrols-lazy.js +0 -1
  172. data/public/dist/js/webshims/shims/jme/mediacontrols.js +0 -1
  173. data/public/dist/js/webshims/shims/jme/playlist.js +0 -1
  174. data/public/dist/js/webshims/shims/jpicker/images/AlphaBar.png +0 -0
  175. data/public/dist/js/webshims/shims/jpicker/images/Bars.png +0 -0
  176. data/public/dist/js/webshims/shims/jpicker/images/Maps.png +0 -0
  177. data/public/dist/js/webshims/shims/jpicker/images/NoColor.png +0 -0
  178. data/public/dist/js/webshims/shims/jpicker/images/bar-opacity.png +0 -0
  179. data/public/dist/js/webshims/shims/jpicker/images/map-opacity.png +0 -0
  180. data/public/dist/js/webshims/shims/jpicker/images/mappoint.gif +0 -0
  181. data/public/dist/js/webshims/shims/jpicker/images/picker.gif +0 -0
  182. data/public/dist/js/webshims/shims/jpicker/images/preview-opacity.png +0 -0
  183. data/public/dist/js/webshims/shims/jpicker/images/rangearrows.gif +0 -0
  184. data/public/dist/js/webshims/shims/jpicker/jpicker.css +0 -1
  185. data/public/dist/js/webshims/shims/matchMedia.js +0 -3
  186. data/public/dist/js/webshims/shims/mediacapture-picker.js +0 -1
  187. data/public/dist/js/webshims/shims/mediacapture.js +0 -1
  188. data/public/dist/js/webshims/shims/mediaelement-core.js +0 -1
  189. data/public/dist/js/webshims/shims/mediaelement-debug.js +0 -1
  190. data/public/dist/js/webshims/shims/mediaelement-jaris.js +0 -1
  191. data/public/dist/js/webshims/shims/mediaelement-native-fix.js +0 -1
  192. data/public/dist/js/webshims/shims/mediaelement-yt.js +0 -1
  193. data/public/dist/js/webshims/shims/moxie/flash/Moxie.cdn.swf +0 -0
  194. data/public/dist/js/webshims/shims/moxie/flash/Moxie.min.swf +0 -0
  195. data/public/dist/js/webshims/shims/moxie/js/moxie-html4.js +0 -3
  196. data/public/dist/js/webshims/shims/moxie/js/moxie-swf.js +0 -2
  197. data/public/dist/js/webshims/shims/picture.js +0 -1
  198. data/public/dist/js/webshims/shims/plugins/jquery.ui.position.js +0 -11
  199. data/public/dist/js/webshims/shims/range-ui.js +0 -1
  200. data/public/dist/js/webshims/shims/sizzle.js +0 -11
  201. data/public/dist/js/webshims/shims/sticky.js +0 -1
  202. data/public/dist/js/webshims/shims/styles/color-picker.png +0 -0
  203. data/public/dist/js/webshims/shims/styles/forms-ext.css +0 -1
  204. data/public/dist/js/webshims/shims/styles/forms-picker.css +0 -1
  205. data/public/dist/js/webshims/shims/styles/progress.gif +0 -0
  206. data/public/dist/js/webshims/shims/styles/progress.png +0 -0
  207. data/public/dist/js/webshims/shims/styles/shim-ext.css +0 -1
  208. data/public/dist/js/webshims/shims/styles/shim.css +0 -1
  209. data/public/dist/js/webshims/shims/styles/transparent.png +0 -0
  210. data/public/dist/js/webshims/shims/styles/widget.eot +0 -0
  211. data/public/dist/js/webshims/shims/styles/widget.svg +0 -12
  212. data/public/dist/js/webshims/shims/styles/widget.ttf +0 -0
  213. data/public/dist/js/webshims/shims/styles/widget.woff +0 -0
  214. data/public/dist/js/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
  215. data/public/dist/js/webshims/shims/swfmini-embed.js +0 -1
  216. data/public/dist/js/webshims/shims/swfmini.js +0 -6
  217. data/public/dist/js/webshims/shims/track-ui.js +0 -1
  218. data/public/dist/js/webshims/shims/track.js +0 -1
  219. data/public/dist/js/webshims/shims/url.js +0 -1
  220. data/public/dist/js/webshims/shims/usermedia-core.js +0 -1
  221. data/public/dist/js/webshims/shims/usermedia-shim.js +0 -1
@@ -0,0 +1,100 @@
1
+ require 'spec_helper'
2
+ require 'sequenceserver/sequence'
3
+ require 'digest/md5'
4
+
5
+ # Test Sequence class.
6
+ module SequenceServer
7
+ describe 'Sequence type detection' do
8
+ it 'should be able to detect nucleotide sequences' do
9
+ sequences = [
10
+ 'AAAAAAAAAAAAAAAAAAAAAT',
11
+ ' CAGATGCRRCAAAGCAAACGGCAA 34523453 652352',
12
+ 'ACCNNNNNNXXXXCAUUUUUU',
13
+ "ACGT\n\t\t\nACCACGGACCACGAAAGCG"
14
+ ]
15
+ sequences.each do |sequence|
16
+ Sequence.guess_type(sequence).should == :nucleotide
17
+ end
18
+ end
19
+
20
+ it 'should be able to detect protein sequences' do
21
+ sequences = [
22
+ 'ADSACGHKSJLFCVMGTL',
23
+ ' 345 KSSYPHYSPPPPHS 345 23453 652352',
24
+ 'GEYSNLNNNNNNXXXXSSSSSSSSSSSSSSSSSSSSSSS',
25
+ "EE\n\t\t\n \t\t\EEQRRQQSARTSRRQR"
26
+ ]
27
+ sequences.each do |sequence|
28
+ Sequence.guess_type(sequence).should == :protein
29
+ end
30
+ end
31
+
32
+ it 'should be able to say sequence type detection impossible' do
33
+ Sequence.guess_type('ACSFGT').should be_nil
34
+ end
35
+
36
+ it 'should be able to tell composition of a sequence string' do
37
+ Sequence.composition('asdfasdfffffAsdf').should == { 'a' => 2, 'd' => 3,
38
+ 'f' => 7, 's' => 3,
39
+ 'A' => 1 }
40
+ end
41
+ end
42
+
43
+ describe 'Sequence retrieval' do
44
+ root = SequenceServer.root
45
+ database_dir = File.join(root, 'spec', 'database')
46
+
47
+ let 'a_normal_database_id' do
48
+ Digest::MD5.hexdigest File.join(database_dir, 'sample', 'proteins',
49
+ 'Solenopsis_invicta',
50
+ 'Sinvicta2-2-3.prot.subset.fasta')
51
+ end
52
+
53
+ let 'funky_ids_database_id' do
54
+ Digest::MD5.hexdigest File.join(database_dir, 'funky_ids',
55
+ 'funky_ids.fa')
56
+ end
57
+
58
+ before :all do
59
+ SequenceServer.config[:database_dir] = database_dir
60
+ Database.scan_databases_dir
61
+ end
62
+
63
+ it 'should be able to retrieve sequences from database' do
64
+ sequences = Sequence::Retriever.new('SI2.2.0_06267',
65
+ a_normal_database_id).sequences
66
+
67
+ sequences.length.should eq 1
68
+ sequences.first.gi.should be_nil
69
+ sequences.first.seqid.should eq 'SI2.2.0_06267'
70
+ sequences.first.id.should eq 'SI2.2.0_06267'
71
+ sequences.first.title.should eq 'locus=Si_gnF.scaffold02592'\
72
+ '[1282609..1284114].pep_2 quality=100.00'
73
+ sequences.first.value.should == "\
74
+ MNTLWLSLWDYPGKLPLNFMVFDTKDDLQAAYWRDPYSIPLAVIFEDPQPISQRLIYEIRTNPSYTLPPPPTKLYSAPI\
75
+ SCRKNKTGHWMDDILSIKTGESCPVNNYLHSGFLALQMITDITKIKLENSDVTIPDIKLIMFPKEPYTADWMLAFRVVI\
76
+ PLYMVLALSQFITYLLILIVGEKENKIKEGMKMMGLNDSVF"
77
+ end
78
+
79
+ it 'should be able to retrieve more than one sequence from a database' do
80
+ sequences = Sequence::Retriever.new(['SI2.2.0_06267', 'SI2.2.0_13722'],
81
+ a_normal_database_id).sequences
82
+ sequences.length.should == 2
83
+ end
84
+
85
+ # it 'should be able to retrieve sequences from database even if accession'\
86
+ # 'contains only numbers' do
87
+ # Database.scan_databases_dir
88
+ # sequences = Sequence.from_blastdb(123456, funky_ids_database_id)
89
+ # sequences.length.should == 1
90
+ # end
91
+
92
+ it 'should be able to retrieve sequences from database for all kinds of'\
93
+ 'funky accessions' do
94
+ funky_accessions = ['abcdef#', 'abc#def', '123#456'] # , '123456#']
95
+ sequences = Sequence::Retriever.new(funky_accessions,
96
+ funky_ids_database_id).sequences
97
+ sequences.length.should == 3
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,108 @@
1
+ require 'spec_helper'
2
+
3
+ # Test the main module, startup process, etc.
4
+ module SequenceServer
5
+ # NOTE:
6
+ # Testing SequenceServer's initialization can be a bit tricky. For
7
+ # instance, to test num_threads, correct database_dir must be set.
8
+ describe 'SequenceServer' do
9
+ let 'root' do
10
+ SequenceServer.root
11
+ end
12
+
13
+ let 'empty_config' do
14
+ File.join(root, 'spec', 'empty_config.yml')
15
+ end
16
+
17
+ let 'database_dir' do
18
+ File.join(root, 'spec', 'database')
19
+ end
20
+
21
+ let 'database_dir_no_db' do
22
+ File.join(root, 'spec', 'database', 'unformatted',
23
+ 'Cardiocondyla_obscurior')
24
+ end
25
+
26
+ let 'config' do
27
+ { :config_file => empty_config }
28
+ end
29
+
30
+ # bin, if set, should be a _directory_ that exists
31
+ it 'raises appropriate error if bin incorrectly set' do
32
+ # Raise if bin dir does not exist.
33
+ expect do
34
+ SequenceServer.init(config.update :bin => '/foo/bar')
35
+ end.to raise_error(BIN_DIR_NOT_FOUND)
36
+
37
+ # Raise if bin dir is not a directory.
38
+ expect do
39
+ SequenceServer.init(config.update :bin => __FILE__)
40
+ end.to raise_error(BIN_DIR_NOT_FOUND)
41
+ end
42
+
43
+ # database_dir is compulsory
44
+ it 'raises appropriate error if database_dir not set' do
45
+ expect do
46
+ SequenceServer.init(config.update :config_file => empty_config)
47
+ end.to raise_error(DATABASE_DIR_NOT_SET)
48
+ end
49
+
50
+ # database_dir, when set, should be a _directory_ that exists.
51
+ it 'raises appropriate error if database_dir incorrectly set' do
52
+ # Raise if database_dir does not exist.
53
+ expect do
54
+ SequenceServer.init(config.update :database_dir => '/foo/bar')
55
+ end.to raise_error(DATABASE_DIR_NOT_FOUND)
56
+
57
+ # Raise if database_dir is not a directory.
58
+ expect do
59
+ SequenceServer.init(config.update :database_dir => __FILE__)
60
+ end.to raise_error(DATABASE_DIR_NOT_FOUND)
61
+ end
62
+
63
+ # database_dir, when correctly set, should contain at least one BLAST+
64
+ # database.
65
+ it "raises appropriate error if database_dir doesn't contain any BLAST+"\
66
+ 'database' do
67
+ expect do
68
+ SequenceServer.init(config.update :database_dir => database_dir_no_db)
69
+ end.to raise_error(NO_BLAST_DATABASE_FOUND)
70
+ end
71
+
72
+ # num_threads, if set, should a number not less than 1.
73
+ it 'raises appropriate error if num_threads incorrectly set' do
74
+ # Raise if not a number.
75
+ expect do
76
+ SequenceServer.init(config.update :database_dir => database_dir,
77
+ :num_threads => 'foo')
78
+ end.to raise_error(NUM_THREADS_INCORRECT)
79
+
80
+ # Raise if less than 1.
81
+ expect do
82
+ SequenceServer.init(config.update :database_dir => database_dir,
83
+ :num_threads => 0)
84
+ end.to raise_error(NUM_THREADS_INCORRECT)
85
+ end
86
+
87
+ # extension file, if set, should be a _file_ that exists.
88
+ it 'raises appropriate error if require incorrectly set' do
89
+ # Raise if not found.
90
+ expect do
91
+ SequenceServer.init(config.update :database_dir => database_dir,
92
+ :require => 'foo/bar')
93
+ end.to raise_error(EXTENSION_FILE_NOT_FOUND)
94
+
95
+ # Raise if directory.
96
+ expect do
97
+ SequenceServer.init(config.update :database_dir => database_dir,
98
+ :require => File.dirname(__FILE__))
99
+ end.to raise_error(EXTENSION_FILE_NOT_FOUND)
100
+ end
101
+
102
+ it 'has a list of databases after startup' do
103
+ SequenceServer.init(config.update :database_dir => database_dir)
104
+ Database.all.should_not be_empty
105
+ Database.all.length.should == 4
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,11 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
3
+
4
+ require 'sequenceserver'
5
+ require 'rack/test'
6
+ require 'rspec'
7
+ require 'capybara/rspec'
8
+
9
+ RSpec.configure do |config|
10
+ config.include Capybara::DSL
11
+ end
data/views/result.erb CHANGED
@@ -82,42 +82,64 @@
82
82
  <div
83
83
  class="page-content collapse in"
84
84
  id="<%="Query_#{query.number}_hit_#{hit.number}_alignment"%>">
85
- <p>
86
- Hit length: <%= hit.length %>, Number of HSP(s): <%= hit.hsps.length %>
87
- </p>
88
- <% hit.hsps.each do |hsp| %>
85
+ <div
86
+ class="row">
89
87
  <div
90
- class="hsps" id="<%="Query_#{query.number}_hit_#{hit.number}_#{hsp.number}"%>"
91
- data-hsp-evalue="<%= hsp.evalue %>" data-hsp-start="<%= hsp.qstart %>"
92
- data-hsp-end="<%= hsp.qend %>" data-hsp-frame="<%= hsp.sframe %>">
93
- <table
94
- class="table table-condensed hsp-stats">
95
- <thead>
96
- <% hsp.stats.keys.each do |key| %>
97
- <th> <%= key %> </th>
98
- <% end %>
99
- </thead>
100
- <tbody>
101
- <tr>
102
- <% hsp.stats.values.each do |value| %>
103
- <td> <%= prettify value %> </th>
104
- <% end %>
105
- </tr>
106
- </tbody>
107
- </table>
108
- <div class="alignment"><%= hsp.pp %></div>
88
+ class="col-md-4">
89
+ Hit length: <%= hit.length %>
90
+ </div>
91
+ <div
92
+ class="hit-links text-right col-md-8">
93
+ <label>
94
+ <input
95
+ type="checkbox" value="<%= hit.accession %>" data-target="<%= "#Query_#{query.number}_hit_#{hit.number}" %>">
96
+ Select
97
+ </label>
98
+ <% hit.links.each do |link| %>
99
+ | <%= a link %>
100
+ <% end %>
109
101
  </div>
110
- <% end %>
111
- <div class="hit-links text-right">
112
- <label>
113
- <input
114
- type="checkbox" value="<%= hit.accession %>" data-target="<%= "#Query_#{query.number}_hit_#{hit.number}" %>">
115
- Select
116
- </label>
117
- <% hit.links.each do |link| %>
118
- | <%= a link %>
119
- <% end %>
120
102
  </div>
103
+ <table
104
+ class="table hsps">
105
+ <tbody>
106
+ <% hit.hsps.each do |hsp| %>
107
+ <tr>
108
+ <td>
109
+ <%= hsp.number %>.
110
+ </td>
111
+ <td
112
+ style="width: 100%;">
113
+ <div
114
+ class="hsp" id="<%="Query_#{query.number}_hit_#{hit.number}_#{hsp.number}"%>"
115
+ data-hsp-evalue="<%= hsp.evalue %>" data-hsp-start="<%= hsp.qstart %>"
116
+ data-hsp-end="<%= hsp.qend %>" data-hsp-frame="<%= hsp.sframe %>">
117
+ <table
118
+ class="table table-condensed hsp-stats">
119
+ <thead>
120
+ <% hsp.stats.keys.each do |key| %>
121
+ <th>
122
+ <%= key %>
123
+ </th>
124
+ <% end %>
125
+ </thead>
126
+ <tbody>
127
+ <tr>
128
+ <% hsp.stats.values.each do |value| %>
129
+ <td>
130
+ <%= prettify value %>
131
+ </th>
132
+ <% end %>
133
+ </tr>
134
+ </tbody>
135
+ </table>
136
+ <div class="alignment"><%= hsp.pp %></div>
137
+ </div>
138
+ </td>
139
+ </tr>
140
+ <% end %>
141
+ </tbody>
142
+ </table>
121
143
  </div>
122
144
  </div>
123
145
  <% end %>
data/views/search.erb CHANGED
@@ -79,7 +79,7 @@
79
79
  <div
80
80
  class="dnd-errors">
81
81
  <div
82
- class="dnd-error"
82
+ class="dnd-error row"
83
83
  id="dnd-multi-notification"
84
84
  style="display: none;">
85
85
  <div
@@ -89,7 +89,7 @@
89
89
  </div>
90
90
 
91
91
  <div
92
- class="dnd-error"
92
+ class="dnd-error row"
93
93
  id="dnd-large-file-notification"
94
94
  style="display: none;">
95
95
  <div
@@ -99,7 +99,7 @@
99
99
  </div>
100
100
 
101
101
  <div
102
- class="dnd-error"
102
+ class="dnd-error row"
103
103
  id="dnd-format-notification"
104
104
  style="display: none;">
105
105
  <div
@@ -148,7 +148,7 @@
148
148
  <textarea
149
149
  class="form-control text-monospace" name="sequence" id="sequence"
150
150
  rows="10"
151
- autofocus="true"
151
+ autofocus
152
152
  spellcheck="false"
153
153
  placeholder="Paste query sequence(s) or drag file containing query sequence(s) in FASTA format here ..." ></textarea>
154
154
  </div>
@@ -158,7 +158,7 @@
158
158
  <div
159
159
  class="notifications">
160
160
  <div
161
- class="notification"
161
+ class="notification row"
162
162
  id="nucleotide-sequence-notification"
163
163
  style="display: none;">
164
164
  <div
@@ -168,7 +168,7 @@
168
168
  </div>
169
169
 
170
170
  <div
171
- class="notification"
171
+ class="notification row"
172
172
  id="protein-sequence-notification"
173
173
  style="display: none;">
174
174
  <div
@@ -178,7 +178,7 @@
178
178
  </div>
179
179
 
180
180
  <div
181
- class="notification"
181
+ class="notification row"
182
182
  id="mixed-sequence-notification"
183
183
  style="display: none;">
184
184
  <div
@@ -225,38 +225,43 @@
225
225
  <div
226
226
  class="col-md-8">
227
227
  <div
228
- class="form-group advanced">
229
- <label
230
- class="col-md-3 control-label"
231
- for="advanced">
232
- Advanced Parameters:
233
- </label>
228
+ class="form-group">
234
229
  <div
235
- class="col-md-9">
230
+ class="col-md-12">
236
231
  <div
237
232
  class="input-group">
233
+ <label
234
+ class="control-label cursor-pointer"
235
+ for="advanced">
236
+ Advanced Parameters:
237
+ </label>
238
238
  <input
239
239
  type="text"
240
240
  class="form-control" name="advanced" id="advanced"
241
241
  title="View, and enter advanced parameters."
242
242
  placeholder="eg: -evalue 1.0e-5 -num_alignments 100"/>
243
- <div class="input-group-addon cursor-pointer" data-toggle="modal" data-toggle="modal" data-target="#help">
243
+ <div class="input-group-addon cursor-pointer" data-toggle="modal" data-target="#help">
244
244
  <i class="fa fa-question"></i>
245
245
  </div>
246
246
  </div>
247
247
  </div>
248
248
  </div>
249
249
  </div>
250
-
251
250
  <div
252
251
  class="col-md-4">
253
252
  <div
254
- class="btn-group btn-block" id="methods">
255
- <button
256
- type="submit"
257
- id="method" class="btn btn-primary col-md-12">
258
- blast
259
- </button>
253
+ class="form-group">
254
+ <div
255
+ class="col-md-12">
256
+ <div
257
+ id="methods">
258
+ <button
259
+ type="submit"
260
+ id="method" class="btn btn-primary form-control">
261
+ blast
262
+ </button>
263
+ </div>
264
+ </div>
260
265
  </div>
261
266
  </div>
262
267
  </div>
@@ -295,7 +300,7 @@
295
300
  <br>
296
301
  Please Cite:
297
302
  <a href='http://www.sequenceserver.com'>
298
- Priyam, Woodcroft, Rai & Wurm, <strong>SequenceServer</strong> (<em>in prep</em>)</a>
303
+ Priyam, Woodcroft, Rai & Wurm, <strong>SequenceServer</strong> (<em>in prep</em>)
299
304
  </a>
300
305
  &amp; relevant data sources.
301
306
  </p>