quorum 0.7.1 → 0.8.0
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.
- data/.rspec +1 -0
- data/.travis.yml +5 -1
- data/Gemfile +4 -2
- data/Gemfile.lock +68 -47
- data/HISTORY.md +9 -0
- data/README.rdoc +1 -1
- data/app/assets/javascripts/quorum/quorum.js +4 -4
- data/app/controllers/quorum/application_controller.rb +1 -0
- data/app/controllers/quorum/jobs_controller.rb +65 -80
- data/app/models/quorum/blastn_job.rb +1 -1
- data/app/models/quorum/blastn_job_report.rb +4 -1
- data/app/models/quorum/blastp_job.rb +1 -1
- data/app/models/quorum/blastp_job_report.rb +4 -1
- data/app/models/quorum/blastx_job.rb +1 -1
- data/app/models/quorum/blastx_job_report.rb +4 -1
- data/app/models/quorum/job.rb +64 -56
- data/app/models/quorum/job_data.rb +22 -0
- data/app/models/quorum/job_fetch_data.rb +11 -0
- data/app/models/quorum/job_queue_observer.rb +11 -0
- data/app/models/quorum/job_queue_service.rb +66 -0
- data/app/models/quorum/job_report_searcher.rb +36 -0
- data/app/models/quorum/job_serializer.rb +96 -0
- data/app/models/quorum/tblastn_job.rb +1 -1
- data/app/models/quorum/tblastn_job_report.rb +4 -1
- data/app/views/quorum/jobs/show.html.erb +3 -0
- data/app/views/quorum/jobs/templates/_blast_detailed_report_template.html.erb +1 -1
- data/app/views/quorum/jobs/templates/_blast_template.html.erb +3 -1
- data/config/initializers/mime_types.rb +2 -0
- data/config/routes.rb +3 -3
- data/db/migrate/20120809155712_add_percent_identity_to_blast_reports.rb +8 -0
- data/db/migrate/20120921182416_add_mismatch_to_blast_reports.rb +8 -0
- data/lib/generators/templates/blast.rb +8 -1
- data/lib/quorum/engine.rb +2 -0
- data/lib/quorum/sequence.rb +35 -0
- data/lib/quorum/version.rb +1 -1
- data/lib/quorum.rb +3 -10
- data/lib/tasks/quorum_blastdb_build.rake +3 -1
- data/lib/workers/system.rb +3 -1
- data/quorum.gemspec +1 -0
- data/spec/dummy/config/environment.rb +18 -5
- data/spec/javascripts/helpers/jasmine-jquery.js +2 -2
- data/spec/javascripts/{jobs_spec.js → suites/jobs_spec.js} +0 -0
- data/spec/javascripts/{quorum_spec.js → suites/quorum_spec.js} +0 -0
- data/spec/javascripts/{string_spec.js → suites/string_spec.js} +0 -0
- data/spec/lib/tasks/travis.rake +9 -4
- data/spec/models/blastn_job_report_spec.rb +7 -3
- data/spec/models/blastp_job_report_spec.rb +8 -3
- data/spec/models/blastx_job_report_spec.rb +8 -3
- data/spec/models/job_data_spec.rb +21 -0
- data/spec/models/job_fetch_data_spec.rb +25 -0
- data/spec/models/job_queue_observer_spec.rb +18 -0
- data/spec/models/job_queue_service_spec.rb +49 -0
- data/spec/models/job_report_searcher_spec.rb +47 -0
- data/spec/models/job_serializer_spec.rb +60 -0
- data/spec/models/job_spec.rb +1 -16
- data/spec/models/tblastn_job_report_spec.rb +8 -3
- data/spec/quorum/quorum_sequence_spec.rb +2 -0
- data/spec/requests/jobs_spec.rb +16 -7
- data/spec/spec_helper.rb +2 -0
- metadata +38 -8
- data/spec/dummy/app/models/blast.rb +0 -2
| @@ -81,7 +81,7 @@ jasmine.Fixtures.prototype.createContainer_ = function(html) { | |
| 81 81 | 
             
              jQuery('body').append(container);
         | 
| 82 82 | 
             
            };
         | 
