Skip to content

Commit

Permalink
Merge pull request #23 from unipept/feature/pept2filtered-cutoff
Browse files Browse the repository at this point in the history
Add cutoff parameter to pept2filtered
  • Loading branch information
pverscha authored Aug 10, 2023
2 parents 0c88d11 + c92d5b2 commit 596edd2
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
10 changes: 9 additions & 1 deletion app/controllers/mpa_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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

Expand Down
12 changes: 6 additions & 6 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 8 additions & 2 deletions config/deploy/feat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,4 +26,6 @@
upload! StringIO.new(content), "#{release_path}/public/robots.txt"
end
end

end

6 changes: 5 additions & 1 deletion config/deploy/prod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 2 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 596edd2

Please sign in to comment.