diff --git a/app/controllers/mpa_controller.rb b/app/controllers/mpa_controller.rb index a43e2c2..cccb52b 100644 --- a/app/controllers/mpa_controller.rb +++ b/app/controllers/mpa_controller.rb @@ -44,6 +44,7 @@ def pept2data def pept2filtered peptides = params[:peptides] || [] + cutoff = params[:cutoff] || 1000 # missed = params[:missed] || false taxa_filter_ids = (params[:taxa] || []).map(&:to_i) @@ -52,11 +53,18 @@ def pept2filtered @seq_entries = {} uniprot_ids = [] + peptides_under_cutoff = Sequence + .joins(:peptides) + .where(sequence: peptides) + .group('sequences.id') + .having('count(peptides.id) < ?', cutoff) + .pluck(:sequence) + taxa_filter_ids.each_slice(5000) do |taxa_slice| sequence_subset = Sequence .joins(peptides: [:uniprot_entry]) .includes(peptides: [:uniprot_entry]) - .where(sequence: peptides) + .where(sequence: peptides_under_cutoff) .where(uniprot_entry: { taxon_id: taxa_slice }) .uniq diff --git a/config/application.rb b/config/application.rb index 5847525..c78c1c4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,16 +13,16 @@ class Application < Rails::Application config.load_defaults 7.0 config.versions = { - unipept: '4.6.4', - gem: '2.2.1', - uniprot: '2021.03', - desktop: '1.2.4' + unipept: '5.0.9', + gem: '3.0.2', + uniprot: '2023.03', + desktop: '2.0.0' } - + config.api_only = true config.api_host = 'api.unipept.ugent.be' - + MultiJson.use :Oj end end diff --git a/config/database.yml b/config/database.yml index 1147c46..06f9ee6 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,11 +1,12 @@ default: &default adapter: mysql2 - username: unipept + username: root password: unipept pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> development: <<: *default + username: unipept database: unipept # setup local port forwarding for this to work host: 127.0.0.1 diff --git a/config/deploy/feat.rb b/config/deploy/feat.rb index 2114fa3..93c3e8c 100644 --- a/config/deploy/feat.rb +++ b/config/deploy/feat.rb @@ -2,12 +2,16 @@ set :deploy_to, '/home/unipept/rails' +set :server, ENV['server'] || 'rick.ugent.be' + +#set :rvm_custom_path, '/usr/share/rvm' + # don't specify db as it's not needed for unipept -server 'sherlock.ugent.be', user: 'unipept', roles: %i[web app], ssh_options: { +server "#{fetch(:server)}", user: 'unipept', roles: %i[web app], ssh_options: { port: 4840 } -set :branch, 'feature/pept2filtered' +set :branch, 'feature/pept2filtered-cutoff' set :rails_env, :development namespace :deploy do @@ -22,4 +26,6 @@ upload! StringIO.new(content), "#{release_path}/public/robots.txt" end end + end + diff --git a/config/deploy/prod.rb b/config/deploy/prod.rb index f5a030e..7784739 100644 --- a/config/deploy/prod.rb +++ b/config/deploy/prod.rb @@ -2,8 +2,12 @@ set :deploy_to, '/home/unipept/rails' +set :server, ENV['server'] || 'patty.ugent.be' + +#set :rvm_custom_path, '/usr/share/rvm' + # don't specify db as it's not needed for unipept -server 'rick.ugent.be', user: 'unipept', roles: %i[web app], ssh_options: { +server "#{fetch(:server)}", user: 'unipept', roles: %i[web app], ssh_options: { port: 4840 } diff --git a/config/environments/development.rb b/config/environments/development.rb index eeb99ac..85ef47c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -53,8 +53,9 @@ config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. - config.active_record.verbose_query_logs = true + # config.active_record.verbose_query_logs = true + # config.log_level = :info # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true diff --git a/config/environments/production.rb b/config/environments/production.rb index dbbe0ea..04dee56 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -71,6 +71,9 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Do not log SQL queries in production mode (this can cause the server to go out of disk space). + config.log_level = :info + # Use a different logger for distributed setups. # require "syslog/logger" # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")