| 83 83 |  | 
| 84 | 
            -
            jasmine.Fixtures.prototype.getFixtureHtml_ = function(url) { | 
| 84 | 
            +
            jasmine.Fixtures.prototype.getFixtureHtml_ = function(url) {
         | 
| 85 85 | 
             
              if (typeof this.fixturesCache_[url] == 'undefined') {
         | 
| 86 86 | 
             
                this.loadFixtureIntoCache_(url);
         | 
| 87 87 | 
             
              }
         | 
| @@ -223,7 +223,7 @@ jasmine.JQuery.matchersClass = {}; | |
| 223 223 | 
             
                  var events = this.actual.data("events");
         | 
| 224 224 | 
             
                  return events && events[eventName].length > 0;
         | 
| 225 225 | 
             
                },
         | 
| 226 | 
            -
             | 
| 226 | 
            +
             | 
| 227 227 | 
             
                // tests the existence of a specific event binding + handler
         | 
| 228 228 | 
             
                toHandleWith: function(eventName, eventHandler) {
         | 
| 229 229 | 
             
                  var stack = this.actual.data("events")[eventName];
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/spec/lib/tasks/travis.rake
    CHANGED
    
    | @@ -95,10 +95,15 @@ namespace :travis do | |
| 95 95 | 
             
              task :create_db_config do
         | 
| 96 96 | 
             
                config = File.expand_path("../../../dummy/config", __FILE__)
         | 
| 97 97 | 
             
                File.open(File.join(config, "database.yml"), "w+") do |file|
         | 
| 98 | 
            -
                  file.puts "\ | 
| 99 | 
            -
                  "   | 
| 100 | 
            -
                  " | 
| 101 | 
            -
                  "   | 
| 98 | 
            +
                  file.puts "\nmysql: &mysql\n  adapter: mysql2\n" <<
         | 
| 99 | 
            +
                  "  database: quorum_test\n  username: root\n"
         | 
| 100 | 
            +
                  file.puts "\npostgresql: &postgresql\n  adapter: postgresql\n" <<
         | 
| 101 | 
            +
                  "  database: quorum_test\n  username: postgres\n" <<
         | 
| 102 | 
            +
                  "  min_messages: ERROR\n"
         | 
| 103 | 
            +
                  file.puts "\ndefaults: &defaults\n  pool: 5\n" <<
         | 
| 104 | 
            +
                  "  timeout: 5000\n  host: localhost\n" <<
         | 
| 105 | 
            +
                  "  <<: *<%= ENV['DB'] %>\n"
         | 
| 106 | 
            +
                  file.puts "\ntest:\n  <<: *defaults"
         | 
| 102 107 | 
             
                end
         | 
| 103 108 | 
             
              end
         | 
| 104 109 |  | 
| @@ -2,12 +2,16 @@ require 'spec_helper' | |
| 2 2 |  | 
| 3 3 | 
             
            describe Quorum::BlastnJobReport do
         | 
| 4 4 |  | 
| 5 | 
            +
              before(:all) do
         | 
| 6 | 
            +
                @blastn = Quorum::BlastnJobReport
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 5 9 | 
             
              it "should respond to default_order" do
         | 
| 6 | 
            -
                 | 
| 10 | 
            +
                @blastn.respond_to?(:default_order).should be_true
         | 
| 7 11 | 
             
              end
         | 
| 8 12 |  | 
| 9 | 
            -
              it "should  | 
| 10 | 
            -
                 | 
| 13 | 
            +
              it "should be searchable" do
         | 
| 14 | 
            +
                @blastn.respond_to?(:search).should be_true
         | 
| 11 15 | 
             
              end
         | 
| 12 16 |  | 
| 13 17 | 
             
            end
         | 
| @@ -2,12 +2,17 @@ require 'spec_helper' | |
| 2 2 |  | 
| 3 3 | 
             
            describe Quorum::BlastpJobReport do
         | 
| 4 4 |  | 
| 5 | 
            +
              before(:all) do
         | 
| 6 | 
            +
                @blastp = Quorum::BlastpJobReport
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 5 9 | 
             
              it "should respond to default_order" do
         | 
| 6 | 
            -
                 | 
| 10 | 
            +
                @blastp.respond_to?(:default_order).should be_true
         | 
| 7 11 | 
             
              end
         | 
| 8 12 |  | 
| 9 | 
            -
              it "should  | 
| 10 | 
            -
                 | 
| 13 | 
            +
              it "should be searchable" do
         | 
| 14 | 
            +
                @blastp.respond_to?(:search).should be_true
         | 
| 11 15 | 
             
              end
         | 
| 12 16 |  | 
| 13 17 | 
             
            end
         | 
| 18 | 
            +
             | 
| @@ -2,12 +2,17 @@ require 'spec_helper' | |
| 2 2 |  | 
| 3 3 | 
             
            describe Quorum::BlastxJobReport do
         | 
| 4 4 |  | 
| 5 | 
            -
               | 
| 6 | 
            -
                Quorum::BlastxJobReport | 
| 5 | 
            +
              before(:all) do
         | 
| 6 | 
            +
                @blastx = Quorum::BlastxJobReport
         | 
| 7 7 | 
             
              end
         | 
| 8 8 |  | 
| 9 9 | 
             
              it "should respond to default_order" do
         | 
| 10 | 
            -
                 | 
| 10 | 
            +
                @blastx.respond_to?(:default_order).should be_true
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              it "should be searchable" do
         | 
| 14 | 
            +
                @blastx.respond_to?(:search).should be_true
         | 
| 11 15 | 
             
              end
         | 
| 12 16 |  | 
| 13 17 | 
             
            end
         | 
| 18 | 
            +
             | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Quorum::JobData do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              before(:each) do
         | 
| 6 | 
            +
                @data = Quorum::JobData.new()
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              it "#results stores data in an array" do
         | 
| 10 | 
            +
                @data.results.should be_a(Array)
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              it "#no_results returns a hash { results: false }" do
         | 
| 14 | 
            +
                @data.no_results.should eq([{ results: false }])
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              it "#not_enqueued returns a hash { results: false, enqueued: false }" do
         | 
| 18 | 
            +
                @data.not_enqueued.should eq([{ results: false, enqueued: false }])
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Quorum::JobFetchData do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              before(:each) do
         | 
| 6 | 
            +
                @fetch = Quorum::JobFetchData.new
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              it "validates presence of attributes" do
         | 
| 10 | 
            +
                @fetch.should have(1).error_on(:algo)
         | 
| 11 | 
            +
                @fetch.should have(1).error_on(:blast_dbs)
         | 
| 12 | 
            +
                @fetch.should have(1).error_on(:hit_id)
         | 
| 13 | 
            +
                @fetch.should have(1).error_on(:hit_display_id)
         | 
| 14 | 
            +
                @fetch.valid?.should be_false
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              it "passes validation when attrs are set" do
         | 
| 18 | 
            +
                @fetch.algo           = "foo"
         | 
| 19 | 
            +
                @fetch.blast_dbs      = "foo"
         | 
| 20 | 
            +
                @fetch.hit_id         = "foo"
         | 
| 21 | 
            +
                @fetch.hit_display_id = "foo"
         | 
| 22 | 
            +
                @fetch.valid?.should be_true
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            end
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Quorum::JobQueueObserver do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              it "should queue workers after create" do
         | 
| 6 | 
            +
                job = Quorum::Job.new()
         | 
| 7 | 
            +
                job.sequence = ">test\n" + "a" * 50
         | 
| 8 | 
            +
                job.build_blastn_job
         | 
| 9 | 
            +
                job.blastn_job.queue     = true
         | 
| 10 | 
            +
                job.blastn_job.blast_dbs = ["test"]
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                obs = Quorum::JobQueueObserver.instance
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                Quorum::JobQueueService.should_receive(:queue_search_workers).with(job)
         | 
| 15 | 
            +
                obs.after_create(job)
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            end
         | 
| @@ -0,0 +1,49 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Quorum::JobQueueService do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              before(:each) do
         | 
| 6 | 
            +
                ResqueSpec.reset!
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              describe "Job Queue" do
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                before(:each) do
         | 
| 12 | 
            +
                  @job = Quorum::Job.new()
         | 
| 13 | 
            +
                  @job.sequence = File.open(
         | 
| 14 | 
            +
                    File.expand_path("../../data/nucl_prot_seqs.txt", __FILE__)
         | 
| 15 | 
            +
                  ).read
         | 
| 16 | 
            +
                  @job.build_blastn_job
         | 
| 17 | 
            +
                  @job.blastn_job.queue     = true
         | 
| 18 | 
            +
                  @job.blastn_job.blast_dbs = ["db"]
         | 
| 19 | 
            +
                  @job.save!
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                it "enqueues job after save" do
         | 
| 23 | 
            +
                  Quorum::JobQueueService.queue_search_workers(@job)
         | 
| 24 | 
            +
                  Workers::System.should have_queue_size_of(1)
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              describe "Fetch Queue" do
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                before(:each) do
         | 
| 32 | 
            +
                  @fetch = Quorum::JobFetchData.new
         | 
| 33 | 
            +
                  @fetch.algo           = "foo"
         | 
| 34 | 
            +
                  @fetch.blast_dbs      = "foo"
         | 
| 35 | 
            +
                  @fetch.hit_id         = "foo"
         | 
| 36 | 
            +
                  @fetch.hit_display_id = "foo"
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                it "enqueues valid blast fetch and returns meta_id" do
         | 
| 40 | 
            +
                  f = Quorum::JobQueueService.queue_fetch_worker(@fetch)
         | 
| 41 | 
            +
                  Workers::System.should have_queue_size_of(1)
         | 
| 42 | 
            +
                  f.should have(1).items
         | 
| 43 | 
            +
                  f[0].keys.should eq([:meta_id])
         | 
| 44 | 
            +
                  f[0].values.should_not be_empty
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            end
         | 
| @@ -0,0 +1,47 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Quorum::JobReportSearcher do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              include Quorum::JobReportSearcher
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              before(:each) do
         | 
| 8 | 
            +
                @algo  = "blastn"
         | 
| 9 | 
            +
                blastn = Quorum::BlastnJobReport
         | 
| 10 | 
            +
                2.times do
         | 
| 11 | 
            +
                  blastn.create!({
         | 
| 12 | 
            +
                    :query => "test",
         | 
| 13 | 
            +
                    :hit_display_id => "foo",
         | 
| 14 | 
            +
                    :identity => 0,
         | 
| 15 | 
            +
                    :align_len => 0,
         | 
| 16 | 
            +
                    :query_from => 10,
         | 
| 17 | 
            +
                    :query_to => 100,
         | 
| 18 | 
            +
                    :hit_from => 900,
         | 
| 19 | 
            +
                    :hit_to => 1000,
         | 
| 20 | 
            +
                    :evalue => "1e-100",
         | 
| 21 | 
            +
                    :bit_score => 1000,
         | 
| 22 | 
            +
                    :results => true,
         | 
| 23 | 
            +
                    :blastn_job_id => 1
         | 
| 24 | 
            +
                  })
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              it "makes job reports searchable" do
         | 
| 29 | 
            +
                p = { :id => 1, :blastn_id => "1,2", :query => "test" }
         | 
| 30 | 
            +
                search(@algo, p).count.should eq(2)
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                p = { :id => 1, :blastn_id => "2", :query => "test" }
         | 
| 33 | 
            +
                search(@algo, p).count.should eq(1)
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                p = { :id => 1, :blastn_id => "1,2", :query => nil }
         | 
| 36 | 
            +
                search(@algo, p).count.should eq(2)
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                p = { :id => 1, :blastn_id => nil, :query => "test" }
         | 
| 39 | 
            +
                search(@algo, p).count.should eq(2)
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                p = { :id => 1 }
         | 
| 42 | 
            +
                search(@algo, p).count.should eq(2)
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                search(@algo, {}).count.should eq(0)
         | 
| 45 | 
            +
              end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            end
         | 
| @@ -0,0 +1,60 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe "Quorum::JobSerializer" do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              include Quorum::JobSerializer
         | 
| 6 | 
            +
              before(:each) do
         | 
| 7 | 
            +
                @blastn = Quorum::BlastnJobReport
         | 
| 8 | 
            +
                2.times do
         | 
| 9 | 
            +
                  @blastn.create!({
         | 
| 10 | 
            +
                    :query => "test",
         | 
| 11 | 
            +
                    :hit_display_id => "foo",
         | 
| 12 | 
            +
                    :identity => 0,
         | 
| 13 | 
            +
                    :align_len => 0,
         | 
| 14 | 
            +
                    :pct_identity => 100.0,
         | 
| 15 | 
            +
                    :query_from => 10,
         | 
| 16 | 
            +
                    :query_to => 100,
         | 
| 17 | 
            +
                    :hit_from => 900,
         | 
| 18 | 
            +
                    :hit_to => 1000,
         | 
| 19 | 
            +
                    :evalue => "1e-100",
         | 
| 20 | 
            +
                    :bit_score => 1000,
         | 
| 21 | 
            +
                    :results => true
         | 
| 22 | 
            +
                  })
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              describe "#as_json" do
         | 
| 27 | 
            +
                it "returns error messages as json when present" do
         | 
| 28 | 
            +
                  Quorum::JobSerializer.as_json(Quorum::Job.create({})).should have_key(:errors)
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                it "returns object as json" do
         | 
| 32 | 
            +
                  Quorum::JobSerializer.as_json(@blastn.first).should eq(@blastn.first.as_json)
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              describe "#as_txt" do
         | 
| 37 | 
            +
                it "returns a tab delimited string of Blast results" do
         | 
| 38 | 
            +
                  Quorum::JobSerializer.as_txt(@blastn.all).match(/[\w\d\W\t\n]*/).should be_true
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              describe "#as_gff" do
         | 
| 43 | 
            +
                it "returns a gff string of Blast results" do
         | 
| 44 | 
            +
                  Quorum::JobSerializer.as_gff(@blastn.all).match(/##gff-version 3\n\.*/).should be_true
         | 
| 45 | 
            +
                  # Strand should be +
         | 
| 46 | 
            +
                  Quorum::JobSerializer.as_gff(@blastn.all).include?("+").should be_true
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              describe "#format_hit_start_stop" do
         | 
| 51 | 
            +
                it "returns original params when start < stop" do
         | 
| 52 | 
            +
                  Quorum::JobSerializer.format_hit_start_stop(10, 12).should eq([10,12])
         | 
| 53 | 
            +
                end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                it "returns params in acending order when start > stop" do
         | 
| 56 | 
            +
                  Quorum::JobSerializer.format_hit_start_stop(12, 10).should eq([10,12])
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
              end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            end
         | 
    
        data/spec/models/job_spec.rb
    CHANGED
    
    | @@ -4,7 +4,6 @@ describe Quorum::Job do | |
| 4 4 |  | 
| 5 5 | 
             
              before(:each) do
         | 
| 6 6 | 
             
                @job = Quorum::Job.new()
         | 
| 7 | 
            -
                ResqueSpec.reset!
         | 
| 8 7 | 
             
              end
         | 
| 9 8 |  | 
| 10 9 | 
             
              it "fails validation without params" do
         | 
| @@ -38,7 +37,7 @@ describe Quorum::Job do | |
| 38 37 | 
             
                @job.should have(0).errors_on(:algorithm)
         | 
| 39 38 | 
             
              end
         | 
| 40 39 |  | 
| 41 | 
            -
              it "deletes  | 
| 40 | 
            +
              it "deletes completed jobs" do
         | 
| 42 41 | 
             
                1.upto(5) do |i|
         | 
| 43 42 | 
             
                  job = Quorum::Job.new()
         | 
| 44 43 | 
             
                  job.sequence = File.open(
         | 
| @@ -56,18 +55,4 @@ describe Quorum::Job do | |
| 56 55 | 
             
                Quorum::BlastnJob.count.should eq(3)
         | 
| 57 56 | 
             
              end
         | 
| 58 57 |  | 
| 59 | 
            -
              it "queues workers after save" do
         | 
| 60 | 
            -
                @job.sequence = File.open(
         | 
| 61 | 
            -
                  File.expand_path("../../data/nucl_prot_seqs.txt", __FILE__)
         | 
| 62 | 
            -
                ).read
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                @job.build_blastn_job
         | 
| 65 | 
            -
                @job.blastn_job.queue     = true
         | 
| 66 | 
            -
                @job.blastn_job.blast_dbs = ["test_1", "test_2"]
         | 
| 67 | 
            -
             | 
| 68 | 
            -
                @job.save!
         | 
| 69 | 
            -
             | 
| 70 | 
            -
                Workers::System.should have_queue_size_of(1)
         | 
| 71 | 
            -
              end
         | 
| 72 | 
            -
             | 
| 73 58 | 
             
            end
         | 
| @@ -2,12 +2,17 @@ require 'spec_helper' | |
| 2 2 |  | 
| 3 3 | 
             
            describe Quorum::TblastnJobReport do
         | 
| 4 4 |  | 
| 5 | 
            -
               | 
| 6 | 
            -
                Quorum::TblastnJobReport | 
| 5 | 
            +
              before(:all) do
         | 
| 6 | 
            +
                @tblastn = Quorum::TblastnJobReport
         | 
| 7 7 | 
             
              end
         | 
| 8 8 |  | 
| 9 9 | 
             
              it "should respond to default_order" do
         | 
| 10 | 
            -
                 | 
| 10 | 
            +
                @tblastn.respond_to?(:default_order).should be_true
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              it "should be searchable" do
         | 
| 14 | 
            +
                @tblastn.respond_to?(:search).should be_true
         | 
| 11 15 | 
             
              end
         | 
| 12 16 |  | 
| 13 17 | 
             
            end
         | 
| 18 | 
            +
             | 
| @@ -4,6 +4,7 @@ require 'quorum/sequence' | |
| 4 4 | 
             
            include Quorum::Sequence
         | 
| 5 5 |  | 
| 6 6 | 
             
            describe "Quorum::Sequence" do
         | 
| 7 | 
            +
             | 
| 7 8 | 
             
              describe "#create_hash" do
         | 
| 8 9 | 
             
                it "creates a MD5.hexdigest of a sequence" do
         | 
| 9 10 | 
             
                  sequence = File.open(
         | 
| @@ -89,4 +90,5 @@ describe "Quorum::Sequence" do | |
| 89 90 | 
             
                  discover_input_sequence_type(sequence).should eq("amino_acid")
         | 
| 90 91 | 
             
                end
         | 
| 91 92 | 
             
              end
         | 
| 93 | 
            +
             | 
| 92 94 | 
             
            end
         | 
    
        data/spec/requests/jobs_spec.rb
    CHANGED
    
    | @@ -54,6 +54,7 @@ describe "Jobs" do | |
| 54 54 | 
             
                  Capybara.current_driver    = :selenium
         | 
| 55 55 | 
             
                end
         | 
| 56 56 | 
             
                before(:each) do
         | 
| 57 | 
            +
                  ActiveRecord::Base.observers.enable Quorum::JobQueueObserver
         | 
| 57 58 | 
             
                  ResqueSpec.reset!
         | 
| 58 59 | 
             
                  ResqueSpec.inline = true
         | 
| 59 60 | 
             
                end
         | 
| @@ -135,7 +136,7 @@ describe "Jobs" do | |
| 135 136 | 
             
                    page.should have_content("hseq")
         | 
| 136 137 |  | 
| 137 138 | 
             
                    # Download sequence
         | 
| 138 | 
            -
                    find("p.small a | 
| 139 | 
            +
                    find("p.small a.download_sequence").click
         | 
| 139 140 | 
             
                    page.should have_content("Fetching sequence...")
         | 
| 140 141 | 
             
                    page.should have_content("Sequence Downloaded Successfully")
         | 
| 141 142 |  | 
| @@ -150,33 +151,41 @@ describe "Jobs" do | |
| 150 151 | 
             
                end
         | 
| 151 152 | 
             
                after(:all) do
         | 
| 152 153 | 
             
                  Capybara.use_default_driver
         | 
| 154 | 
            +
                  ActiveRecord::Base.observers.disable :all
         | 
| 153 155 | 
             
                end
         | 
| 154 156 | 
             
              end
         | 
| 155 157 |  | 
| 156 158 | 
             
              describe "GET /quorum/jobs/id" do
         | 
| 157 159 | 
             
                it "displays notice and renders form with invalid id" do
         | 
| 158 | 
            -
                  visit job_path(' | 
| 160 | 
            +
                  visit job_path('12893')
         | 
| 159 161 | 
             
                  page.should have_content("The data you requested is unavailable. Please check your URL and try again.")
         | 
| 160 162 | 
             
                  current_path.should eq(new_job_path)
         | 
| 161 163 | 
             
                end
         | 
| 162 164 | 
             
              end
         | 
| 163 165 |  | 
| 164 | 
            -
              describe "GET /quorum/jobs/id/ | 
| 166 | 
            +
              describe "GET /quorum/jobs/id/search" do
         | 
| 165 167 | 
             
                it "renders JSON results => false with invalid id" do
         | 
| 166 | 
            -
                  visit "/quorum/jobs/ | 
| 168 | 
            +
                  visit "/quorum/jobs/23542/search.json"
         | 
| 167 169 | 
             
                  page.should have_content("[{\"results\":false}]")
         | 
| 168 170 | 
             
                end
         | 
| 169 171 | 
             
              end
         | 
| 170 172 |  | 
| 171 | 
            -
              describe "GET /quorum/jobs/id/ | 
| 173 | 
            +
              describe "GET /quorum/jobs/id/get_blast_hit_sequence" do
         | 
| 172 174 | 
             
                it "renders empty JSON with invalid id" do
         | 
| 173 | 
            -
                  visit "/quorum/jobs/ | 
| 175 | 
            +
                  visit "/quorum/jobs/23542/get_blast_hit_sequence.json"
         | 
| 174 176 | 
             
                  page.should have_content("[]")
         | 
| 175 177 | 
             
                end
         | 
| 176 178 |  | 
| 177 179 | 
             
                it "renders empty JSON with invalid id and valid params" do
         | 
| 178 | 
            -
                  visit "/quorum/jobs/ | 
| 180 | 
            +
                  visit "/quorum/jobs/23542/get_blast_hit_sequence.json?algo=blastn"
         | 
| 179 181 | 
             
                  page.should have_content("[]")
         | 
| 180 182 | 
             
                end
         | 
| 181 183 | 
             
              end
         | 
| 184 | 
            +
             | 
| 185 | 
            +
              describe "GET /quorum/jobs/id/send_blast_hit_sequence" do
         | 
| 186 | 
            +
                it "renders empty text on error" do
         | 
| 187 | 
            +
                  visit "/quorum/jobs/23423/send_blast_hit_sequence?meta_id=1231"
         | 
| 188 | 
            +
                  page.should_not have_content(" ")
         | 
| 189 | 
            +
                end
         | 
| 190 | 
            +
              end
         | 
| 182 191 | 
             
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: quorum
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.8.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012-11- | 
| 12 | 
            +
            date: 2012-11-30 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rails
         | 
| @@ -123,6 +123,22 @@ dependencies: | |
| 123 123 | 
             
                - - ~>
         | 
| 124 124 | 
             
                  - !ruby/object:Gem::Version
         | 
| 125 125 | 
             
                    version: 0.3.11
         | 
| 126 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 127 | 
            +
              name: pg
         | 
| 128 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 129 | 
            +
                none: false
         | 
| 130 | 
            +
                requirements:
         | 
| 131 | 
            +
                - - ~>
         | 
| 132 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 133 | 
            +
                    version: 0.14.1
         | 
| 134 | 
            +
              type: :development
         | 
| 135 | 
            +
              prerelease: false
         | 
| 136 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 137 | 
            +
                none: false
         | 
| 138 | 
            +
                requirements:
         | 
| 139 | 
            +
                - - ~>
         | 
| 140 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 141 | 
            +
                    version: 0.14.1
         | 
| 126 142 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 127 143 | 
             
              name: rspec-rails
         | 
| 128 144 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -255,6 +271,12 @@ files: | |
| 255 271 | 
             
            - app/models/quorum/blastx_job.rb
         | 
| 256 272 | 
             
            - app/models/quorum/blastx_job_report.rb
         | 
| 257 273 | 
             
            - app/models/quorum/job.rb
         | 
| 274 | 
            +
            - app/models/quorum/job_data.rb
         | 
| 275 | 
            +
            - app/models/quorum/job_fetch_data.rb
         | 
| 276 | 
            +
            - app/models/quorum/job_queue_observer.rb
         | 
| 277 | 
            +
            - app/models/quorum/job_queue_service.rb
         | 
| 278 | 
            +
            - app/models/quorum/job_report_searcher.rb
         | 
| 279 | 
            +
            - app/models/quorum/job_serializer.rb
         | 
| 258 280 | 
             
            - app/models/quorum/tblastn_job.rb
         | 
| 259 281 | 
             
            - app/models/quorum/tblastn_job_report.rb
         | 
| 260 282 | 
             
            - app/views/layouts/quorum/application.html.erb
         | 
| @@ -267,6 +289,7 @@ files: | |
| 267 289 | 
             
            - app/views/quorum/jobs/templates/_blast_detailed_report_template.html.erb
         | 
| 268 290 | 
             
            - app/views/quorum/jobs/templates/_blast_template.html.erb
         | 
| 269 291 | 
             
            - app/views/shared/_error_messages.html.erb
         | 
| 292 | 
            +
            - config/initializers/mime_types.rb
         | 
| 270 293 | 
             
            - config/locales/en.yml
         | 
| 271 294 | 
             
            - config/routes.rb
         | 
| 272 295 | 
             
            - db/migrate/20111031204518_create_jobs.rb
         | 
| @@ -280,8 +303,10 @@ files: | |
| 280 303 | 
             
            - db/migrate/20111031204941_create_tblastn_job_reports.rb
         | 
| 281 304 | 
             
            - db/migrate/20120109232446_add_hit_display_id_to_blast_reports.rb
         | 
| 282 305 | 
             
            - db/migrate/20120807202555_add_gaps_to_blast_reports.rb
         | 
| 306 | 
            +
            - db/migrate/20120809155712_add_percent_identity_to_blast_reports.rb
         | 
| 283 307 | 
             
            - db/migrate/20120910175911_change_hsp_group_column_type.rb
         | 
| 284 308 | 
             
            - db/migrate/20120918205556_rename_max_score_column.rb
         | 
| 309 | 
            +
            - db/migrate/20120921182416_add_mismatch_to_blast_reports.rb
         | 
| 285 310 | 
             
            - lib/generators/quorum/images_generator.rb
         | 
| 286 311 | 
             
            - lib/generators/quorum/install_generator.rb
         | 
| 287 312 | 
             
            - lib/generators/quorum/styles_generator.rb
         | 
| @@ -329,7 +354,6 @@ files: | |
| 329 354 | 
             
            - spec/dummy/app/helpers/application_helper.rb
         | 
| 330 355 | 
             
            - spec/dummy/app/mailers/.gitkeep
         | 
| 331 356 | 
             
            - spec/dummy/app/models/.gitkeep
         | 
| 332 | 
            -
            - spec/dummy/app/models/blast.rb
         | 
| 333 357 | 
             
            - spec/dummy/app/views/layouts/application.html.erb
         | 
| 334 358 | 
             
            - spec/dummy/config.ru
         | 
| 335 359 | 
             
            - spec/dummy/config/application.rb
         | 
| @@ -358,12 +382,12 @@ files: | |
| 358 382 | 
             
            - spec/javascripts/fixtures/quorum_search_form.html
         | 
| 359 383 | 
             
            - spec/javascripts/fixtures/quorum_tabs.html
         | 
| 360 384 | 
             
            - spec/javascripts/helpers/jasmine-jquery.js
         | 
| 361 | 
            -
            - spec/javascripts/jobs_spec.js
         | 
| 362 385 | 
             
            - spec/javascripts/jquery/jquery-ui.min.js
         | 
| 363 386 | 
             
            - spec/javascripts/jquery/jquery.min.js
         | 
| 364 387 | 
             
            - spec/javascripts/jquery/jquery_ujs.js
         | 
| 365 | 
            -
            - spec/javascripts/ | 
| 366 | 
            -
            - spec/javascripts/ | 
| 388 | 
            +
            - spec/javascripts/suites/jobs_spec.js
         | 
| 389 | 
            +
            - spec/javascripts/suites/quorum_spec.js
         | 
| 390 | 
            +
            - spec/javascripts/suites/string_spec.js
         | 
| 367 391 | 
             
            - spec/javascripts/support/jasmine.yml
         | 
| 368 392 | 
             
            - spec/javascripts/support/jasmine_config.rb
         | 
| 369 393 | 
             
            - spec/javascripts/support/jasmine_runner.rb
         | 
| @@ -374,6 +398,12 @@ files: | |
| 374 398 | 
             
            - spec/models/blastp_job_spec.rb
         | 
| 375 399 | 
             
            - spec/models/blastx_job_report_spec.rb
         | 
| 376 400 | 
             
            - spec/models/blastx_job_spec.rb
         | 
| 401 | 
            +
            - spec/models/job_data_spec.rb
         | 
| 402 | 
            +
            - spec/models/job_fetch_data_spec.rb
         | 
| 403 | 
            +
            - spec/models/job_queue_observer_spec.rb
         | 
| 404 | 
            +
            - spec/models/job_queue_service_spec.rb
         | 
| 405 | 
            +
            - spec/models/job_report_searcher_spec.rb
         | 
| 406 | 
            +
            - spec/models/job_serializer_spec.rb
         | 
| 377 407 | 
             
            - spec/models/job_spec.rb
         | 
| 378 408 | 
             
            - spec/models/tblastn_job_report_spec.rb
         | 
| 379 409 | 
             
            - spec/models/tblastn_job_spec.rb
         | 
| @@ -403,7 +433,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 403 433 | 
             
                  version: '0'
         | 
| 404 434 | 
             
                  segments:
         | 
| 405 435 | 
             
                  - 0
         | 
| 406 | 
            -
                  hash:  | 
| 436 | 
            +
                  hash: -3863476940221336517
         | 
| 407 437 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 408 438 | 
             
              none: false
         | 
| 409 439 | 
             
              requirements:
         | 
| @@ -412,7 +442,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 412 442 | 
             
                  version: '0'
         | 
| 413 443 | 
             
                  segments:
         | 
| 414 444 | 
             
                  - 0
         | 
| 415 | 
            -
                  hash:  | 
| 445 | 
            +
                  hash: -3863476940221336517
         | 
| 416 446 | 
             
            requirements: []
         | 
| 417 447 | 
             
            rubyforge_project: 
         | 
| 418 448 | 
             
            rubygems_version: 1.8.24
         |