diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 00000000..132c1191
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,2 @@
+Metrics/LineLength:
+ Max: 120
\ No newline at end of file
diff --git a/Capfile b/Capfile
index ef82ed7d..b20936e7 100644
--- a/Capfile
+++ b/Capfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Load DSL and Setup Up Stages
require 'capistrano/setup'
require 'capistrano/deploy'
@@ -17,4 +19,4 @@ require 'capistrano/sidekiq/monit'
require 'whenever/capistrano'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
-Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
\ No newline at end of file
+Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
diff --git a/GBOLapp/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb b/GBOLapp/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb
index 0896bd7b..e28adcd1 100644
--- a/GBOLapp/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb
+++ b/GBOLapp/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class BiorubyGenerator < Rails::Generator::Base
def manifest
record do |m|
@@ -26,4 +28,3 @@ def manifest
end
end
end
-
diff --git a/GBOLapp/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb b/GBOLapp/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb
index 9905406e..9d973794 100644
--- a/GBOLapp/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb
+++ b/GBOLapp/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb
@@ -1,9 +1,10 @@
-module BiorubyHelper
+# frozen_string_literal: true
+module BiorubyHelper
include Bio::Shell
def project_workdir
- if Bio::Shell.cache[:savedir].match(/\.bioruby$/)
+ if Bio::Shell.cache[:savedir] =~ /\.bioruby$/
Bio::Shell.cache[:workdir]
else
Bio::Shell.cache[:savedir]
@@ -15,13 +16,13 @@ def have_results
end
def local_variables
- eval("local_variables", Bio::Shell.cache[:binding]) -
+ eval('local_variables', Bio::Shell.cache[:binding]) -
BiorubyController::HIDE_VARIABLES
end
def render_log(page)
- page.insert_html :top, :logs, :partial => "log"
- page.replace_html "variables", :partial => "variables"
+ page.insert_html :top, :logs, partial: 'log'
+ page.replace_html 'variables', partial: 'variables'
page.hide "methods_#{@number}"
page.hide "classes_#{@number}"
page.hide "modules_#{@number}"
@@ -31,17 +32,15 @@ def reference_link(class_or_module)
name = class_or_module.to_s
case name
when /Bio::(.+)/
- path = $1.split('::').join('/')
+ path = Regexp.last_match(1).split('::').join('/')
url = "http://bioruby.org/rdoc/classes/Bio/#{path}.html"
when /Chem::(.+)/
- path = $1.split('::').join('/')
+ path = Regexp.last_match(1).split('::').join('/')
url = "http://chemruby.org/rdoc/classes/Chem/#{path}.html"
else
path = name.split('::').join('/')
url = "http://www.ruby-doc.org/core/classes/#{path}.html"
end
- return "#{name}"
+ "#{name}"
end
-
end
-
diff --git a/Gemfile b/Gemfile
index 7f0af0bd..92aa00b2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
source 'https://rubygems.org'
ruby '2.3.3'
@@ -12,9 +14,9 @@ gem 'pg_search'
gem 'puma', '~> 3.0'
gem 'redis', '~> 3.0' # Use Redis adapter to run Action Cable in production
gem 'sidekiq'
-gem 'sidekiq-limit_fetch'
gem 'sidekiq-client-cli'
-gem 'sinatra', :require => false # Needed to monitor sidekiq jobs
+gem 'sidekiq-limit_fetch'
+gem 'sinatra', require: false # Needed to monitor sidekiq jobs
# Asset pipeline
gem 'coffee-rails', '~> 4.2' # Use CoffeeScript for .coffee assets and views
@@ -32,12 +34,12 @@ gem 'aws-sdk'
gem 'paperclip'
# Javascript
+gem 'bootstrap-multiselect_rails' # multi select boxes using bootstrap
gem 'chosen-rails' # Javascript select boxes
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
gem 'jquery-fileupload-rails'
gem 'jquery-turbolinks'
gem 'select2-rails' # Integrate Select2 Javascript library
-gem 'bootstrap-multiselect_rails' # multi select boxes using bootstrap
gem 'bcrypt', '~> 3.1.7', platforms: :ruby
gem 'bio' # BioRuby
@@ -51,14 +53,14 @@ gem 'roo-xls' # Handle excel files
gem 'rubyzip' # Handle zip files
gem 'simple_form'
gem 'slim' # TODO: Used anywhere?
-gem 'sprockets-rails', :require => 'sprockets/railtie'
+gem 'sprockets-rails', require: 'sprockets/railtie'
# gem 'turbolinks' # Turbolinks makes navigating your web application faster TODO: Does not work unless first changes to js code, in particular data-tables (see http://guides.rubyonrails.org/working_with_javascript_in_rails.html#turbolinks)
gem 'whenever', require: false # Runs scheduled jobs via cron
gem 'will_paginate', '> 3.0' # TODO: Really needed?
gem 'will_paginate-bootstrap' # TODO: Really needed?
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
-gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
+gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
group :development do
gem 'capistrano', require: false
diff --git a/Rakefile b/Rakefile
index e85f9139..488c551f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 5dd28135..65209822 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
class ApplicationController < ActionController::Base
- check_authorization :unless => :devise_controller?
+ check_authorization unless: :devise_controller?
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
- rescue_from CanCan::AccessDenied do |exception|
+ rescue_from CanCan::AccessDenied do |_exception|
redirect_back(fallback_location: root_url, alert: 'You are not authorized to access this page or perform this action.')
end
end
diff --git a/app/controllers/concerns/project_concern.rb b/app/controllers/concerns/project_concern.rb
index 4057740e..98d9a84d 100644
--- a/app/controllers/concerns/project_concern.rb
+++ b/app/controllers/concerns/project_concern.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
module ProjectConcern
extend ActiveSupport::Concern
def current_project_id
- user_signed_in? ? current_user.default_project_id : Project.where('name like ?', "All%").first.id
+ user_signed_in? ? current_user.default_project_id : Project.where('name like ?', 'All%').first.id
end
-end
\ No newline at end of file
+end
diff --git a/app/controllers/contig_searches_controller.rb b/app/controllers/contig_searches_controller.rb
index 06abb64b..c4b6e4a5 100644
--- a/app/controllers/contig_searches_controller.rb
+++ b/app/controllers/contig_searches_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ContigSearchesController < ApplicationController
load_and_authorize_resource
@@ -15,8 +17,8 @@ def new
def create
@contig_search = ContigSearch.create!(contig_search_params)
- @contig_search.update(:user_id => current_user.id)
- @contig_search.update(:project_id => current_user.default_project_id)
+ @contig_search.update(user_id: current_user.id)
+ @contig_search.update(project_id: current_user.default_project_id)
redirect_to @contig_search
end
@@ -51,7 +53,7 @@ def delete_all
def export_as_pde
@contig_search = ContigSearch.find(params[:contig_search_id])
file_name = @contig_search.title.empty? ? "contig_search_#{@contig_search.created_at}" : @contig_search.title
- send_data(ContigSearch.pde(@contig_search.contigs.includes(:partial_cons, isolate: [individual: :species]), add_reads: false), :filename => "#{file_name}.pde", :type => "application/txt")
+ send_data(ContigSearch.pde(@contig_search.contigs.includes(:partial_cons, isolate: [individual: :species]), add_reads: false), filename: "#{file_name}.pde", type: 'application/txt')
end
# TODO: Unfinished feature
@@ -68,6 +70,7 @@ def export_as_pde
# end
private
+
# Never trust parameters from the scary internet, only allow the white list through.
def contig_search_params
params.require(:contig_search).permit(:title, :assembled, :has_warnings, :family, :marker, :max_age, :max_update, :min_age, :min_update, :name, :order, :species, :specimen, :verified, :verified_by, :project_id, :search_result_archive)
diff --git a/app/controllers/contigs_controller.rb b/app/controllers/contigs_controller.rb
index 6bc5c71d..2a26cb94 100644
--- a/app/controllers/contigs_controller.rb
+++ b/app/controllers/contigs_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ContigsController < ApplicationController
include ProjectConcern
@@ -5,8 +7,8 @@ class ContigsController < ApplicationController
skip_before_action :verify_authenticity_token
- before_action :set_contig, only: [:verify_next, :verify, :pde, :fasta, :fasta_trimmed, :fasta_raw, :overlap, :overlap_background, :show, :edit,\
- :update, :destroy]
+ before_action :set_contig, only: %i[verify_next verify pde fasta fasta_trimmed fasta_raw overlap overlap_background show edit
+ update destroy]
# GET /contigs
# GET /contigs.json
@@ -32,8 +34,8 @@ def externally_verified
end
def filter
- @contigs = Contig.in_project(current_project_id).order(:name).where("name ilike ?", "%#{params[:term]}%").limit(100)
- size = Contig.in_project(current_project_id).order(:name).where("name ilike ?", "%#{params[:term]}%").size
+ @contigs = Contig.in_project(current_project_id).order(:name).where('name ilike ?', "%#{params[:term]}%").limit(100)
+ size = Contig.in_project(current_project_id).order(:name).where('name ilike ?', "%#{params[:term]}%").size
if size > 100
message = "and #{size} more..."
@@ -45,8 +47,7 @@ def filter
# GET /contigs/1
# GET /contigs/1.json
- def show
- end
+ def show; end
# GET /contigs/new
def new
@@ -54,8 +55,7 @@ def new
end
# GET /contigs/1/edit
- def edit
- end
+ def edit; end
# POST /contigs
# POST /contigs.json
@@ -79,10 +79,10 @@ def create
def update
respond_to do |format|
if @contig.update(contig_params)
- format.html {
+ format.html do
Issue.create(title: "Contig updated by #{current_user.name}", contig_id: @contig.id)
redirect_back(fallback_location: edit_contig_path(@contig), notice: 'Contig was successfully updated.')
- }
+ end
format.json { render :show, status: :ok, location: @contig }
else
format.html { render :edit }
@@ -107,7 +107,7 @@ def compare_contigs
CompareContigs.perform_async(contig_names)
- send_data("Comparison started as background process, may take a minute or so. View results under http://gbol5.de/analysis_output\n", filename: "msg.txt", type: "application/txt")
+ send_data("Comparison started as background process, may take a minute or so. View results under http://gbol5.de/analysis_output\n", filename: 'msg.txt', type: 'application/txt')
end
def analysis_output
@@ -116,7 +116,6 @@ def analysis_output
# for overwriting with externally edited / verified contigs in fas format (via .pde)
def change_via_script
-
filename = params[:filename]
fastastring = params[:fastastring]
@@ -134,23 +133,20 @@ def change_via_script
contig.assembled = true
contig.verified = true
- contig.verified_by = 8 #User.first.id #unclear who did external verification, but won't be displayed anyway if imported
+ contig.verified_by = 8 # User.first.id #unclear who did external verification, but won't be displayed anyway if imported
contig.verified_at = Time.zone.now
# destroy all current partial_cons
contig.partial_cons.destroy_all
- #create a single new partial_con to be overwritten by imported stuff
+ # create a single new partial_con to be overwritten by imported stuff
new_partial_con = contig.partial_cons.create
-
# get aligned read sequences
- fas_seqs = fastastring.split(">")
-
+ fas_seqs = fastastring.split('>')
fas_seqs[1..-1].each do |fs|
-
pair = fs.split("\n")
# overwrite single reads (aligned - / manually corrected version (?) ) (> that do match general read pattern; use the exactly matching read or generate new)
@@ -167,7 +163,7 @@ def change_via_script
primer_read.aligned_seq = pair[1]
- #cannot use aligned qualities since not existing when imported from external alignment:
+ # cannot use aligned qualities since not existing when imported from external alignment:
primer_read.aligned_qualities = primer_read.qualities
primer_read.overwritten = true
@@ -175,7 +171,7 @@ def change_via_script
primer_read.used_for_con = true
primer_read.assembled = true
- # todo: adjust trimmedReadStart etc. based on ???? in aligned_seq (though this is not technically correct due to alignemnt of ??? with gappy stretches in other reads)
+ # TODO: adjust trimmedReadStart etc. based on ???? in aligned_seq (though this is not technically correct due to alignemnt of ??? with gappy stretches in other reads)
if primer_read.trimmedReadStart.nil?
primer_read.trimmedReadStart = 1
@@ -197,15 +193,14 @@ def change_via_script
# generate marker sequence
ms = MarkerSequence.find_or_create_by(name: contig.name)
- ms.sequence = pair[1].gsub('-','')
- ms.sequence = ms.sequence.gsub('?','')
+ ms.sequence = pair[1].delete('-')
+ ms.sequence = ms.sequence.delete('?')
ms.contigs << contig
ms.marker = contig.marker
ms.isolate = contig.isolate
ms.save
end
-
end
new_partial_con.save
@@ -216,17 +211,16 @@ def change_via_script
output = "No match found.\n"
end
- send_data(output, filename: "#{filename}.txt", type: "application/txt")
-
+ send_data(output, filename: "#{filename}.txt", type: 'application/txt')
end
def identify_primer_read(read_name)
- primer_read = PrimerRead.where("name ILIKE ?", "#{read_name}.scf").first
+ primer_read = PrimerRead.where('name ILIKE ?', "#{read_name}.scf").first
if primer_read
return primer_read
else
- primer_read = PrimerRead.where("name ILIKE ?", "#{read_name}.ab1").first
+ primer_read = PrimerRead.where('name ILIKE ?', "#{read_name}.ab1").first
if primer_read
return primer_read
else
@@ -234,14 +228,14 @@ def identify_primer_read(read_name)
end
end
- return nil
+ nil
end
def identify_contig(c)
contig_name = c[0...-4]
- #match found?
- contig = Contig.in_project(current_project_id).where("name ILIKE ?", contig_name).first
+ # match found?
+ contig = Contig.in_project(current_project_id).where('name ILIKE ?', contig_name).first
if contig
return contig if contig
@@ -256,22 +250,19 @@ def identify_contig(c)
isolate_name = m[1]
begin
primer_names = m[2]
- primer_name = primer_names.split("_").last
- primer = Primer.where("name ILIKE ?", primer_name).first
+ primer_name = primer_names.split('_').last
+ primer = Primer.where('name ILIKE ?', primer_name).first
if primer
marker = primer.marker
if marker
true_marker_name = marker.name
true_contig_name = isolate_name + "_#{true_marker_name}"
- contig = Contig.in_project(current_project_id).where("name ILIKE ?", true_contig_name).first
- if contig
- return contig
- end
+ contig = Contig.in_project(current_project_id).where('name ILIKE ?', true_contig_name).first
+ return contig if contig
end
end
- rescue
+ rescue StandardError
end
- else
end
end
end
@@ -287,23 +278,23 @@ def assemble_all
end
def verify
- if @contig.verified_by or @contig.verified
+ if @contig.verified_by || @contig.verified
@contig.update(verified_by: nil, verified_at: nil, verified: false)
- redirect_to edit_contig_path, notice: "Set to non-verified."
+ redirect_to edit_contig_path, notice: 'Set to non-verified.'
else
@contig.update(verified_by: current_user.id, verified_at: Time.now, assembled: true, verified: true)
# generate / update marker sequence
ms = MarkerSequence.find_or_create_by(name: @contig.name)
partial_cons = @contig.partial_cons.first
- ms.sequence = partial_cons.aligned_sequence.gsub('-','')
- ms.sequence = ms.sequence.gsub('?','')
+ ms.sequence = partial_cons.aligned_sequence.delete('-')
+ ms.sequence = ms.sequence.delete('?')
ms.contigs << @contig
ms.marker = @contig.marker
ms.isolate = @contig.isolate
ms.save
- redirect_to edit_contig_path, notice: "Verified & linked marker sequence updated."
+ redirect_to edit_contig_path, notice: 'Verified & linked marker sequence updated.'
end
end
@@ -314,8 +305,8 @@ def verify_next
# generate marker sequence
ms = MarkerSequence.find_or_create_by(name: @contig.name)
partial_cons = @contig.partial_cons.first
- ms.sequence = partial_cons.aligned_sequence.gsub('-','')
- ms.sequence = ms.sequence.gsub('?','')
+ ms.sequence = partial_cons.aligned_sequence.delete('-')
+ ms.sequence = ms.sequence.delete('?')
ms.contigs << @contig
ms.marker = @contig.marker
ms.isolate = @contig.isolate
@@ -346,22 +337,22 @@ def overlap_background
def pde
pde = Contig.pde([@contig], add_reads: true)
- send_data(pde, filename: "#{@contig.name}.pde", type: "application/txt")
+ send_data(pde, filename: "#{@contig.name}.pde", type: 'application/txt')
end
def fasta
fasta = Contig.fasta([@contig], mode: 'assembled')
- send_data(fasta, filename: "#{@contig.name}.fas", type: "application/txt")
+ send_data(fasta, filename: "#{@contig.name}.fas", type: 'application/txt')
end
def fasta_trimmed
fasta = Contig.fasta([@contig], mode: 'trimmed')
- send_data(fasta, filename: "#{@contig.name}_trimmed.fas", type: "application/txt")
+ send_data(fasta, filename: "#{@contig.name}_trimmed.fas", type: 'application/txt')
end
def fasta_raw
fasta = Contig.fasta([@contig], mode: 'raw')
- send_data(fasta, filename: "#{@contig.name}_raw.fas", type: "application/txt")
+ send_data(fasta, filename: "#{@contig.name}_raw.fas", type: 'application/txt')
end
# TODO: Not used anywhere yet, talk to Susi about her needs for this export
@@ -373,7 +364,7 @@ def fastq
fastq = Contig.fastq(contigs.where(verified: true, imported: false), use_mira)
- send_data(fastq, filename: "contigs.fastq", type: "application/txt")
+ send_data(fastq, filename: 'contigs.fastq', type: 'application/txt')
end
# Is used by API endpoint to compare sequences to PacBio data
@@ -386,16 +377,15 @@ def as_fasq
contig_names_array = contig_names.split
- fasq_str = +""
+ fasq_str = +''
not_included_str = +"\n\n\n--------------------------------------------------------------------\n\n\n"
contig_names_array.map do |contig_name|
-
contig_name += "_#{marker}"
# mk case insensitive
- contig = Contig.in_project(current_project_id).where("name ILIKE ?", contig_name).first
+ contig = Contig.in_project(current_project_id).where('name ILIKE ?', contig_name).first
# ignore if not verified
if contig
@@ -406,7 +396,7 @@ def as_fasq
begin
fasq = contig.as_fasq(mira)
fasq_str += fasq
- rescue
+ rescue StandardError
not_included_str += "#{contig_name}: Unknown issue.\n"
end
end
@@ -418,7 +408,7 @@ def as_fasq
end
end
- send_data(fasq_str + not_included_str, :filename => "fasq.txt", :type => "application/txt")
+ send_data(fasq_str + not_included_str, filename: 'fasq.txt', type: 'application/txt')
end
private
@@ -429,14 +419,14 @@ def set_contig
end
# Never trust parameters from the scary internet, only allow the white list through.
- #TODO mira and marker only used by fastq export
- #TODO contig_names is only used by contig compare feature
- #TODO filename and fastastring are only used by change via script action
- #TODO: isolate_name used in form for contig, but cant that be done via id?
+ # TODO mira and marker only used by fastq export
+ # TODO contig_names is only used by contig compare feature
+ # TODO filename and fastastring are only used by change via script action
+ # TODO: isolate_name used in form for contig, but cant that be done via id?
def contig_params
params.require(:contig).permit(:mira, :marker, :overlap_length, :allowed_mismatch_percent, :imported, :contig_names,
:filename, :fastastring, :comment, :assembled, :name, :consensus, :marker_id,
:isolate_id, :marker_sequence_id, :term, :isolate_name, :verified,
project_ids: [])
end
-end
\ No newline at end of file
+end
diff --git a/app/controllers/families_controller.rb b/app/controllers/families_controller.rb
index 018fc47a..c3485c1e 100644
--- a/app/controllers/families_controller.rb
+++ b/app/controllers/families_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class FamiliesController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_family, only: [:show, :edit, :update, :destroy]
+ before_action :set_family, only: %i[show edit update destroy]
# GET /families
# GET /families.json
@@ -14,7 +16,7 @@ def index
end
def filter
- @families = Family.in_project(current_project_id).order(:name).where("families.name ilike ?", "%#{params[:term]}%")
+ @families = Family.in_project(current_project_id).order(:name).where('families.name ilike ?', "%#{params[:term]}%")
render json: @families.map(&:name)
end
@@ -27,8 +29,7 @@ def show_species
# GET /families/1
# GET /families/1.json
- def show
- end
+ def show; end
# GET /families/new
def new
@@ -36,8 +37,7 @@ def new
end
# GET /families/1/edit
- def edit
- end
+ def edit; end
# POST /families
# POST /families.json
@@ -89,6 +89,6 @@ def set_family
# Never trust parameters from the scary internet, only allow the white list through.
def family_params
- params.require(:family).permit(:name, :author, :order_id, :term, :project_ids => [])
+ params.require(:family).permit(:name, :author, :order_id, :term, project_ids: [])
end
end
diff --git a/app/controllers/freezers_controller.rb b/app/controllers/freezers_controller.rb
index 2a594385..d551529c 100644
--- a/app/controllers/freezers_controller.rb
+++ b/app/controllers/freezers_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class FreezersController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_freezer, only: [:show, :edit, :update, :destroy]
+ before_action :set_freezer, only: %i[show edit update destroy]
# GET /freezers
# GET /freezers.json
@@ -16,8 +18,7 @@ def index
# GET /freezers/1
# GET /freezers/1.json
- def show
- end
+ def show; end
# GET /freezers/new
def new
@@ -25,8 +26,7 @@ def new
end
# GET /freezers/1/edit
- def edit
- end
+ def edit; end
# POST /freezers
# POST /freezers.json
@@ -78,6 +78,6 @@ def set_freezer
# Never trust parameters from the scary internet, only allow the white list through.
def freezer_params
- params.require(:freezer).permit(:freezercode, :lab_id, :project_ids => [])
+ params.require(:freezer).permit(:freezercode, :lab_id, project_ids: [])
end
end
diff --git a/app/controllers/higher_order_taxons_controller.rb b/app/controllers/higher_order_taxons_controller.rb
index e1bf726c..5ea44e4c 100644
--- a/app/controllers/higher_order_taxons_controller.rb
+++ b/app/controllers/higher_order_taxons_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class HigherOrderTaxonsController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_higher_order_taxon, only: [:show, :edit, :update, :destroy]
+ before_action :set_higher_order_taxon, only: %i[show edit update destroy]
# GET /higher_order_taxons
# GET /higher_order_taxons.json
@@ -20,8 +22,7 @@ def show_species
# GET /higher_order_taxons/1
# GET /higher_order_taxons/1.json
- def show
- end
+ def show; end
# GET /higher_order_taxons/new
def new
@@ -29,8 +30,7 @@ def new
end
# GET /higher_order_taxons/1/edit
- def edit
- end
+ def edit; end
# POST /higher_order_taxons
# POST /higher_order_taxons.json
@@ -82,6 +82,6 @@ def set_higher_order_taxon
# Never trust parameters from the scary internet, only allow the white list through.
def higher_order_taxon_params
- params.require(:higher_order_taxon).permit(:position, :name, :german_name,:marker_ids => [], :project_ids => [])
+ params.require(:higher_order_taxon).permit(:position, :name, :german_name, marker_ids: [], project_ids: [])
end
end
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index d307bd2e..f17de7a2 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,5 +1,6 @@
-class HomeController < ApplicationController
+# frozen_string_literal: true
+class HomeController < ApplicationController
def overview
authorize! :overview, :home
end
@@ -19,12 +20,7 @@ def privacy_policy
authorize! :privacy_policy, :home
end
- def help
-
- end
-
- def contact
-
- end
+ def help; end
+ def contact; end
end
diff --git a/app/controllers/individual_searches_controller.rb b/app/controllers/individual_searches_controller.rb
index 7e718a17..162c512a 100644
--- a/app/controllers/individual_searches_controller.rb
+++ b/app/controllers/individual_searches_controller.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class IndividualSearchesController < ApplicationController
load_and_authorize_resource
- before_action :set_individual_search, only: [:show, :edit, :update, :destroy]
+ before_action :set_individual_search, only: %i[show edit update destroy]
def index
respond_to do |format|
@@ -24,8 +26,8 @@ def new
def create
@individual_search = IndividualSearch.new(individual_search_params)
- @individual_search.update(:user_id => current_user.id)
- @individual_search.update(:project_id => current_user.default_project_id)
+ @individual_search.update(user_id: current_user.id)
+ @individual_search.update(project_id: current_user.default_project_id)
respond_to do |format|
if @individual_search.save
diff --git a/app/controllers/individuals_controller.rb b/app/controllers/individuals_controller.rb
index 61ec69b8..73de43a6 100644
--- a/app/controllers/individuals_controller.rb
+++ b/app/controllers/individuals_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class IndividualsController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_individual, :only => [:show, :edit, :update, :destroy]
+ before_action :set_individual, only: %i[show edit update destroy]
def index
respond_to do |format|
@@ -24,20 +26,19 @@ def xls
def problematic_specimens
# Liste aller Bundesländer to check 'state_province' against:
- @states = %w(Baden-Württemberg Bayern Berlin Brandenburg Bremen Hamburg Hessen Mecklenburg-Vorpommern Niedersachsen Nordrhein-Westfalen Rheinland-Pfalz Saarland Sachsen Sachsen-Anhalt Schleswig-Holstein Thüringen)
+ @states = %w[Baden-Württemberg Bayern Berlin Brandenburg Bremen Hamburg Hessen Mecklenburg-Vorpommern Niedersachsen Nordrhein-Westfalen Rheinland-Pfalz Saarland Sachsen Sachsen-Anhalt Schleswig-Holstein Thüringen]
@individuals = []
Individual.in_project(current_project_id).each do |i|
- if i.country == "Germany"
+ if i.country == 'Germany'
@individuals.push(i) unless @states.include? i.state_province
end
end
-
end
def filter
- @individuals = Individual.where("individuals.specimen_id ilike ?", "%#{params[:term]}%").in_project(current_project_id).limit(100)
- size = Individual.where("individuals.specimen_id ilike ?", "%#{params[:term]}%").in_project(current_project_id).size
+ @individuals = Individual.where('individuals.specimen_id ilike ?', "%#{params[:term]}%").in_project(current_project_id).limit(100)
+ size = Individual.where('individuals.specimen_id ilike ?', "%#{params[:term]}%").in_project(current_project_id).size
if size > 100
message = "and #{size} more..."
@@ -49,8 +50,7 @@ def filter
# GET /individuals/1
# GET /individuals/1.json
- def show
- end
+ def show; end
# GET /individuals/new
def new
@@ -58,8 +58,7 @@ def new
end
# GET /individuals/1/edit
- def edit
- end
+ def edit; end
# POST /individuals
# POST /individuals.json
@@ -137,6 +136,6 @@ def individual_params
:comments,
:species_id,
:species_name,
- :project_ids => [])
+ project_ids: [])
end
-end
\ No newline at end of file
+end
diff --git a/app/controllers/isolates_controller.rb b/app/controllers/isolates_controller.rb
index b885ca10..b077df51 100644
--- a/app/controllers/isolates_controller.rb
+++ b/app/controllers/isolates_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class IsolatesController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_isolate, only: [:show, :edit, :update, :destroy]
+ before_action :set_isolate, only: %i[show edit update destroy]
def index
respond_to do |format|
@@ -12,8 +14,7 @@ def index
end
end
- def duplicates
- end
+ def duplicates; end
def no_specimen
respond_to do |format|
@@ -33,15 +34,13 @@ def import
redirect_to isolates_path, notice: 'Imported.'
end
- def show
- end
+ def show; end
def new
@isolate = Isolate.new
end
- def edit
- end
+ def edit; end
def create
@isolate = Isolate.new(isolate_params)
@@ -87,11 +86,11 @@ def set_isolate
# Never trust parameters from the scary internet, only allow the white list through.
def isolate_params
- params.require(:isolate).permit(:comment_orig, :comment_copy, :micronic_tube_id_copy, :micronic_tube_id_orig, :concentration_copy, :concentration_orig, :well_pos_micronic_plate_copy, :well_pos_micronic_plate_orig, :micronic_plate_id_copy,:micronic_plate_id_orig, :isolation_date, :lab_id_copy, :lab_id_orig, :user_id, :well_pos_plant_plate, :lab_nr, :micronic_tube_id, :well_pos_micronic_plate, :concentration,
+ params.require(:isolate).permit(:comment_orig, :comment_copy, :micronic_tube_id_copy, :micronic_tube_id_orig, :concentration_copy, :concentration_orig, :well_pos_micronic_plate_copy, :well_pos_micronic_plate_orig, :micronic_plate_id_copy, :micronic_plate_id_orig, :isolation_date, :lab_id_copy, :lab_id_orig, :user_id, :well_pos_plant_plate, :lab_nr, :micronic_tube_id, :well_pos_micronic_plate, :concentration,
:tissue_id, :micronic_plate_id, :plant_plate_id, :term,
:file,
:individual_name,
:query,
- :project_ids => [])
+ project_ids: [])
end
end
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 4db092c2..dc1d453d 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class IssuesController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_issue, only: [:show, :edit, :update, :destroy]
+ before_action :set_issue, only: %i[show edit update destroy]
# GET /issues
# GET /issues.json
@@ -16,8 +18,7 @@ def index
# GET /issues/1
# GET /issues/1.json
- def show
- end
+ def show; end
# GET /issues/new
def new
@@ -25,8 +26,7 @@ def new
end
# GET /issues/1/edit
- def edit
- end
+ def edit; end
# POST /issues
# POST /issues.json
@@ -78,6 +78,6 @@ def set_issue
# Never trust parameters from the scary internet, only allow the white list through.
def issue_params
- params.require(:issue).permit(:title, :description, :project_ids => [])
+ params.require(:issue).permit(:title, :description, project_ids: [])
end
end
diff --git a/app/controllers/lab_racks_controller.rb b/app/controllers/lab_racks_controller.rb
index fd1af01b..1036f3a1 100644
--- a/app/controllers/lab_racks_controller.rb
+++ b/app/controllers/lab_racks_controller.rb
@@ -1,23 +1,24 @@
+# frozen_string_literal: true
+
class LabRacksController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_lab_rack, only: [:show, :edit, :update, :destroy]
+ before_action :set_lab_rack, only: %i[show edit update destroy]
# GET /lab_racks
# GET /lab_racks.json
def index
respond_to do |format|
format.html
- format.json { render json: LabRackDatatable.new(view_context, current_project_id)}
+ format.json { render json: LabRackDatatable.new(view_context, current_project_id) }
end
end
# GET /lab_racks/1
# GET /lab_racks/1.json
- def show
- end
+ def show; end
# GET /lab_racks/new
def new
@@ -25,8 +26,7 @@ def new
end
# GET /lab_racks/1/edit
- def edit
- end
+ def edit; end
# POST /lab_racks
# POST /lab_racks.json
@@ -78,6 +78,6 @@ def set_lab_rack
# Never trust parameters from the scary internet, only allow the white list through.
def lab_rack_params
- params.require(:lab_rack).permit(:shelf, :rack_position, :rackcode, :freezer_id, :project_ids => [])
+ params.require(:lab_rack).permit(:shelf, :rack_position, :rackcode, :freezer_id, project_ids: [])
end
end
diff --git a/app/controllers/labs_controller.rb b/app/controllers/labs_controller.rb
index d2415cc1..4febd0bf 100644
--- a/app/controllers/labs_controller.rb
+++ b/app/controllers/labs_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class LabsController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_lab, only: [:show, :edit, :update, :destroy]
+ before_action :set_lab, only: %i[show edit update destroy]
# GET /labs
# GET /labs.json
@@ -13,8 +15,7 @@ def index
# GET /labs/1
# GET /labs/1.json
- def show
- end
+ def show; end
# GET /labs/new
def new
@@ -22,8 +23,7 @@ def new
end
# GET /labs/1/edit
- def edit
- end
+ def edit; end
# POST /labs
# POST /labs.json
@@ -75,6 +75,6 @@ def set_lab
# Never trust parameters from the scary internet, only allow the white list through.
def lab_params
- params.require(:lab).permit(:labcode, :project_ids => [])
+ params.require(:lab).permit(:labcode, project_ids: [])
end
end
diff --git a/app/controllers/marker_sequence_searches_controller.rb b/app/controllers/marker_sequence_searches_controller.rb
index 9702d2f2..762b44b0 100644
--- a/app/controllers/marker_sequence_searches_controller.rb
+++ b/app/controllers/marker_sequence_searches_controller.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class MarkerSequenceSearchesController < ApplicationController
load_and_authorize_resource
- before_action :set_marker_sequence_search, only: [:export_as_fasta, :export_as_pde]
+ before_action :set_marker_sequence_search, only: %i[export_as_fasta export_as_pde]
def index
respond_to do |format|
@@ -18,8 +20,8 @@ def create
@marker_sequence_search = MarkerSequenceSearch.create!(marker_sequence_search_params)
if user_signed_in?
- @marker_sequence_search.update(:user_id => current_user.id)
- @marker_sequence_search.update(:project_id => current_user.default_project_id)
+ @marker_sequence_search.update(user_id: current_user.id)
+ @marker_sequence_search.update(project_id: current_user.default_project_id)
end
redirect_to @marker_sequence_search
@@ -45,12 +47,12 @@ def destroy
def export_as_fasta
file_name = @marker_sequence_search.title.empty? ? "marker_sequence_search_#{@marker_sequence_search.created_at}" : @marker_sequence_search.title
- send_data(MarkerSequenceSearch.fasta(@marker_sequence_search.marker_sequences, metadata: true), :filename => "#{file_name}.fasta", :type => "application/txt")
+ send_data(MarkerSequenceSearch.fasta(@marker_sequence_search.marker_sequences, metadata: true), filename: "#{file_name}.fasta", type: 'application/txt')
end
def export_as_pde
file_name = @marker_sequence_search.title.empty? ? "marker_sequence_search_#{@marker_sequence_search.created_at}" : @marker_sequence_search.title
- send_data(MarkerSequenceSearch.pde(@marker_sequence_search.marker_sequences, {}), :filename => "#{file_name}.pde", :type => "application/txt")
+ send_data(MarkerSequenceSearch.pde(@marker_sequence_search.marker_sequences, {}), filename: "#{file_name}.pde", type: 'application/txt')
end
private
diff --git a/app/controllers/marker_sequences_controller.rb b/app/controllers/marker_sequences_controller.rb
index 5e53ae5b..d569d431 100644
--- a/app/controllers/marker_sequences_controller.rb
+++ b/app/controllers/marker_sequences_controller.rb
@@ -1,18 +1,19 @@
+# frozen_string_literal: true
+
class MarkerSequencesController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_marker_sequence, only: [:show, :edit, :update, :destroy]
+ before_action :set_marker_sequence, only: %i[show edit update destroy]
# GET /marker_sequences
# GET /marker_sequences.json
def index
respond_to do |format|
format.html
- format.json { render json: MarkerSequenceDatatable.new(view_context, current_project_id)}
+ format.json { render json: MarkerSequenceDatatable.new(view_context, current_project_id) }
end
-
end
def filter
@@ -29,8 +30,7 @@ def filter
# GET /marker_sequences/1
# GET /marker_sequences/1.json
- def show
- end
+ def show; end
# GET /marker_sequences/new
def new
@@ -38,8 +38,7 @@ def new
end
# GET /marker_sequences/1/edit
- def edit
- end
+ def edit; end
# POST /marker_sequences
# POST /marker_sequences.json
@@ -65,15 +64,11 @@ def create
# PATCH/PUT /marker_sequences/1
# PATCH/PUT /marker_sequences/1.json
def update
-
@marker_sequence.update(marker_sequence_params)
- if @marker_sequence.name.empty?
- @marker_sequence.generate_name
- end
+ @marker_sequence.generate_name if @marker_sequence.name.empty?
redirect_to edit_marker_sequence_path(@marker_sequence), notice: 'Marker sequence was successfully updated.'
-
end
# DELETE /marker_sequences/1
@@ -87,13 +82,14 @@ def destroy
end
private
+
# Use callbacks to share common setup or constraints between actions.
def set_marker_sequence
- @marker_sequence = MarkerSequence.includes(:isolate => :individual).find(params[:id])
+ @marker_sequence = MarkerSequence.includes(isolate: :individual).find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def marker_sequence_params
- params.require(:marker_sequence).permit(:genbank, :name, :sequence, :isolate_id, :marker_id, :contig_id, :isolate_lab_nr, :reference, :project_ids => [])
+ params.require(:marker_sequence).permit(:genbank, :name, :sequence, :isolate_id, :marker_id, :contig_id, :isolate_lab_nr, :reference, project_ids: [])
end
end
diff --git a/app/controllers/markers_controller.rb b/app/controllers/markers_controller.rb
index 4dbce8f2..d0379fc6 100644
--- a/app/controllers/markers_controller.rb
+++ b/app/controllers/markers_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class MarkersController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_marker, only: [:show, :edit, :update, :destroy]
+ before_action :set_marker, only: %i[show edit update destroy]
# GET /markers
# GET /markers.json
@@ -13,8 +15,7 @@ def index
# GET /markers/1
# GET /markers/1.json
- def show
- end
+ def show; end
# GET /markers/new
def new
@@ -22,8 +23,7 @@ def new
end
# GET /markers/1/edit
- def edit
- end
+ def edit; end
# POST /markers
# POST /markers.json
@@ -67,13 +67,14 @@ def destroy
end
private
- # Use callbacks to share common setup or constraints between actions.
- def set_marker
- @marker = Marker.find(params[:id])
- end
- # Never trust parameters from the scary internet, only allow the white list through.
- def marker_params
- params.require(:marker).permit(:alt_name, :is_gbol, :expected_reads, :name, :sequence, :accession, :higher_order_taxon_ids => [], :project_ids => [])
- end
+ # Use callbacks to share common setup or constraints between actions.
+ def set_marker
+ @marker = Marker.find(params[:id])
+ end
+
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def marker_params
+ params.require(:marker).permit(:alt_name, :is_gbol, :expected_reads, :name, :sequence, :accession, higher_order_taxon_ids: [], project_ids: [])
+ end
end
diff --git a/app/controllers/micronic_plates_controller.rb b/app/controllers/micronic_plates_controller.rb
index 3debf538..298d1cc1 100644
--- a/app/controllers/micronic_plates_controller.rb
+++ b/app/controllers/micronic_plates_controller.rb
@@ -1,23 +1,24 @@
+# frozen_string_literal: true
+
class MicronicPlatesController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_micronic_plate, only: [:show, :edit, :update, :destroy]
+ before_action :set_micronic_plate, only: %i[show edit update destroy]
# GET /micronic_plates
# GET /micronic_plates.json
def index
respond_to do |format|
format.html
- format.json { render json: MicronicPlateDatatable.new(view_context, current_project_id)}
+ format.json { render json: MicronicPlateDatatable.new(view_context, current_project_id) }
end
end
# GET /micronic_plates/1
# GET /micronic_plates/1.json
- def show
- end
+ def show; end
# GET /micronic_plates/new
def new
@@ -25,8 +26,7 @@ def new
end
# GET /micronic_plates/1/edit
- def edit
- end
+ def edit; end
# POST /micronic_plates
# POST /micronic_plates.json
@@ -78,6 +78,6 @@ def set_micronic_plate
# Never trust parameters from the scary internet, only allow the white list through.
def micronic_plate_params
- params.require(:micronic_plate).permit(:location_in_rack, :micronic_plate_id, :name, :project_ids => [])
+ params.require(:micronic_plate).permit(:location_in_rack, :micronic_plate_id, :name, project_ids: [])
end
end
diff --git a/app/controllers/mislabel_analyses_controller.rb b/app/controllers/mislabel_analyses_controller.rb
index e43fd914..9972ba3b 100644
--- a/app/controllers/mislabel_analyses_controller.rb
+++ b/app/controllers/mislabel_analyses_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class MislabelAnalysesController < ApplicationController
load_and_authorize_resource
@@ -40,7 +42,7 @@ def import
redirect_to mislabel_analyses_path, alert: 'Please select a SATIVA output file (*.mis) to import results.'
else
results = File.new(params[:file].path)
- title = File.basename(file.original_filename, ".mis")
+ title = File.basename(file.original_filename, '.mis')
@mislabel_analysis = MislabelAnalysis.import(results, title)
redirect_to mislabel_analysis_path(@mislabel_analysis), notice: 'Imported analysis output. Possibly mislabeled sequences have been marked.'
diff --git a/app/controllers/mislabels_controller.rb b/app/controllers/mislabels_controller.rb
index 90e7d398..a5db36c4 100644
--- a/app/controllers/mislabels_controller.rb
+++ b/app/controllers/mislabels_controller.rb
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
class MislabelsController < ApplicationController
load_and_authorize_resource
before_action :set_mislabel, only: :solve
def solve
- if @mislabel.solved_by or @mislabel.solved
- redirect_back(fallback_location: marker_sequences_path, warning: "Mislabel warning was already marked as solved.")
+ if @mislabel.solved_by || @mislabel.solved
+ redirect_back(fallback_location: marker_sequences_path, warning: 'Mislabel warning was already marked as solved.')
else
- @mislabel.update(:solved_by => current_user.id, :solved_at => Time.now, :solved => true)
- redirect_back(fallback_location: marker_sequences_path, notice: "Mislabel warning marked as solved.")
+ @mislabel.update(solved_by: current_user.id, solved_at: Time.now, solved: true)
+ redirect_back(fallback_location: marker_sequences_path, notice: 'Mislabel warning marked as solved.')
end
end
diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb
index 4b6d6b85..d9c47fd1 100644
--- a/app/controllers/orders_controller.rb
+++ b/app/controllers/orders_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class OrdersController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_order, only: [:show, :edit, :update, :destroy]
+ before_action :set_order, only: %i[show edit update destroy]
# GET /orders
# GET /orders.json
@@ -13,8 +15,7 @@ def index
# GET /orders/1
# GET /orders/1.json
- def show
- end
+ def show; end
# GET /orders/new
def new
@@ -22,8 +23,7 @@ def new
end
# GET /orders/1/edit
- def edit
- end
+ def edit; end
# POST /orders
# POST /orders.json
@@ -75,6 +75,6 @@ def set_order
# Never trust parameters from the scary internet, only allow the white list through.
def order_params
- params.require(:order).permit(:name, :author, :higher_order_taxon_id, :project_ids => [])
+ params.require(:order).permit(:name, :author, :higher_order_taxon_id, project_ids: [])
end
end
diff --git a/app/controllers/overview_diagram_controller.rb b/app/controllers/overview_diagram_controller.rb
index 420950b8..d8fc13ed 100644
--- a/app/controllers/overview_diagram_controller.rb
+++ b/app/controllers/overview_diagram_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class OverviewDiagramController < ApplicationController
include ProjectConcern
diff --git a/app/controllers/partial_cons_controller.rb b/app/controllers/partial_cons_controller.rb
index f81184fb..d8e20b8f 100644
--- a/app/controllers/partial_cons_controller.rb
+++ b/app/controllers/partial_cons_controller.rb
@@ -1,21 +1,23 @@
+# frozen_string_literal: true
+
class PartialConsController < ApplicationController
load_and_authorize_resource
- before_action :set_partial_con, only: [:show_page, :show_position]
+ before_action :set_partial_con, only: %i[show_page show_position]
def show_page
respond_to do |format|
- format.json {
- render :json => @partial_con.to_json_for_page(params[:page], params[:width_in_bases])
- }
+ format.json do
+ render json: @partial_con.to_json_for_page(params[:page], params[:width_in_bases])
+ end
end
end
def show_position
respond_to do |format|
- format.json {
- render :json => @partial_con.to_json_for_position(params[:position], params[:width_in_bases])
- }
+ format.json do
+ render json: @partial_con.to_json_for_position(params[:position], params[:width_in_bases])
+ end
end
end
diff --git a/app/controllers/plant_plates_controller.rb b/app/controllers/plant_plates_controller.rb
index 7c67b0fa..30fdb4d5 100644
--- a/app/controllers/plant_plates_controller.rb
+++ b/app/controllers/plant_plates_controller.rb
@@ -1,23 +1,24 @@
+# frozen_string_literal: true
+
class PlantPlatesController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_plant_plate, only: [:show, :edit, :update, :destroy]
+ before_action :set_plant_plate, only: %i[show edit update destroy]
# GET /plant_plates
# GET /plant_plates.json
def index
respond_to do |format|
format.html
- format.json { render json: PlantPlateDatatable.new(view_context, current_project_id)}
+ format.json { render json: PlantPlateDatatable.new(view_context, current_project_id) }
end
end
# GET /plant_plates/1
# GET /plant_plates/1.json
- def show
- end
+ def show; end
# GET /plant_plates/new
def new
@@ -25,8 +26,7 @@ def new
end
# GET /plant_plates/1/edit
- def edit
- end
+ def edit; end
# POST /plant_plates
# POST /plant_plates.json
@@ -78,6 +78,6 @@ def set_plant_plate
# Never trust parameters from the scary internet, only allow the white list through.
def plant_plate_params
- params.require(:plant_plate).permit(:name, :how_many, :project_ids => [])
+ params.require(:plant_plate).permit(:name, :how_many, project_ids: [])
end
end
diff --git a/app/controllers/primer_pos_on_genomes_controller.rb b/app/controllers/primer_pos_on_genomes_controller.rb
index 188e4b9d..b01b7642 100644
--- a/app/controllers/primer_pos_on_genomes_controller.rb
+++ b/app/controllers/primer_pos_on_genomes_controller.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class PrimerPosOnGenomesController < ApplicationController
load_and_authorize_resource
- before_action :set_primer_pos_on_genome, only: [:show, :edit, :update, :destroy]
+ before_action :set_primer_pos_on_genome, only: %i[show edit update destroy]
# GET /primer_pos_on_genomes
# GET /primer_pos_on_genomes.json
@@ -11,8 +13,7 @@ def index
# GET /primer_pos_on_genomes/1
# GET /primer_pos_on_genomes/1.json
- def show
- end
+ def show; end
# GET /primer_pos_on_genomes/new
def new
@@ -20,8 +21,7 @@ def new
end
# GET /primer_pos_on_genomes/1/edit
- def edit
- end
+ def edit; end
# POST /primer_pos_on_genomes
# POST /primer_pos_on_genomes.json
@@ -64,13 +64,14 @@ def destroy
end
private
- # Use callbacks to share common setup or constraints between actions.
- def set_primer_pos_on_genome
- @primer_pos_on_genome = PrimerPosOnGenome.find(params[:id])
- end
- # Never trust parameters from the scary internet, only allow the white list through.
- def primer_pos_on_genome_params
- params.require(:primer_pos_on_genome).permit(:note, :position)
- end
+ # Use callbacks to share common setup or constraints between actions.
+ def set_primer_pos_on_genome
+ @primer_pos_on_genome = PrimerPosOnGenome.find(params[:id])
+ end
+
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def primer_pos_on_genome_params
+ params.require(:primer_pos_on_genome).permit(:note, :position)
+ end
end
diff --git a/app/controllers/primer_reads_controller.rb b/app/controllers/primer_reads_controller.rb
index 8280494c..757924dc 100644
--- a/app/controllers/primer_reads_controller.rb
+++ b/app/controllers/primer_reads_controller.rb
@@ -1,39 +1,40 @@
+# frozen_string_literal: true
+
class PrimerReadsController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- skip_authorize_resource only: [:change_base, :change_left_clip, :change_right_clip]
- skip_authorization_check only: [:change_base, :change_left_clip, :change_right_clip]
+ skip_authorize_resource only: %i[change_base change_left_clip change_right_clip]
+ skip_authorization_check only: %i[change_base change_left_clip change_right_clip]
- before_action :set_primer_read, only: [:go_to_pos, :do_not_use_for_assembly, :use_for_assembly, :change_left_clip, :change_right_clip, :edit, :fasta, :reverse, :restore, :assign, :trim, :show, :update, :change_base, :destroy]
+ before_action :set_primer_read, only: %i[go_to_pos do_not_use_for_assembly use_for_assembly change_left_clip change_right_clip edit fasta reverse restore assign trim show update change_base destroy]
# GET /primer_reads
# GET /primer_reads.json
def index
respond_to do |format|
format.html
- format.json { render json: PrimerReadDatatable.new(view_context, '', current_project_id)}
+ format.json { render json: PrimerReadDatatable.new(view_context, '', current_project_id) }
end
end
def duplicates
respond_to do |format|
format.html
- format.json { render json: PrimerReadDatatable.new(view_context, 'duplicates', current_project_id)}
+ format.json { render json: PrimerReadDatatable.new(view_context, 'duplicates', current_project_id) }
end
end
def reads_without_contigs
respond_to do |format|
format.html
- format.json { render json: PrimerReadDatatable.new(view_context, 'no_contig', current_project_id)}
+ format.json { render json: PrimerReadDatatable.new(view_context, 'no_contig', current_project_id) }
end
end
# GET /primer_reads/1
# GET /primer_reads/1.json
- def show
- end
+ def show; end
# GET /primer_reads/new
def new
@@ -42,7 +43,7 @@ def new
# GET /primer_reads/1/edit
def edit
- #@primer_read = PrimerRead.includes(:primer, :contig).find(params[:id]) #TODO Add select statement here to initially NOT load chromatogram?
+ # @primer_read = PrimerRead.includes(:primer, :contig).find(params[:id]) #TODO Add select statement here to initially NOT load chromatogram?
end
# POST /primer_reads
@@ -53,8 +54,8 @@ def create
if @primer_read.save
PherogramProcessing.perform_async(@primer_read.id)
- @primer_read.update(:sequence => '') if @primer_read.sequence.nil?
- @primer_read.update(:name => @primer_read.name + '_duplicate') if (PrimerRead.where(name: @primer_read.name).size > 1)
+ @primer_read.update(sequence: '') if @primer_read.sequence.nil?
+ @primer_read.update(name: @primer_read.name + '_duplicate') if PrimerRead.where(name: @primer_read.name).size > 1
end
end
@@ -83,28 +84,28 @@ def destroy
end
def do_not_use_for_assembly
- @primer_read.update(:used_for_con => false, :assembled => false)
+ @primer_read.update(used_for_con: false, assembled: false)
if @primer_read.contig
- if @primer_read.contig.primer_reads.where(:used_for_con => true).count <= 4
+ if @primer_read.contig.primer_reads.where(used_for_con: true).count <= 4
@primer_read.contig.auto_overlap
- msg='Assembly finished.'
+ msg = 'Assembly finished.'
else
ContigAssembly.perform_async(@primer_read.contig.id)
- msg='Assembly started in background.'
+ msg = 'Assembly started in background.'
end
end
redirect_back(fallback_location: primer_reads_path, notice: msg)
end
def use_for_assembly
- @primer_read.update(:used_for_con => true)
+ @primer_read.update(used_for_con: true)
if @primer_read.contig
- if @primer_read.contig.primer_reads.where(:used_for_con => true).count <= 4
+ if @primer_read.contig.primer_reads.where(used_for_con: true).count <= 4
@primer_read.contig.auto_overlap
- msg='Assembly finished.'
+ msg = 'Assembly finished.'
else
ContigAssembly.perform_async(@primer_read.contig.id)
- msg='Assembly started in background.'
+ msg = 'Assembly started in background.'
end
end
redirect_back(fallback_location: primer_reads_path, notice: msg)
@@ -129,7 +130,6 @@ def assign
else
redirect_to edit_primer_read_path, notice: msg_hash[:msg]
end
-
end
def reverse
@@ -137,10 +137,10 @@ def reverse
redirect_to edit_primer_read_path, alert: 'Already reversed.'
else
begin
- @primer_read.update(:reverse => true)
+ @primer_read.update(reverse: true)
@primer_read.auto_trim(true)
redirect_to edit_primer_read_path, notice: 'Reversed.'
- rescue
+ rescue StandardError
redirect_to edit_primer_read_path, alert: 'Could not reverse'
end
end
@@ -149,11 +149,11 @@ def reverse
def restore
if @primer_read.reverse
begin
- @primer_read.update(:reverse => false)
+ @primer_read.update(reverse: false)
@primer_read.auto_trim(true)
redirect_to edit_primer_read_path, notice: 'Restored non-reversed state.'
- rescue
+ rescue StandardError
redirect_to edit_primer_read_path, alert: 'Could not restore.'
end
else
@@ -173,7 +173,7 @@ def change_base
# If insertions needed: handle inserting new elements in qualities etc. arrays
if base.length > 1
- insertions_needed = base.length-1
+ insertions_needed = base.length - 1
qualities = @primer_read.qualities
insertions_needed.times do
@@ -185,9 +185,9 @@ def change_base
# Compute new indices based on existing neighbors:
left_index = peak_indices[pos]
- right_index = peak_indices[pos+1]
- distance = right_index-left_index
- x_increment = (distance/base.length)
+ right_index = peak_indices[pos + 1]
+ distance = right_index - left_index
+ x_increment = (distance / base.length)
x = left_index
insertions_needed.times do
@@ -198,7 +198,7 @@ def change_base
# In all cases (replacement, insertion & deletion) insert string:
sequence[pos] = base
- @primer_read.update(:sequence => sequence)
+ @primer_read.update(sequence: sequence)
head :ok
else
head :unauthorized
@@ -207,7 +207,7 @@ def change_base
def change_left_clip
if can? :change_left_clip, @primer_read
- @primer_read.update(:trimmedReadStart => params[:position].to_i)
+ @primer_read.update(trimmedReadStart: params[:position].to_i)
head :ok
else
head :unauthorized
@@ -216,7 +216,7 @@ def change_left_clip
def change_right_clip
if can? :change_right_clip, @primer_read
- @primer_read.update(:trimmedReadEnd => params[:position].to_i)
+ @primer_read.update(trimmedReadEnd: params[:position].to_i)
head :ok
else
head :unauthorized
@@ -229,16 +229,16 @@ def import
end
def fasta
- str=">#{@primer_read.name} \n#{@primer_read.trimmed_seq}"
+ str = ">#{@primer_read.name} \n#{@primer_read.trimmed_seq}"
# send_data str
- send_data(str, :filename => "#{@primer_read.name}.fas", :type => "application/txt")
+ send_data(str, filename: "#{@primer_read.name}.fas", type: 'application/txt')
end
private
# Use callbacks to share common setup or constraints between actions.
def set_primer_read
- @primer_read = PrimerRead.includes(:contig => { :isolate => :individual }).find(params[:id])
+ @primer_read = PrimerRead.includes(contig: { isolate: :individual }).find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
@@ -247,6 +247,6 @@ def primer_read_params
:used_for_con, :file, :name, :sequence, :pherogram_url, :chromatogram, :primer_id, :contig_id,
:contig_name, :isolate_id, :chromatograms, :trimmedReadEnd, :trimmedReadStart,
:min_quality_score, :count_in_window, :window_size,
- :position, :base, :project_ids => [])
+ :position, :base, project_ids: [])
end
-end
\ No newline at end of file
+end
diff --git a/app/controllers/primers_controller.rb b/app/controllers/primers_controller.rb
index 1a59cea7..ceba06e9 100644
--- a/app/controllers/primers_controller.rb
+++ b/app/controllers/primers_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class PrimersController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_primer, only: [:show, :edit, :update, :destroy]
+ before_action :set_primer, only: %i[show edit update destroy]
# GET /primers
# GET /primers.json
@@ -21,8 +23,7 @@ def import
# GET /primers/1
# GET /primers/1.json
- def show
- end
+ def show; end
# GET /primers/new
def new
@@ -30,8 +31,7 @@ def new
end
# GET /primers/1/edit
- def edit
- end
+ def edit; end
# POST /primers
# POST /primers.json
@@ -75,13 +75,14 @@ def destroy
end
private
- # Use callbacks to share common setup or constraints between actions.
- def set_primer
- @primer = Primer.find(params[:id])
- end
- # Never trust parameters from the scary internet, only allow the white list through.
- def primer_params
- params.require(:primer).permit(:alt_name, :position, :file, :name, :sequence, :reverse, :marker_id, :project_ids => [])
- end
+ # Use callbacks to share common setup or constraints between actions.
+ def set_primer
+ @primer = Primer.find(params[:id])
+ end
+
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def primer_params
+ params.require(:primer).permit(:alt_name, :position, :file, :name, :sequence, :reverse, :marker_id, project_ids: [])
+ end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index f673164a..aac6e67a 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -1,22 +1,23 @@
+# frozen_string_literal: true
+
class ProjectsController < ApplicationController
load_and_authorize_resource
- before_action :set_project, only: [:show, :edit, :update, :destroy]
+ before_action :set_project, only: %i[show edit update destroy]
# GET /projects
# GET /projects.json
def index
- if user_signed_in?
- @projects = current_user.admin? ? Project.all : current_user.projects
- else
- @projects = []
- end
+ @projects = if user_signed_in?
+ current_user.admin? ? Project.all : current_user.projects
+ else
+ []
+ end
end
# GET /projects/1
# GET /projects/1.json
- def show
- end
+ def show; end
# GET /projects/new
def new
@@ -24,8 +25,7 @@ def new
end
# GET /projects/1/edit
- def edit
- end
+ def edit; end
# POST /projects
# POST /projects.json
@@ -87,6 +87,7 @@ def add_to_taxa
end
private
+
# Use callbacks to share common setup or constraints between actions.
def set_project
@project = Project.find(params[:id])
@@ -94,6 +95,6 @@ def set_project
# Never trust parameters from the scary internet, only allow the white list through.
def project_params
- params.require(:project).permit(:name, :description, :start, :due, :user_ids => [])
+ params.require(:project).permit(:name, :description, :start, :due, user_ids: [])
end
end
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 76c8f539..783f448b 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -1,9 +1,10 @@
+# frozen_string_literal: true
+
class RegistrationsController < Devise::RegistrationsController
before_action :update_sanitized_params, if: :devise_controller?
def update_sanitized_params
- devise_parameter_sanitizer.permit(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)}
- devise_parameter_sanitizer.permit(:account_update) {|u| u.permit(:name, :email, :password, :password_confirmation, :current_password)}
+ devise_parameter_sanitizer.permit(:sign_up) { |u| u.permit(:name, :email, :password, :password_confirmation) }
+ devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:name, :email, :password, :password_confirmation, :current_password) }
end
-
end
diff --git a/app/controllers/responsibilities_controller.rb b/app/controllers/responsibilities_controller.rb
index 55b7c07f..05f9c3ca 100644
--- a/app/controllers/responsibilities_controller.rb
+++ b/app/controllers/responsibilities_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ResponsibilitiesController < ApplicationController
load_and_authorize_resource
@@ -5,15 +7,13 @@ def index
@responsibilities = Responsibility.all
end
- def show
- end
+ def show; end
def new
@responsibility = Responsibility.new
end
- def edit
- end
+ def edit; end
def create
@responsibility = Responsibility.new(responsibility_params)
@@ -50,6 +50,7 @@ def destroy
end
private
+
# Never trust parameters from the scary internet, only allow the white list through.
def responsibility_params
params.require(:responsibility).permit(:name, :description)
diff --git a/app/controllers/shelves_controller.rb b/app/controllers/shelves_controller.rb
index f3211531..727cec79 100644
--- a/app/controllers/shelves_controller.rb
+++ b/app/controllers/shelves_controller.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class ShelvesController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_shelf, only: [:show, :edit, :update, :destroy]
+ before_action :set_shelf, only: %i[show edit update destroy]
# GET /shelves
# GET /shelves.json
@@ -13,8 +15,7 @@ def index
# GET /shelves/1
# GET /shelves/1.json
- def show
- end
+ def show; end
# GET /shelves/new
def new
@@ -22,8 +23,7 @@ def new
end
# GET /shelves/1/edit
- def edit
- end
+ def edit; end
# POST /shelves
# POST /shelves.json
@@ -75,6 +75,6 @@ def set_shelf
# Never trust parameters from the scary internet, only allow the white list through.
def shelf_params
- params.require(:shelf).permit(:name, :project_ids => [])
+ params.require(:shelf).permit(:name, project_ids: [])
end
end
diff --git a/app/controllers/species_controller.rb b/app/controllers/species_controller.rb
index a7915e0f..a77fc5c9 100644
--- a/app/controllers/species_controller.rb
+++ b/app/controllers/species_controller.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
# noinspection RubyArgCount
class SpeciesController < ApplicationController
include ProjectConcern
load_and_authorize_resource
- before_action :set_species, only: [:show, :edit, :update, :destroy]
+ before_action :set_species, only: %i[show edit update destroy]
def create_xls
SpeciesExport.perform_async(current_project_id)
@@ -28,8 +30,8 @@ def index
end
def filter
- @species = Species.where("composed_name ILIKE ?", "%#{params[:term]}%").in_project(current_project_id).order(:composed_name).limit(100)
- size = Species.where("composed_name ILIKE ?", "%#{params[:term]}%").in_project(current_project_id).order(:composed_name).size
+ @species = Species.where('composed_name ILIKE ?', "%#{params[:term]}%").in_project(current_project_id).order(:composed_name).limit(100)
+ size = Species.where('composed_name ILIKE ?', "%#{params[:term]}%").in_project(current_project_id).order(:composed_name).size
if size > 100
render json: @species.map(&:composed_name).push("and #{size} more...")
@@ -81,18 +83,16 @@ def get_ant
def collect_and_send_species(ht)
str = ''
- @species = Species.joins(:family => { :order => :higher_order_taxon }).where(orders: { higher_order_taxon_id: ht.id }).in_project(current_project_id).each do |s|
+ @species = Species.joins(family: { order: :higher_order_taxon }).where(orders: { higher_order_taxon_id: ht.id }).in_project(current_project_id).each do |s|
str += s.id.to_s + "\t" + s.name_for_display + "\n"
end
- send_data(str, :filename => "#{ht.name}.txt", :type => "application/txt")
+ send_data(str, filename: "#{ht.name}.txt", type: 'application/txt')
end
-
# GET /species/1
# GET /species/1.json
- def show
- end
+ def show; end
# GET /species/new
def new
@@ -100,8 +100,7 @@ def new
end
# GET /species/1/edit
- def edit
- end
+ def edit; end
# POST /species
# POST /species.json
@@ -111,8 +110,8 @@ def create
respond_to do |format|
if @species.save
- @species.update(:species_component => @species.get_species_component)
- @species.update(:composed_name => @species.full_name)
+ @species.update(species_component: @species.get_species_component)
+ @species.update(composed_name: @species.full_name)
format.html { redirect_to species_index_path, notice: 'Species was successfully created.' }
format.json { render :show, status: :created, location: @species }
else
@@ -127,12 +126,12 @@ def create
def update
respond_to do |format|
if @species.update(species_params)
- @species.update(:species_component => @species.get_species_component)
- @species.update(:composed_name=>@species.full_name)
- format.html {
- Issue.create(:title => "#{@species.name_for_display} updated by #{current_user.name}")
+ @species.update(species_component: @species.get_species_component)
+ @species.update(composed_name: @species.full_name)
+ format.html do
+ Issue.create(title: "#{@species.name_for_display} updated by #{current_user.name}")
redirect_to species_index_path, notice: 'Species was successfully updated.'
- }
+ end
format.json { render :show, status: :ok, location: @species }
else
format.html { render :edit }
@@ -161,6 +160,6 @@ def set_species
# Never trust parameters from the scary internet, only allow the white list through.
def species_params
params.require(:species).permit(:term, :originalFileName, :file, :infraspecific, :comment, :author_infra, :family_name, :family_id,
- :author, :genus_name, :species_epithet, :composed_name, :project_ids => [])
+ :author, :genus_name, :species_epithet, :composed_name, project_ids: [])
end
-end
\ No newline at end of file
+end
diff --git a/app/controllers/tissues_controller.rb b/app/controllers/tissues_controller.rb
index ecac20e9..dd502405 100644
--- a/app/controllers/tissues_controller.rb
+++ b/app/controllers/tissues_controller.rb
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
class TissuesController < ApplicationController
load_and_authorize_resource
- before_action :set_tissue, only: [:show, :edit, :update, :destroy]
+ before_action :set_tissue, only: %i[show edit update destroy]
# GET /tissues
# GET /tissues.json
@@ -10,8 +12,7 @@ def index
# GET /tissues/1
# GET /tissues/1.json
- def show
- end
+ def show; end
# GET /tissues/new
def new
@@ -19,8 +20,7 @@ def new
end
# GET /tissues/1/edit
- def edit
- end
+ def edit; end
# POST /tissues
# POST /tissues.json
@@ -63,13 +63,14 @@ def destroy
end
private
- # Use callbacks to share common setup or constraints between actions.
- def set_tissue
- @tissue = Tissue.find(params[:id])
- end
- # Never trust parameters from the scary internet, only allow the white list through.
- def tissue_params
- params.require(:tissue).permit(:name)
- end
+ # Use callbacks to share common setup or constraints between actions.
+ def set_tissue
+ @tissue = Tissue.find(params[:id])
+ end
+
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def tissue_params
+ params.require(:tissue).permit(:name)
+ end
end
diff --git a/app/controllers/txt_uploaders_controller.rb b/app/controllers/txt_uploaders_controller.rb
index d3ce1e6f..39aed8c8 100644
--- a/app/controllers/txt_uploaders_controller.rb
+++ b/app/controllers/txt_uploaders_controller.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class TxtUploadersController < ApplicationController
- before_action :set_txt_uploader, only: [:show, :edit, :update, :destroy]
+ before_action :set_txt_uploader, only: %i[show edit update destroy]
# GET /txt_uploaders
# GET /txt_uploaders.json
@@ -9,8 +11,7 @@ def index
# GET /txt_uploaders/1
# GET /txt_uploaders/1.json
- def show
- end
+ def show; end
# GET /txt_uploaders/new
def new
@@ -18,8 +19,7 @@ def new
end
# GET /txt_uploaders/1/edit
- def edit
- end
+ def edit; end
# POST /txt_uploaders
# POST /txt_uploaders.json
@@ -62,13 +62,14 @@ def destroy
end
private
- # Use callbacks to share common setup or constraints between actions.
- def set_txt_uploader
- @txt_uploader = TxtUploader.find(params[:id])
- end
- # Never trust parameters from the scary internet, only allow the white list through.
- def txt_uploader_params
- params[:txt_uploader]
- end
+ # Use callbacks to share common setup or constraints between actions.
+ def set_txt_uploader
+ @txt_uploader = TxtUploader.find(params[:id])
+ end
+
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def txt_uploader_params
+ params[:txt_uploader]
+ end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 4f8fffab..e55b3e4b 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UsersController < ApplicationController
load_and_authorize_resource
@@ -27,7 +29,7 @@ def edit
def update
@user = User.find(params[:id])
- puts "ATTENTION"
+ puts 'ATTENTION'
puts params[:id], current_user.id
if @user.admin? && !current_user.admin?
@@ -65,7 +67,8 @@ def home
end
private
+
def user_params
- params.require(:user).permit(:name, :email, :password, :password_confirmation, :role, :lab_id, :default_project_id, :project_ids => [], :responsibility_ids => [])
+ params.require(:user).permit(:name, :email, :password, :password_confirmation, :role, :lab_id, :default_project_id, project_ids: [], responsibility_ids: [])
end
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 272fc711..be666f65 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Ability
include CanCan::Ability
@@ -30,17 +32,17 @@ def initialize(user)
# https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities
# Permissions for every user, even if not logged in
- can [:edit, :index, :filter, :change_via_script, :compare_contigs, :as_fasq], Contig
- can [:edit, :index, :filter, :show_species], Family
- can [:edit, :index, :show_species], HigherOrderTaxon
- can [:about, :overview, :impressum, :privacy_policy], :home
- can [:edit, :index, :filter, :xls], Individual
- can [:edit, :index, :filter], Isolate
+ can %i[edit index filter change_via_script compare_contigs as_fasq], Contig
+ can %i[edit index filter show_species], Family
+ can %i[edit index show_species], HigherOrderTaxon
+ can %i[about overview impressum privacy_policy], :home
+ can %i[edit index filter xls], Individual
+ can %i[edit index filter], Isolate
can [:filter], MarkerSequence
- can [:edit, :index, :filter], Order
+ can %i[edit index filter], Order
can :manage, PartialCon
- can [:edit, :index], PrimerRead
- can [:edit, :index, :filter, :show_individuals, :xls], Species
+ can %i[edit index], PrimerRead
+ can %i[edit index filter show_individuals xls], Species
can :manage, TxtUploader
can :manage, :overview_diagram
@@ -51,15 +53,15 @@ def initialize(user)
cannot :manage, User
cannot :manage, Project
cannot :manage, Responsibility
- cannot [:create, :destroy], MislabelAnalysis
- cannot [:create, :destroy], Mislabel
+ cannot %i[create destroy], MislabelAnalysis
+ cannot %i[create destroy], Mislabel
- can [:read, :search_taxa, :add_to_taxa], Project, id: user.project_ids
+ can %i[read search_taxa add_to_taxa], Project, id: user.project_ids
# Additional permissions for guests
if user.guest?
- cannot [:change_base, :change_left_clip, :change_right_clip], PrimerRead
- cannot [:create, :update, :destroy], :all
+ cannot %i[change_base change_left_clip change_right_clip], PrimerRead
+ cannot %i[create update destroy], :all
can :edit, :all
end
@@ -71,10 +73,10 @@ def initialize(user)
can :manage, MislabelAnalysis
can :manage, Mislabel
- cannot [:create, :update, :destroy], User, role: 'admin' if user.supervisor?
+ cannot %i[create update destroy], User, role: 'admin' if user.supervisor?
end
- can [:home, :show, :edit, :update, :destroy], User, id: user.id # User can see and edit own profile
+ can %i[home show edit update destroy], User, id: user.id # User can see and edit own profile
cannot :manage, ContigSearch
can :create, ContigSearch
@@ -84,15 +86,15 @@ def initialize(user)
can :create, MarkerSequenceSearch
can :manage, MarkerSequenceSearch, user_id: user.id # Users can only edit their own searches
- if user.responsibilities.exists?(:name => "lab") # Restrictions for users in project "lab"
- cannot [:create, :update, :destroy], [Family, Species, Individual, Division, Order, TaxonomicClass, HigherOrderTaxon]
+ if user.responsibilities.exists?(name: 'lab') # Restrictions for users in project "lab"
+ cannot %i[create update destroy], [Family, Species, Individual, Division, Order, TaxonomicClass, HigherOrderTaxon]
can :edit, [Family, Species, Individual, Division, Order, TaxonomicClass, HigherOrderTaxon]
- elsif user.responsibilities.exists?(:name => 'taxonomy') # Restrictions for users in project "taxonomy"
- cannot [:create, :update, :destroy], [Alignment, Contig, Freezer, Isolate, Issue, Lab, LabRack, Marker,
- MarkerSequence, MicronicPlate, PartialCon, PlantPlate, Primer, PrimerRead, Shelf, Tissue]
+ elsif user.responsibilities.exists?(name: 'taxonomy') # Restrictions for users in project "taxonomy"
+ cannot %i[create update destroy], [Alignment, Contig, Freezer, Isolate, Issue, Lab, LabRack, Marker,
+ MarkerSequence, MicronicPlate, PartialCon, PlantPlate, Primer, PrimerRead, Shelf, Tissue]
can :edit, [Alignment, Contig, Freezer, Isolate, Issue, Lab, LabRack, Marker, MarkerSequence, MicronicPlate,
PartialCon, PlantPlate, Primer, PrimerRead, Shelf, Tissue]
- cannot [:change_base, :change_left_clip, :change_right_clip], PrimerRead
+ cannot %i[change_base change_left_clip change_right_clip], PrimerRead
cannot :manage, ContigSearch
cannot :manage, MarkerSequenceSearch
end
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 10a4cba8..71fbba5b 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
diff --git a/app/models/concerns/export.rb b/app/models/concerns/export.rb
index 3cb70f94..716826b0 100644
--- a/app/models/concerns/export.rb
+++ b/app/models/concerns/export.rb
@@ -96,7 +96,7 @@ def fastq(contigs, use_mira)
def pde_contigs(contigs, add_reads)
contigs.each do |contig|
species = contig.try(:isolate).try(:individual).try(:species)&.composed_name
- contig_name = species.blank? ? contig.name : [contig.name, species.gsub(' ', '_')].join('_')
+ contig_name = species.blank? ? contig.name : [contig.name, species.tr(' ', '_')].join('_')
contig.partial_cons.each do |partial_con|
aligned_sequence = partial_con.aligned_sequence.nil? ? '' : partial_con.aligned_sequence
@@ -109,20 +109,20 @@ def pde_contigs(contigs, add_reads)
next unless add_reads
# Add unassembled reads:
- contig.primer_reads.not_assembled.each { |read| add_primer_read_to_pde(read, false) } if (contig.primer_reads.not_assembled.count > 0)
+ contig.primer_reads.not_assembled.each { |read| add_primer_read_to_pde(read, false) } if contig.primer_reads.not_assembled.count > 0
- contig.primer_reads.not_used_for_assembly.each { |read| add_primer_read_to_pde(read, false) } if (contig.primer_reads.not_used_for_assembly.count > 0)
+ contig.primer_reads.not_used_for_assembly.each { |read| add_primer_read_to_pde(read, false) } if contig.primer_reads.not_used_for_assembly.count > 0
- contig.primer_reads.not_trimmed.each { |read| add_primer_read_to_pde(read, false) } if (contig.primer_reads.not_trimmed.count > 0)
+ contig.primer_reads.not_trimmed.each { |read| add_primer_read_to_pde(read, false) } if contig.primer_reads.not_trimmed.count > 0
- contig.primer_reads.unprocessed.each { |read| add_primer_read_to_pde(read, false) } if (contig.primer_reads.unprocessed.count > 0)
+ contig.primer_reads.unprocessed.each { |read| add_primer_read_to_pde(read, false) } if contig.primer_reads.unprocessed.count > 0
end
end
def pde_marker_sequences(marker_sequences)
marker_sequences.each do |marker_sequence|
species = marker_sequence.try(:isolate).try(:individual).try(:species)&.composed_name
- name = species.blank? ? marker_sequence.name : [marker_sequence.name, species.gsub(' ', '_')].join('_')
+ name = species.blank? ? marker_sequence.name : [marker_sequence.name, species.tr(' ', '_')].join('_')
add_sequence_to_pde(name, species, routes.edit_marker_sequence_url(marker_sequence, url_options), marker_sequence.sequence, false)
end
@@ -144,12 +144,12 @@ def fasta_contigs(contigs, mode)
add_sequence_to_fasta(name, partial_con.aligned_sequence)
end
when 'trimmed'
- used_reads = contig.primer_reads.where("used_for_con = ? AND assembled = ?", true, true).order('position')
+ used_reads = contig.primer_reads.where('used_for_con = ? AND assembled = ?', true, true).order('position')
used_reads.each do |read|
add_sequence_to_fasta(read.name, read.trimmed_seq)
end
when 'raw'
- used_reads = contig.primer_reads.where("used_for_con = ? AND assembled = ?", true, true).order('position')
+ used_reads = contig.primer_reads.where('used_for_con = ? AND assembled = ?', true, true).order('position')
used_reads.each do |read|
add_sequence_to_fasta(read.name, read.sequence)
end
@@ -185,7 +185,7 @@ def url_options
end
def add_sequence_to_pde(name, species, url, sequence, is_primer_read)
- sequence = sequence ? sequence : ''
+ sequence ||= ''
@pde_header += ""\
"#{name}"
@@ -234,11 +234,10 @@ def add_sequence_to_fastq(contig, use_mira)
qualities_to_use = use_mira ? partial_con.mira_consensus_qualities : partial_con.aligned_qualities
qualities_to_use.each do |q|
- if q > 0
- consensus += raw_cons[count]
- qualities += (q + 33).chr
- count += 1
- end
+ next unless q > 0
+ consensus += raw_cons[count]
+ qualities += (q + 33).chr
+ count += 1
end
# Return empty string in case that sequence and qualities do not have the same length
diff --git a/app/models/concerns/import.rb b/app/models/concerns/import.rb
index fcb9ee4c..ab4d7c97 100644
--- a/app/models/concerns/import.rb
+++ b/app/models/concerns/import.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Import
extend ActiveSupport::Concern
@@ -59,7 +61,7 @@ def search_dna_bank(id_string, individual = nil)
latitude = unit.at_xpath('//abcd21:LatitudeDecimal').content
higher_taxon_rank = unit.at_xpath('//abcd21:HigherTaxonRank').content
higher_taxon_name = unit.at_xpath('//abcd21:HigherTaxonName').content
- rescue
+ rescue StandardError
puts 'Could not read ABCD.'
end
@@ -71,36 +73,36 @@ def search_dna_bank(id_string, individual = nil)
puts "ID: #{individual.id}"
puts "Specimen ID: #{specimen_unit_id}"
- individual.update(:specimen_id => specimen_unit_id)
+ individual.update(specimen_id: specimen_unit_id)
if unit_id
puts "DNABank number: #{unit_id}"
- individual.update(:DNA_bank_id => unit_id)
+ individual.update(DNA_bank_id: unit_id)
end
if collector
puts "Collector: #{collector.strip}"
- individual.update(:collector => collector.strip)
+ individual.update(collector: collector.strip)
end
if locality
puts "Locality: #{locality}"
- individual.update(:locality => locality)
+ individual.update(locality: locality)
end
if longitude
puts "Longitude: #{longitude}"
- individual.update(:longitude => longitude)
+ individual.update(longitude: longitude)
end
if latitude
puts "Latitude: #{latitude}"
- individual.update(:latitude => latitude)
+ individual.update(latitude: latitude)
end
if herbarium
puts "Herbarium: #{herbarium}"
- individual.update(:herbarium => herbarium)
+ individual.update(herbarium: herbarium)
end
if full_name
@@ -117,33 +119,33 @@ def search_dna_bank(id_string, individual = nil)
species = individual.species
if species.nil?
- species = Species.find_or_create_by(:species_component => species_component)
- species.update(:genus_name => genus)
- species.update(:species_epithet => species_epithet)
- species.update(:composed_name => species.full_name)
+ species = Species.find_or_create_by(species_component: species_component)
+ species.update(genus_name: genus)
+ species.update(species_epithet: species_epithet)
+ species.update(composed_name: species.full_name)
if higher_taxon_rank == 'familia'
- if higher_taxon_name.capitalize == 'Labiatae'
+ if higher_taxon_name.capitalize == 'Labiatae'
higher_taxon_name = 'Lamiaceae'
end
- family = Family.find_or_create_by(:name => higher_taxon_name.capitalize)
+ family = Family.find_or_create_by(name: higher_taxon_name.capitalize)
puts "Family: #{higher_taxon_name}"
- species.update(:family => family)
+ species.update(family: family)
end
- individual.update(:species => species)
+ individual.update(species: species)
end
end
end
- isolate = Isolate.where(:lab_nr => id_string).first
- isolate&.update(:individual => individual)
+ isolate = Isolate.where(lab_nr: id_string).first
+ isolate&.update(individual: individual)
end
puts 'Done.'
individual
end
-end
\ No newline at end of file
+end
diff --git a/app/models/concerns/project_record.rb b/app/models/concerns/project_record.rb
index 34d447bc..cdb3834a 100644
--- a/app/models/concerns/project_record.rb
+++ b/app/models/concerns/project_record.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Contains methods used by records with associated projects
module ProjectRecord
extend ActiveSupport::Concern
@@ -11,7 +13,7 @@ module ProjectRecord
# Adds the given project as well as the general project if not already added
def add_project(project_id)
project = Project.find(project_id)
- project_all = Project.where('name like ?', "All%").first
+ project_all = Project.where('name like ?', 'All%').first
projects << project unless projects.include?(project)
projects << project_all unless projects.include?(project_all)
@@ -27,4 +29,4 @@ def in_project(project_id)
joins(:projects).where(projects: { id: project_id }).distinct
end
end
-end
\ No newline at end of file
+end
diff --git a/app/models/contig.rb b/app/models/contig.rb
index dbba031f..5737a977 100644
--- a/app/models/contig.rb
+++ b/app/models/contig.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# noinspection RubyStringKeysInHashInspection
class Contig < ApplicationRecord
include Export
@@ -30,9 +32,9 @@ class Contig < ApplicationRecord
def self.spp_in_higher_order_taxon(higher_order_taxon_id)
# TODO: (how to) includes spp. etc (on top of individual)
- contigs = Contig.select("species_id").includes(:isolate => :individual).joins(:isolate => {:individual => {:species => {:family => {:order => :higher_order_taxon}}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
- contigs_s = Contig.select("species_component").includes(:isolate => :individual).joins(:isolate => {:individual => {:species => {:family => {:order => :higher_order_taxon}}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
- contigs_i = Contig.select("individual_id").includes(:isolate => :individual).joins(:isolate => {:individual => {:species => {:family => {:order => :higher_order_taxon}}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
+ contigs = Contig.select('species_id').includes(isolate: :individual).joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
+ contigs_s = Contig.select('species_component').includes(isolate: :individual).joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
+ contigs_i = Contig.select('individual_id').includes(isolate: :individual).joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
[contigs.count, contigs_s.distinct.count, contigs.distinct.count, contigs_i.distinct.count]
end
@@ -45,7 +47,7 @@ def isolate_name=(name)
if name == ''
self.isolate = nil
else
- self.isolate = Isolate.find_or_create_by(:lab_nr => name) if name.present?
+ self.isolate = Isolate.find_or_create_by(lab_nr: name) if name.present?
end
end
@@ -57,16 +59,16 @@ def marker_sequence_name=(name)
if name == ''
self.marker_sequence = nil
else
- self.marker_sequence = MarkerSequence.find_or_create_by(:name => name) if name.present?
+ self.marker_sequence = MarkerSequence.find_or_create_by(name: name) if name.present?
end
end
def generate_name
- if self.marker.present? && self.isolate.present?
- self.name = "#{self.isolate.lab_nr}_#{self.marker.name}"
- else
- self.name = ''
- end
+ self.name = if marker.present? && isolate.present?
+ "#{isolate.lab_nr}_#{marker.name}"
+ else
+ ''
+ end
end
def mda(width, height)
@@ -74,23 +76,21 @@ def mda(width, height)
end
def degapped_consensus
- self.consensus.gsub('-', '')
+ consensus.delete('-')
end
def as_fasq(mira)
use_mira = false
- if mira == "1" or mira == 1
- use_mira = true
- end
+ use_mira = true if (mira == '1') || (mira == 1)
# restrict to cases with partial_cons count == 1
- if self.partial_cons.count > 1 or self.partial_cons.count < 1
- puts "Must have 1 partial_cons."
+ if (partial_cons.count > 1) || (partial_cons.count < 1)
+ puts 'Must have 1 partial_cons.'
return
end
- pc = self.partial_cons.first
+ pc = partial_cons.first
# compute coverage
used_nucleotides_count = 0
@@ -102,7 +102,7 @@ def as_fasq(mira)
coverage = (used_nucleotides_count.to_f / pc.aligned_sequence.length)
# header
- fasq_str = "@#{self.name} | #{sprintf '%.2f', coverage}"
+ fasq_str = "@#{name} | #{format '%.2f', coverage}"
# seq
raw_cons = pc.aligned_sequence
@@ -114,21 +114,20 @@ def as_fasq(mira)
ctr = 0
- if use_mira
- qualities_to_use = pc.aligned_qualities
- else
- qualities_to_use = pc.mira_consensus_qualities
- end
+ qualities_to_use = if use_mira
+ pc.aligned_qualities
+ else
+ pc.mira_consensus_qualities
+ end
qualities_to_use.each do |q|
- if q > 0
- cons_seq += raw_cons[ctr]
- qual_str += (q + 33).chr
- ctr += 1
- end
+ next unless q > 0
+ cons_seq += raw_cons[ctr]
+ qual_str += (q + 33).chr
+ ctr += 1
end
- #check that seq + qual have same length -> for externally verified this needs not be true
+ # check that seq + qual have same length -> for externally verified this needs not be true
unless cons_seq.length == qual_str.length
puts "Error: seq (#{seq_no_gaps.length}) + qual (#{ctr}) do not have same length"
return
@@ -136,65 +135,63 @@ def as_fasq(mira)
"#{fasq_str}\n#{cons_seq}\n+\n#{qual_str}\n"
end
-
- def auto_overlap
- self.partial_cons.destroy_all
+ def auto_overlap
+ partial_cons.destroy_all
msg = nil
- self.primer_reads.use_for_assembly.update_all(:assembled => false)
+ primer_reads.use_for_assembly.update_all(assembled: false)
- remaining_reads = Array.new(self.primer_reads.use_for_assembly) #creates local Array to mess around without affecting db
+ remaining_reads = Array.new(primer_reads.use_for_assembly) # creates local Array to mess around without affecting db
- #test how many
+ # test how many
if remaining_reads.size > 10
- # todo: arbitrary, change.
+ # TODO: arbitrary, change.
msg = 'Currently no more than 10 reads allowed for assembly.'
return
elsif remaining_reads.size == 1
- single_read = self.primer_reads.use_for_assembly.first
+ single_read = primer_reads.use_for_assembly.first
single_read.get_aligned_peak_indices
- pc = PartialCon.create(:aligned_sequence => single_read.trimmed_and_cleaned_seq, :aligned_qualities => single_read.trimmed_quals, :contig_id => self.id)
+ pc = PartialCon.create(aligned_sequence: single_read.trimmed_and_cleaned_seq, aligned_qualities: single_read.trimmed_quals, contig_id: id)
single_read.aligned_qualities = single_read.trimmed_quals
single_read.aligned_seq = single_read.trimmed_and_cleaned_seq
single_read.assembled = true
single_read.save
pc.primer_reads << single_read
- self.partial_cons << pc
- ms = MarkerSequence.find_or_create_by(:name => self.name, :sequence => single_read.trimmed_and_cleaned_seq)
+ partial_cons << pc
+ ms = MarkerSequence.find_or_create_by(name: name, sequence: single_read.trimmed_and_cleaned_seq)
ms.contigs << self
- ms.marker = self.marker
- ms.isolate = self.isolate
- ms.projects = self.projects
+ ms.marker = marker
+ ms.isolate = isolate
+ ms.projects = projects
ms.save
self.marker_sequence = ms
return
- elsif remaining_reads.size == 0
+ elsif remaining_reads.empty?
msg = 'Need at least 1 read for creating consensus sequence.'
return
end
- #test if trimmed_Seq
+ # test if trimmed_Seq
- starting_read = remaining_reads.delete_at(0) #Deletes the element at the specified index, returning that element, or nil if the index is out of range.
+ starting_read = remaining_reads.delete_at(0) # Deletes the element at the specified index, returning that element, or nil if the index is out of range.
assembled_reads = [starting_read] # successfully overlapped reads
- growing_consensus = {:reads => [{:read => starting_read,
- :aligned_seq => starting_read.trimmed_and_cleaned_seq,
- :aligned_qualities => starting_read.trimmed_quals}],
- :consensus => starting_read.trimmed_and_cleaned_seq,
- :consensus_qualities => starting_read.trimmed_quals}
+ growing_consensus = { reads: [{ read: starting_read,
+ aligned_seq: starting_read.trimmed_and_cleaned_seq,
+ aligned_qualities: starting_read.trimmed_quals }],
+ consensus: starting_read.trimmed_and_cleaned_seq,
+ consensus_qualities: starting_read.trimmed_quals }
- partial_contigs = Array.new #contains singleton reads and successful overlaps (sub-contigs) that
+ partial_contigs = [] # contains singleton reads and successful overlaps (sub-contigs) that
# themselves are isolated (including the single & final contig if everything could be overlapped)
# format: partial_contigs.push({:reads => assembled_reads, :consensus => growing_consensus })
-
assemble(growing_consensus, assembled_reads, partial_contigs, remaining_reads)
# -----> ASSEMBLY <------
@@ -202,21 +199,20 @@ def auto_overlap
current_largest_partial_contig = 0
current_largest_partial_contig_seq = nil
- #clean previously stored partial_cons:
- self.partial_cons.destroy_all
+ # clean previously stored partial_cons:
+ partial_cons.destroy_all
- height = 0 #count needed lines for pde dimensions
+ height = 0 # count needed lines for pde dimensions
max_width = 0
- block_seqs = [] #collect sequences for block, later fill with '?' up to max_width
+ block_seqs = [] # collect sequences for block, later fill with '?' up to max_width
partial_contigs.each do |partial_contig|
-
- #single partial_contig: ({:reads => assembled_reads, :consensus => growing_consensus})
+ # single partial_contig: ({:reads => assembled_reads, :consensus => growing_consensus})
if partial_contig[:reads].size > 1 # something where 2 or more primers overlapped:
- #growing_consensus = {:reads => [{:read => starting_read, :aligned_seq => starting_read.trimmed_and_cleaned_seq}],
+ # growing_consensus = {:reads => [{:read => starting_read, :aligned_seq => starting_read.trimmed_and_cleaned_seq}],
# :consensus => starting_read.trimmed_and_cleaned_seq }
if partial_contig[:reads].size > current_largest_partial_contig
@@ -226,45 +222,41 @@ def auto_overlap
growing_consensus = partial_contig[:consensus]
- pc = PartialCon.create(:aligned_sequence => growing_consensus[:consensus], :aligned_qualities => growing_consensus[:consensus_qualities])
+ pc = PartialCon.create(aligned_sequence: growing_consensus[:consensus], aligned_qualities: growing_consensus[:consensus_qualities])
growing_consensus[:reads].each do |aligned_read|
-
- #get original primer_read from db:
+ # get original primer_read from db:
pr = PrimerRead.find(aligned_read[:read].id)
- pr.update(:aligned_seq => aligned_read[:aligned_seq], :assembled => true, :aligned_qualities => aligned_read[:aligned_qualities])
+ pr.update(aligned_seq: aligned_read[:aligned_seq], assembled: true, aligned_qualities: aligned_read[:aligned_qualities])
pr.get_aligned_peak_indices # <-- uses aligned_qualities to populate aligned_peak_indices array. Needed in new variant of d3.js contig slize
pc.primer_reads << pr
-
end
- self.partial_cons << pc
+ partial_cons << pc
else # singleton
end
-
end
# set to "assembled" & create MarkerSequence if applicable
- if current_largest_partial_contig >= self.marker.expected_reads
- self.update(:assembled => true)
+ if current_largest_partial_contig >= marker.expected_reads
+ update(assembled: true)
- ms = MarkerSequence.find_or_create_by(:name => self.name, :sequence => current_largest_partial_contig_seq.gsub('-',''))
+ ms = MarkerSequence.find_or_create_by(name: name, sequence: current_largest_partial_contig_seq.delete('-'))
ms.contigs << self
- ms.marker = self.marker
- ms.isolate = self.isolate
- ms.projects = self.projects
+ ms.marker = marker
+ ms.isolate = isolate
+ ms.projects = projects
ms.save
end
if msg
- Issue.create(:title => msg, :contig_id => self.id)
+ Issue.create(title: msg, contig_id: id)
self.assembled = false
end
-
end
# Recursive assembly function
@@ -273,62 +265,57 @@ def assemble(growing_consensus, assembled_reads, partial_contigs, remaining_read
none_overlapped = true
remaining_reads.each do |read|
-
aligned_seqs = overlap(growing_consensus, read.trimmed_and_cleaned_seq, read.trimmed_quals)
- if aligned_seqs # if one overlaps
-
- none_overlapped = false
+ next unless aligned_seqs # if one overlaps
- # only in case overlap worked copy the adjusted_aligned sequences that are returned from "overlap" over to growing_consensus:
- (0...aligned_seqs[:adjusted_prev_aligned_reads].size).each { |i|
- growing_consensus[:reads][i][:aligned_seq] = aligned_seqs[:adjusted_prev_aligned_reads][i]
- growing_consensus[:reads][i][:aligned_qualities] = aligned_seqs[:adjusted_prev_aligned_qualities][i]
- }
+ none_overlapped = false
- growing_consensus[:reads].push({:read => read,
- :aligned_seq => aligned_seqs[:read_seq],
- :aligned_qualities => aligned_seqs[:read_qal]})
+ # only in case overlap worked copy the adjusted_aligned sequences that are returned from "overlap" over to growing_consensus:
+ (0...aligned_seqs[:adjusted_prev_aligned_reads].size).each do |i|
+ growing_consensus[:reads][i][:aligned_seq] = aligned_seqs[:adjusted_prev_aligned_reads][i]
+ growing_consensus[:reads][i][:aligned_qualities] = aligned_seqs[:adjusted_prev_aligned_qualities][i]
+ end
+ growing_consensus[:reads].push(read: read,
+ aligned_seq: aligned_seqs[:read_seq],
+ aligned_qualities: aligned_seqs[:read_qal])
- # move it into assembled_reads
- overlapped_read = remaining_reads.delete(read)
- assembled_reads.push(overlapped_read)
+ # move it into assembled_reads
+ overlapped_read = remaining_reads.delete(read)
+ assembled_reads.push(overlapped_read)
- r = compute_consensus(aligned_seqs[:growing_cons_seq],
+ r = compute_consensus(aligned_seqs[:growing_cons_seq],
aligned_seqs[:growing_consensus_qualities],
aligned_seqs[:read_seq],
aligned_seqs[:read_qal])
- growing_consensus[:consensus] = r.first
- growing_consensus[:consensus_qualities] = r.last
-
- # break loop through remaining_reads
- break
-
- end
+ growing_consensus[:consensus] = r.first
+ growing_consensus[:consensus_qualities] = r.last
+ # break loop through remaining_reads
+ break
end
# if none overlaps,
if none_overlapped
# move assembled_reads into partial_contigs_and_singleton_reads
- partial_contigs.push({:reads => assembled_reads, :consensus => growing_consensus})
+ partial_contigs.push(reads: assembled_reads, consensus: growing_consensus)
# move first of remaining_reads into growing_consensus & assembled_reads
# ( just as during initializing prior to first function call)
new_starting_read = remaining_reads.delete_at(0)
- if new_starting_read #catch case when new aligned_read could not be pruned
+ if new_starting_read # catch case when new aligned_read could not be pruned
growing_assembled_reads_reset = [new_starting_read]
- growing_consensus_reset = {:reads => [{:read => new_starting_read,
- :aligned_seq => new_starting_read.trimmed_and_cleaned_seq,
- :aligned_qualities => new_starting_read.trimmed_quals}],
- :consensus => new_starting_read.trimmed_and_cleaned_seq, :consensus_qualities => new_starting_read.trimmed_quals}
+ growing_consensus_reset = { reads: [{ read: new_starting_read,
+ aligned_seq: new_starting_read.trimmed_and_cleaned_seq,
+ aligned_qualities: new_starting_read.trimmed_quals }],
+ consensus: new_starting_read.trimmed_and_cleaned_seq, consensus_qualities: new_starting_read.trimmed_quals }
assemble(growing_consensus_reset, growing_assembled_reads_reset, partial_contigs, remaining_reads)
end
@@ -338,7 +325,6 @@ def assemble(growing_consensus, assembled_reads, partial_contigs, remaining_read
assemble(growing_consensus, assembled_reads, partial_contigs, remaining_reads)
end
-
end
# Perform Needleman-Wunsch-based overlapping:
@@ -346,8 +332,8 @@ def overlap(growing_cons_hash, read, qualities)
growing_consensus = growing_cons_hash[:consensus]
growing_consensus_qualities = growing_cons_hash[:consensus_qualities]
- previously_aligned_reads = Array.new
- previously_aligned_qualities = Array.new
+ previously_aligned_reads = []
+ previously_aligned_qualities = []
growing_cons_hash[:reads].each do |curr_read|
previously_aligned_reads.push(curr_read[:aligned_seq])
@@ -391,8 +377,7 @@ def overlap(growing_cons_hash, read, qualities)
'-G' => -1,
'-C' => -1,
'-T' => -1,
- '--' => 1,
- }
+ '--' => 1 }
rows = read.length + 1
cols = growing_consensus.length + 1
@@ -406,14 +391,14 @@ def overlap(growing_cons_hash, read, qualities)
for i in 0...rows do a[i][0] = 0 end
for j in 0...cols do a[0][j] = 0 end
- (1...rows).each { |i|
- (1...cols).each { |j|
- choice1 = a[i - 1][j - 1] + s[(read[i - 1] + growing_consensus[j - 1]).upcase] #match
- choice2 = a[i - 1][j] + gap #insert
- choice3 = a[i][j - 1] + gap #delete
+ (1...rows).each do |i|
+ (1...cols).each do |j|
+ choice1 = a[i - 1][j - 1] + s[(read[i - 1] + growing_consensus[j - 1]).upcase] # match
+ choice2 = a[i - 1][j] + gap # insert
+ choice3 = a[i][j - 1] + gap # delete
a[i][j] = [choice1, choice2, choice3].max
- }
- }
+ end
+ end
aligned_read_seq = '' # -> aligned_read
aligned_read_qual = []
@@ -421,21 +406,20 @@ def overlap(growing_cons_hash, read, qualities)
aligned_cons_seq = '' # -> growing_consensus
aligned_cons_qual = []
- adjusted_prev_aligned_reads = Array.new
- adjusted_prev_aligned_qualities = Array.new
+ adjusted_prev_aligned_reads = []
+ adjusted_prev_aligned_qualities = []
- (0...previously_aligned_reads.size).each { |_|
+ (0...previously_aligned_reads.size).each do |_|
new_seq = ''
adjusted_prev_aligned_reads.push(new_seq)
adjusted_prev_aligned_qualities.push([])
- }
-
+ end
# for classic Needleman-Wunsch:
- #start from lowermost rightmost cell
+ # start from lowermost rightmost cell
- #for overlap:
+ # for overlap:
# the best score is now in A(m, j) such that A(m, j) = max_k,l(A(k,n),A(m,l)) and the alignment itself can be
# obtained by tracing back from A(m, j) to A(0, 0) as before.
@@ -449,9 +433,9 @@ def overlap(growing_cons_hash, read, qualities)
while i > 0
if a[i][j] > bestscore
- bestscore = a[i][j]
- bestscore_i = i
- bestscore_j = j
+ bestscore = a[i][j]
+ bestscore_i = i
+ bestscore_j = j
end
i -= 1
end
@@ -461,9 +445,9 @@ def overlap(growing_cons_hash, read, qualities)
while j > 0
if a[i][j] > bestscore
- bestscore = a[i][j]
- bestscore_i = i
- bestscore_j = j
+ bestscore = a[i][j]
+ bestscore_i = i
+ bestscore_j = j
end
j -= 1
end
@@ -473,89 +457,88 @@ def overlap(growing_cons_hash, read, qualities)
i = read.length
j = growing_consensus.length
- #add 5' extending gaps...
+ # add 5' extending gaps...
while i > bestscore_i
aligned_read_seq = read[i - 1].chr + aligned_read_seq
aligned_read_qual.unshift(qualities[i - 1])
- aligned_cons_seq = aligned_cons_seq + '-'
+ aligned_cons_seq += '-'
aligned_cons_qual.push(-1) # -1 ~ '-'
# mirror everything that's done to aligned_cons_seq in all previously aligned_seqs:
for k in 0...adjusted_prev_aligned_reads.size do
- adjusted_prev_aligned_reads[k] = adjusted_prev_aligned_reads[k] + '-'
- adjusted_prev_aligned_qualities[k].push(-1)
+ adjusted_prev_aligned_reads[k] = adjusted_prev_aligned_reads[k] + '-'
+ adjusted_prev_aligned_qualities[k].push(-1)
end
i -= 1
end
-
while j > bestscore_j
- aligned_read_seq = aligned_read_seq + '-'
+ aligned_read_seq += '-'
aligned_read_qual.push(-1)
aligned_cons_seq = growing_consensus[j - 1].chr + aligned_cons_seq
aligned_cons_qual.unshift(growing_consensus_qualities[j - 1])
for k in 0...adjusted_prev_aligned_reads.size do
- adjusted_prev_aligned_reads[k] = previously_aligned_reads[k][j - 1].chr + adjusted_prev_aligned_reads[k]
- adjusted_prev_aligned_qualities[k].unshift(previously_aligned_qualities[k][j - 1])
+ adjusted_prev_aligned_reads[k] = previously_aligned_reads[k][j - 1].chr + adjusted_prev_aligned_reads[k]
+ adjusted_prev_aligned_qualities[k].unshift(previously_aligned_qualities[k][j - 1])
end
j -= 1
end
- #tracing back...
+ # tracing back...
i = bestscore_i
j = bestscore_j
- while i > 0 and j > 0
+ while (i > 0) && (j > 0)
score = a[i][j]
score_diag = a[i - 1][j - 1]
score_up = a[i][j - 1]
score_left = a[i - 1][j]
- if score == score_diag + s[read[i - 1].chr + growing_consensus[j - 1].chr] #match
- aligned_read_seq = read[i - 1].chr + aligned_read_seq
- aligned_read_qual.unshift(qualities[i - 1])
- aligned_cons_seq = growing_consensus[j - 1].chr + aligned_cons_seq
- aligned_cons_qual.unshift(growing_consensus_qualities[j - 1])
-
- for k in 0...adjusted_prev_aligned_reads.size do
- adjusted_prev_aligned_reads[k] = previously_aligned_reads[k][j - 1].chr + adjusted_prev_aligned_reads[k]
- adjusted_prev_aligned_qualities[k].unshift(previously_aligned_qualities[k][j - 1])
- end
+ if score == score_diag + s[read[i - 1].chr + growing_consensus[j - 1].chr] # match
+ aligned_read_seq = read[i - 1].chr + aligned_read_seq
+ aligned_read_qual.unshift(qualities[i - 1])
+ aligned_cons_seq = growing_consensus[j - 1].chr + aligned_cons_seq
+ aligned_cons_qual.unshift(growing_consensus_qualities[j - 1])
+
+ for k in 0...adjusted_prev_aligned_reads.size do
+ adjusted_prev_aligned_reads[k] = previously_aligned_reads[k][j - 1].chr + adjusted_prev_aligned_reads[k]
+ adjusted_prev_aligned_qualities[k].unshift(previously_aligned_qualities[k][j - 1])
+ end
- i -= 1
- j -= 1
- elsif score == score_left + gap #insert
- aligned_read_seq = read[i - 1].chr + aligned_read_seq
- aligned_read_qual.unshift(qualities[i - 1])
- aligned_cons_seq = '-' + aligned_cons_seq
- aligned_cons_qual.unshift(-1)
+ i -= 1
+ j -= 1
+ elsif score == score_left + gap # insert
+ aligned_read_seq = read[i - 1].chr + aligned_read_seq
+ aligned_read_qual.unshift(qualities[i - 1])
+ aligned_cons_seq = '-' + aligned_cons_seq
+ aligned_cons_qual.unshift(-1)
+
+ for k in 0...adjusted_prev_aligned_reads.size do
+ adjusted_prev_aligned_reads[k] = '-' + adjusted_prev_aligned_reads[k]
+ adjusted_prev_aligned_qualities[k].unshift(-1)
+ end
- for k in 0...adjusted_prev_aligned_reads.size do
- adjusted_prev_aligned_reads[k] = '-' + adjusted_prev_aligned_reads[k]
- adjusted_prev_aligned_qualities[k].unshift(-1)
- end
+ i -= 1
+ elsif score == score_up + gap # delete
+ aligned_read_seq = '-' + aligned_read_seq
+ aligned_read_qual.unshift(-1)
+ aligned_cons_seq = growing_consensus[j - 1].chr + aligned_cons_seq
+ aligned_cons_qual.unshift(growing_consensus_qualities[j - 1])
- i -= 1
- elsif score == score_up + gap #delete
- aligned_read_seq = '-' + aligned_read_seq
- aligned_read_qual.unshift(-1)
- aligned_cons_seq = growing_consensus[j - 1].chr + aligned_cons_seq
- aligned_cons_qual.unshift(growing_consensus_qualities[j - 1])
-
- for k in 0...adjusted_prev_aligned_reads.size do
- adjusted_prev_aligned_reads[k] = previously_aligned_reads[k][j - 1].chr + adjusted_prev_aligned_reads[k]
- adjusted_prev_aligned_qualities[k].unshift(previously_aligned_qualities[k][j - 1])
- end
+ for k in 0...adjusted_prev_aligned_reads.size do
+ adjusted_prev_aligned_reads[k] = previously_aligned_reads[k][j - 1].chr + adjusted_prev_aligned_reads[k]
+ adjusted_prev_aligned_qualities[k].unshift(previously_aligned_qualities[k][j - 1])
+ end
- j -= 1
+ j -= 1
end
end
- #add 3' extending gaps...
+ # add 3' extending gaps...
while i > 0
aligned_read_seq = read[i - 1].chr + aligned_read_seq
aligned_read_qual.unshift(qualities[i - 1])
@@ -564,8 +547,8 @@ def overlap(growing_cons_hash, read, qualities)
# mirror everything that's done to aligned_cons_seq in all previously aligned_seqs:
for k in 0...adjusted_prev_aligned_reads.size do
- adjusted_prev_aligned_reads[k] = '-' + adjusted_prev_aligned_reads[k]
- adjusted_prev_aligned_qualities[k].unshift(-1)
+ adjusted_prev_aligned_reads[k] = '-' + adjusted_prev_aligned_reads[k]
+ adjusted_prev_aligned_qualities[k].unshift(-1)
end
i -= 1
@@ -579,8 +562,8 @@ def overlap(growing_cons_hash, read, qualities)
# mirror everything that's done to aligned_cons_seq in all previously aligned_seqs:
for k in 0...adjusted_prev_aligned_reads.size do
- adjusted_prev_aligned_reads[k] = previously_aligned_reads[k][j - 1].chr + adjusted_prev_aligned_reads[k]
- adjusted_prev_aligned_qualities[k].unshift(previously_aligned_qualities[k][j - 1])
+ adjusted_prev_aligned_reads[k] = previously_aligned_reads[k][j - 1].chr + adjusted_prev_aligned_reads[k]
+ adjusted_prev_aligned_qualities[k].unshift(previously_aligned_qualities[k][j - 1])
end
j -= 1
@@ -589,18 +572,17 @@ def overlap(growing_cons_hash, read, qualities)
msg = ''
msg_type = 1
- aligned_seqs = {:growing_cons_seq => aligned_cons_seq,
- :growing_consensus_qualities => aligned_cons_qual,
+ aligned_seqs = { growing_cons_seq: aligned_cons_seq,
+ growing_consensus_qualities: aligned_cons_qual,
- :read_seq => aligned_read_seq,
- :read_qal => aligned_read_qual,
+ read_seq: aligned_read_seq,
+ read_qal: aligned_read_qual,
- :adjusted_prev_aligned_reads => adjusted_prev_aligned_reads,
- :adjusted_prev_aligned_qualities => adjusted_prev_aligned_qualities,
+ adjusted_prev_aligned_reads: adjusted_prev_aligned_reads,
+ adjusted_prev_aligned_qualities: adjusted_prev_aligned_qualities,
- :message => msg,
- :message_type => msg_type
- }
+ message: msg,
+ message_type: msg_type }
# puts "growing_cons_seq:"
# puts aligned_seqs[:growing_cons_seq]
@@ -612,45 +594,44 @@ def overlap(growing_cons_hash, read, qualities)
diffs = 0
valids = 0
- conflicting_positions = Array.new
-
- (0...aligned_seqs[:growing_cons_seq].length).each { |m|
+ conflicting_positions = []
- if aligned_seqs[:growing_cons_seq][m] == '-' or aligned_seqs[:read_seq][m] == '-'
- next
+ (0...aligned_seqs[:growing_cons_seq].length).each do |m|
+ if (aligned_seqs[:growing_cons_seq][m] == '-') || (aligned_seqs[:read_seq][m] == '-')
+ next
else
- valids += 1
+ valids += 1
end
if aligned_seqs[:growing_cons_seq][m] != aligned_seqs[:read_seq][m]
- diffs += 1
- conflicting_positions << m
+ diffs += 1
+ conflicting_positions << m
end
- }
+ end
perc = (diffs.to_f / valids)
- if perc <= self.allowed_mismatch_percent / 100.0
+ if perc <= allowed_mismatch_percent / 100.0
# wenn zu wenig overlap:
- if valids < self.overlap_length
- #return nil
- nil
+ if valids < overlap_length
+ # return nil
+ nil
else
- #return alignment:
- aligned_seqs[:message] = perc
- aligned_seqs
+ # return alignment:
+ aligned_seqs[:message] = perc
+ aligned_seqs
end
else
- #return nil
+ # return nil
nil
end
end
def not_assembled
- self.primer_reads.not_assembled.as_json
+ primer_reads.not_assembled.as_json
end
def compute_consensus(seq1, qual1, seq2, qual2)
@@ -659,34 +640,20 @@ def compute_consensus(seq1, qual1, seq2, qual2)
for i in 0...seq1.length
- unless qual1[i] == -1 or qual2[i] == -1
+ if (qual1[i] == -1) || (qual2[i] == -1)
- if qual1[i] > qual2[i]
- consensus_qal.push(qual1[i])
- consensus_seq += seq1[i]
- else
- consensus_qal.push(qual2[i])
- consensus_seq += seq2[i]
- end
-
- else
-
- if qual1[i] == -1 and qual2[i] == -1
+ if (qual1[i] == -1) && (qual2[i] == -1)
consensus_qal.push(-1)
consensus_seq += '-'
else
if qual1[i] == -1
- #if further gap adjacent, it's most likely end of trimmed_seq --> qual2/seq2 win
+ # if further gap adjacent, it's most likely end of trimmed_seq --> qual2/seq2 win
trimmed_end = false
if i > 0
- if qual1[i - 1] == -1 or qual1[i + 1] == -1
- trimmed_end = true
- end
+ trimmed_end = true if (qual1[i - 1] == -1) || (qual1[i + 1] == -1)
else
- if qual1[i + 1] == -1
- trimmed_end = true
- end
+ trimmed_end = true if qual1[i + 1] == -1
end
if trimmed_end
@@ -696,13 +663,13 @@ def compute_consensus(seq1, qual1, seq2, qual2)
else
- #get surrounding base qualities
+ # get surrounding base qualities
- if i > 0
- neighboring_qual1 = qual1[i - 1]
- else
- neighboring_qual1 = qual1[i + 1]
- end
+ neighboring_qual1 = if i > 0
+ qual1[i - 1]
+ else
+ qual1[i + 1]
+ end
if neighboring_qual1 > qual2[i]
consensus_seq += '-'
@@ -715,16 +682,12 @@ def compute_consensus(seq1, qual1, seq2, qual2)
elsif qual2[i] == -1
- #if further gap adjacent, it's most likely end of trimmed_seq --> qual1/seq1 win
+ # if further gap adjacent, it's most likely end of trimmed_seq --> qual1/seq1 win
trimmed_end = false
if i > 0
- if qual2[i - 1] == -1 or qual2[i + 1] == -1
- trimmed_end = true
- end
+ trimmed_end = true if (qual2[i - 1] == -1) || (qual2[i + 1] == -1)
else
- if qual2[i + 1] == -1
- trimmed_end = true
- end
+ trimmed_end = true if qual2[i + 1] == -1
end
if trimmed_end
@@ -734,12 +697,12 @@ def compute_consensus(seq1, qual1, seq2, qual2)
else
- #get surrounding base qualities
- if i > 0
- neighboring_qual2 = qual2[i - 1]
- else
- neighboring_qual2 = qual2[i + 1]
- end
+ # get surrounding base qualities
+ neighboring_qual2 = if i > 0
+ qual2[i - 1]
+ else
+ qual2[i + 1]
+ end
if neighboring_qual2 > qual1[i]
consensus_seq += '-'
@@ -754,16 +717,20 @@ def compute_consensus(seq1, qual1, seq2, qual2)
end
- end
+ else
+ if qual1[i] > qual2[i]
+ consensus_qal.push(qual1[i])
+ consensus_seq += seq1[i]
+ else
+ consensus_qal.push(qual2[i])
+ consensus_seq += seq2[i]
+ end
+
+ end
end
[consensus_seq, consensus_qal]
-
-
end
end
-
-
-
diff --git a/app/models/contig_search.rb b/app/models/contig_search.rb
index 7dffb683..f00b8f31 100644
--- a/app/models/contig_search.rb
+++ b/app/models/contig_search.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
class ContigSearch < ApplicationRecord
include Export
belongs_to :user
belongs_to :project
- enum has_warnings: [:both, :yes, :no]
+ enum has_warnings: %i[both yes no]
# TODO: Unfinished feature
# has_attached_file :search_result_archive,
@@ -24,40 +26,40 @@ def contigs
def find_contigs
contigs = Contig.in_project(user.default_project_id).order(:name)
- contigs = contigs.where("contigs.name ilike ?", "%#{name}%") if name.present?
+ contigs = contigs.where('contigs.name ilike ?', "%#{name}%") if name.present?
if assembled != 'both'
- contigs = contigs.assembled if (assembled == 'assembled')
- contigs = contigs.not_assembled if (assembled == 'unassembled')
+ contigs = contigs.assembled if assembled == 'assembled'
+ contigs = contigs.not_assembled if assembled == 'unassembled'
end
if verified != 'both'
- contigs = contigs.verified if (verified == 'verified')
- contigs = contigs.where(verified: false) if (verified == 'unverified')
+ contigs = contigs.verified if verified == 'verified'
+ contigs = contigs.where(verified: false) if verified == 'unverified'
end
if has_warnings != 'both'
- contigs = contigs.with_warnings if (has_warnings == 'yes')
- contigs = contigs.where.not(id: Contig.with_warnings.pluck(:id)) if (has_warnings == 'no')
+ contigs = contigs.with_warnings if has_warnings == 'yes'
+ contigs = contigs.where.not(id: Contig.with_warnings.pluck(:id)) if has_warnings == 'no'
end
- contigs = contigs.joins(:marker).where("markers.name ilike ?", "%#{marker}%") if marker.present?
+ contigs = contigs.joins(:marker).where('markers.name ilike ?', "%#{marker}%") if marker.present?
- contigs = contigs.joins(isolate: { individual: { species: { family: :order } } }).where("orders.name ilike ?", "%#{order}%") if order.present?
+ contigs = contigs.joins(isolate: { individual: { species: { family: :order } } }).where('orders.name ilike ?', "%#{order}%") if order.present?
- contigs = contigs.joins(isolate: { individual: { species: :family } }).where("families.name ilike ?", "%#{family}%") if family.present?
+ contigs = contigs.joins(isolate: { individual: { species: :family } }).where('families.name ilike ?', "%#{family}%") if family.present?
- contigs = contigs.joins(isolate: { individual: :species }).where("species.composed_name ilike ?", "%#{species}%") if species.present?
+ contigs = contigs.joins(isolate: { individual: :species }).where('species.composed_name ilike ?', "%#{species}%") if species.present?
- contigs = contigs.joins(isolate: :individual).where("individuals.specimen_id ilike ?", "%#{specimen}%") if specimen.present?
+ contigs = contigs.joins(isolate: :individual).where('individuals.specimen_id ilike ?', "%#{specimen}%") if specimen.present?
- contigs = contigs.where("contigs.verified_by = ?", User.find_by_name(verified_by)&.id) if verified_by.present?
+ contigs = contigs.where('contigs.verified_by = ?', User.find_by_name(verified_by)&.id) if verified_by.present?
- contigs = contigs.where("contigs.created_at >= ?", min_age.midnight) if min_age.present?
- contigs = contigs.where("contigs.created_at <= ?", max_age.end_of_day) if max_age.present?
+ contigs = contigs.where('contigs.created_at >= ?', min_age.midnight) if min_age.present?
+ contigs = contigs.where('contigs.created_at <= ?', max_age.end_of_day) if max_age.present?
- contigs = contigs.where("contigs.updated_at >= ?", min_update.midnight) if min_update.present?
- contigs = contigs.where("contigs.updated_at <= ?", max_update.end_of_day) if max_update.present?
+ contigs = contigs.where('contigs.updated_at >= ?', min_update.midnight) if min_update.present?
+ contigs = contigs.where('contigs.updated_at <= ?', max_update.end_of_day) if max_update.present?
contigs
end
diff --git a/app/models/division.rb b/app/models/division.rb
index 52677dfa..c7a1154a 100644
--- a/app/models/division.rb
+++ b/app/models/division.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Division < ApplicationRecord
has_many :subdivisions
end
diff --git a/app/models/family.rb b/app/models/family.rb
index cd7ebc02..cd4cc7c8 100644
--- a/app/models/family.rb
+++ b/app/models/family.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
class Family < ApplicationRecord
include ProjectRecord
include PgSearch
- multisearchable :against => :name
+ multisearchable against: :name
has_many :species
belongs_to :order
diff --git a/app/models/freezer.rb b/app/models/freezer.rb
index 3c6e8595..c51cbf8f 100644
--- a/app/models/freezer.rb
+++ b/app/models/freezer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Freezer < ApplicationRecord
include ProjectRecord
diff --git a/app/models/higher_order_taxon.rb b/app/models/higher_order_taxon.rb
index 6f9b9e0c..ebd5f5d3 100644
--- a/app/models/higher_order_taxon.rb
+++ b/app/models/higher_order_taxon.rb
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
class HigherOrderTaxon < ApplicationRecord
include ProjectRecord
include PgSearch
- multisearchable :against => :name
+ multisearchable against: :name
has_many :orders
- has_many :families, :through => :orders
+ has_many :families, through: :orders
has_and_belongs_to_many :markers
validates_presence_of :name
diff --git a/app/models/individual.rb b/app/models/individual.rb
index 27a6d6fe..d78868c5 100644
--- a/app/models/individual.rb
+++ b/app/models/individual.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Individual < ApplicationRecord
include ProjectRecord
include PgSearch
@@ -5,13 +7,13 @@ class Individual < ApplicationRecord
has_many :isolates
belongs_to :species
- pg_search_scope :quick_search, against: [:specimen_id, :herbarium, :collector, :collection_nr]
+ pg_search_scope :quick_search, against: %i[specimen_id herbarium collector collection_nr]
- scope :without_species, -> { where(:species => nil) }
+ scope :without_species, -> { where(species: nil) }
scope :without_isolates, -> { left_outer_joins(:isolates).select(:id).group(:id).having('count(isolates.id) = 0') }
scope :no_species_isolates, -> { without_species.left_outer_joins(:isolates).select(:id).group(:id).having('count(isolates.id) = 0') }
- scope :bad_longitude, -> { where('individuals.longitude_original NOT SIMILAR TO ?', '[0-9]{1,}\.{0,}[0-9]{0,}')}
- scope :bad_latitude, -> { where('individuals.latitude_original NOT SIMILAR TO ?', '[0-9]{1,}\.{0,}[0-9]{0,}')}
+ scope :bad_longitude, -> { where('individuals.longitude_original NOT SIMILAR TO ?', '[0-9]{1,}\.{0,}[0-9]{0,}') }
+ scope :bad_latitude, -> { where('individuals.latitude_original NOT SIMILAR TO ?', '[0-9]{1,}\.{0,}[0-9]{0,}') }
scope :bad_location, -> { bad_latitude.or(Individual.bad_longitude) }
def self.to_csv(options = {})
@@ -25,8 +27,8 @@ def self.to_csv(options = {})
end
def self.spp_in_higher_order_taxon(higher_order_taxon_id)
- individuals = Individual.select("species_id").joins(:species => {:family => {:order => :higher_order_taxon}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
- individuals_s = Individual.select("species_component").joins(:species => {:family => {:order => :higher_order_taxon}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
+ individuals = Individual.select('species_id').joins(species: { family: { order: :higher_order_taxon } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
+ individuals_s = Individual.select('species_component').joins(species: { family: { order: :higher_order_taxon } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
[individuals.count, individuals_s.distinct.count, individuals.distinct.count]
end
@@ -38,31 +40,31 @@ def species_name=(name)
if name == ''
self.species = nil
else
- self.species = Species.find_or_create_by(:composed_name => name) if name.present?
+ self.species = Species.find_or_create_by(composed_name: name) if name.present?
end
end
def habitat_for_display
- if self.habitat.present? and self.habitat.length > 60
- "#{self.habitat[0..30]...self.habitat[-30..-1]}"
+ if habitat.present? && (habitat.length > 60)
+ (habitat[0..30]...habitat[-30..-1]).to_s
else
- self.habitat
+ habitat
end
end
def locality_for_display
- if self.locality.present? and self.locality.length > 60
- "#{self.locality[0..30]...self.locality[-30..-1]}"
+ if locality.present? && (locality.length > 60)
+ (locality[0..30]...locality[-30..-1]).to_s
else
- self.locality
+ locality
end
end
def comments_for_display
- if self.comments.present? and self.comments.length > 60
- "#{self.comments[0..30]...self.comments[-30..-1]}"
+ if comments.present? && (comments.length > 60)
+ (comments[0..30]...comments[-30..-1]).to_s
else
- self.comments
+ comments
end
end
end
diff --git a/app/models/individual_search.rb b/app/models/individual_search.rb
index 9f914b03..92b6738c 100644
--- a/app/models/individual_search.rb
+++ b/app/models/individual_search.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
class IndividualSearch < ApplicationRecord
belongs_to :user
belongs_to :project
- enum has_issue: [:all_issue, :issues, :no_issues]
- enum has_species: [:all_species, :species, :no_species]
- enum has_problematic_location: [:all_location, :bad_location, :location_okay]
+ enum has_issue: %i[all_issue issues no_issues]
+ enum has_species: %i[all_species species no_species]
+ enum has_problematic_location: %i[all_location bad_location location_okay]
def individuals
@individuals ||= find_individuals
@@ -15,30 +17,30 @@ def individuals
def find_individuals
individuals = Individual.in_project(project_id).order(:specimen_id)
- individuals = individuals.where("individuals.specimen_id ilike ?", "%#{specimen_id}%") if specimen_id.present?
+ individuals = individuals.where('individuals.specimen_id ilike ?', "%#{specimen_id}%") if specimen_id.present?
- individuals = individuals.where("individuals.DNA_bank_id ilike ?", "%#{self.DNA_bank_id}%") if self.DNA_bank_id.present?
+ individuals = individuals.where('individuals.DNA_bank_id ilike ?', "%#{self.DNA_bank_id}%") if self.DNA_bank_id.present?
if has_problematic_location != 'all_location'
- individuals = individuals.bad_location if (has_problematic_location == 'bad_location')
- individuals = individuals.where.not(id: Individual.bad_location.pluck(:id)) if (has_problematic_location == 'location_okay')
+ individuals = individuals.bad_location if has_problematic_location == 'bad_location'
+ individuals = individuals.where.not(id: Individual.bad_location.pluck(:id)) if has_problematic_location == 'location_okay'
end
if has_issue != 'all_issue'
- individuals = individuals.where(has_issue: true) if (has_issue == 'issues')
- individuals = individuals.where(has_issue: nil).or(individuals.where(has_issue: false)) if (has_issue == 'no_issues')
+ individuals = individuals.where(has_issue: true) if has_issue == 'issues'
+ individuals = individuals.where(has_issue: nil).or(individuals.where(has_issue: false)) if has_issue == 'no_issues'
end
if has_species != 'all_species'
- individuals = individuals.joins(:species) if (has_species == 'species')
- individuals = individuals.without_species if (has_species == 'no_species')
+ individuals = individuals.joins(:species) if has_species == 'species'
+ individuals = individuals.without_species if has_species == 'no_species'
end
- individuals = individuals.joins(species: { family: :order }).where("orders.name ilike ?", "%#{order}%") if order.present?
+ individuals = individuals.joins(species: { family: :order }).where('orders.name ilike ?', "%#{order}%") if order.present?
- individuals = individuals.joins(species: :family).where("families.name ilike ?", "%#{family}%") if family.present?
+ individuals = individuals.joins(species: :family).where('families.name ilike ?', "%#{family}%") if family.present?
- individuals = individuals.joins(:species).where("species.composed_name ilike ?", "%#{species}%") if species.present?
+ individuals = individuals.joins(:species).where('species.composed_name ilike ?', "%#{species}%") if species.present?
individuals
end
diff --git a/app/models/isolate.rb b/app/models/isolate.rb
index 5ed62f49..8c59d98a 100644
--- a/app/models/isolate.rb
+++ b/app/models/isolate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Isolate < ApplicationRecord
extend Import
include ProjectRecord
@@ -14,12 +16,12 @@ class Isolate < ApplicationRecord
before_create :assign_specimen
scope :recent, -> { where('isolates.updated_at > ?', 1.hours.ago) }
- scope :no_controls, -> { where(:negative_control => false) }
+ scope :no_controls, -> { where(negative_control: false) }
def self.spp_in_higher_order_taxon(higher_order_taxon_id)
- isolates = Isolate.select(:species_id).includes(:individual).joins(:individual => {:species => {:family => {:order => :higher_order_taxon}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
- isolates_s = Isolate.select(:species_component).includes(:individual).joins(:individual => {:species => {:family => {:order => :higher_order_taxon}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
- isolates_i = Isolate.select(:individual_id).joins(:individual => {:species => {:family => {:order => :higher_order_taxon}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
+ isolates = Isolate.select(:species_id).includes(:individual).joins(individual: { species: { family: { order: :higher_order_taxon } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
+ isolates_s = Isolate.select(:species_component).includes(:individual).joins(individual: { species: { family: { order: :higher_order_taxon } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
+ isolates_i = Isolate.select(:individual_id).joins(individual: { species: { family: { order: :higher_order_taxon } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
[isolates.size, isolates_s.distinct.count, isolates.distinct.count, isolates_i.distinct.count]
end
@@ -35,10 +37,10 @@ def self.import(file, project_id)
lab_nr = row['GBoL Isolation No.']
lab_nr ||= row['DNA Bank No']
- isolate = Isolate.where("lab_nr ILIKE ?", lab_nr).first
- isolate ||= Isolate.new(:lab_nr => lab_nr)
+ isolate = Isolate.where('lab_nr ILIKE ?', lab_nr).first
+ isolate ||= Isolate.new(lab_nr: lab_nr)
- plant_plate = PlantPlate.find_or_create_by(:name => row['GBoL5 Tissue Plate No.'].to_i.to_s)
+ plant_plate = PlantPlate.find_or_create_by(name: row['GBoL5 Tissue Plate No.'].to_i.to_s)
isolate.plant_plate = plant_plate
isolate.well_pos_plant_plate = row['G5o Well']
@@ -54,36 +56,35 @@ def self.import(file, project_id)
isolate.save!
individual = row['Voucher ID']
- if individual
- individual = Individual.find_or_create_by(specimen_id: individual) # Assign to existing or new individual
-
- individual.collector = row['Collector']
- individual.herbarium = row['Herbarium']
- individual.country = row['Country']
- individual.state_province = row['State/Province']
- individual.locality = row['Locality']
- individual.latitude = row['Latitude']
- individual.longitude = row['Longitude']
- individual.latitude_original = row['Latitude (original)']
- individual.longitude_original = row['Longitude (original)']
- individual.elevation = row['Elevation']
- individual.exposition = row['Exposition']
- individual.habitat = row['Habitat']
- individual.substrate = row['Substrate']
- individual.life_form = row['Life form']
- individual.collection_nr = row['Collection number']
- individual.collection_date = row['Date']
- individual.determination = row['Determination']
- individual.revision = row['Revision']
- individual.confirmation = row['Confirmation']
- individual.comments = row['Comments']
-
- individual.add_project(project_id)
-
- individual.save!
-
- isolate.update(individual_id: individual.id)
- end
+ next unless individual
+ individual = Individual.find_or_create_by(specimen_id: individual) # Assign to existing or new individual
+
+ individual.collector = row['Collector']
+ individual.herbarium = row['Herbarium']
+ individual.country = row['Country']
+ individual.state_province = row['State/Province']
+ individual.locality = row['Locality']
+ individual.latitude = row['Latitude']
+ individual.longitude = row['Longitude']
+ individual.latitude_original = row['Latitude (original)']
+ individual.longitude_original = row['Longitude (original)']
+ individual.elevation = row['Elevation']
+ individual.exposition = row['Exposition']
+ individual.habitat = row['Habitat']
+ individual.substrate = row['Substrate']
+ individual.life_form = row['Life form']
+ individual.collection_nr = row['Collection number']
+ individual.collection_date = row['Date']
+ individual.determination = row['Determination']
+ individual.revision = row['Revision']
+ individual.confirmation = row['Confirmation']
+ individual.comments = row['Comments']
+
+ individual.add_project(project_id)
+
+ individual.save!
+
+ isolate.update(individual_id: individual.id)
# species_id = row['GBoL5_TaxID'].to_i
# begin
@@ -109,7 +110,7 @@ def individual_name=(name)
if name == ''
self.individual = nil
else
- self.individual = Individual.find_or_create_by(:specimen_id => name) if name.present?
+ self.individual = Individual.find_or_create_by(specimen_id: name) if name.present?
end
end
end
diff --git a/app/models/issue.rb b/app/models/issue.rb
index ebce0491..b0597e2e 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Issue < ApplicationRecord
include ProjectRecord
diff --git a/app/models/lab.rb b/app/models/lab.rb
index a21e41f3..33b4aba4 100644
--- a/app/models/lab.rb
+++ b/app/models/lab.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Lab < ApplicationRecord
include ProjectRecord
diff --git a/app/models/lab_rack.rb b/app/models/lab_rack.rb
index 34448a4d..17c7d429 100644
--- a/app/models/lab_rack.rb
+++ b/app/models/lab_rack.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class LabRack < ApplicationRecord
include ProjectRecord
diff --git a/app/models/marker.rb b/app/models/marker.rb
index 9d7e9c70..38ae874b 100644
--- a/app/models/marker.rb
+++ b/app/models/marker.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Marker < ApplicationRecord
include ProjectRecord
@@ -12,18 +14,10 @@ class Marker < ApplicationRecord
scope :gbol_marker, -> { in_project(Project.find_by_name('GBOL5')) }
def spp_in_higher_order_taxon(higher_order_taxon_id)
- ms = MarkerSequence.select("species_id").includes(:isolate => :individual).joins(:isolate =>
- { :individual =>
- { :species =>
- { :family =>
- { :order => :higher_order_taxon }}}}).
- where(orders: { higher_order_taxon_id: higher_order_taxon_id }, marker_sequences: { marker_id: self.id })
- ms_i = MarkerSequence.select("individual_id").includes(:isolate => :individual).joins(:isolate =>
- {:individual =>
- {:species =>
- {:family =>
- {:order => :higher_order_taxon}}}}).
- where(orders: { higher_order_taxon_id: higher_order_taxon_id }, marker_sequences: { marker_id: self.id })
+ ms = MarkerSequence.select('species_id').includes(isolate: :individual).joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } })
+ .where(orders: { higher_order_taxon_id: higher_order_taxon_id }, marker_sequences: { marker_id: id })
+ ms_i = MarkerSequence.select('individual_id').includes(isolate: :individual).joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } })
+ .where(orders: { higher_order_taxon_id: higher_order_taxon_id }, marker_sequences: { marker_id: id })
[ms.count, ms.distinct.count, ms_i.distinct.count]
end
diff --git a/app/models/marker_sequence.rb b/app/models/marker_sequence.rb
index f41b9482..0e39927a 100644
--- a/app/models/marker_sequence.rb
+++ b/app/models/marker_sequence.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class MarkerSequence < ApplicationRecord
include ProjectRecord
@@ -13,17 +15,17 @@ class MarkerSequence < ApplicationRecord
scope :with_warnings, -> { joins(:mislabels).where(mislabels: { solved: false }) }
def self.spp_in_higher_order_taxon(higher_order_taxon_id)
- ms = MarkerSequence.select("species_id").includes(:isolate => :individual).joins(:isolate => {:individual => {:species => {:family => {:order => :higher_order_taxon}}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
- ms_s = MarkerSequence.select("species_component").includes(:isolate => :individual).joins(:isolate => {:individual => {:species => {:family => {:order => :higher_order_taxon}}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
- ms_i = MarkerSequence.select("individual_id").includes(:isolate => :individual).joins(:isolate => {:individual => {:species => {:family => {:order => :higher_order_taxon}}}}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
+ ms = MarkerSequence.select('species_id').includes(isolate: :individual).joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
+ ms_s = MarkerSequence.select('species_component').includes(isolate: :individual).joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
+ ms_i = MarkerSequence.select('individual_id').includes(isolate: :individual).joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
[ms.count, ms_s.distinct.count, ms.distinct.count, ms_i.distinct.count]
end
def generate_name
- if self.marker.present? and self.isolate.present?
- self.update(:name => "#{self.isolate.lab_nr}_#{self.marker.name}")
+ if marker.present? && isolate.present?
+ update(name: "#{isolate.lab_nr}_#{marker.name}")
else
- self.update(:name=>'')
+ update(name: '')
end
end
@@ -35,11 +37,11 @@ def isolate_lab_nr=(lab_nr)
if lab_nr == ''
self.isolate = nil
else
- self.isolate = Isolate.find_or_create_by(:lab_nr => lab_nr) if lab_nr.present?
+ self.isolate = Isolate.find_or_create_by(lab_nr: lab_nr) if lab_nr.present?
end
end
def has_unsolved_mislabels
- !mislabels.where(:solved => false).blank?
+ !mislabels.where(solved: false).blank?
end
end
diff --git a/app/models/marker_sequence_search.rb b/app/models/marker_sequence_search.rb
index e8e97dc2..3c4b2f87 100644
--- a/app/models/marker_sequence_search.rb
+++ b/app/models/marker_sequence_search.rb
@@ -6,7 +6,7 @@ class MarkerSequenceSearch < ApplicationRecord
belongs_to :user
belongs_to :project
- enum has_warnings: [:both, :yes, :no]
+ enum has_warnings: %i[both yes no]
def marker_sequences
@marker_sequences ||= find_marker_sequences
@@ -42,42 +42,42 @@ def taxon_file(include_singletons)
def find_marker_sequences
marker_sequences = MarkerSequence.in_project(project_id).order(:name)
- marker_sequences = marker_sequences.where("marker_sequences.name ilike ?", "%#{name}%") if name.present?
+ marker_sequences = marker_sequences.where('marker_sequences.name ilike ?', "%#{name}%") if name.present?
if verified != 'both'
- marker_sequences = marker_sequences.verified if (verified == 'verified')
- marker_sequences = marker_sequences.not_verified if (verified == 'unverified')
+ marker_sequences = marker_sequences.verified if verified == 'verified'
+ marker_sequences = marker_sequences.not_verified if verified == 'unverified'
end
marker_sequences = marker_sequences.has_species if has_species.present?
if has_warnings != 'both'
- marker_sequences = marker_sequences.with_warnings if (has_warnings == 'yes')
- marker_sequences = marker_sequences.where.not(id: MarkerSequence.with_warnings.pluck(:id)) if (has_warnings == 'no')
+ marker_sequences = marker_sequences.with_warnings if has_warnings == 'yes'
+ marker_sequences = marker_sequences.where.not(id: MarkerSequence.with_warnings.pluck(:id)) if has_warnings == 'no'
end
- marker_sequences = marker_sequences.joins(:marker).where("markers.name ilike ?", "%#{marker}%") if marker.present?
+ marker_sequences = marker_sequences.joins(:marker).where('markers.name ilike ?', "%#{marker}%") if marker.present?
- marker_sequences = marker_sequences.joins(isolate: {individual: {species: {family: {order: :higher_order_taxon}}}}).where("higher_order_taxa.name ilike ?", "%#{higher_order_taxon}%") if higher_order_taxon.present?
+ marker_sequences = marker_sequences.joins(isolate: { individual: { species: { family: { order: :higher_order_taxon } } } }).where('higher_order_taxa.name ilike ?', "%#{higher_order_taxon}%") if higher_order_taxon.present?
- marker_sequences = marker_sequences.joins(isolate: {individual: {species: {family: :order}}}).where("orders.name ilike ?", "%#{order}%") if order.present?
+ marker_sequences = marker_sequences.joins(isolate: { individual: { species: { family: :order } } }).where('orders.name ilike ?', "%#{order}%") if order.present?
- marker_sequences = marker_sequences.joins(isolate: {individual: {species: :family}}).where("families.name ilike ?", "%#{family}%") if family.present?
+ marker_sequences = marker_sequences.joins(isolate: { individual: { species: :family } }).where('families.name ilike ?', "%#{family}%") if family.present?
- marker_sequences = marker_sequences.joins(isolate: {individual: :species }).where("species.composed_name ilike ?", "%#{species}%") if species.present?
+ marker_sequences = marker_sequences.joins(isolate: { individual: :species }).where('species.composed_name ilike ?', "%#{species}%") if species.present?
- marker_sequences = marker_sequences.joins(isolate: :individual).where("individuals.specimen_id ilike ?", "%#{specimen}%") if specimen.present?
+ marker_sequences = marker_sequences.joins(isolate: :individual).where('individuals.specimen_id ilike ?', "%#{specimen}%") if specimen.present?
- marker_sequences = marker_sequences.joins(:contigs).where("contigs.verified_by = ?", User.find_by_name(verified_by)&.id) if verified_by.present?
+ marker_sequences = marker_sequences.joins(:contigs).where('contigs.verified_by = ?', User.find_by_name(verified_by)&.id) if verified_by.present?
- marker_sequences = marker_sequences.where("length(marker_sequences.sequence) >= ?", min_length) if min_length.present?
- marker_sequences = marker_sequences.where("length(marker_sequences.sequence) <= ?", max_length) if max_length.present?
+ marker_sequences = marker_sequences.where('length(marker_sequences.sequence) >= ?', min_length) if min_length.present?
+ marker_sequences = marker_sequences.where('length(marker_sequences.sequence) <= ?', max_length) if max_length.present?
- marker_sequences = marker_sequences.where("marker_sequences.created_at >= ?", min_age.midnight) if min_age.present?
- marker_sequences = marker_sequences.where("marker_sequences.created_at <= ?", max_age.end_of_day) if max_age.present?
+ marker_sequences = marker_sequences.where('marker_sequences.created_at >= ?', min_age.midnight) if min_age.present?
+ marker_sequences = marker_sequences.where('marker_sequences.created_at <= ?', max_age.end_of_day) if max_age.present?
- marker_sequences = marker_sequences.where("marker_sequences.updated_at >= ?", min_update.midnight) if min_update.present?
- marker_sequences = marker_sequences.where("marker_sequences.updated_at <= ?", max_update.end_of_day) if max_update.present?
+ marker_sequences = marker_sequences.where('marker_sequences.updated_at >= ?', min_update.midnight) if min_update.present?
+ marker_sequences = marker_sequences.where('marker_sequences.updated_at <= ?', max_update.end_of_day) if max_update.present?
marker_sequences
end
diff --git a/app/models/micronic_plate.rb b/app/models/micronic_plate.rb
index 5f376957..546f6f59 100644
--- a/app/models/micronic_plate.rb
+++ b/app/models/micronic_plate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class MicronicPlate < ApplicationRecord
include ProjectRecord
diff --git a/app/models/mislabel.rb b/app/models/mislabel.rb
index 83f4af57..fe729564 100644
--- a/app/models/mislabel.rb
+++ b/app/models/mislabel.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Mislabel < ApplicationRecord
belongs_to :mislabel_analysis
belongs_to :marker_sequence
diff --git a/app/models/mislabel_analysis.rb b/app/models/mislabel_analysis.rb
index ee7339f3..98e0c94d 100644
--- a/app/models/mislabel_analysis.rb
+++ b/app/models/mislabel_analysis.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class MislabelAnalysis < ApplicationRecord
belongs_to :marker
has_many :mislabels, dependent: :destroy
diff --git a/app/models/order.rb b/app/models/order.rb
index 75ddae73..50ff1a77 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
class Order < ApplicationRecord
include ProjectRecord
include PgSearch
- multisearchable :against => :name
+ multisearchable against: :name
has_many :families
- has_many :species, :through => :families
+ has_many :species, through: :families
belongs_to :higher_order_taxon
belongs_to :taxonomic_class
diff --git a/app/models/overview_all_taxa.rb b/app/models/overview_all_taxa.rb
index d93f6fed..77452688 100644
--- a/app/models/overview_all_taxa.rb
+++ b/app/models/overview_all_taxa.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class OverviewAllTaxa < ApplicationRecord
include ProjectRecord
diff --git a/app/models/overview_finished_taxa.rb b/app/models/overview_finished_taxa.rb
index b2ffff5a..c0ef6216 100644
--- a/app/models/overview_finished_taxa.rb
+++ b/app/models/overview_finished_taxa.rb
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
class OverviewFinishedTaxa < ApplicationRecord
include ProjectRecord
def self.finished_taxa_json(current_project_id, marker_id)
root = { :name => 'root', 'children' => [] }
taxa = HigherOrderTaxon.in_project(current_project_id).includes(orders: [:families]).order(:position)
- marker_sequence_cnts = MarkerSequence.in_project(current_project_id).joins(isolate: [individual: [species: :family]]).where(:marker => marker_id).order('families.name').group('families.name').count
+ marker_sequence_cnts = MarkerSequence.in_project(current_project_id).joins(isolate: [individual: [species: :family]]).where(marker: marker_id).order('families.name').group('families.name').count
i = 0
taxa.each do |taxon|
diff --git a/app/models/partial_con.rb b/app/models/partial_con.rb
index 34849dc7..5c6e3743 100644
--- a/app/models/partial_con.rb
+++ b/app/models/partial_con.rb
@@ -1,34 +1,33 @@
+# frozen_string_literal: true
+
class PartialCon < ApplicationRecord
belongs_to :contig, counter_cache: true
has_many :primer_reads
def mira_consensus_qualities
- group_probs_all_pos=[]
+ group_probs_all_pos = []
# for each position:
(0...aligned_sequence.length).each do |i|
- unless aligned_qualities[i] < 0 #cases with gap in consensus, -1 or -10
- #get group probabilities for consensus character:
- group_prob=0
- ctr=0
- primer_reads.each do |r|
- if ctr>1
- break
- end
-
- if r.aligned_seq[i]==aligned_sequence[i]
- group_prob += r.aligned_qualities[i]
- end
-
- ctr+=1
+ next if aligned_qualities[i] < 0 # cases with gap in consensus, -1 or -10
+ # get group probabilities for consensus character:
+ group_prob = 0
+ ctr = 0
+ primer_reads.each do |r|
+ break if ctr > 1
+
+ if r.aligned_seq[i] == aligned_sequence[i]
+ group_prob += r.aligned_qualities[i]
end
- if group_prob > 93
- group_probs_all_pos << 93
- else
- group_probs_all_pos << group_prob
- end
+ ctr += 1
end
+
+ group_probs_all_pos << if group_prob > 93
+ 93
+ else
+ group_prob
+ end
end
group_probs_all_pos
@@ -38,8 +37,8 @@ def test_name
puts id
end
- def as_json(options={})
- super(:include => [:primer_reads])
+ def as_json(_options = {})
+ super(include: [:primer_reads])
end
def to_json_for_page(page, width_in_bases)
@@ -57,17 +56,17 @@ def to_json_for_page(page, width_in_bases)
end_pos = alignment_length - 1 if end_pos > alignment_length
{
- :page => page.as_json,
- :aligned_sequence => aligned_sequence[start_pos..end_pos].as_json,
+ page: page.as_json,
+ aligned_sequence: aligned_sequence[start_pos..end_pos].as_json,
# :aligned_qualities => self.aligned_qualities[start_pos..end_pos].as_json,
- :start_pos => start_pos.as_json,
- :end_pos => end_pos.as_json,
- :primer_reads => primer_reads.map { |pr| pr.slice_to_json(start_pos, end_pos) }
+ start_pos: start_pos.as_json,
+ end_pos: end_pos.as_json,
+ primer_reads: primer_reads.map { |pr| pr.slice_to_json(start_pos, end_pos) }
}
end
def to_json_for_position(position_string, width_in_bases)
- alignment_length = self.aligned_qualities.blank? ? self.aligned_sequence.length : self.aligned_qualities.length # Most externally edited contigs do not have the aligned qualities array
+ alignment_length = aligned_qualities.blank? ? aligned_sequence.length : aligned_qualities.length # Most externally edited contigs do not have the aligned qualities array
start_pos = position_string.to_i
start_pos = 0 if start_pos < 0
@@ -79,12 +78,12 @@ def to_json_for_position(position_string, width_in_bases)
page = (start_pos / alignment_length).to_i
{
- :page => page.as_json,
- :aligned_sequence => self.aligned_sequence[start_pos..end_pos].as_json,
+ page: page.as_json,
+ aligned_sequence: aligned_sequence[start_pos..end_pos].as_json,
# :aligned_qualities => self.aligned_qualities[start_pos..end_pos].as_json,
- :start_pos => start_pos.as_json,
- :end_pos => end_pos.as_json,
- :primer_reads => self.primer_reads.map { |pr| pr.slice_to_json(start_pos, end_pos) }
+ start_pos: start_pos.as_json,
+ end_pos: end_pos.as_json,
+ primer_reads: primer_reads.map { |pr| pr.slice_to_json(start_pos, end_pos) }
}
end
end
diff --git a/app/models/plant_plate.rb b/app/models/plant_plate.rb
index b690a237..fbdf5f65 100644
--- a/app/models/plant_plate.rb
+++ b/app/models/plant_plate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class PlantPlate < ApplicationRecord
include ProjectRecord
diff --git a/app/models/primer.rb b/app/models/primer.rb
index b314acaf..97cbec18 100644
--- a/app/models/primer.rb
+++ b/app/models/primer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Primer < ApplicationRecord
extend Import
include ProjectRecord
@@ -15,13 +17,13 @@ def self.import(file, project_id)
(2..spreadsheet.last_row).each do |i|
row = Hash[[header, spreadsheet.row(i)].transpose]
- valid_keys = ['alt_name', 'sequence', 'author', 'name', 'tm', 'target_group'] # Only direct attributes; associations are extra:
+ valid_keys = %w[alt_name sequence author name tm target_group] # Only direct attributes; associations are extra:
# Update existing spp or create new
primer = find_or_create_by(name: row['name'])
# Add marker or assign to existing:
- marker = Marker.find_or_create_by(:name => row['marker'])
+ marker = Marker.find_or_create_by(name: row['marker'])
marker.add_project_and_save(project_id)
primer.marker_id = marker.id
diff --git a/app/models/primer_pos_on_genome.rb b/app/models/primer_pos_on_genome.rb
index 28f364bd..b818fbef 100644
--- a/app/models/primer_pos_on_genome.rb
+++ b/app/models/primer_pos_on_genome.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class PrimerPosOnGenome < ApplicationRecord
belongs_to :primer
belongs_to :species
diff --git a/app/models/primer_read.rb b/app/models/primer_read.rb
index 15c7e933..5fa6b8fd 100644
--- a/app/models/primer_read.rb
+++ b/app/models/primer_read.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class PrimerRead < ApplicationRecord
include ProjectRecord
@@ -7,30 +9,30 @@ class PrimerRead < ApplicationRecord
has_many :issues, dependent: :destroy
has_attached_file :chromatogram,
- :default_url => '/chromatograms/primer_read.scf'
+ default_url: '/chromatograms/primer_read.scf'
# Do_not_validate_attachment_file_type :chromatogram
# Validate content type
- validates_attachment_content_type :chromatogram, :content_type => /\Aapplication\/octet-stream/
+ validates_attachment_content_type :chromatogram, content_type: /\Aapplication\/octet-stream/
# Validate filename
- validates_attachment_file_name :chromatogram, :matches => [/scf\Z/, /ab1\Z/]
+ validates_attachment_file_name :chromatogram, matches: [/scf\Z/, /ab1\Z/]
before_create :default_name
- scope :assembled, -> { use_for_assembly.where(:assembled => true) }
- scope :not_assembled, -> { use_for_assembly.where(:assembled => false) }
+ scope :assembled, -> { use_for_assembly.where(assembled: true) }
+ scope :not_assembled, -> { use_for_assembly.where(assembled: false) }
- scope :use_for_assembly, -> { trimmed.where(:used_for_con => true) }
- scope :not_used_for_assembly, -> { trimmed.where(:used_for_con => false) }
+ scope :use_for_assembly, -> { trimmed.where(used_for_con: true) }
+ scope :not_used_for_assembly, -> { trimmed.where(used_for_con: false) }
- scope :trimmed, -> { where.not(:trimmedReadStart => nil) }
- scope :not_trimmed, -> { where(:trimmedReadStart => nil) }
+ scope :trimmed, -> { where.not(trimmedReadStart: nil) }
+ scope :not_trimmed, -> { where(trimmedReadStart: nil) }
- scope :processed, -> { where(:processed => true) }
- scope :unprocessed, -> { where(:processed => false) }
- scope :contig_not_verified, -> { joins(:contig).where(:contigs => {:verified => false, :verified_by => nil}) }
+ scope :processed, -> { where(processed: true) }
+ scope :unprocessed, -> { where(processed: false) }
+ scope :contig_not_verified, -> { joins(:contig).where(contigs: { verified: false, verified_by: nil }) }
validates_attachment_presence :chromatogram
@@ -39,7 +41,7 @@ def self.in_higher_order_taxon(higher_order_taxon_id)
HigherOrderTaxon.find(higher_order_taxon_id).orders.each do |ord|
ord.families.each do |fam|
- fam.species.each do |sp|
+ fam.species.each do |sp|
sp.individuals.each do |ind|
ind.isolates.each do |iso|
iso.contigs.each do |con|
@@ -55,87 +57,84 @@ def self.in_higher_order_taxon(higher_order_taxon_id)
end
def file_name_id
- self.name.gsub('.', "_#{self.id}.")
+ name.gsub('.', "_#{id}.")
end
def slice_to_json(start_pos, end_pos)
# get trace position corresponding to first / last aligned_peaks index that exists and is not -1:
- start_pos_trace=start_pos
- end_pos_trace=end_pos
+ start_pos_trace = start_pos
+ end_pos_trace = end_pos
- xstart=self.aligned_peak_indices[start_pos_trace]
+ xstart = aligned_peak_indices[start_pos_trace]
while xstart == -1
- start_pos_trace+=1
- xstart=self.aligned_peak_indices[start_pos_trace]
+ start_pos_trace += 1
+ xstart = aligned_peak_indices[start_pos_trace]
end
# does aligned_peaks index exist?
- if self.aligned_peak_indices[end_pos_trace]
- xend=self.aligned_peak_indices[end_pos_trace]
- #else use last:
+ if aligned_peak_indices[end_pos_trace]
+ xend = aligned_peak_indices[end_pos_trace]
+ # else use last:
else
- end_pos_trace=self.aligned_peak_indices.count-1
- xend=self.aligned_peak_indices[end_pos_trace]
+ end_pos_trace = aligned_peak_indices.count - 1
+ xend = aligned_peak_indices[end_pos_trace]
end
# find first that isnt -1:
- while xend == -1 and end_pos_trace > 0
- end_pos_trace-=1
- xend=self.aligned_peak_indices[end_pos_trace]
+ while (xend == -1) && (end_pos_trace > 0)
+ end_pos_trace -= 1
+ xend = aligned_peak_indices[end_pos_trace]
end
# create hash with x-pos as key, ya, yc, … as value
- traces=Hash.new
+ traces = {}
- if xstart and xend #account for situations where nothing from this read is seen in respective contig slice/page:
+ if xstart && xend # account for situations where nothing from this read is seen in respective contig slice/page:
- xstart-=10
- xend+=10
+ xstart -= 10
+ xend += 10
(xstart..xend).each do |x|
traces[x] = {
- :ay => self.atrace[x],
- :cy => self.ctrace[x],
- :gy => self.gtrace[x],
- :ty => self.ttrace[x]
+ ay: atrace[x],
+ cy: ctrace[x],
+ gy: gtrace[x],
+ ty: ttrace[x]
}
end
end
# get position in original, non-trimmed, non-aligned primer read:
-
# return json
{
- :id => self.id.as_json,
- :name => self.name.as_json,
- :aligned_seq => self.aligned_seq[start_pos..end_pos].as_json,
- :aligned_qualities => self.aligned_qualities[start_pos..end_pos].as_json,
- :traces => traces.as_json,
- :aligned_peak_indices => self.aligned_peak_indices[start_pos..end_pos].as_json,
- :trimmedReadStart => self.trimmedReadStart.as_json,
- :trimmedReadEnd => self.trimmedReadEnd.as_json,
- :original_positions => self.original_positions[start_pos..end_pos].as_json
+ id: id.as_json,
+ name: name.as_json,
+ aligned_seq: aligned_seq[start_pos..end_pos].as_json,
+ aligned_qualities: aligned_qualities[start_pos..end_pos].as_json,
+ traces: traces.as_json,
+ aligned_peak_indices: aligned_peak_indices[start_pos..end_pos].as_json,
+ trimmedReadStart: trimmedReadStart.as_json,
+ trimmedReadEnd: trimmedReadEnd.as_json,
+ original_positions: original_positions[start_pos..end_pos].as_json
}
end
def original_positions
- original_positions=Array.new
+ original_positions = []
- i=self.trimmedReadStart
-
- self.aligned_qualities.each do |aq|
+ i = trimmedReadStart
+ aligned_qualities.each do |aq|
if aq == -1
original_positions << -1
else
original_positions << i
- i+=1
+ i += 1
end
-
end
original_positions
@@ -149,28 +148,28 @@ def contig_name=(name)
if name == ''
self.contig = nil
else
- self.contig = Contig.find_or_create_by(:name => name) if name.present?
+ self.contig = Contig.find_or_create_by(name: name) if name.present?
end
end
def seq_for_display
- "#{self.sequence[0..30]...self.sequence[-30..-1]}" if self.sequence.present?
+ (sequence[0..30]...sequence[-30..-1]).to_s if sequence.present?
end
def trimmed_seq_for_display
- "#{self.sequence[self.trimmedReadStart..self.trimmedReadStart+30]...self.sequence[self.trimmedReadEnd-30..self.trimmedReadEnd]}" if self.sequence.present?
+ (sequence[trimmedReadStart..trimmedReadStart + 30]...sequence[trimmedReadEnd - 30..trimmedReadEnd]).to_s if sequence.present?
end
def name_for_display
- if self.name.length > 25
- "#{self.name[0..11]...self.name[-11..-5]}"
+ if name.length > 25
+ (name[0..11]...name[-11..-5]).to_s
else
- "#{self.name[0..-5]}"
+ name[0..-5].to_s
end
end
def default_name
- self.name ||= self.chromatogram.original_filename
+ self.name ||= chromatogram.original_filename
end
def auto_assign
@@ -184,16 +183,16 @@ def auto_assign
if name_components
primer_name = name_components[3]
name_variants_t7 = %w[T7promoter T7 T7-1] # T7 is always forward
- name_variants_m13 = %w[M13R-pUC M13-RP M13-RP-1] #M13R-pU
+ name_variants_m13 = %w[M13R-pUC M13-RP M13-RP-1] # M13R-pU
- #logic if T7promoter or M13R-pUC.scf:
+ # logic if T7promoter or M13R-pUC.scf:
if name_variants_t7.include? primer_name
rgx = /^_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/
matches = name_components[2].match(rgx) # --> uv2
primer_name = matches[1]
- primer = Primer.where("primers.name ILIKE ?", "#{primer_name}").first
- primer ||= Primer.where("primers.alt_name ILIKE ?", "#{primer_name}").first
+ primer = Primer.where('primers.name ILIKE ?', primer_name.to_s).first
+ primer ||= Primer.where('primers.alt_name ILIKE ?', primer_name.to_s).first
if primer
primer_name = matches[2] if primer.reverse
@@ -206,8 +205,8 @@ def auto_assign
matches = name_components[2].match(rgx) # --> 4
primer_name = matches[2] # --> uv4
- primer = Primer.where("primers.name ILIKE ?", "#{primer_name}").first
- primer ||= Primer.where("primers.alt_name ILIKE ?", "#{primer_name}").first
+ primer = Primer.where('primers.name ILIKE ?', primer_name.to_s).first
+ primer ||= Primer.where('primers.alt_name ILIKE ?', primer_name.to_s).first
if primer
primer_name = matches[1] unless primer.reverse
@@ -215,20 +214,18 @@ def auto_assign
output_message = "Cannot find primer with name #{primer_name}."
create_issue = true
end
- else
- # Leave primer_name as is
end
# Find & assign primer
- primer = Primer.where("primers.name ILIKE ?", "#{primer_name}").first
- primer ||= Primer.where("primers.alt_name ILIKE ?", "#{primer_name}").first
+ primer = Primer.where('primers.name ILIKE ?', primer_name.to_s).first
+ primer ||= Primer.where('primers.alt_name ILIKE ?', primer_name.to_s).first
puts primer.name
- puts "STOP"
+ puts 'STOP'
if primer
- self.update(:primer_id => primer.id, :reverse => primer.reverse)
+ update(primer_id: primer.id, reverse: primer.reverse)
# find marker that primer belongs to
marker = primer.marker
@@ -245,32 +242,32 @@ def auto_assign
isolate_component = "#{db_number_name_components[1]} #{db_number_name_components[2]}" # DNABank number
end
- isolate = Isolate.where("isolates.lab_nr ILIKE ?", isolate_component.to_s).first
- isolate ||= Isolate.where("isolates.dna_bank_id ILIKE ?", isolate_component.to_s).first
- isolate ||= Isolate.create(:lab_nr => isolate_component)
+ isolate = Isolate.where('isolates.lab_nr ILIKE ?', isolate_component.to_s).first
+ isolate ||= Isolate.where('isolates.dna_bank_id ILIKE ?', isolate_component.to_s).first
+ isolate ||= Isolate.create(lab_nr: isolate_component)
if db_number_name_components
- isolate.update(:dna_bank_id => isolate_component)
+ isolate.update(dna_bank_id: isolate_component)
end
- self.update(:isolate_id => isolate.id)
+ update(isolate_id: isolate.id)
# Figure out which contig to assign to
- matching_contig = Contig.where("contigs.marker_id = ? AND contigs.isolate_id = ?", marker.id, isolate.id).first
+ matching_contig = Contig.where('contigs.marker_id = ? AND contigs.isolate_id = ?', marker.id, isolate.id).first
if matching_contig
self.contig = matching_contig
- self.save
+ save
output_message = "Assigned to contig #{matching_contig.name}."
else
# Create new contig, auto assign to primer, copy, auto-name
- contig = Contig.new(:marker_id => marker.id, :isolate_id => isolate.id, :assembled => false)
- contig.projects = self.projects
+ contig = Contig.new(marker_id: marker.id, isolate_id: isolate.id, assembled: false)
+ contig.projects = projects
contig.generate_name
contig.save
self.contig = contig
- self.save
+ save
output_message = "Created contig #{contig.name} and assigned primer read to it."
end
@@ -288,175 +285,165 @@ def auto_assign
end
if create_issue
- i = Issue.create(:title => output_message, :primer_read_id => self.id)
+ i = Issue.create(title: output_message, primer_read_id: id)
else # Everything worked
- self.contig.update(:assembled => false, :assembly_tried => false)
+ self.contig.update(assembled: false, assembly_tried: false)
end
- { :msg => output_message, :create_issue => create_issue }
+ { msg: output_message, create_issue: create_issue }
end
def get_position_in_marker(p)
# get position in marker
- pp=nil
+ pp = nil
- if self.trimmed_seq
- if self.reverse
- pp= p.position-self.trimmed_seq.length
- else
- pp= p.position
- end
+ if trimmed_seq
+ pp = if reverse
+ p.position - trimmed_seq.length
+ else
+ p.position
+ end
end
pp
end
def auto_trim(write_to_db)
- msg=nil
+ msg = nil
create_issue = false
# Get local copy from s3
- dest = Tempfile.new(self.chromatogram_file_name)
+ dest = Tempfile.new(chromatogram_file_name)
dest.binmode
- self.chromatogram.copy_to_local_file(:original, dest.path)
+ chromatogram.copy_to_local_file(:original, dest.path)
begin
chromatogram_ff1 = nil
p = /\.ab1$/
- if self.chromatogram_file_name.match(p)
- chromatogram_ff1 = Bio::Abif.open(dest.path)
- else
- chromatogram_ff1 = Bio::Scf.open(dest.path)
- end
+ chromatogram_ff1 = if chromatogram_file_name.match(p)
+ Bio::Abif.open(dest.path)
+ else
+ Bio::Scf.open(dest.path)
+ end
chromatogram1 = chromatogram_ff1.next_entry
- if self.reverse
- chromatogram1.complement!()
- end
+ chromatogram1.complement! if reverse
sequence = chromatogram1.sequence.upcase
- #copy chromatogram over into db
- if self.sequence.nil? or write_to_db
- self.update(:sequence => sequence)
- self.update(:base_count => sequence.length)
+ # copy chromatogram over into db
+ if self.sequence.nil? || write_to_db
+ update(sequence: sequence)
+ update(base_count: sequence.length)
end
- if self.qualities.nil? or write_to_db
- self.update(:qualities => chromatogram1.qualities)
+ if qualities.nil? || write_to_db
+ update(qualities: chromatogram1.qualities)
end
- if self.atrace.nil? or write_to_db
- self.update(:atrace => chromatogram1.atrace)
- self.update(:ctrace => chromatogram1.ctrace)
- self.update(:gtrace => chromatogram1.gtrace)
- self.update(:ttrace => chromatogram1.ttrace)
- self.update(:peak_indices => chromatogram1.peak_indices)
+ if atrace.nil? || write_to_db
+ update(atrace: chromatogram1.atrace)
+ update(ctrace: chromatogram1.ctrace)
+ update(gtrace: chromatogram1.gtrace)
+ update(ttrace: chromatogram1.ttrace)
+ update(peak_indices: chromatogram1.peak_indices)
end
- se = Array.new
+ se = []
- se = self.trim_seq(chromatogram1.qualities, self.min_quality_score, self.window_size, self.count_in_window)
+ se = trim_seq(chromatogram1.qualities, min_quality_score, window_size, count_in_window)
- #se = self.trim_seq_inverse(chromatogram1.qualities)
+ # se = self.trim_seq_inverse(chromatogram1.qualities)
if se
- if se[0]>=se[1] # trimming has not found any stretch of bases > min_score
- msg='Quality too low - no stretch of readable bases found.'
- create_issue=true
- self.update(:used_for_con => false)
+ if se[0] >= se[1] # trimming has not found any stretch of bases > min_score
+ msg = 'Quality too low - no stretch of readable bases found.'
+ create_issue = true
+ update(used_for_con: false)
elsif se[2] > 0.6
- msg="Quality too low - #{(se[2]*100).round}% low-quality base calls in trimmed sequence."
- create_issue=true
+ msg = "Quality too low - #{(se[2] * 100).round}% low-quality base calls in trimmed sequence."
+ create_issue = true
- self.update(:used_for_con => false)
+ update(used_for_con: false)
else
# everything works:
- self.update(:trimmedReadStart => se[0]+1, :trimmedReadEnd => se[1]+1, :used_for_con => true)
+ update(trimmedReadStart: se[0] + 1, trimmedReadEnd: se[1] + 1, used_for_con: true)
#:position => self.get_position_in_marker(self.primer)
- msg='Sequence trimmed.'
+ msg = 'Sequence trimmed.'
end
else
- msg='Quality too low - no stretch of readable bases found.'
- create_issue=true
- self.update(:used_for_con => false)
+ msg = 'Quality too low - no stretch of readable bases found.'
+ create_issue = true
+ update(used_for_con: false)
end
- rescue
- msg='Sequence could not be trimmed - no scf/ab1 file or no quality scores?'
+ rescue StandardError
+ msg = 'Sequence could not be trimmed - no scf/ab1 file or no quality scores?'
create_issue = true
- self.update(:used_for_con => false)
+ update(used_for_con: false)
end
if create_issue
- i=Issue.create(:title => msg, :primer_read_id => self.id)
- self.update(:used_for_con=>false)
+ i = Issue.create(title: msg, primer_read_id: id)
+ update(used_for_con: false)
end
- {:msg => msg, :create_issue => create_issue}
-
+ { msg: msg, create_issue: create_issue }
end
def trimmed_seq
- if trimmedReadStart.nil? or trimmedReadEnd.nil?
+ if trimmedReadStart.nil? || trimmedReadEnd.nil?
nil
else
if trimmedReadEnd > trimmedReadStart
- self.sequence[(self.trimmedReadStart-1)..(self.trimmedReadEnd-1)] if self.sequence.present?
- #cleaned_sequence = raw_sequence.gsub('-', '') # in case basecalls in pherogram have already '-' - as in some crappy seq. I got from BN
- else
- nil
+ sequence[(trimmedReadStart - 1)..(trimmedReadEnd - 1)] if sequence.present?
+ # cleaned_sequence = raw_sequence.gsub('-', '') # in case basecalls in pherogram have already '-' - as in some crappy seq. I got from BN
end
end
end
def trimmed_quals
- if trimmedReadStart.nil? or trimmedReadEnd.nil?
+ if trimmedReadStart.nil? || trimmedReadEnd.nil?
nil
else
if trimmedReadEnd > trimmedReadStart
- self.qualities[(self.trimmedReadStart-1)..(self.trimmedReadEnd-1)] if self.qualities.present?
- else
- nil
+ qualities[(trimmedReadStart - 1)..(trimmedReadEnd - 1)] if qualities.present?
end
end
end
def trimmed_and_cleaned_seq
- self.trimmed_seq.upcase.gsub /[^ACTGN-]+/, 'N'
+ trimmed_seq.upcase.gsub /[^ACTGN-]+/, 'N'
end
def get_aligned_peak_indices
+ if trimmedReadStart
- if self.trimmedReadStart
-
- aligned_peak_indices = Array.new
+ aligned_peak_indices = []
- pi=self.trimmedReadStart-2
+ pi = trimmedReadStart - 2
- if self.aligned_qualities
+ if aligned_qualities
- self.aligned_qualities.each do |aq|
- if aq==-1
+ aligned_qualities.each do |aq|
+ if aq == -1
aligned_peak_indices << -1
else
- aligned_peak_indices << self.peak_indices[pi]
- pi+=1
+ aligned_peak_indices << peak_indices[pi]
+ pi += 1
end
end
- self.update_columns(aligned_peak_indices: aligned_peak_indices)
+ update_columns(aligned_peak_indices: aligned_peak_indices)
end
end
-
end
-
- #deactivated cause even worse than original
+ # deactivated cause even worse than original
# def trim_seq_inverse(qualities)
#
# #settings
@@ -612,93 +599,79 @@ def get_aligned_peak_indices
#
# end
-
# old version
def trim_seq(qualities, min_quality_score, t, c)
-
trimmed_read_start = 0
trimmed_read_end = qualities.length
# --- find readstart:
- for i in 0..qualities.length-t
- #extract window of size t
+ for i in 0..qualities.length - t
+ # extract window of size t
- count=0
+ count = 0
- for k in i...i+t
- if qualities[k]>=min_quality_score
- count += 1
- end
+ for k in i...i + t
+ count += 1 if qualities[k] >= min_quality_score
end
- if count>=c
+ if count >= c
trimmed_read_start = i
break
end
end
- #fine-tune: if bad bases are at beginning of last window, cut further until current base's score >= min_qual:
+ # fine-tune: if bad bases are at beginning of last window, cut further until current base's score >= min_qual:
- ctr=trimmed_read_start
+ ctr = trimmed_read_start
- for a in ctr..ctr+t
- if qualities[a]>=min_quality_score
+ for a in ctr..ctr + t
+ if qualities[a] >= min_quality_score
trimmed_read_start = a
break
end
end
-
# --- find readend:
- i =qualities.length
+ i = qualities.length
while i > 0
- #extract window of size t
+ # extract window of size t
# k=i
- count=0
+ count = 0
- for k in i-t...i
- if qualities[k]>=min_quality_score
- count += 1
- end
+ for k in i - t...i
+ count += 1 if qualities[k] >= min_quality_score
end
- if count>=c
+ if count >= c
trimmed_read_end = i
break
end
- i-=1
+ i -= 1
end
- #fine-tune: if bad bases are at beginning of last window, go back until current base's score >= min_qual:
+ # fine-tune: if bad bases are at beginning of last window, go back until current base's score >= min_qual:
- while i > trimmed_read_end-t
- if qualities[i]>=min_quality_score
- break
- end
- i-=1
+ while i > trimmed_read_end - t
+ break if qualities[i] >= min_quality_score
+ i -= 1
end
trimmed_read_end = i
- #check if xy% < min_score:
- ctr_bad=0
- ctr_total=0
+ # check if xy% < min_score:
+ ctr_bad = 0
+ ctr_total = 0
for j in trimmed_read_start...trimmed_read_end
- if qualities[j] :composed_name
+ multisearchable against: :composed_name
has_many :individuals
has_many :primer_pos_on_genomes
belongs_to :family
def self.spp_in_higher_order_taxon(higher_order_taxon_id)
- spp = Species.select(:species_component).joins(:family => {:order => :higher_order_taxon}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
- subspp = Species.select(:id).joins(:family => {:order => :higher_order_taxon}).where(orders: {higher_order_taxon_id: higher_order_taxon_id})
+ spp = Species.select(:species_component).joins(family: { order: :higher_order_taxon }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
+ subspp = Species.select(:id).joins(family: { order: :higher_order_taxon }).where(orders: { higher_order_taxon_id: higher_order_taxon_id })
[spp.distinct.count, subspp.count]
end
@@ -72,26 +74,26 @@ def self.import_species(file, valid_keys, project_id)
def self.import_stuttgart(file, project_id)
# Only direct attributes; associations are extra
- valid_keys = ['genus_name',
- 'species_epithet',
- 'id',
- 'author',
- 'author_infra',
- 'infraspecific',
- 'comment',
- 'german_name']
+ valid_keys = %w[genus_name
+ species_epithet
+ id
+ author
+ author_infra
+ infraspecific
+ comment
+ german_name]
import_species(file, valid_keys, project_id)
end
def self.import_berlin(file, project_id)
- valid_keys = ['genus_name',
- 'species_epithet',
- 'id',
- 'author',
- 'infraspecific',
- 'author_infra',
- 'comment'] # Only direct attributes; associations are extra
+ valid_keys = %w[genus_name
+ species_epithet
+ id
+ author
+ infraspecific
+ author_infra
+ comment] # Only direct attributes; associations are extra
import_species(file, valid_keys, project_id)
end
@@ -104,43 +106,42 @@ def self.import_gbolII(file)
(2..spreadsheet.last_row).each do |i|
row = Hash[[header, spreadsheet.row(i)].transpose]
- if (row['GBOL 1 oder 2?'].include? 'GBOL2') || (row['GBOL 1 oder 2?'].include? 'Nachtrag') # Only add new species
- # Add family or assign to existing:
- family = Family.find_or_create_by(:name => row['Familie (sensu APG)'])
-
- # Add order or assign to existing
- order = Order.find_or_create_by(:name => row['Ordnung (sensu APG)'])
- family.update(:order_id => order.id)
-
- full_name = row['Arten/Unterarten']
- components = full_name.split(' ')
-
- species = Species.find_or_create_by(:composed_name => full_name)
-
- species.update(:family => family)
- species.update(:genus_name => components.first)
-
- case components.size
- when 2
- species.update(:species_epithet => components[1])
- when 3
- if components[1] == 'x'
- species_ep = components[1] + ' ' + components.last
- species.update(:species_epithet => species_ep)
- else
- species.update(:species_epithet => components[1], :infraspecific => components.last)
- end
- when 4
- if components[2] == 'subsp.'
- species.update(:species_epithet => components[1], :infraspecific => components.last)
- else
- infraspecific = components[2] + ' ' + components.last
- species.update(:species_epithet => components[1], :infraspecific => infraspecific)
- end
- end
+ next unless (row['GBOL 1 oder 2?'].include? 'GBOL2') || (row['GBOL 1 oder 2?'].include? 'Nachtrag') # Only add new species
+ # Add family or assign to existing:
+ family = Family.find_or_create_by(name: row['Familie (sensu APG)'])
+
+ # Add order or assign to existing
+ order = Order.find_or_create_by(name: row['Ordnung (sensu APG)'])
+ family.update(order_id: order.id)
+
+ full_name = row['Arten/Unterarten']
+ components = full_name.split(' ')
+
+ species = Species.find_or_create_by(composed_name: full_name)
+
+ species.update(family: family)
+ species.update(genus_name: components.first)
- species.update(:species_component => species.get_species_component)
+ case components.size
+ when 2
+ species.update(species_epithet: components[1])
+ when 3
+ if components[1] == 'x'
+ species_ep = components[1] + ' ' + components.last
+ species.update(species_epithet: species_ep)
+ else
+ species.update(species_epithet: components[1], infraspecific: components.last)
+ end
+ when 4
+ if components[2] == 'subsp.'
+ species.update(species_epithet: components[1], infraspecific: components.last)
+ else
+ infraspecific = components[2] + ' ' + components.last
+ species.update(species_epithet: components[1], infraspecific: infraspecific)
+ end
end
+
+ species.update(species_component: species.get_species_component)
end
end
@@ -150,24 +151,18 @@ def self.import_stuttgart_set_class(file)
header = spreadsheet.row(1)
(2..spreadsheet.last_row).each do |i|
-
row = Hash[[header, spreadsheet.row(i)].transpose]
order = Order.find_by_name(row['order'])
- if order
- taxonomic_class = TaxonomicClass.find_or_create_by(:name => row['class'])
-
- if taxonomic_class
- order.update(:taxonomic_class_id => taxonomic_class.id)
- subdivision = Subdivision.find_or_create_by(:name => row['subdivision'])
+ next unless order
+ taxonomic_class = TaxonomicClass.find_or_create_by(name: row['class'])
- if subdivision
- taxonomic_class.update(:subdivision_id => subdivision.id)
- end
- end
- end
+ next unless taxonomic_class
+ order.update(taxonomic_class_id: taxonomic_class.id)
+ subdivision = Subdivision.find_or_create_by(name: row['subdivision'])
+ taxonomic_class.update(subdivision_id: subdivision.id) if subdivision
end
end
@@ -194,6 +189,6 @@ def family_name
end
def family_name=(name)
- self.family = Family.find_or_create_by(:name => name) if name.present?
+ self.family = Family.find_or_create_by(name: name) if name.present?
end
end
diff --git a/app/models/species_exporter.rb b/app/models/species_exporter.rb
index cb0312dd..afb4b0c3 100644
--- a/app/models/species_exporter.rb
+++ b/app/models/species_exporter.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Write SPECIMENS & STATUS to Excel-XML (xls) for use by ZFMK for their "Portal / db : bolgermany.de "
class SpeciesExporter < ApplicationRecord
has_attached_file :species_export,
@@ -15,7 +17,7 @@ def create_species_export(project_id)
file_to_upload.close
self.species_export = File.open('species_export.xls')
- self.save!
+ save!
end
def xml_string(project_id)
diff --git a/app/models/specimen_exporter.rb b/app/models/specimen_exporter.rb
index d3bcabc9..856e4757 100644
--- a/app/models/specimen_exporter.rb
+++ b/app/models/specimen_exporter.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Write SPECIMENS & STATUS to Excel-XML (xls) for use by ZFMK for their "Portal / db : bolgermany.de "
class SpecimenExporter < ApplicationRecord
include ActionView::Helpers
@@ -16,15 +18,15 @@ def create_specimen_export(project_id)
file_to_upload.close
self.specimen_export = File.open('specimens_export.xls')
- self.save!
+ save!
end
def xml_string(project_id)
markers = Marker.gbol_marker
@states = %w[Baden-Württemberg Bayern Berlin Brandenburg Bremen Hamburg
- Hessen Mecklenburg-Vorpommern Niedersachsen Nordrhein-Westfalen
- Rheinland-Pfalz Saarland Sachsen Sachsen-Anhalt Schleswig-Holstein
+ Hessen Mecklenburg-Vorpommern Niedersachsen Nordrhein-Westfalen
+ Rheinland-Pfalz Saarland Sachsen Sachsen-Anhalt Schleswig-Holstein
Thüringen]
@header_cells = ['GBOL5 specimen ID',
@@ -67,15 +69,14 @@ def xml_string(project_id)
builder = Nokogiri::XML::Builder.new do |xml|
xml.comment("Generated by gbol5.de web app on #{Time.zone.now}")
- xml.Workbook('xmlns'=>'urn:schemas-microsoft-com:office:spreadsheet',
- 'xmlns:o'=>'urn:schemas-microsoft-com:office:office',
- 'xmlns:x'=>'urn:schemas-microsoft-com:office:excel',
- 'xmlns:ss'=>'urn:schemas-microsoft-com:office:spreadsheet',
- 'xmlns:html'=>'https://www.w3.org/TR/REC-html40') do
- xml.Worksheet('ss:Name'=>'Sheet1') do
+ xml.Workbook('xmlns' => 'urn:schemas-microsoft-com:office:spreadsheet',
+ 'xmlns:o' => 'urn:schemas-microsoft-com:office:office',
+ 'xmlns:x' => 'urn:schemas-microsoft-com:office:excel',
+ 'xmlns:ss' => 'urn:schemas-microsoft-com:office:spreadsheet',
+ 'xmlns:html' => 'https://www.w3.org/TR/REC-html40') do
+ xml.Worksheet('ss:Name' => 'Sheet1') do
xml.Table do
xml.Row do
-
@header_cells.each do |o|
xml.Cell do
xml.Data('ss:Type' => 'String') do
@@ -83,11 +84,10 @@ def xml_string(project_id)
end
end
end
-
end
# Individuals in current project
- Individual.includes(isolates: [contigs: [:marker_sequence, :marker, :isolate]], species: :family).in_project(project_id).find_each do |individual|
+ Individual.includes(isolates: [contigs: %i[marker_sequence marker isolate]], species: :family).in_project(project_id).find_each do |individual|
xml.Row do
# GBOL5 specimen ID
xml.Cell do
@@ -228,8 +228,7 @@ def xml_string(project_id)
# Bundesland
xml.Cell do
xml.Data('ss:Type' => 'String') do
-
- if individual.country == 'Germany' or individual.country == 'Deutschland'
+ if (individual.country == 'Germany') || (individual.country == 'Deutschland')
# tests first if is a Bundesland; outputs nothing if other crap was entered in this field:
if @states.include? individual.state_province
@@ -269,14 +268,14 @@ def xml_string(project_id)
# Breitengrad
xml.Cell do
xml.Data('ss:Type' => 'String') do
- xml.text(number_with_precision(individual.latitude, precision:5))
+ xml.text(number_with_precision(individual.latitude, precision: 5))
end
end
# Längengrad
xml.Cell do
xml.Data('ss:Type' => 'String') do
- xml.text(number_with_precision(individual.longitude, precision:5))
+ xml.text(number_with_precision(individual.longitude, precision: 5))
end
end
@@ -334,18 +333,15 @@ def xml_string(project_id)
individual.try(:isolates).each do |iso|
markers.each do |current_marker|
-
current_contig = iso.try(:contigs).includes(marker_sequence: :contigs).where(marker_id: current_marker.id).first
current_marker_sequence = current_contig&.marker_sequence
current_ms_sequence = current_marker_sequence&.sequence
- if current_ms_sequence
- longest_sequences[current_marker.id] ||= current_marker_sequence
- if current_ms_sequence.length > longest_sequences[current_marker.id].sequence.length
- longest_sequences[current_marker.id] = current_marker_sequence
- end
+ next unless current_ms_sequence
+ longest_sequences[current_marker.id] ||= current_marker_sequence
+ if current_ms_sequence.length > longest_sequences[current_marker.id].sequence.length
+ longest_sequences[current_marker.id] = current_marker_sequence
end
-
end
end
@@ -358,7 +354,7 @@ def xml_string(project_id)
xml.Data('ss:Type' => 'String') do
current_contig_id = current_sequence&.contigs&.first&.id
if current_contig_id
- xml.text("gbol5.de/contigs/#{current_contig_id}/edit") #edit_contig_path(current_sequence.contigs.first)
+ xml.text("gbol5.de/contigs/#{current_contig_id}/edit") # edit_contig_path(current_sequence.contigs.first)
end
end
end
@@ -366,9 +362,7 @@ def xml_string(project_id)
# Markersequenz
xml.Cell do
xml.Data('ss:Type' => 'String') do
- if current_ms
- xml.text(current_ms)
- end
+ xml.text(current_ms) if current_ms
end
end
@@ -390,4 +384,4 @@ def xml_string(project_id)
builder.to_xml
end
-end
\ No newline at end of file
+end
diff --git a/app/models/subdivision.rb b/app/models/subdivision.rb
index 201241ea..1f4c662a 100644
--- a/app/models/subdivision.rb
+++ b/app/models/subdivision.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Subdivision < ApplicationRecord
has_many :taxonomic_classes
belongs_to :division
diff --git a/app/models/taxonomic_class.rb b/app/models/taxonomic_class.rb
index 811ef71f..bc04a0ba 100644
--- a/app/models/taxonomic_class.rb
+++ b/app/models/taxonomic_class.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class TaxonomicClass < ApplicationRecord
belongs_to :subdivision
has_many :orders
diff --git a/app/models/tissue.rb b/app/models/tissue.rb
index 1dad5405..dd956905 100644
--- a/app/models/tissue.rb
+++ b/app/models/tissue.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Tissue < ApplicationRecord
has_many :isolates
diff --git a/app/models/txt_uploader.rb b/app/models/txt_uploader.rb
index 12f8cbbe..5a31109b 100644
--- a/app/models/txt_uploader.rb
+++ b/app/models/txt_uploader.rb
@@ -1,21 +1,22 @@
-class TxtUploader < ApplicationRecord
+# frozen_string_literal: true
+class TxtUploader < ApplicationRecord
has_attached_file :uploaded_file,
- :path => "/output.txt"
+ path: '/output.txt'
# Validate content type
- validates_attachment_content_type :uploaded_file, :content_type => /\Atext\/plain/
+ validates_attachment_content_type :uploaded_file, content_type: /\Atext\/plain/
# Validate filename
- validates_attachment_file_name :uploaded_file, :matches => [/txt\Z/]
+ validates_attachment_file_name :uploaded_file, matches: [/txt\Z/]
def create_uploaded_file(text)
- file_to_upload = File.open("output.txt", "w")
+ file_to_upload = File.open('output.txt', 'w')
file_to_upload.write(text)
file_to_upload.close
- self.uploaded_file = File.open("output.txt")
- self.save!
+ self.uploaded_file = File.open('output.txt')
+ save!
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 356a59fb..f70dcb32 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class User < ApplicationRecord
include ProjectRecord
@@ -17,9 +19,9 @@ class User < ApplicationRecord
before_save :default_project
- enum role: [:guest, :user, :supervisor, :admin]
+ enum role: %i[guest user supervisor admin]
def default_project
self.default_project_id ||= projects&.first&.id
end
-end
\ No newline at end of file
+end
diff --git a/app/views/contigs/index.json.jbuilder b/app/views/contigs/index.json.jbuilder
index e2dc5b86..e6562a0e 100644
--- a/app/views/contigs/index.json.jbuilder
+++ b/app/views/contigs/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@contigs) do |contig|
json.extract! contig, :id, :name, :consensus
json.url contig_url(contig, format: :json)
diff --git a/app/views/contigs/show.json.jbuilder b/app/views/contigs/show.json.jbuilder
index 62a7853a..4ac40877 100644
--- a/app/views/contigs/show.json.jbuilder
+++ b/app/views/contigs/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @contig, :id, :name, :consensus, :created_at, :updated_at
diff --git a/app/views/families/index.json.jbuilder b/app/views/families/index.json.jbuilder
index 9eea844f..eaea640d 100644
--- a/app/views/families/index.json.jbuilder
+++ b/app/views/families/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@families) do |family|
json.extract! family, :id, :name, :author
json.url family_url(family, format: :json)
diff --git a/app/views/families/show.json.jbuilder b/app/views/families/show.json.jbuilder
index e18940b7..63c04bdf 100644
--- a/app/views/families/show.json.jbuilder
+++ b/app/views/families/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @family, :id, :name, :author, :created_at, :updated_at
diff --git a/app/views/freezers/index.json.jbuilder b/app/views/freezers/index.json.jbuilder
index 0f59e848..0bc24547 100644
--- a/app/views/freezers/index.json.jbuilder
+++ b/app/views/freezers/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@freezers) do |freezer|
json.extract! freezer, :id, :freezercode
json.url freezer_url(freezer, format: :json)
diff --git a/app/views/freezers/show.json.jbuilder b/app/views/freezers/show.json.jbuilder
index dca9a8b3..f026725b 100644
--- a/app/views/freezers/show.json.jbuilder
+++ b/app/views/freezers/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @freezer, :id, :freezercode, :created_at, :updated_at
diff --git a/app/views/higher_order_taxons/index.json.jbuilder b/app/views/higher_order_taxons/index.json.jbuilder
index 7e688779..15e90a1d 100644
--- a/app/views/higher_order_taxons/index.json.jbuilder
+++ b/app/views/higher_order_taxons/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@higher_order_taxons) do |higher_order_taxon|
json.extract! higher_order_taxon, :id, :name
json.url higher_order_taxon_url(higher_order_taxon, format: :json)
diff --git a/app/views/higher_order_taxons/show.json.jbuilder b/app/views/higher_order_taxons/show.json.jbuilder
index 46a97555..79366c64 100644
--- a/app/views/higher_order_taxons/show.json.jbuilder
+++ b/app/views/higher_order_taxons/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @higher_order_taxon, :id, :name, :created_at, :updated_at
diff --git a/app/views/individuals/index.json.jbuilder b/app/views/individuals/index.json.jbuilder
index 25be9eaa..e8c51fa8 100644
--- a/app/views/individuals/index.json.jbuilder
+++ b/app/views/individuals/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@individuals) do |individual|
json.extract! individual, :id, :specimen_id, :DNA_bank_id, :collector
json.url individual_url(individual, format: :json)
diff --git a/app/views/individuals/show.json.jbuilder b/app/views/individuals/show.json.jbuilder
index 51d21fde..50ca9d13 100644
--- a/app/views/individuals/show.json.jbuilder
+++ b/app/views/individuals/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @individual, :id, :specimen_id, :DNA_bank_id, :collector, :created_at, :updated_at
diff --git a/app/views/isolates/index.json.jbuilder b/app/views/isolates/index.json.jbuilder
index 0af21fa9..2176482c 100644
--- a/app/views/isolates/index.json.jbuilder
+++ b/app/views/isolates/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@isolates) do |copy|
json.extract! copy, :id, :well_pos_plant_plate, :lab_nr, :micronic_tube_id, :well_pos_micronic_plate, :concentration
json.url copy_url(copy, format: :json)
diff --git a/app/views/isolates/show.json.jbuilder b/app/views/isolates/show.json.jbuilder
index 3e14735d..1b51a9c0 100644
--- a/app/views/isolates/show.json.jbuilder
+++ b/app/views/isolates/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @isolate, :id, :well_pos_plant_plate, :lab_nr, :micronic_tube_id, :well_pos_micronic_plate, :concentration, :created_at, :updated_at
diff --git a/app/views/issues/index.json.jbuilder b/app/views/issues/index.json.jbuilder
index ceab77bf..f361db2d 100644
--- a/app/views/issues/index.json.jbuilder
+++ b/app/views/issues/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@issues) do |issue|
json.extract! issue, :id, :title, :description
json.url issue_url(issue, format: :json)
diff --git a/app/views/issues/show.json.jbuilder b/app/views/issues/show.json.jbuilder
index a1ff8b89..99dccf9f 100644
--- a/app/views/issues/show.json.jbuilder
+++ b/app/views/issues/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @issue, :id, :title, :description, :created_at, :updated_at
diff --git a/app/views/lab_racks/index.json.jbuilder b/app/views/lab_racks/index.json.jbuilder
index 21bbc9aa..f9609134 100644
--- a/app/views/lab_racks/index.json.jbuilder
+++ b/app/views/lab_racks/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@lab_racks) do |lab_rack|
json.extract! lab_rack, :id, :rackcode
json.url lab_rack_url(lab_rack, format: :json)
diff --git a/app/views/lab_racks/show.json.jbuilder b/app/views/lab_racks/show.json.jbuilder
index 06b10ba8..aaf4944e 100644
--- a/app/views/lab_racks/show.json.jbuilder
+++ b/app/views/lab_racks/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @lab_rack, :id, :rackcode, :created_at, :updated_at
diff --git a/app/views/labs/index.json.jbuilder b/app/views/labs/index.json.jbuilder
index 2b1071eb..9571aca3 100644
--- a/app/views/labs/index.json.jbuilder
+++ b/app/views/labs/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@labs) do |lab|
json.extract! lab, :id, :labcode
json.url lab_url(lab, format: :json)
diff --git a/app/views/labs/show.json.jbuilder b/app/views/labs/show.json.jbuilder
index d55a3675..b1b5b3b5 100644
--- a/app/views/labs/show.json.jbuilder
+++ b/app/views/labs/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @lab, :id, :labcode, :created_at, :updated_at
diff --git a/app/views/marker_sequences/index.json.jbuilder b/app/views/marker_sequences/index.json.jbuilder
index 35ec3845..93a6bb09 100644
--- a/app/views/marker_sequences/index.json.jbuilder
+++ b/app/views/marker_sequences/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@marker_sequences) do |marker_sequence|
json.extract! marker_sequence, :id, :name, :sequence
json.url marker_sequence_url(marker_sequence, format: :json)
diff --git a/app/views/marker_sequences/show.json.jbuilder b/app/views/marker_sequences/show.json.jbuilder
index 09f3f5f6..65e1509d 100644
--- a/app/views/marker_sequences/show.json.jbuilder
+++ b/app/views/marker_sequences/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @marker_sequence, :id, :name, :sequence, :created_at, :updated_at
diff --git a/app/views/markers/index.json.jbuilder b/app/views/markers/index.json.jbuilder
index 1ca0abdd..a3f6bc11 100644
--- a/app/views/markers/index.json.jbuilder
+++ b/app/views/markers/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@markers) do |marker|
json.extract! marker, :id, :name, :sequence, :accession
json.url marker_url(marker, format: :json)
diff --git a/app/views/markers/show.json.jbuilder b/app/views/markers/show.json.jbuilder
index 5aa1da68..9c9f4137 100644
--- a/app/views/markers/show.json.jbuilder
+++ b/app/views/markers/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @marker, :id, :name, :sequence, :accession, :created_at, :updated_at
diff --git a/app/views/micronic_plates/index.json.jbuilder b/app/views/micronic_plates/index.json.jbuilder
index 2cb64676..ec567cb9 100644
--- a/app/views/micronic_plates/index.json.jbuilder
+++ b/app/views/micronic_plates/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@micronic_plates) do |micronic_plate|
json.extract! micronic_plate, :id, :micronic_plate_id, :name
json.url micronic_plate_url(micronic_plate, format: :json)
diff --git a/app/views/micronic_plates/show.json.jbuilder b/app/views/micronic_plates/show.json.jbuilder
index 0ed82b62..6ee5d175 100644
--- a/app/views/micronic_plates/show.json.jbuilder
+++ b/app/views/micronic_plates/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @micronic_plate, :id, :micronic_plate_id, :name, :created_at, :updated_at
diff --git a/app/views/orders/index.json.jbuilder b/app/views/orders/index.json.jbuilder
index e81672fe..51345067 100644
--- a/app/views/orders/index.json.jbuilder
+++ b/app/views/orders/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@orders) do |order|
json.extract! order, :id, :name, :author
json.url order_url(order, format: :json)
diff --git a/app/views/orders/show.json.jbuilder b/app/views/orders/show.json.jbuilder
index 5971c423..f182a27f 100644
--- a/app/views/orders/show.json.jbuilder
+++ b/app/views/orders/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @order, :id, :name, :author, :created_at, :updated_at
diff --git a/app/views/plant_plates/index.json.jbuilder b/app/views/plant_plates/index.json.jbuilder
index 06781cc1..5a981341 100644
--- a/app/views/plant_plates/index.json.jbuilder
+++ b/app/views/plant_plates/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@plant_plates) do |plant_plate|
json.extract! plant_plate, :id, :name, :how_many
json.url plant_plate_url(plant_plate, format: :json)
diff --git a/app/views/plant_plates/show.json.jbuilder b/app/views/plant_plates/show.json.jbuilder
index 97d6ca4f..bd1c048e 100644
--- a/app/views/plant_plates/show.json.jbuilder
+++ b/app/views/plant_plates/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @plant_plate, :id, :name, :how_many, :created_at, :updated_at
diff --git a/app/views/primer_pos_on_genomes/index.json.jbuilder b/app/views/primer_pos_on_genomes/index.json.jbuilder
index f0c89d2c..9248fbd2 100644
--- a/app/views/primer_pos_on_genomes/index.json.jbuilder
+++ b/app/views/primer_pos_on_genomes/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@primer_pos_on_genomes) do |primer_pos_on_genome|
json.extract! primer_pos_on_genome, :id, :note, :position
json.url primer_pos_on_genome_url(primer_pos_on_genome, format: :json)
diff --git a/app/views/primer_pos_on_genomes/show.json.jbuilder b/app/views/primer_pos_on_genomes/show.json.jbuilder
index bfcf22f0..b7098efa 100644
--- a/app/views/primer_pos_on_genomes/show.json.jbuilder
+++ b/app/views/primer_pos_on_genomes/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @primer_pos_on_genome, :id, :note, :position, :created_at, :updated_at
diff --git a/app/views/primer_reads/index.json.jbuilder b/app/views/primer_reads/index.json.jbuilder
index e5784c3e..9e53caea 100644
--- a/app/views/primer_reads/index.json.jbuilder
+++ b/app/views/primer_reads/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@primer_reads) do |primer_read|
json.extract! primer_read, :id, :name, :sequence, :pherogram_url
json.url primer_read_url(primer_read, format: :json)
diff --git a/app/views/primer_reads/show.json.jbuilder b/app/views/primer_reads/show.json.jbuilder
index 86c6f37b..f476cf47 100644
--- a/app/views/primer_reads/show.json.jbuilder
+++ b/app/views/primer_reads/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @primer_read, :id, :name, :sequence, :pherogram_url, :created_at, :updated_at
diff --git a/app/views/primers/index.json.jbuilder b/app/views/primers/index.json.jbuilder
index 1d9a88e9..29dadeed 100644
--- a/app/views/primers/index.json.jbuilder
+++ b/app/views/primers/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@primers) do |primer|
json.extract! primer, :id, :name, :sequence, :reverse
json.url primer_url(primer, format: :json)
diff --git a/app/views/primers/show.json.jbuilder b/app/views/primers/show.json.jbuilder
index 2dc72640..2528aefb 100644
--- a/app/views/primers/show.json.jbuilder
+++ b/app/views/primers/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @primer, :id, :name, :sequence, :reverse, :created_at, :updated_at
diff --git a/app/views/projects/index.json.jbuilder b/app/views/projects/index.json.jbuilder
index 5c99b6cb..d598b5f3 100644
--- a/app/views/projects/index.json.jbuilder
+++ b/app/views/projects/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@projects) do |project|
json.extract! project, :id, :name, :description, :start, :due
json.url project_url(project, format: :json)
diff --git a/app/views/projects/show.json.jbuilder b/app/views/projects/show.json.jbuilder
index e2eccac4..b2a264e6 100644
--- a/app/views/projects/show.json.jbuilder
+++ b/app/views/projects/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @project, :id, :name, :description, :start, :due, :created_at, :updated_at
diff --git a/app/views/shelves/index.json.jbuilder b/app/views/shelves/index.json.jbuilder
index a5cbb32a..25d597ec 100644
--- a/app/views/shelves/index.json.jbuilder
+++ b/app/views/shelves/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@shelves) do |shelf|
json.extract! shelf, :id, :name
json.url shelf_url(shelf, format: :json)
diff --git a/app/views/shelves/show.json.jbuilder b/app/views/shelves/show.json.jbuilder
index 3bd2d99e..0de1cc8b 100644
--- a/app/views/shelves/show.json.jbuilder
+++ b/app/views/shelves/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @shelf, :id, :name, :created_at, :updated_at
diff --git a/app/views/species/index.json.jbuilder b/app/views/species/index.json.jbuilder
index 8dea39fd..6c362d17 100644
--- a/app/views/species/index.json.jbuilder
+++ b/app/views/species/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@species) do |species|
json.extract! species, :id, :author, :genus_name, :species_epithet
json.url species_url(species, format: :json)
diff --git a/app/views/species/show.json.jbuilder b/app/views/species/show.json.jbuilder
index c4b5a20f..3825e2ac 100644
--- a/app/views/species/show.json.jbuilder
+++ b/app/views/species/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @species, :id, :author, :genus_name, :species_epithet, :created_at, :updated_at
diff --git a/app/views/tissues/index.json.jbuilder b/app/views/tissues/index.json.jbuilder
index aae81277..c0b473ec 100644
--- a/app/views/tissues/index.json.jbuilder
+++ b/app/views/tissues/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@tissues) do |tissue|
json.extract! tissue, :id, :name
json.url tissue_url(tissue, format: :json)
diff --git a/app/views/tissues/show.json.jbuilder b/app/views/tissues/show.json.jbuilder
index eb781faf..19260f4d 100644
--- a/app/views/tissues/show.json.jbuilder
+++ b/app/views/tissues/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @tissue, :id, :name, :created_at, :updated_at
diff --git a/app/views/txt_uploaders/index.json.jbuilder b/app/views/txt_uploaders/index.json.jbuilder
index 1f5005f4..bcfd3f08 100644
--- a/app/views/txt_uploaders/index.json.jbuilder
+++ b/app/views/txt_uploaders/index.json.jbuilder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
json.array!(@txt_uploaders) do |txt_uploader|
json.extract! txt_uploader, :id
json.url txt_uploader_url(txt_uploader, format: :json)
diff --git a/app/views/txt_uploaders/show.json.jbuilder b/app/views/txt_uploaders/show.json.jbuilder
index d7851c51..2be5cc84 100644
--- a/app/views/txt_uploaders/show.json.jbuilder
+++ b/app/views/txt_uploaders/show.json.jbuilder
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
json.extract! @txt_uploader, :id, :created_at, :updated_at
diff --git a/config.ru b/config.ru
index 5bc2a619..61c04e13 100644
--- a/config.ru
+++ b/config.ru
@@ -1,4 +1,6 @@
+# frozen_string_literal: true
+
# This file is used by Rack-based servers to start the application.
-require ::File.expand_path('../config/environment', __FILE__)
+require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
diff --git a/config/application.rb b/config/application.rb
index f5f7f2f2..50efef84 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative 'boot'
require 'csv'
@@ -9,7 +11,6 @@
module GBOLapp
class Application < Rails::Application
-
config.generators do |g|
g.test_framework :minitest
end
diff --git a/config/boot.rb b/config/boot.rb
index 30f5120d..30e594e2 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/config/deploy.rb b/config/deploy.rb
index 87f22d78..a4fe484a 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
# Change these
-server '46.101.149.34', port: 1694, roles: [:web, :app, :db], primary: true
+server '46.101.149.34', port: 1694, roles: %i[web app db], primary: true
set :repo_url, 'ssh://Sarah_Wiechers@bitbucket.org/kai42/gbol5.git'
set :application, 'gbol5'
@@ -8,7 +10,7 @@
set :puma_workers, 2
# Always deploy currently checked out branch
-set :branch, $1 if `git branch` =~ /\* (\S+)\s/m
+set :branch, Regexp.last_match(1) if `git branch` =~ /\* (\S+)\s/m
# Rbenv setup
set :whenever_environment, fetch(:stage)
@@ -35,11 +37,11 @@
set :puma_user, fetch(:user)
# Set key location to 'C:/Users/Sarah/.ssh/id_rsa' when deploying from windows
-set :ssh_options, { port: 1694, forward_agent: true, user: fetch(:user), keys: %w(/home/sarah/.ssh/id_rsa) }
+set :ssh_options, port: 1694, forward_agent: true, user: fetch(:user), keys: %w[/home/sarah/.ssh/id_rsa]
# Sidekiq setup
-set :sidekiq_log => File.join(release_path, 'log', 'sidekiq.log')
-set :sidekiq_config => File.join(shared_path, 'config', 'sidekiq.yml')
+set sidekiq_log: File.join(release_path, 'log', 'sidekiq.log')
+set sidekiq_config: File.join(shared_path, 'config', 'sidekiq.yml')
## Defaults:
# set :scm, :git
@@ -65,12 +67,12 @@
end
namespace :deploy do
- desc "Make sure local git is in sync with remote."
+ desc 'Make sure local git is in sync with remote.'
task :check_revision do
on roles(:app) do
unless `git rev-parse HEAD` == `git rev-parse origin/#{fetch(:branch)}`
- puts "WARNING: HEAD is not the same as origin/master"
- puts "Run `git push` to sync changes."
+ puts 'WARNING: HEAD is not the same as origin/master'
+ puts 'Run `git push` to sync changes.'
exit
end
end
@@ -99,14 +101,14 @@
before 'deploy:assets:precompile', :symlink_config_files
-desc "Link shared files"
+desc 'Link shared files'
task :symlink_config_files do
symlinks = {
- "#{shared_path}/config/database.yml" => "#{release_path}/config/database.yml",
- "#{shared_path}/config/local_env.yml" => "#{release_path}/config/local_env.yml"
+ "#{shared_path}/config/database.yml" => "#{release_path}/config/database.yml",
+ "#{shared_path}/config/local_env.yml" => "#{release_path}/config/local_env.yml"
}
on roles(:app) do
- execute symlinks.map{|from, to| "ln -nfs #{from} #{to}"}.join(" && ")
+ execute symlinks.map { |from, to| "ln -nfs #{from} #{to}" }.join(' && ')
end
-end
\ No newline at end of file
+end
diff --git a/config/deploy/production.rb b/config/deploy/production.rb
index 4bb7a714..b84cc032 100644
--- a/config/deploy/production.rb
+++ b/config/deploy/production.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# server-based syntax
# ======================
# Defines a single server with a list of roles and multiple properties.
@@ -7,8 +9,6 @@
# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value
# server "db.example.com", user: "deploy", roles: %w{db}
-
-
# role-based syntax
# ==================
@@ -21,8 +21,6 @@
# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
# role :db, %w{deploy@example.com}
-
-
# Configuration
# =============
# You can set any configuration variable like in config/deploy.rb
@@ -31,8 +29,6 @@
# http://capistranorb.com/documentation/getting-started/configuration/
# Feel free to add new variables to customise your setup.
-
-
# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb
index 4bb7a714..b84cc032 100644
--- a/config/deploy/staging.rb
+++ b/config/deploy/staging.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# server-based syntax
# ======================
# Defines a single server with a list of roles and multiple properties.
@@ -7,8 +9,6 @@
# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value
# server "db.example.com", user: "deploy", roles: %w{db}
-
-
# role-based syntax
# ==================
@@ -21,8 +21,6 @@
# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
# role :db, %w{deploy@example.com}
-
-
# Configuration
# =============
# You can set any configuration variable like in config/deploy.rb
@@ -31,8 +29,6 @@
# http://capistranorb.com/documentation/getting-started/configuration/
# Feel free to add new variables to customise your setup.
-
-
# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
diff --git a/config/environment.rb b/config/environment.rb
index 426333bb..d5abe558 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Load the Rails application.
require_relative 'application'
diff --git a/config/environments/development.rb b/config/environments/development.rb
index ad106a61..e704e2ea 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
Rails.application.configure do
# for devise
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+ config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
- config.action_mailer.smtp_settings = {:address => 'localhost', :port => 1025}
+ config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
# Settings specified here will take precedence over those in config/application.rb.
@@ -70,6 +72,6 @@
end
config.paperclip_defaults = {
- :storage => 'filesystem'
+ storage: 'filesystem'
}
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 8f1df812..da1b510a 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@@ -33,9 +35,11 @@
# Load environment variables
config.before_configuration do
env_file = File.join(Rails.root, 'config', 'local_env.yml')
- YAML.load(File.open(env_file)).each do |key, value|
- ENV[key.to_s] = value
- end if File.exists?(env_file)
+ if File.exist?(env_file)
+ YAML.safe_load(File.open(env_file)).each do |key, value|
+ ENV[key.to_s] = value
+ end
+ end
end
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
@@ -58,7 +62,7 @@
config.log_level = :info
# Prepend all log lines with the following tags.
- config.log_tags = [ :request_id ]
+ config.log_tags = [:request_id]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
@@ -72,11 +76,11 @@
config.action_mailer.default_url_options = { host: 'gbol5.de' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
- :address => '127.0.0.1',
- :port => 25,
- :domain => 'gbol5.de',
- :tls => false,
- :enable_starttls_auto => false,
+ address: '127.0.0.1',
+ port: 25,
+ domain: 'gbol5.de',
+ tls: false,
+ enable_starttls_auto: false
}
# Ignore bad email addresses and do not raise email delivery errors.
@@ -110,15 +114,15 @@
config.secret_key_base = '<%= ENV["SECRET_KEY_BASE"] %>'
config.paperclip_defaults = {
- :storage => :s3,
- :url =>':s3_domain_url',
- :path => '/:class/:attachment/:id_partition/:style/:filename',
- :s3_credentials => {
- :bucket => ENV['S3_BUCKET_NAME'],
- :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
- :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
- :s3_region => ENV['S3_REGION'],
- :preserve_files => true
- },
+ storage: :s3,
+ url: ':s3_domain_url',
+ path: '/:class/:attachment/:id_partition/:style/:filename',
+ s3_credentials: {
+ bucket: ENV['S3_BUCKET_NAME'],
+ access_key_id: ENV['AWS_ACCESS_KEY_ID'],
+ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
+ s3_region: ENV['S3_REGION'],
+ preserve_files: true
+ }
}
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 666724af..f45fd458 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Rails.application.configure do
# for devise
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
@@ -50,5 +52,4 @@
Rails.application.configure do
config.active_support.test_order = :sorted
end
-
end
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 01ef3e66..678efe9f 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
index 59385cdf..4b63f289 100644
--- a/config/initializers/backtrace_silencers.rb
+++ b/config/initializers/backtrace_silencers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
index 5a6a32d3..ee8dff9c 100644
--- a/config/initializers/cookies_serializer.rb
+++ b/config/initializers/cookies_serializer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 06e6924b..6492f73d 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
@@ -8,7 +10,6 @@
config.secret_key = '422ed9a725773e72abb68813a794ffcc0659a7426fc1687bac085b61b10b1a0ac2a4440799d0e085b1baa622ed3a7d501931b96caaadcc4133021e94cb540c80'
-
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
@@ -44,12 +45,12 @@
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
- config.case_insensitive_keys = [ :email ]
+ config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
- config.strip_whitespace_keys = [ :email ]
+ config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
index f24a2166..52f05587 100644
--- a/config/initializers/filter_parameter_logging.rb
+++ b/config/initializers/filter_parameter_logging.rb
@@ -1,4 +1,6 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
-Rails.application.config.filter_parameters += [:password, :user_name, :user_id]
+Rails.application.config.filter_parameters += %i[password user_name user_id]
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index a245e208..123a9e36 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
@@ -5,16 +7,16 @@
# locales as you wish. All of these examples are active by default:
ActiveSupport::Inflector.inflections(:en) do |inflect|
-# inflect.plural /^(ox)$/i, '\1en'
-# inflect.singular /^(ox)en/i, '\1'
-# inflect.irregular 'person', 'people'
-# inflect.uncountable %w( fish sheep )
- inflect.uncountable %w( species )
- inflect.irregular 'syntaxon', 'syntaxa'
- inflect.irregular 'higher_order_taxon', 'higher_order_taxa'
- inflect.irregular 'HigherOrderTaxon', 'HigherOrderTaxa'
- inflect.irregular 'genus', 'genera'
- inflect.uncountable %w( subspecies )
+ # inflect.plural /^(ox)$/i, '\1en'
+ # inflect.singular /^(ox)en/i, '\1'
+ # inflect.irregular 'person', 'people'
+ # inflect.uncountable %w( fish sheep )
+ inflect.uncountable %w[species]
+ inflect.irregular 'syntaxon', 'syntaxa'
+ inflect.irregular 'higher_order_taxon', 'higher_order_taxa'
+ inflect.irregular 'HigherOrderTaxon', 'HigherOrderTaxa'
+ inflect.irregular 'genus', 'genera'
+ inflect.uncountable %w[subspecies]
end
# These inflection rules are supported but not enabled by default:
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index 212d2fe0..5aaebc7b 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-Mime::Type.register "application/xls", :xls
-Mime::Type.register "application/xml ", :abc
+Mime::Type.register 'application/xls', :xls
+Mime::Type.register 'application/xml ', :abc
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
index 152ff87c..b68e8a9a 100644
--- a/config/initializers/paperclip.rb
+++ b/config/initializers/paperclip.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
Paperclip.options[:content_type_mappings] = {
- :scf => "application/octet-stream",
- :ab1 => "application/octet-stream"
- # :xls => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
-}
\ No newline at end of file
+ scf: 'application/octet-stream',
+ ab1: 'application/octet-stream'
+ # :xls => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+}
diff --git a/config/initializers/pg_search.rb b/config/initializers/pg_search.rb
index 7c8e5fd3..63b10e8a 100644
--- a/config/initializers/pg_search.rb
+++ b/config/initializers/pg_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
PgSearch.multisearch_options = {
- :using => { :tsearch => { :prefix => true }, :trigram => {} }
-}
\ No newline at end of file
+ using: { tsearch: { prefix: true }, trigram: {} }
+}
diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb
index 746171f5..6f03e3a5 100644
--- a/config/initializers/redis.rb
+++ b/config/initializers/redis.rb
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
# uri = URI.parse(ENV["REDISTOGO_URL"])
-# REDIS = Redis.new(:url => ENV['REDISTOGO_URL'])
\ No newline at end of file
+# REDIS = Redis.new(:url => ENV['REDISTOGO_URL'])
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 1865c681..e7b0fab1 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_gbo_lapp_session'
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
index 6986de98..29665f56 100644
--- a/config/initializers/simple_form.rb
+++ b/config/initializers/simple_form.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
@@ -6,7 +8,7 @@
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :input,
- hint_class: :field_with_hint, error_class: :field_with_errors do |b|
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb
index ad4ca74c..140a8ecd 100644
--- a/config/initializers/simple_form_bootstrap.rb
+++ b/config/initializers/simple_form_bootstrap.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
@@ -11,7 +13,7 @@
end
end
- config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
+ config.wrappers :prepend, tag: 'div', class: 'control-group', error_class: 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
@@ -24,7 +26,7 @@
end
end
- config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
+ config.wrappers :append, tag: 'div', class: 'control-group', error_class: 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
index bbfc3961..2f3c0db4 100644
--- a/config/initializers/wrap_parameters.rb
+++ b/config/initializers/wrap_parameters.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
diff --git a/config/puma.rb b/config/puma.rb
index 15e8ac3e..a508ed35 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -1,21 +1,23 @@
+# frozen_string_literal: true
+
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
-threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
+threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
threads threads_count, threads_count
rackup DefaultRackup
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
-port ENV.fetch("PORT") { 3000 }
+port ENV.fetch('PORT') { 3000 }
# Specifies the `environment` that Puma will run in.
#
-environment ENV.fetch("RAILS_ENV") { "development" }
+environment ENV.fetch('RAILS_ENV') { 'development' }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
@@ -54,4 +56,4 @@
end
# Allow puma to be restarted by `rails restart` command.
-plugin :tmp_restart
\ No newline at end of file
+plugin :tmp_restart
diff --git a/config/routes.rb b/config/routes.rb
index a58dcb58..a7097c4d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,7 @@
-GBOLapp::Application.routes.draw do
+# frozen_string_literal: true
- root :to => "home#about"
+GBOLapp::Application.routes.draw do
+ root to: 'home#about'
match 'help', to: 'home#help', via: 'get'
match 'about', to: 'home#about', via: 'get'
@@ -10,11 +11,11 @@
match 'overview', to: 'home#overview', via: 'get'
get 'overview_diagram/index'
- get 'overview_diagram/all_species', :defaults => { :format => 'json' }
- get 'overview_diagram/finished_species_trnlf', :defaults => { :format => 'json' }
- get 'overview_diagram/finished_species_its', :defaults => { :format => 'json' }
- get 'overview_diagram/finished_species_rpl16', :defaults => { :format => 'json' }
- get 'overview_diagram/finished_species_trnk_matk', :defaults => { :format => 'json' }
+ get 'overview_diagram/all_species', defaults: { format: 'json' }
+ get 'overview_diagram/finished_species_trnlf', defaults: { format: 'json' }
+ get 'overview_diagram/finished_species_its', defaults: { format: 'json' }
+ get 'overview_diagram/finished_species_rpl16', defaults: { format: 'json' }
+ get 'overview_diagram/finished_species_trnk_matk', defaults: { format: 'json' }
get 'specimens_xls', action: :xls, controller: 'individuals'
get 'specimens_create_xls', action: :create_xls, controller: 'individuals'
@@ -24,8 +25,8 @@
get 'analysis_output', action: :analysis_output, controller: 'contigs'
get 'reads_without_contigs', action: :reads_without_contigs, controller: 'primer_reads'
- get 'partial_cons/:id/:page/:width_in_bases', action: :show_page, controller: 'partial_cons', :defaults => { :format => 'json' }
- get 'partial_cons_pos/:id/:position/:width_in_bases', action: :show_position, controller: 'partial_cons', :defaults => { :format => 'json' }
+ get 'partial_cons/:id/:page/:width_in_bases', action: :show_page, controller: 'partial_cons', defaults: { format: 'json' }
+ get 'partial_cons_pos/:id/:position/:width_in_bases', action: :show_position, controller: 'partial_cons', defaults: { format: 'json' }
get 'primer_reads/:id/edit/:pos', action: :go_to_pos, controller: 'primer_reads'
@@ -44,7 +45,6 @@
resources :individual_searches
resources :contigs do
-
collection do
get 'show_need_verify'
get 'caryophyllales_need_verification'
@@ -73,7 +73,6 @@
get 'overlap'
get 'overlap_background'
end
-
end
resources :individuals do
@@ -204,18 +203,18 @@
resources :responsibilities
- #hack: avoid malicious users to directly type in the sign-up route
- #later: use authorization system to
+ # HACK: avoid malicious users to directly type in the sign-up route
+ # later: use authorization system to
devise_scope :user do
- get "/users/sign_up", :to => "home#about"
+ get '/users/sign_up', to: 'home#about'
end
- devise_for :users, :controllers => {:registrations => "registrations"}, path_names: {sign_in: "login", sign_out: "logout"}
+ devise_for :users, controllers: { registrations: 'registrations' }, path_names: { sign_in: 'login', sign_out: 'logout' }
devise_scope :users do
get '/login' => 'devise/sessions#new'
get '/logout' => 'devise/sessions#destroy'
end
- resources :users, :controller => 'users' do
+ resources :users, controller: 'users' do
member do
get 'home'
end
@@ -226,4 +225,4 @@
require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'
-end
\ No newline at end of file
+end
diff --git a/config/schedule.rb b/config/schedule.rb
index 4afc3242..b81d3191 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -1,32 +1,34 @@
+# frozen_string_literal: true
+
set :output, "#{path}/log/cron.log"
# Whenever config
if defined? rbenv_root
- job_type :rake, %{cd :path && :environment_variable=:environment :rbenv_root/bin/rbenv exec bundle exec rake :task --silent :output}
- job_type :runner, %{cd :path && :rbenv_root/bin/rbenv exec bundle exec rails runner -e :environment ':task' :output}
- job_type :script, %{cd :path && :environment_variable=:environment :rbenv_root/bin/rbenv exec bundle exec script/:task :output}
+ job_type :rake, %(cd :path && :environment_variable=:environment :rbenv_root/bin/rbenv exec bundle exec rake :task --silent :output)
+ job_type :runner, %(cd :path && :rbenv_root/bin/rbenv exec bundle exec rails runner -e :environment ':task' :output)
+ job_type :script, %(cd :path && :environment_variable=:environment :rbenv_root/bin/rbenv exec bundle exec script/:task :output)
end
-every 1.day, :at => '23:30 am' do
- rake "data:create_xls" # Create Specimen.xls file from current database
+every 1.day, at: '23:30 am' do
+ rake 'data:create_xls' # Create Specimen.xls file from current database
end
-every 1.day, :at => '0:30 am' do
- rake "data:remove_old_searches" # Delete all untitled contig searches older than a month
+every 1.day, at: '0:30 am' do
+ rake 'data:remove_old_searches' # Delete all untitled contig searches older than a month
end
-every 1.day, :at => '21:00 am' do
- rake "data:check_new_marker_sequences" # Checks amount of new/updated sequences and runs SATIVA analysis if necessary
+every 1.day, at: '21:00 am' do
+ rake 'data:check_new_marker_sequences' # Checks amount of new/updated sequences and runs SATIVA analysis if necessary
end
-every 1.day, :at => '5:00 am' do
- rake "data:download_sativa_results" # Downloads any available SATIVA results
+every 1.day, at: '5:00 am' do
+ rake 'data:download_sativa_results' # Downloads any available SATIVA results
end
-every 1.day, :at => '5:10 am' do
- rake "data:flag_specimen" # Places a warning on specimens with multiple sequences that have issues
+every 1.day, at: '5:10 am' do
+ rake 'data:flag_specimen' # Places a warning on specimens with multiple sequences that have issues
end
-every 1.day, :at => '5:15 am' do
- rake "data:unflag_specimen" # Removes warnings from specimens with less than two sequences that have issues
-end
\ No newline at end of file
+every 1.day, at: '5:15 am' do
+ rake 'data:unflag_specimen' # Removes warnings from specimens with less than two sequences that have issues
+end
diff --git a/db/migrate/20140427145700_devise_create_users.rb b/db/migrate/20140427145700_devise_create_users.rb
index cf497c27..620b04c3 100644
--- a/db/migrate/20140427145700_devise_create_users.rb
+++ b/db/migrate/20140427145700_devise_create_users.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
- t.string :email, null: false, default: ""
- t.string :encrypted_password, null: false, default: ""
+ t.string :email, null: false, default: ''
+ t.string :encrypted_password, null: false, default: ''
## Recoverable
t.string :reset_password_token
@@ -30,7 +32,6 @@ def change
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
-
t.timestamps
end
diff --git a/db/migrate/20140427145702_add_name_to_users.rb b/db/migrate/20140427145702_add_name_to_users.rb
index bac750eb..f6e6bef4 100644
--- a/db/migrate/20140427145702_add_name_to_users.rb
+++ b/db/migrate/20140427145702_add_name_to_users.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddNameToUsers < ActiveRecord::Migration
def change
add_column :users, :name, :string
diff --git a/db/migrate/20140427170957_create_contigs.rb b/db/migrate/20140427170957_create_contigs.rb
index 81c734cb..23b36e94 100644
--- a/db/migrate/20140427170957_create_contigs.rb
+++ b/db/migrate/20140427170957_create_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateContigs < ActiveRecord::Migration
def change
create_table :contigs do |t|
diff --git a/db/migrate/20140427171206_create_families.rb b/db/migrate/20140427171206_create_families.rb
index 7cce5b66..c175392b 100644
--- a/db/migrate/20140427171206_create_families.rb
+++ b/db/migrate/20140427171206_create_families.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateFamilies < ActiveRecord::Migration
def change
create_table :families do |t|
diff --git a/db/migrate/20140427171750_create_copies.rb b/db/migrate/20140427171750_create_copies.rb
index 02a2e978..950553a9 100644
--- a/db/migrate/20140427171750_create_copies.rb
+++ b/db/migrate/20140427171750_create_copies.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateCopies < ActiveRecord::Migration
def change
create_table :copies do |t|
diff --git a/db/migrate/20140427171848_create_markers.rb b/db/migrate/20140427171848_create_markers.rb
index 4185f8ef..64dba680 100644
--- a/db/migrate/20140427171848_create_markers.rb
+++ b/db/migrate/20140427171848_create_markers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateMarkers < ActiveRecord::Migration
def change
create_table :markers do |t|
diff --git a/db/migrate/20140427171933_create_micronic_plates.rb b/db/migrate/20140427171933_create_micronic_plates.rb
index 25b3f4d2..b15e550c 100644
--- a/db/migrate/20140427171933_create_micronic_plates.rb
+++ b/db/migrate/20140427171933_create_micronic_plates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateMicronicPlates < ActiveRecord::Migration
def change
create_table :micronic_plates do |t|
diff --git a/db/migrate/20140427172024_create_plant_plates.rb b/db/migrate/20140427172024_create_plant_plates.rb
index 2ca6bfda..a3bdfb6a 100644
--- a/db/migrate/20140427172024_create_plant_plates.rb
+++ b/db/migrate/20140427172024_create_plant_plates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreatePlantPlates < ActiveRecord::Migration
def change
create_table :plant_plates do |t|
diff --git a/db/migrate/20140427172121_create_primer_reads.rb b/db/migrate/20140427172121_create_primer_reads.rb
index 8f9809fb..7e2c181d 100644
--- a/db/migrate/20140427172121_create_primer_reads.rb
+++ b/db/migrate/20140427172121_create_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreatePrimerReads < ActiveRecord::Migration
def change
create_table :primer_reads do |t|
diff --git a/db/migrate/20140427172201_create_primers.rb b/db/migrate/20140427172201_create_primers.rb
index 28c23db4..cfccb8b2 100644
--- a/db/migrate/20140427172201_create_primers.rb
+++ b/db/migrate/20140427172201_create_primers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreatePrimers < ActiveRecord::Migration
def change
create_table :primers do |t|
diff --git a/db/migrate/20140427172301_create_statuses.rb b/db/migrate/20140427172301_create_statuses.rb
index f6c0e156..2489d53d 100644
--- a/db/migrate/20140427172301_create_statuses.rb
+++ b/db/migrate/20140427172301_create_statuses.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateStatuses < ActiveRecord::Migration
def change
create_table :statuses do |t|
diff --git a/db/migrate/20140427172324_create_tissues.rb b/db/migrate/20140427172324_create_tissues.rb
index 027ac8d0..a2ddd262 100644
--- a/db/migrate/20140427172324_create_tissues.rb
+++ b/db/migrate/20140427172324_create_tissues.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateTissues < ActiveRecord::Migration
def change
create_table :tissues do |t|
diff --git a/db/migrate/20140427175033_create_individuals.rb b/db/migrate/20140427175033_create_individuals.rb
index 27e9485f..c305b3b7 100644
--- a/db/migrate/20140427175033_create_individuals.rb
+++ b/db/migrate/20140427175033_create_individuals.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateIndividuals < ActiveRecord::Migration
def change
create_table :individuals do |t|
diff --git a/db/migrate/20140504191737_create_orders.rb b/db/migrate/20140504191737_create_orders.rb
index ef944c8d..599c89b2 100644
--- a/db/migrate/20140504191737_create_orders.rb
+++ b/db/migrate/20140504191737_create_orders.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateOrders < ActiveRecord::Migration
def change
create_table :orders do |t|
diff --git a/db/migrate/20140505202236_create_marker_sequences.rb b/db/migrate/20140505202236_create_marker_sequences.rb
index b677a3f5..91a66af6 100644
--- a/db/migrate/20140505202236_create_marker_sequences.rb
+++ b/db/migrate/20140505202236_create_marker_sequences.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateMarkerSequences < ActiveRecord::Migration
def change
create_table :marker_sequences do |t|
diff --git a/db/migrate/20140507193213_add_genbank_to_marker_sequences.rb b/db/migrate/20140507193213_add_genbank_to_marker_sequences.rb
index 417a1cd8..8a6460d1 100644
--- a/db/migrate/20140507193213_add_genbank_to_marker_sequences.rb
+++ b/db/migrate/20140507193213_add_genbank_to_marker_sequences.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddGenbankToMarkerSequences < ActiveRecord::Migration
def change
add_column :marker_sequences, :genbank, :string
diff --git a/db/migrate/20140507194029_create_lab_racks.rb b/db/migrate/20140507194029_create_lab_racks.rb
index 552451b6..570fadbf 100644
--- a/db/migrate/20140507194029_create_lab_racks.rb
+++ b/db/migrate/20140507194029_create_lab_racks.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateLabRacks < ActiveRecord::Migration
def change
create_table :lab_racks do |t|
diff --git a/db/migrate/20140507194056_create_freezers.rb b/db/migrate/20140507194056_create_freezers.rb
index 5b20ae20..cfd51ee8 100644
--- a/db/migrate/20140507194056_create_freezers.rb
+++ b/db/migrate/20140507194056_create_freezers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateFreezers < ActiveRecord::Migration
def change
create_table :freezers do |t|
diff --git a/db/migrate/20140507194116_create_labs.rb b/db/migrate/20140507194116_create_labs.rb
index 365eb117..cae876fd 100644
--- a/db/migrate/20140507194116_create_labs.rb
+++ b/db/migrate/20140507194116_create_labs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateLabs < ActiveRecord::Migration
def change
create_table :labs do |t|
diff --git a/db/migrate/20140507195652_remove_sequence_from_marker_sequences.rb b/db/migrate/20140507195652_remove_sequence_from_marker_sequences.rb
index 64a982f0..c3e026d5 100644
--- a/db/migrate/20140507195652_remove_sequence_from_marker_sequences.rb
+++ b/db/migrate/20140507195652_remove_sequence_from_marker_sequences.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveSequenceFromMarkerSequences < ActiveRecord::Migration
def change
remove_column :marker_sequences, :sequence, :string
diff --git a/db/migrate/20140507195841_add_sequence_to_marker_sequences.rb b/db/migrate/20140507195841_add_sequence_to_marker_sequences.rb
index 92d57bc4..3865a304 100644
--- a/db/migrate/20140507195841_add_sequence_to_marker_sequences.rb
+++ b/db/migrate/20140507195841_add_sequence_to_marker_sequences.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSequenceToMarkerSequences < ActiveRecord::Migration
def change
add_column :marker_sequences, :sequence, :string
diff --git a/db/migrate/20140507195937_remove_sequence_from_markers.rb b/db/migrate/20140507195937_remove_sequence_from_markers.rb
index d96b1f6d..e22a666a 100644
--- a/db/migrate/20140507195937_remove_sequence_from_markers.rb
+++ b/db/migrate/20140507195937_remove_sequence_from_markers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveSequenceFromMarkers < ActiveRecord::Migration
def change
remove_column :markers, :sequence, :text
diff --git a/db/migrate/20140507200016_remove_accession_from_markers.rb b/db/migrate/20140507200016_remove_accession_from_markers.rb
index cca94d01..eda50305 100644
--- a/db/migrate/20140507200016_remove_accession_from_markers.rb
+++ b/db/migrate/20140507200016_remove_accession_from_markers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveAccessionFromMarkers < ActiveRecord::Migration
def change
remove_column :markers, :accession, :string
diff --git a/db/migrate/20140507200544_remove_seqe_from_marker_sequences.rb b/db/migrate/20140507200544_remove_seqe_from_marker_sequences.rb
index 8b99b43a..6e52554f 100644
--- a/db/migrate/20140507200544_remove_seqe_from_marker_sequences.rb
+++ b/db/migrate/20140507200544_remove_seqe_from_marker_sequences.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveSeqeFromMarkerSequences < ActiveRecord::Migration
def change
remove_column :marker_sequences, :sequence, :string
diff --git a/db/migrate/20140507200617_add_seq_to_marker_sequences.rb b/db/migrate/20140507200617_add_seq_to_marker_sequences.rb
index a060e229..8615cdb3 100644
--- a/db/migrate/20140507200617_add_seq_to_marker_sequences.rb
+++ b/db/migrate/20140507200617_add_seq_to_marker_sequences.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSeqToMarkerSequences < ActiveRecord::Migration
def change
add_column :marker_sequences, :sequence, :text
diff --git a/db/migrate/20140509145138_create_shelves.rb b/db/migrate/20140509145138_create_shelves.rb
index 92234a1d..b3ec3084 100644
--- a/db/migrate/20140509145138_create_shelves.rb
+++ b/db/migrate/20140509145138_create_shelves.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateShelves < ActiveRecord::Migration
def change
create_table :shelves do |t|
diff --git a/db/migrate/20140510135015_create_projects.rb b/db/migrate/20140510135015_create_projects.rb
index e466a13d..5bd14967 100644
--- a/db/migrate/20140510135015_create_projects.rb
+++ b/db/migrate/20140510135015_create_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
diff --git a/db/migrate/20140510135301_create_alignments.rb b/db/migrate/20140510135301_create_alignments.rb
index 2a0bcef3..5987c6cb 100644
--- a/db/migrate/20140510135301_create_alignments.rb
+++ b/db/migrate/20140510135301_create_alignments.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateAlignments < ActiveRecord::Migration
def change
create_table :alignments do |t|
diff --git a/db/migrate/20140510143055_create_primer_pos_on_genomes.rb b/db/migrate/20140510143055_create_primer_pos_on_genomes.rb
index 90848ba4..37f47cac 100644
--- a/db/migrate/20140510143055_create_primer_pos_on_genomes.rb
+++ b/db/migrate/20140510143055_create_primer_pos_on_genomes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreatePrimerPosOnGenomes < ActiveRecord::Migration
def change
create_table :primer_pos_on_genomes do |t|
diff --git a/db/migrate/20140510144847_add_projects_users_table.rb b/db/migrate/20140510144847_add_projects_users_table.rb
index 27c6bec5..6150274c 100644
--- a/db/migrate/20140510144847_add_projects_users_table.rb
+++ b/db/migrate/20140510144847_add_projects_users_table.rb
@@ -1,7 +1,8 @@
-class AddProjUsersTable < ActiveRecord::Migration
+# frozen_string_literal: true
+class AddProjUsersTable < ActiveRecord::Migration
def change
- create_table :projects_users, :id => false do |t|
+ create_table :projects_users, id: false do |t|
t.references :project
t.references :user
end
@@ -10,4 +11,4 @@ def change
def self.down
drop_table :projects_users
end
-end
\ No newline at end of file
+end
diff --git a/db/migrate/20140510151628_add_pr_us_table.rb b/db/migrate/20140510151628_add_pr_us_table.rb
index 3924d0fe..aaa815e3 100644
--- a/db/migrate/20140510151628_add_pr_us_table.rb
+++ b/db/migrate/20140510151628_add_pr_us_table.rb
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
class AddPrUsTable < ActiveRecord::Migration
def change
- create_table :projects_users, :id => false do |t|
+ create_table :projects_users, id: false do |t|
t.references :project
t.references :user
end
diff --git a/db/migrate/20140510163102_add_silica_gel_to_individuals.rb b/db/migrate/20140510163102_add_silica_gel_to_individuals.rb
index 17b099e2..d8407f06 100644
--- a/db/migrate/20140510163102_add_silica_gel_to_individuals.rb
+++ b/db/migrate/20140510163102_add_silica_gel_to_individuals.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSilicaGelToIndividuals < ActiveRecord::Migration
def change
add_column :individuals, :silica_gel, :boolean
diff --git a/db/migrate/20140510163211_add_collected_to_individuals.rb b/db/migrate/20140510163211_add_collected_to_individuals.rb
index 8171a068..2f6cfb1b 100644
--- a/db/migrate/20140510163211_add_collected_to_individuals.rb
+++ b/db/migrate/20140510163211_add_collected_to_individuals.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddCollectedToIndividuals < ActiveRecord::Migration
def change
add_column :individuals, :collected, :date
diff --git a/db/migrate/20140510174836_add_notes_to_primers.rb b/db/migrate/20140510174836_add_notes_to_primers.rb
index 9cbd6c07..4e914faa 100644
--- a/db/migrate/20140510174836_add_notes_to_primers.rb
+++ b/db/migrate/20140510174836_add_notes_to_primers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddNotesToPrimers < ActiveRecord::Migration
def change
add_column :primers, :notes, :text
diff --git a/db/migrate/20140510175052_create_higher_order_taxons.rb b/db/migrate/20140510175052_create_higher_order_taxons.rb
index 0b68a165..867adae7 100644
--- a/db/migrate/20140510175052_create_higher_order_taxons.rb
+++ b/db/migrate/20140510175052_create_higher_order_taxons.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateHigherOrderTaxons < ActiveRecord::Migration
def change
create_table :higher_order_taxons do |t|
diff --git a/db/migrate/20140510175410_add_location_in_rack_to_plant_plate.rb b/db/migrate/20140510175410_add_location_in_rack_to_plant_plate.rb
index c3947e3c..13587e6f 100644
--- a/db/migrate/20140510175410_add_location_in_rack_to_plant_plate.rb
+++ b/db/migrate/20140510175410_add_location_in_rack_to_plant_plate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddLocationInRackToPlantPlate < ActiveRecord::Migration
def change
add_column :plant_plates, :location_in_rack, :string
diff --git a/db/migrate/20140510175437_add_location_in_rack_to_micronic_plate.rb b/db/migrate/20140510175437_add_location_in_rack_to_micronic_plate.rb
index d6399ce8..e9f01eb7 100644
--- a/db/migrate/20140510175437_add_location_in_rack_to_micronic_plate.rb
+++ b/db/migrate/20140510175437_add_location_in_rack_to_micronic_plate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddLocationInRackToMicronicPlate < ActiveRecord::Migration
def change
add_column :micronic_plates, :location_in_rack, :string
diff --git a/db/migrate/20140510175842_add_is_copy_to_copy.rb b/db/migrate/20140510175842_add_is_copy_to_copy.rb
index a770526e..825f4247 100644
--- a/db/migrate/20140510175842_add_is_copy_to_copy.rb
+++ b/db/migrate/20140510175842_add_is_copy_to_copy.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddIsCopyToCopy < ActiveRecord::Migration
def change
add_column :copies, :isCopy, :boolean
diff --git a/db/migrate/20140510181511_drop_spec_epi.rb b/db/migrate/20140510181511_drop_spec_epi.rb
index ff565a32..ac4ff069 100644
--- a/db/migrate/20140510181511_drop_spec_epi.rb
+++ b/db/migrate/20140510181511_drop_spec_epi.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DropSpecEpi < ActiveRecord::Migration
def change
drop_table :species_epithets
diff --git a/db/migrate/20140510181759_remove_species_epithet_from_species.rb b/db/migrate/20140510181759_remove_species_epithet_from_species.rb
index ddd415be..cf789924 100644
--- a/db/migrate/20140510181759_remove_species_epithet_from_species.rb
+++ b/db/migrate/20140510181759_remove_species_epithet_from_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveSpeciesEpithetFromSpecies < ActiveRecord::Migration
def change
remove_column :species, :species_epithet, :string
diff --git a/db/migrate/20140510181829_remove_author_from_species.rb b/db/migrate/20140510181829_remove_author_from_species.rb
index ed86374a..2434be4c 100644
--- a/db/migrate/20140510181829_remove_author_from_species.rb
+++ b/db/migrate/20140510181829_remove_author_from_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveAuthorFromSpecies < ActiveRecord::Migration
def change
remove_column :species, :author, :string
diff --git a/db/migrate/20140510182038_add_published_to_species.rb b/db/migrate/20140510182038_add_published_to_species.rb
index 3fbb9899..13dc732e 100644
--- a/db/migrate/20140510182038_add_published_to_species.rb
+++ b/db/migrate/20140510182038_add_published_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPublishedToSpecies < ActiveRecord::Migration
def change
add_column :species, :published, :date
diff --git a/db/migrate/20140510182641_drop_table_species_eptithets.rb b/db/migrate/20140510182641_drop_table_species_eptithets.rb
index fc4ac682..64ed0587 100644
--- a/db/migrate/20140510182641_drop_table_species_eptithets.rb
+++ b/db/migrate/20140510182641_drop_table_species_eptithets.rb
@@ -1,6 +1,7 @@
+# frozen_string_literal: true
+
class DropTableSpeciesEptithets < ActiveRecord::Migration
def change
drop_table :species_eptithets
-
end
end
diff --git a/db/migrate/20140511124759_create_issues.rb b/db/migrate/20140511124759_create_issues.rb
index f4295c72..9c4a2366 100644
--- a/db/migrate/20140511124759_create_issues.rb
+++ b/db/migrate/20140511124759_create_issues.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateIssues < ActiveRecord::Migration
def change
create_table :issues do |t|
diff --git a/db/migrate/20140530114118_add_chromatogram_to_primer_read.rb b/db/migrate/20140530114118_add_chromatogram_to_primer_read.rb
index 9eb21a67..457b9b35 100644
--- a/db/migrate/20140530114118_add_chromatogram_to_primer_read.rb
+++ b/db/migrate/20140530114118_add_chromatogram_to_primer_read.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddChromatogramToPrimerRead < ActiveRecord::Migration
def self.up
add_attachment :primer_reads, :chromatogram
diff --git a/db/migrate/20140530151411_add_primer_id_to_primer_reads.rb b/db/migrate/20140530151411_add_primer_id_to_primer_reads.rb
index f03c6cab..87fc710d 100644
--- a/db/migrate/20140530151411_add_primer_id_to_primer_reads.rb
+++ b/db/migrate/20140530151411_add_primer_id_to_primer_reads.rb
@@ -1,7 +1,7 @@
+# frozen_string_literal: true
+
class AddPrimerIdToPrimerReads < ActiveRecord::Migration
def change
-
- add_column :primer_reads, :primer_id, :integer
-
+ add_column :primer_reads, :primer_id, :integer
end
end
diff --git a/db/migrate/20140530153116_add_copy_id_to_primer_reads.rb b/db/migrate/20140530153116_add_copy_id_to_primer_reads.rb
index 3b3b47fd..920cb4dc 100644
--- a/db/migrate/20140530153116_add_copy_id_to_primer_reads.rb
+++ b/db/migrate/20140530153116_add_copy_id_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddCopyIdToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :copy_id, :integer
diff --git a/db/migrate/20140530154334_add_author_id_to_species.rb b/db/migrate/20140530154334_add_author_id_to_species.rb
index 7e328b3d..059b9463 100644
--- a/db/migrate/20140530154334_add_author_id_to_species.rb
+++ b/db/migrate/20140530154334_add_author_id_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAuthorIdToSpecies < ActiveRecord::Migration
def change
add_column :species, :author_id, :integer
diff --git a/db/migrate/20140530161425_add_genus_id_to_species.rb b/db/migrate/20140530161425_add_genus_id_to_species.rb
index 95a88434..b8ac0387 100644
--- a/db/migrate/20140530161425_add_genus_id_to_species.rb
+++ b/db/migrate/20140530161425_add_genus_id_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddGenusIdToSpecies < ActiveRecord::Migration
def change
add_column :species, :genus_id, :integer
diff --git a/db/migrate/20140530161534_add_epithet_id_to_species.rb b/db/migrate/20140530161534_add_epithet_id_to_species.rb
index cfaff9f0..3432be6b 100644
--- a/db/migrate/20140530161534_add_epithet_id_to_species.rb
+++ b/db/migrate/20140530161534_add_epithet_id_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddEpithetIdToSpecies < ActiveRecord::Migration
def change
add_column :species, :epithet_id, :integer
diff --git a/db/migrate/20140530161733_add_family_id_to_genus.rb b/db/migrate/20140530161733_add_family_id_to_genus.rb
index e9d4f98f..f46bcdc9 100644
--- a/db/migrate/20140530161733_add_family_id_to_genus.rb
+++ b/db/migrate/20140530161733_add_family_id_to_genus.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddFamilyIdToGenus < ActiveRecord::Migration
def change
add_column :gens, :family_id, :integer
diff --git a/db/migrate/20140530161912_add_marker_id_to_primer.rb b/db/migrate/20140530161912_add_marker_id_to_primer.rb
index b62c6b51..3db5f276 100644
--- a/db/migrate/20140530161912_add_marker_id_to_primer.rb
+++ b/db/migrate/20140530161912_add_marker_id_to_primer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddMarkerIdToPrimer < ActiveRecord::Migration
def change
add_column :primers, :marker_id, :integer
diff --git a/db/migrate/20140530172425_change_species_id_names.rb b/db/migrate/20140530172425_change_species_id_names.rb
index 65ee4f93..88887c04 100644
--- a/db/migrate/20140530172425_change_species_id_names.rb
+++ b/db/migrate/20140530172425_change_species_id_names.rb
@@ -1,8 +1,8 @@
+# frozen_string_literal: true
+
class ChangeSpeciesIdNames < ActiveRecord::Migration
def change
-
- rename_column :species, :epithet_id, :species_epithet_id
- rename_column :species, :genus_id, :gen_id
-
+ rename_column :species, :epithet_id, :species_epithet_id
+ rename_column :species, :genus_id, :gen_id
end
end
diff --git a/db/migrate/20140530175330_rename_higher_order_id.rb b/db/migrate/20140530175330_rename_higher_order_id.rb
index 8ca20b60..a7155f5b 100644
--- a/db/migrate/20140530175330_rename_higher_order_id.rb
+++ b/db/migrate/20140530175330_rename_higher_order_id.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameHigherOrderId < ActiveRecord::Migration
def change
rename_column :orders, :higher_order_id, :higher_order_taxon_id
diff --git a/db/migrate/20140530192237_remove_lab_nr_from_copies.rb b/db/migrate/20140530192237_remove_lab_nr_from_copies.rb
index 50c6a854..ec166b7a 100644
--- a/db/migrate/20140530192237_remove_lab_nr_from_copies.rb
+++ b/db/migrate/20140530192237_remove_lab_nr_from_copies.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveLabNrFromCopies < ActiveRecord::Migration
def change
remove_column :copies, :lab_nr, :integer
diff --git a/db/migrate/20140530193440_rename_marker_seq_id.rb b/db/migrate/20140530193440_rename_marker_seq_id.rb
index 2b203598..efcab851 100644
--- a/db/migrate/20140530193440_rename_marker_seq_id.rb
+++ b/db/migrate/20140530193440_rename_marker_seq_id.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameMarkerSeqId < ActiveRecord::Migration
def change
rename_column :contigs, :marker_seq_id, :marker_sequence_id
diff --git a/db/migrate/20140611123927_add_trimmed_to_primer_read.rb b/db/migrate/20140611123927_add_trimmed_to_primer_read.rb
index e9db62e9..c216bbd2 100644
--- a/db/migrate/20140611123927_add_trimmed_to_primer_read.rb
+++ b/db/migrate/20140611123927_add_trimmed_to_primer_read.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddTrimmedToPrimerRead < ActiveRecord::Migration
def change
add_column :primer_reads, :trimmedReadEnd, :integer
diff --git a/db/migrate/20140611125718_add_qualities.rb b/db/migrate/20140611125718_add_qualities.rb
index a9edfe38..892d6fe1 100644
--- a/db/migrate/20140611125718_add_qualities.rb
+++ b/db/migrate/20140611125718_add_qualities.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddQualities < ActiveRecord::Migration
def change
add_column :primer_reads, :qualities, :integer, array: true
diff --git a/db/migrate/20140628084625_add_labcode_to_primers.rb b/db/migrate/20140628084625_add_labcode_to_primers.rb
index 496efd1b..8b2bca71 100644
--- a/db/migrate/20140628084625_add_labcode_to_primers.rb
+++ b/db/migrate/20140628084625_add_labcode_to_primers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddLabcodeToPrimers < ActiveRecord::Migration
def change
add_column :primers, :labcode, :string
diff --git a/db/migrate/20140629173725_add_copy_id_to_contigs.rb b/db/migrate/20140629173725_add_copy_id_to_contigs.rb
index a9b60e7f..4a3cc479 100644
--- a/db/migrate/20140629173725_add_copy_id_to_contigs.rb
+++ b/db/migrate/20140629173725_add_copy_id_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddCopyIdToContigs < ActiveRecord::Migration
def change
add_column :contigs, :copy_id, :integer
diff --git a/db/migrate/20140629173952_add_marker_id_to_contigs.rb b/db/migrate/20140629173952_add_marker_id_to_contigs.rb
index 9fa5f951..d4cf1858 100644
--- a/db/migrate/20140629173952_add_marker_id_to_contigs.rb
+++ b/db/migrate/20140629173952_add_marker_id_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddMarkerIdToContigs < ActiveRecord::Migration
def change
add_column :contigs, :marker_id, :integer
diff --git a/db/migrate/20140701183233_add_primer_read_id_to_issues.rb b/db/migrate/20140701183233_add_primer_read_id_to_issues.rb
index 5973f3ec..244811c4 100644
--- a/db/migrate/20140701183233_add_primer_read_id_to_issues.rb
+++ b/db/migrate/20140701183233_add_primer_read_id_to_issues.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPrimerReadIdToIssues < ActiveRecord::Migration
def change
add_column :issues, :primer_read_id, :integer
diff --git a/db/migrate/20140703164632_add_reverse_to_primer_reads.rb b/db/migrate/20140703164632_add_reverse_to_primer_reads.rb
index 25830852..7416ed5f 100644
--- a/db/migrate/20140703164632_add_reverse_to_primer_reads.rb
+++ b/db/migrate/20140703164632_add_reverse_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddReverseToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :reverse, :boolean
diff --git a/db/migrate/20140704191315_add_aligned_seq_to_primer_read.rb b/db/migrate/20140704191315_add_aligned_seq_to_primer_read.rb
index ab0d0d80..aea1fd57 100644
--- a/db/migrate/20140704191315_add_aligned_seq_to_primer_read.rb
+++ b/db/migrate/20140704191315_add_aligned_seq_to_primer_read.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAlignedSeqToPrimerRead < ActiveRecord::Migration
def change
add_column :primer_reads, :aligned_seq, :string
diff --git a/db/migrate/20140704191354_add_used_for_con_to_primer_read.rb b/db/migrate/20140704191354_add_used_for_con_to_primer_read.rb
index 80624f18..a231ecee 100644
--- a/db/migrate/20140704191354_add_used_for_con_to_primer_read.rb
+++ b/db/migrate/20140704191354_add_used_for_con_to_primer_read.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddUsedForConToPrimerRead < ActiveRecord::Migration
def change
add_column :primer_reads, :used_for_con, :boolean
diff --git a/db/migrate/20140705130422_change_type.rb b/db/migrate/20140705130422_change_type.rb
index f1ac7f77..4b1fbe96 100644
--- a/db/migrate/20140705130422_change_type.rb
+++ b/db/migrate/20140705130422_change_type.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeType < ActiveRecord::Migration
def change
change_column(:primer_reads, :aligned_seq, :text)
diff --git a/db/migrate/20140706140552_add_contig_id_to_issue.rb b/db/migrate/20140706140552_add_contig_id_to_issue.rb
index 2cd74c48..02c8edb9 100644
--- a/db/migrate/20140706140552_add_contig_id_to_issue.rb
+++ b/db/migrate/20140706140552_add_contig_id_to_issue.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddContigIdToIssue < ActiveRecord::Migration
def change
add_column :issues, :contig_id, :integer
diff --git a/db/migrate/20140706182145_add_quality_string_to_primer_reads.rb b/db/migrate/20140706182145_add_quality_string_to_primer_reads.rb
index 6ec95989..441fd0ae 100644
--- a/db/migrate/20140706182145_add_quality_string_to_primer_reads.rb
+++ b/db/migrate/20140706182145_add_quality_string_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddQualityStringToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :quality_string, :text
diff --git a/db/migrate/20140711115017_remove_gen_id_from_species.rb b/db/migrate/20140711115017_remove_gen_id_from_species.rb
index 501af530..fb03ddd0 100644
--- a/db/migrate/20140711115017_remove_gen_id_from_species.rb
+++ b/db/migrate/20140711115017_remove_gen_id_from_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveGenIdFromSpecies < ActiveRecord::Migration
def change
remove_column :species, :gen_id, :integer
diff --git a/db/migrate/20140711115143_remove_sp_epi_from_species.rb b/db/migrate/20140711115143_remove_sp_epi_from_species.rb
index b3670367..8c716461 100644
--- a/db/migrate/20140711115143_remove_sp_epi_from_species.rb
+++ b/db/migrate/20140711115143_remove_sp_epi_from_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveSpEpiFromSpecies < ActiveRecord::Migration
def change
remove_column :species, :species_epithet_id, :integer
diff --git a/db/migrate/20140711115248_remove_author_id_from_species.rb b/db/migrate/20140711115248_remove_author_id_from_species.rb
index 64ac2386..6ec44ea8 100644
--- a/db/migrate/20140711115248_remove_author_id_from_species.rb
+++ b/db/migrate/20140711115248_remove_author_id_from_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveAuthorIdFromSpecies < ActiveRecord::Migration
def change
remove_column :species, :author_id, :integer
diff --git a/db/migrate/20140711115330_remove_published_from_species.rb b/db/migrate/20140711115330_remove_published_from_species.rb
index f9d37fb0..45a4aa41 100644
--- a/db/migrate/20140711115330_remove_published_from_species.rb
+++ b/db/migrate/20140711115330_remove_published_from_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemovePublishedFromSpecies < ActiveRecord::Migration
def change
remove_column :species, :published, :date
diff --git a/db/migrate/20140711115522_add_genus_name_to_species.rb b/db/migrate/20140711115522_add_genus_name_to_species.rb
index 0c452b72..ef1e811b 100644
--- a/db/migrate/20140711115522_add_genus_name_to_species.rb
+++ b/db/migrate/20140711115522_add_genus_name_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddGenusNameToSpecies < ActiveRecord::Migration
def change
add_column :species, :genus_name, :string
diff --git a/db/migrate/20140711115558_add_species_epithet_to_species.rb b/db/migrate/20140711115558_add_species_epithet_to_species.rb
index 478a060d..f3bbd553 100644
--- a/db/migrate/20140711115558_add_species_epithet_to_species.rb
+++ b/db/migrate/20140711115558_add_species_epithet_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSpeciesEpithetToSpecies < ActiveRecord::Migration
def change
add_column :species, :species_epithet, :string
diff --git a/db/migrate/20140711115635_add_author_to_species.rb b/db/migrate/20140711115635_add_author_to_species.rb
index c98fdc8c..cf8fe23b 100644
--- a/db/migrate/20140711115635_add_author_to_species.rb
+++ b/db/migrate/20140711115635_add_author_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAuthorToSpecies < ActiveRecord::Migration
def change
add_column :species, :author, :string
diff --git a/db/migrate/20140711115737_add_family_id_to_species.rb b/db/migrate/20140711115737_add_family_id_to_species.rb
index c79a31f3..d2ccaa81 100644
--- a/db/migrate/20140711115737_add_family_id_to_species.rb
+++ b/db/migrate/20140711115737_add_family_id_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddFamilyIdToSpecies < ActiveRecord::Migration
def change
add_column :species, :family_id, :integer
diff --git a/db/migrate/20140711121015_drop_gens_etc.rb b/db/migrate/20140711121015_drop_gens_etc.rb
index b0c89e22..80f08951 100644
--- a/db/migrate/20140711121015_drop_gens_etc.rb
+++ b/db/migrate/20140711121015_drop_gens_etc.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DropGensEtc < ActiveRecord::Migration
def change
drop_table :gens
diff --git a/db/migrate/20140711155739_create_species.rb b/db/migrate/20140711155739_create_species.rb
index a73b32b6..80bd3197 100644
--- a/db/migrate/20140711155739_create_species.rb
+++ b/db/migrate/20140711155739_create_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateSpecies < ActiveRecord::Migration
def change
create_table :species do |t|
diff --git a/db/migrate/20140711163837_add_family_to_species.rb b/db/migrate/20140711163837_add_family_to_species.rb
index 13bf76b9..fb6a0913 100644
--- a/db/migrate/20140711163837_add_family_to_species.rb
+++ b/db/migrate/20140711163837_add_family_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddFamilyToSpecies < ActiveRecord::Migration
def change
add_column :species, :family_id, :integer
diff --git a/db/migrate/20140711193809_add_infra_to_species.rb b/db/migrate/20140711193809_add_infra_to_species.rb
index b3ea7f70..49ae473f 100644
--- a/db/migrate/20140711193809_add_infra_to_species.rb
+++ b/db/migrate/20140711193809_add_infra_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddInfraToSpecies < ActiveRecord::Migration
def change
add_column :species, :infraspecific, :string
diff --git a/db/migrate/20140711193842_add_comment_to_species.rb b/db/migrate/20140711193842_add_comment_to_species.rb
index f4cc391c..0bf44ed6 100644
--- a/db/migrate/20140711193842_add_comment_to_species.rb
+++ b/db/migrate/20140711193842_add_comment_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddCommentToSpecies < ActiveRecord::Migration
def change
add_column :species, :comment, :text
diff --git a/db/migrate/20140711194227_add_german_to_species.rb b/db/migrate/20140711194227_add_german_to_species.rb
index 81236be2..c415fcd1 100644
--- a/db/migrate/20140711194227_add_german_to_species.rb
+++ b/db/migrate/20140711194227_add_german_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddGermanToSpecies < ActiveRecord::Migration
def change
add_column :species, :german_name, :string
diff --git a/db/migrate/20140711201249_add_infraauthor_to_species.rb b/db/migrate/20140711201249_add_infraauthor_to_species.rb
index 7b878d74..15582d59 100644
--- a/db/migrate/20140711201249_add_infraauthor_to_species.rb
+++ b/db/migrate/20140711201249_add_infraauthor_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddInfraauthorToSpecies < ActiveRecord::Migration
def change
add_column :species, :author_infra, :string
diff --git a/db/migrate/20140711205359_add_germa_to_higher_order_taxons.rb b/db/migrate/20140711205359_add_germa_to_higher_order_taxons.rb
index 3073813c..d64031e7 100644
--- a/db/migrate/20140711205359_add_germa_to_higher_order_taxons.rb
+++ b/db/migrate/20140711205359_add_germa_to_higher_order_taxons.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddGermaToHigherOrderTaxons < ActiveRecord::Migration
def change
add_column :higher_order_taxons, :german_name, :string
diff --git a/db/migrate/20140712202023_create_delayed_jobs.rb b/db/migrate/20140712202023_create_delayed_jobs.rb
index ec0dd93c..e9e32d0f 100644
--- a/db/migrate/20140712202023_create_delayed_jobs.rb
+++ b/db/migrate/20140712202023_create_delayed_jobs.rb
@@ -1,9 +1,11 @@
+# frozen_string_literal: true
+
class CreateDelayedJobs < ActiveRecord::Migration
def self.up
- create_table :delayed_jobs, :force => true do |table|
- table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue
- table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually.
- table.text :handler, :null => false # YAML-encoded string of the object that will do work
+ create_table :delayed_jobs, force: true do |table|
+ table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
+ table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
+ table.text :handler, null: false # YAML-encoded string of the object that will do work
table.text :last_error # reason for last failure (See Note below)
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
table.datetime :locked_at # Set when a client is working on this object
@@ -13,7 +15,7 @@ def self.up
table.timestamps
end
- add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
+ add_index :delayed_jobs, %i[priority run_at], name: 'delayed_jobs_priority'
end
def self.down
diff --git a/db/migrate/20140713183721_add_contig_id_to_statuses.rb b/db/migrate/20140713183721_add_contig_id_to_statuses.rb
index 792048f3..e820c0b2 100644
--- a/db/migrate/20140713183721_add_contig_id_to_statuses.rb
+++ b/db/migrate/20140713183721_add_contig_id_to_statuses.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddContigIdToStatuses < ActiveRecord::Migration
def change
add_column :statuses, :contig_id, :integer
diff --git a/db/migrate/20140713184925_add_assembled_to_contigs.rb b/db/migrate/20140713184925_add_assembled_to_contigs.rb
index 26b49220..6b3933a3 100644
--- a/db/migrate/20140713184925_add_assembled_to_contigs.rb
+++ b/db/migrate/20140713184925_add_assembled_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAssembledToContigs < ActiveRecord::Migration
def change
add_column :contigs, :assembled, :boolean
diff --git a/db/migrate/20140716134550_add_position_to_primer_reads.rb b/db/migrate/20140716134550_add_position_to_primer_reads.rb
index 8292be6b..1e840773 100644
--- a/db/migrate/20140716134550_add_position_to_primer_reads.rb
+++ b/db/migrate/20140716134550_add_position_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPositionToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :position, :integer
diff --git a/db/migrate/20140716162344_add_assembled_to_primer_reads.rb b/db/migrate/20140716162344_add_assembled_to_primer_reads.rb
index 1a820932..c5474f04 100644
--- a/db/migrate/20140716162344_add_assembled_to_primer_reads.rb
+++ b/db/migrate/20140716162344_add_assembled_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAssembledToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :assembled, :boolean
diff --git a/db/migrate/20140716201705_add_author_to_primers.rb b/db/migrate/20140716201705_add_author_to_primers.rb
index 8a628711..9ae58d47 100644
--- a/db/migrate/20140716201705_add_author_to_primers.rb
+++ b/db/migrate/20140716201705_add_author_to_primers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAuthorToPrimers < ActiveRecord::Migration
def change
add_column :primers, :author, :string
diff --git a/db/migrate/20140716201746_add_alt_name_to_primers.rb b/db/migrate/20140716201746_add_alt_name_to_primers.rb
index 0d9e006e..3e985fbc 100644
--- a/db/migrate/20140716201746_add_alt_name_to_primers.rb
+++ b/db/migrate/20140716201746_add_alt_name_to_primers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAltNameToPrimers < ActiveRecord::Migration
def change
add_column :primers, :alt_name, :string
diff --git a/db/migrate/20140716201820_add_target_group_to_primers.rb b/db/migrate/20140716201820_add_target_group_to_primers.rb
index a3b5ccef..36f695ef 100644
--- a/db/migrate/20140716201820_add_target_group_to_primers.rb
+++ b/db/migrate/20140716201820_add_target_group_to_primers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddTargetGroupToPrimers < ActiveRecord::Migration
def change
add_column :primers, :target_group, :string
diff --git a/db/migrate/20140716203939_add_tm_to_primers.rb b/db/migrate/20140716203939_add_tm_to_primers.rb
index 136419da..91985ade 100644
--- a/db/migrate/20140716203939_add_tm_to_primers.rb
+++ b/db/migrate/20140716203939_add_tm_to_primers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddTmToPrimers < ActiveRecord::Migration
def change
add_column :primers, :tm, :string
diff --git a/db/migrate/20140717115622_add_overlaps_to_contigs.rb b/db/migrate/20140717115622_add_overlaps_to_contigs.rb
index 3b661d3f..5b1620c4 100644
--- a/db/migrate/20140717115622_add_overlaps_to_contigs.rb
+++ b/db/migrate/20140717115622_add_overlaps_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddOverlapsToContigs < ActiveRecord::Migration
def change
add_column :contigs, :overlaps, :integer
diff --git a/db/migrate/20140717120009_add_expected_reads_to_markers.rb b/db/migrate/20140717120009_add_expected_reads_to_markers.rb
index b22a145b..a022963b 100644
--- a/db/migrate/20140717120009_add_expected_reads_to_markers.rb
+++ b/db/migrate/20140717120009_add_expected_reads_to_markers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddExpectedReadsToMarkers < ActiveRecord::Migration
def change
add_column :markers, :expected_reads, :integer
diff --git a/db/migrate/20140717135209_add_partial_cons1_to_contigs.rb b/db/migrate/20140717135209_add_partial_cons1_to_contigs.rb
index 58d27f2a..c9132e58 100644
--- a/db/migrate/20140717135209_add_partial_cons1_to_contigs.rb
+++ b/db/migrate/20140717135209_add_partial_cons1_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPartialCons1ToContigs < ActiveRecord::Migration
def change
add_column :contigs, :partial_cons1, :text
diff --git a/db/migrate/20140717135233_add_partial_cons2_to_contigs.rb b/db/migrate/20140717135233_add_partial_cons2_to_contigs.rb
index 57baa1bc..27589fb9 100644
--- a/db/migrate/20140717135233_add_partial_cons2_to_contigs.rb
+++ b/db/migrate/20140717135233_add_partial_cons2_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPartialCons2ToContigs < ActiveRecord::Migration
def change
add_column :contigs, :partial_cons2, :text
diff --git a/db/migrate/20140717173827_add_assembly_tried_to_contigs.rb b/db/migrate/20140717173827_add_assembly_tried_to_contigs.rb
index 68d6b64d..f1cf2ba2 100644
--- a/db/migrate/20140717173827_add_assembly_tried_to_contigs.rb
+++ b/db/migrate/20140717173827_add_assembly_tried_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAssemblyTriedToContigs < ActiveRecord::Migration
def change
add_column :contigs, :assembly_tried, :boolean
diff --git a/db/migrate/20140718112955_add_position_to_primers.rb b/db/migrate/20140718112955_add_position_to_primers.rb
index 9f966ca6..70e76d9e 100644
--- a/db/migrate/20140718112955_add_position_to_primers.rb
+++ b/db/migrate/20140718112955_add_position_to_primers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPositionToPrimers < ActiveRecord::Migration
def change
add_column :primers, :position, :integer
diff --git a/db/migrate/20140911131412_add_synonym_to_species.rb b/db/migrate/20140911131412_add_synonym_to_species.rb
index 54d131b7..f9267067 100644
--- a/db/migrate/20140911131412_add_synonym_to_species.rb
+++ b/db/migrate/20140911131412_add_synonym_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSynonymToSpecies < ActiveRecord::Migration
def change
add_column :species, :synonym, :string
diff --git a/db/migrate/20140921155154_add_gbol_to_markers.rb b/db/migrate/20140921155154_add_gbol_to_markers.rb
index cd288718..ee3e1287 100644
--- a/db/migrate/20140921155154_add_gbol_to_markers.rb
+++ b/db/migrate/20140921155154_add_gbol_to_markers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddGbolToMarkers < ActiveRecord::Migration
def change
add_column :markers, :is_gbol, :boolean
diff --git a/db/migrate/20140923152840_add_aligned_cons_to_contigs.rb b/db/migrate/20140923152840_add_aligned_cons_to_contigs.rb
index 7817286d..557999be 100644
--- a/db/migrate/20140923152840_add_aligned_cons_to_contigs.rb
+++ b/db/migrate/20140923152840_add_aligned_cons_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAlignedConsToContigs < ActiveRecord::Migration
def change
add_column :contigs, :aligned_cons, :string
diff --git a/db/migrate/20140924170203_create_partial_cons.rb b/db/migrate/20140924170203_create_partial_cons.rb
index 2f462dd2..50e01899 100644
--- a/db/migrate/20140924170203_create_partial_cons.rb
+++ b/db/migrate/20140924170203_create_partial_cons.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreatePartialCons < ActiveRecord::Migration
def change
create_table :partial_cons do |t|
diff --git a/db/migrate/20140924170931_add_column.rb b/db/migrate/20140924170931_add_column.rb
index 25bc9b56..d5440f09 100644
--- a/db/migrate/20140924170931_add_column.rb
+++ b/db/migrate/20140924170931_add_column.rb
@@ -1,5 +1,5 @@
-class AddColumn < ActiveRecord::Migration
- def change
+# frozen_string_literal: true
- end
+class AddColumn < ActiveRecord::Migration
+ def change; end
end
diff --git a/db/migrate/20140924171250_add_contig_id_to_partial_cons.rb b/db/migrate/20140924171250_add_contig_id_to_partial_cons.rb
index 9274e24e..0fc480f0 100644
--- a/db/migrate/20140924171250_add_contig_id_to_partial_cons.rb
+++ b/db/migrate/20140924171250_add_contig_id_to_partial_cons.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddContigIdToPartialCons < ActiveRecord::Migration
def change
add_column :partial_cons, :contig_id, :integer
diff --git a/db/migrate/20140924171424_add_partial_con_id_to_primer_read.rb b/db/migrate/20140924171424_add_partial_con_id_to_primer_read.rb
index 4ef20ccd..3f1840f3 100644
--- a/db/migrate/20140924171424_add_partial_con_id_to_primer_read.rb
+++ b/db/migrate/20140924171424_add_partial_con_id_to_primer_read.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPartialConIdToPrimerRead < ActiveRecord::Migration
def change
add_column :primer_reads, :partial_con_id, :integer
diff --git a/db/migrate/20140924173029_change_partial_cons_type.rb b/db/migrate/20140924173029_change_partial_cons_type.rb
index 772d8045..1dfae845 100644
--- a/db/migrate/20140924173029_change_partial_cons_type.rb
+++ b/db/migrate/20140924173029_change_partial_cons_type.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangePartialConsType < ActiveRecord::Migration
def change
change_column :partial_cons, :aligned_sequence, :text
diff --git a/db/migrate/20140925105938_pde.rb b/db/migrate/20140925105938_pde.rb
index 471666d8..4c9d4884 100644
--- a/db/migrate/20140925105938_pde.rb
+++ b/db/migrate/20140925105938_pde.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Pde < ActiveRecord::Migration
def change
add_column :contigs, :pde, :text
diff --git a/db/migrate/20140926160225_rename_copy_to_isolate.rb b/db/migrate/20140926160225_rename_copy_to_isolate.rb
index 5ce33f25..217480ff 100644
--- a/db/migrate/20140926160225_rename_copy_to_isolate.rb
+++ b/db/migrate/20140926160225_rename_copy_to_isolate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameCopyToIsolate < ActiveRecord::Migration
def change
rename_table :copies, :isolates
diff --git a/db/migrate/20140926163501_add_gbol_isolation_nr_to_isolates.rb b/db/migrate/20140926163501_add_gbol_isolation_nr_to_isolates.rb
index 68568f72..f6c8bfe0 100644
--- a/db/migrate/20140926163501_add_gbol_isolation_nr_to_isolates.rb
+++ b/db/migrate/20140926163501_add_gbol_isolation_nr_to_isolates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddGbolIsolationNrToIsolates < ActiveRecord::Migration
def change
add_column :isolates, :gbol_isolation_nr, :string
diff --git a/db/migrate/20140926163549_add_herbarium_to_individuals.rb b/db/migrate/20140926163549_add_herbarium_to_individuals.rb
index 97f38170..bc9c43ee 100644
--- a/db/migrate/20140926163549_add_herbarium_to_individuals.rb
+++ b/db/migrate/20140926163549_add_herbarium_to_individuals.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddHerbariumToIndividuals < ActiveRecord::Migration
def change
add_column :individuals, :herbarium, :string
diff --git a/db/migrate/20140928114133_rename_copy_id.rb b/db/migrate/20140928114133_rename_copy_id.rb
index 47eff859..020ba864 100644
--- a/db/migrate/20140928114133_rename_copy_id.rb
+++ b/db/migrate/20140928114133_rename_copy_id.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameCopyId < ActiveRecord::Migration
def change
rename_column :contigs, :copy_id, :isolate_id
diff --git a/db/migrate/20140928124921_add_composed_name_to_species.rb b/db/migrate/20140928124921_add_composed_name_to_species.rb
index cf7a8254..70a42129 100644
--- a/db/migrate/20140928124921_add_composed_name_to_species.rb
+++ b/db/migrate/20140928124921_add_composed_name_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddComposedNameToSpecies < ActiveRecord::Migration
def change
add_column :species, :composed_name, :string
diff --git a/db/migrate/20140928164126_add_individual_id_to_isolates.rb b/db/migrate/20140928164126_add_individual_id_to_isolates.rb
index fe818bef..65c90e54 100644
--- a/db/migrate/20140928164126_add_individual_id_to_isolates.rb
+++ b/db/migrate/20140928164126_add_individual_id_to_isolates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddIndividualIdToIsolates < ActiveRecord::Migration
def change
add_column :isolates, :individual_id, :integer
diff --git a/db/migrate/20140928203437_change_tube_id_type.rb b/db/migrate/20140928203437_change_tube_id_type.rb
index 3027f469..9928b59f 100644
--- a/db/migrate/20140928203437_change_tube_id_type.rb
+++ b/db/migrate/20140928203437_change_tube_id_type.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeTubeIdType < ActiveRecord::Migration
def change
change_column :isolates, :micronic_tube_id, :string
diff --git a/db/migrate/20140929134322_rename_higher.rb b/db/migrate/20140929134322_rename_higher.rb
index 01bfbea3..da897c64 100644
--- a/db/migrate/20140929134322_rename_higher.rb
+++ b/db/migrate/20140929134322_rename_higher.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameHigher < ActiveRecord::Migration
def change
rename_table :higher_order_taxons, :higher_order_taxa
diff --git a/db/migrate/20140929195137_add_aligned_qualities_to_primer_reads.rb b/db/migrate/20140929195137_add_aligned_qualities_to_primer_reads.rb
index e7e810f1..f89ef2c4 100644
--- a/db/migrate/20140929195137_add_aligned_qualities_to_primer_reads.rb
+++ b/db/migrate/20140929195137_add_aligned_qualities_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAlignedQualitiesToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :aligned_qualities, :integer, array: true
diff --git a/db/migrate/20140929201548_add_aligned_qualities_to_partial_con.rb b/db/migrate/20140929201548_add_aligned_qualities_to_partial_con.rb
index 79a485ac..1618eeed 100644
--- a/db/migrate/20140929201548_add_aligned_qualities_to_partial_con.rb
+++ b/db/migrate/20140929201548_add_aligned_qualities_to_partial_con.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAlignedQualitiesToPartialCon < ActiveRecord::Migration
def change
add_column :partial_cons, :aligned_qualities, :integer, array: true
diff --git a/db/migrate/20141002132544_rename_copy.rb b/db/migrate/20141002132544_rename_copy.rb
index 2226a2eb..6f77fa13 100644
--- a/db/migrate/20141002132544_rename_copy.rb
+++ b/db/migrate/20141002132544_rename_copy.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameCopy < ActiveRecord::Migration
def change
rename_column :marker_sequences, :copy_id, :isolate_id
diff --git a/db/migrate/20141002133841_add_marker_id_to_marker_sequences.rb b/db/migrate/20141002133841_add_marker_id_to_marker_sequences.rb
index 103f0ce7..61eeb55a 100644
--- a/db/migrate/20141002133841_add_marker_id_to_marker_sequences.rb
+++ b/db/migrate/20141002133841_add_marker_id_to_marker_sequences.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddMarkerIdToMarkerSequences < ActiveRecord::Migration
def change
add_column :marker_sequences, :marker_id, :integer
diff --git a/db/migrate/20141002202251_add_settings.rb b/db/migrate/20141002202251_add_settings.rb
index ed3ab6ff..5b4c19f3 100644
--- a/db/migrate/20141002202251_add_settings.rb
+++ b/db/migrate/20141002202251_add_settings.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSettings < ActiveRecord::Migration
def change
add_column :primer_reads, :window_size, :integer
diff --git a/db/migrate/20141002202721_set_defaults.rb b/db/migrate/20141002202721_set_defaults.rb
index 0dbe10af..54fb15cd 100644
--- a/db/migrate/20141002202721_set_defaults.rb
+++ b/db/migrate/20141002202721_set_defaults.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class SetDefaults < ActiveRecord::Migration
def change
- change_column :primer_reads, :window_size, :integer, :default => 10
- change_column :primer_reads, :count_in_window, :integer, :default => 8
- change_column :primer_reads, :min_quality_score, :integer, :default => 30
+ change_column :primer_reads, :window_size, :integer, default: 10
+ change_column :primer_reads, :count_in_window, :integer, default: 8
+ change_column :primer_reads, :min_quality_score, :integer, default: 30
end
end
diff --git a/db/migrate/20141003111508_add_traces.rb b/db/migrate/20141003111508_add_traces.rb
index cb8a51be..bd61c06b 100644
--- a/db/migrate/20141003111508_add_traces.rb
+++ b/db/migrate/20141003111508_add_traces.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddTraces < ActiveRecord::Migration
def change
add_column :primer_reads, :atrace, :integer, array: true
diff --git a/db/migrate/20141003125433_rename_c_id.rb b/db/migrate/20141003125433_rename_c_id.rb
index b8d6a66b..7b38946e 100644
--- a/db/migrate/20141003125433_rename_c_id.rb
+++ b/db/migrate/20141003125433_rename_c_id.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameCId < ActiveRecord::Migration
def change
rename_column :primer_reads, :copy_id, :isolate_id
diff --git a/db/migrate/20141008133438_add_pos.rb b/db/migrate/20141008133438_add_pos.rb
index d5795419..7be2e474 100644
--- a/db/migrate/20141008133438_add_pos.rb
+++ b/db/migrate/20141008133438_add_pos.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPos < ActiveRecord::Migration
def change
add_column :higher_order_taxa, :position, :integer
diff --git a/db/migrate/20141008144017_add_dnabank.rb b/db/migrate/20141008144017_add_dnabank.rb
index b4ca6fdd..45880e17 100644
--- a/db/migrate/20141008144017_add_dnabank.rb
+++ b/db/migrate/20141008144017_add_dnabank.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddDnabank < ActiveRecord::Migration
def change
add_column :isolates, :DNA_bank_id, :string
diff --git a/db/migrate/20141008162119_reanme.rb b/db/migrate/20141008162119_reanme.rb
index 615cc044..ba5fd399 100644
--- a/db/migrate/20141008162119_reanme.rb
+++ b/db/migrate/20141008162119_reanme.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Reanme < ActiveRecord::Migration
def change
rename_column :isolates, :DNA_bank_id, :dna_bank_id
diff --git a/db/migrate/20141008185051_rm_gblol_nr.rb b/db/migrate/20141008185051_rm_gblol_nr.rb
index 8d86b614..3fa32b41 100644
--- a/db/migrate/20141008185051_rm_gblol_nr.rb
+++ b/db/migrate/20141008185051_rm_gblol_nr.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RmGblolNr < ActiveRecord::Migration
def change
remove_column :isolates, :gbol_isolation_nr
diff --git a/db/migrate/20141008191217_change_lab_nr_type.rb b/db/migrate/20141008191217_change_lab_nr_type.rb
index 0f085b29..8eced61d 100644
--- a/db/migrate/20141008191217_change_lab_nr_type.rb
+++ b/db/migrate/20141008191217_change_lab_nr_type.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeLabNrType < ActiveRecord::Migration
def change
change_column :isolates, :lab_nr, :string
diff --git a/db/migrate/20150129141612_add_primary_key_isolates.rb b/db/migrate/20150129141612_add_primary_key_isolates.rb
index 5a42c5ca..bc36ba97 100644
--- a/db/migrate/20150129141612_add_primary_key_isolates.rb
+++ b/db/migrate/20150129141612_add_primary_key_isolates.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class AddPrimaryKeyIsolates < ActiveRecord::Migration
def change
- execute "ALTER TABLE isolates ADD PRIMARY KEY (id);"
+ execute 'ALTER TABLE isolates ADD PRIMARY KEY (id);'
end
end
diff --git a/db/migrate/20150211200426_add_processed_to_primer_reads.rb b/db/migrate/20150211200426_add_processed_to_primer_reads.rb
index fda99e05..2fa3fe74 100644
--- a/db/migrate/20150211200426_add_processed_to_primer_reads.rb
+++ b/db/migrate/20150211200426_add_processed_to_primer_reads.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class AddProcessedToPrimerReads < ActiveRecord::Migration
def change
- add_column :primer_reads, :processed, :boolean, :default => false
+ add_column :primer_reads, :processed, :boolean, default: false
end
end
diff --git a/db/migrate/20150227173532_create_higher_order_taxa_markers_join_table.rb b/db/migrate/20150227173532_create_higher_order_taxa_markers_join_table.rb
index f0ef9082..567447e5 100644
--- a/db/migrate/20150227173532_create_higher_order_taxa_markers_join_table.rb
+++ b/db/migrate/20150227173532_create_higher_order_taxa_markers_join_table.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateHigherOrderTaxaMarkersJoinTable < ActiveRecord::Migration
def change
create_table :higher_order_taxa_markers, id: false do |t|
diff --git a/db/migrate/20150228182800_add_species_component_to_species.rb b/db/migrate/20150228182800_add_species_component_to_species.rb
index 40a2e91c..0c56661b 100644
--- a/db/migrate/20150228182800_add_species_component_to_species.rb
+++ b/db/migrate/20150228182800_add_species_component_to_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSpeciesComponentToSpecies < ActiveRecord::Migration
def change
add_column :species, :species_component, :string
diff --git a/db/migrate/20150301190309_add_base_count_to_primer_reads.rb b/db/migrate/20150301190309_add_base_count_to_primer_reads.rb
index daadfb4c..7836470f 100644
--- a/db/migrate/20150301190309_add_base_count_to_primer_reads.rb
+++ b/db/migrate/20150301190309_add_base_count_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddBaseCountToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :base_count, :integer
diff --git a/db/migrate/20150302001516_add_negative_control_to_isolates.rb b/db/migrate/20150302001516_add_negative_control_to_isolates.rb
index b86ab58b..12a22a4e 100644
--- a/db/migrate/20150302001516_add_negative_control_to_isolates.rb
+++ b/db/migrate/20150302001516_add_negative_control_to_isolates.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class AddNegativeControlToIsolates < ActiveRecord::Migration
def change
- add_column :isolates, :negative_control, :boolean, :default => false
+ add_column :isolates, :negative_control, :boolean, default: false
end
end
diff --git a/db/migrate/20150305175028_add_verified_to_contigs.rb b/db/migrate/20150305175028_add_verified_to_contigs.rb
index 4fcd6520..134977f9 100644
--- a/db/migrate/20150305175028_add_verified_to_contigs.rb
+++ b/db/migrate/20150305175028_add_verified_to_contigs.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class AddVerifiedToContigs < ActiveRecord::Migration
def change
- add_column :contigs, :verified, :boolean, :default => false
+ add_column :contigs, :verified, :boolean, default: false
end
end
diff --git a/db/migrate/20150308202429_add_verified_by_to_contigs.rb b/db/migrate/20150308202429_add_verified_by_to_contigs.rb
index 33c3415d..8e3d7800 100644
--- a/db/migrate/20150308202429_add_verified_by_to_contigs.rb
+++ b/db/migrate/20150308202429_add_verified_by_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddVerifiedByToContigs < ActiveRecord::Migration
def change
add_column :contigs, :verified_by, :integer
diff --git a/db/migrate/20150704192029_create_xml_uploaders.rb b/db/migrate/20150704192029_create_xml_uploaders.rb
index 3bc140b9..9c59fda1 100644
--- a/db/migrate/20150704192029_create_xml_uploaders.rb
+++ b/db/migrate/20150704192029_create_xml_uploaders.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateXmlUploaders < ActiveRecord::Migration
def change
create_table :xml_uploaders do |t|
diff --git a/db/migrate/20150719172520_habtm_individuals_projects.rb b/db/migrate/20150719172520_habtm_individuals_projects.rb
index 4c92a06e..d5c9d284 100644
--- a/db/migrate/20150719172520_habtm_individuals_projects.rb
+++ b/db/migrate/20150719172520_habtm_individuals_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class HabtmIndividualsProjects < ActiveRecord::Migration
def change
create_table :individuals_projects, id: false do |t|
@@ -5,4 +7,4 @@ def change
t.integer :project_id
end
end
-end
\ No newline at end of file
+end
diff --git a/db/migrate/20150719194029_add_projects_species.rb b/db/migrate/20150719194029_add_projects_species.rb
index 8a929033..02b192b3 100644
--- a/db/migrate/20150719194029_add_projects_species.rb
+++ b/db/migrate/20150719194029_add_projects_species.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddProjectsSpecies < ActiveRecord::Migration
def change
create_table :projects_species, id: false do |t|
diff --git a/db/migrate/20150719195650_contigs_projects.rb b/db/migrate/20150719195650_contigs_projects.rb
index 17543c22..a272b39f 100644
--- a/db/migrate/20150719195650_contigs_projects.rb
+++ b/db/migrate/20150719195650_contigs_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ContigsProjects < ActiveRecord::Migration
def change
create_table :contigs_projects, id: false do |t|
diff --git a/db/migrate/20150719195755_families_projects.rb b/db/migrate/20150719195755_families_projects.rb
index 445912de..2b74c1db 100644
--- a/db/migrate/20150719195755_families_projects.rb
+++ b/db/migrate/20150719195755_families_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class FamiliesProjects < ActiveRecord::Migration
def change
create_table :families_projects, id: false do |t|
diff --git a/db/migrate/20150719195821_orders_projects.rb b/db/migrate/20150719195821_orders_projects.rb
index 023b7627..827483df 100644
--- a/db/migrate/20150719195821_orders_projects.rb
+++ b/db/migrate/20150719195821_orders_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class OrdersProjects < ActiveRecord::Migration
def change
create_table :orders_projects, id: false do |t|
@@ -5,5 +7,4 @@ def change
t.integer :project_id
end
end
-
end
diff --git a/db/migrate/20150719195851_higher_order_taxa_projects.rb b/db/migrate/20150719195851_higher_order_taxa_projects.rb
index c7557853..27efc6c0 100644
--- a/db/migrate/20150719195851_higher_order_taxa_projects.rb
+++ b/db/migrate/20150719195851_higher_order_taxa_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class HigherOrderTaxaProjects < ActiveRecord::Migration
def change
create_table :higher_order_taxa_projects, id: false do |t|
diff --git a/db/migrate/20150719195926_isolates_projects.rb b/db/migrate/20150719195926_isolates_projects.rb
index e1323427..9077f6ba 100644
--- a/db/migrate/20150719195926_isolates_projects.rb
+++ b/db/migrate/20150719195926_isolates_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class IsolatesProjects < ActiveRecord::Migration
def change
create_table :isolates_projects, id: false do |t|
diff --git a/db/migrate/20150719200002_primer_reads_projects.rb b/db/migrate/20150719200002_primer_reads_projects.rb
index 7f98d228..27905b19 100644
--- a/db/migrate/20150719200002_primer_reads_projects.rb
+++ b/db/migrate/20150719200002_primer_reads_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class PrimerReadsProjects < ActiveRecord::Migration
def change
create_table :primer_reads_projects, id: false do |t|
diff --git a/db/migrate/20150719200028_issues_projects.rb b/db/migrate/20150719200028_issues_projects.rb
index 2503207c..e05abc72 100644
--- a/db/migrate/20150719200028_issues_projects.rb
+++ b/db/migrate/20150719200028_issues_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class IssuesProjects < ActiveRecord::Migration
def change
create_table :issues_projects, id: false do |t|
diff --git a/db/migrate/20150719200053_labs_projects.rb b/db/migrate/20150719200053_labs_projects.rb
index f50ffe22..22954642 100644
--- a/db/migrate/20150719200053_labs_projects.rb
+++ b/db/migrate/20150719200053_labs_projects.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class LabsProjects < ActiveRecord::Migration
def change
create_table :labs_projects, id: false do |t|
diff --git a/db/migrate/20160502113129_add_comment_to_primer_reads.rb b/db/migrate/20160502113129_add_comment_to_primer_reads.rb
index dbcce39f..a0a8efab 100644
--- a/db/migrate/20160502113129_add_comment_to_primer_reads.rb
+++ b/db/migrate/20160502113129_add_comment_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddCommentToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :comment, :string
diff --git a/db/migrate/20160502113154_add_comment_to_contigs.rb b/db/migrate/20160502113154_add_comment_to_contigs.rb
index cf1aa3d2..cd556644 100644
--- a/db/migrate/20160502113154_add_comment_to_contigs.rb
+++ b/db/migrate/20160502113154_add_comment_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddCommentToContigs < ActiveRecord::Migration
def change
add_column :contigs, :comment, :string
diff --git a/db/migrate/20160502144910_add_alt_name_to_markers.rb b/db/migrate/20160502144910_add_alt_name_to_markers.rb
index 53ccb5bf..c34a5802 100644
--- a/db/migrate/20160502144910_add_alt_name_to_markers.rb
+++ b/db/migrate/20160502144910_add_alt_name_to_markers.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAltNameToMarkers < ActiveRecord::Migration
def change
add_column :markers, :alt_name, :string
diff --git a/db/migrate/20160505161255_create_txt_uploaders.rb b/db/migrate/20160505161255_create_txt_uploaders.rb
index fd8ebecb..132fa509 100644
--- a/db/migrate/20160505161255_create_txt_uploaders.rb
+++ b/db/migrate/20160505161255_create_txt_uploaders.rb
@@ -1,7 +1,8 @@
+# frozen_string_literal: true
+
class CreateTxtUploaders < ActiveRecord::Migration
def change
create_table :txt_uploaders do |t|
-
t.timestamps null: false
end
end
diff --git a/db/migrate/20160505163022_add_filename_to_txt_uploaders.rb b/db/migrate/20160505163022_add_filename_to_txt_uploaders.rb
index e0d0c09e..ccc6b558 100644
--- a/db/migrate/20160505163022_add_filename_to_txt_uploaders.rb
+++ b/db/migrate/20160505163022_add_filename_to_txt_uploaders.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddFilenameToTxtUploaders < ActiveRecord::Migration
def change
add_column :txt_uploaders, :file_name, :string
diff --git a/db/migrate/20160505163634_add_attachment_uploaded_file_to_txt_uploaders.rb b/db/migrate/20160505163634_add_attachment_uploaded_file_to_txt_uploaders.rb
index a9ba8257..a38d06d3 100644
--- a/db/migrate/20160505163634_add_attachment_uploaded_file_to_txt_uploaders.rb
+++ b/db/migrate/20160505163634_add_attachment_uploaded_file_to_txt_uploaders.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAttachmentUploadedFileToTxtUploaders < ActiveRecord::Migration
def self.up
change_table :txt_uploaders do |t|
diff --git a/db/migrate/20160505163813_remove_file_name_from_txt_uploaders.rb b/db/migrate/20160505163813_remove_file_name_from_txt_uploaders.rb
index edb0a77e..9cee5750 100644
--- a/db/migrate/20160505163813_remove_file_name_from_txt_uploaders.rb
+++ b/db/migrate/20160505163813_remove_file_name_from_txt_uploaders.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveFileNameFromTxtUploaders < ActiveRecord::Migration
def change
remove_column :txt_uploaders, :file_name
diff --git a/db/migrate/20160507111437_rename_latitude.rb b/db/migrate/20160507111437_rename_latitude.rb
index d962076c..41f3a760 100644
--- a/db/migrate/20160507111437_rename_latitude.rb
+++ b/db/migrate/20160507111437_rename_latitude.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameLatitude < ActiveRecord::Migration
def change
rename_column :individuals, :latitude, :latitude_original
diff --git a/db/migrate/20160507112312_add_latitude_to_individuals.rb b/db/migrate/20160507112312_add_latitude_to_individuals.rb
index c3f02745..f00f4293 100644
--- a/db/migrate/20160507112312_add_latitude_to_individuals.rb
+++ b/db/migrate/20160507112312_add_latitude_to_individuals.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddLatitudeToIndividuals < ActiveRecord::Migration
def change
add_column :individuals, :latitude, :decimal
diff --git a/db/migrate/20160508134633_add_imported_to_contigs.rb b/db/migrate/20160508134633_add_imported_to_contigs.rb
index 780874fb..7e94ea14 100644
--- a/db/migrate/20160508134633_add_imported_to_contigs.rb
+++ b/db/migrate/20160508134633_add_imported_to_contigs.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class AddImportedToContigs < ActiveRecord::Migration
def change
- add_column :contigs, :imported, :boolean, :default => false
+ add_column :contigs, :imported, :boolean, default: false
end
end
diff --git a/db/migrate/20160508150233_add_overwritten_to_primer_reads.rb b/db/migrate/20160508150233_add_overwritten_to_primer_reads.rb
index d7c651d7..c6116a4a 100644
--- a/db/migrate/20160508150233_add_overwritten_to_primer_reads.rb
+++ b/db/migrate/20160508150233_add_overwritten_to_primer_reads.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class AddOverwrittenToPrimerReads < ActiveRecord::Migration
def change
- add_column :primer_reads, :overwritten, :boolean, :default => false
+ add_column :primer_reads, :overwritten, :boolean, default: false
end
end
diff --git a/db/migrate/20160509194717_add_copy_attributes_to_isolates.rb b/db/migrate/20160509194717_add_copy_attributes_to_isolates.rb
index d2cfbfc9..8630507d 100644
--- a/db/migrate/20160509194717_add_copy_attributes_to_isolates.rb
+++ b/db/migrate/20160509194717_add_copy_attributes_to_isolates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddCopyAttributesToIsolates < ActiveRecord::Migration
def change
add_column :isolates, :lab_id_orig, :integer
diff --git a/db/migrate/20160509200511_add_user_to_isolates.rb b/db/migrate/20160509200511_add_user_to_isolates.rb
index fe7d7418..1eb6bad2 100644
--- a/db/migrate/20160509200511_add_user_to_isolates.rb
+++ b/db/migrate/20160509200511_add_user_to_isolates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddUserToIsolates < ActiveRecord::Migration
def change
add_column :isolates, :user_id, :integer
diff --git a/db/migrate/20160510123450_add_lab_rack_id_to_micronic_plates.rb b/db/migrate/20160510123450_add_lab_rack_id_to_micronic_plates.rb
index 9c2c1487..f8a2e1a2 100644
--- a/db/migrate/20160510123450_add_lab_rack_id_to_micronic_plates.rb
+++ b/db/migrate/20160510123450_add_lab_rack_id_to_micronic_plates.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddLabRackIdToMicronicPlates < ActiveRecord::Migration
def change
add_column :micronic_plates, :lab_rack_id, :integer
diff --git a/db/migrate/20160510125555_add_rack_position_to_lab_racks.rb b/db/migrate/20160510125555_add_rack_position_to_lab_racks.rb
index 013482bc..1c53b426 100644
--- a/db/migrate/20160510125555_add_rack_position_to_lab_racks.rb
+++ b/db/migrate/20160510125555_add_rack_position_to_lab_racks.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddRackPositionToLabRacks < ActiveRecord::Migration
def change
add_column :lab_racks, :rack_position, :string
diff --git a/db/migrate/20160510161111_add_shelf_to_lab_rack.rb b/db/migrate/20160510161111_add_shelf_to_lab_rack.rb
index 5304eab1..a3338ac2 100644
--- a/db/migrate/20160510161111_add_shelf_to_lab_rack.rb
+++ b/db/migrate/20160510161111_add_shelf_to_lab_rack.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddShelfToLabRack < ActiveRecord::Migration
def change
add_column :lab_racks, :shelf, :string
diff --git a/db/migrate/20160511191823_change_precision_of_concentration.rb b/db/migrate/20160511191823_change_precision_of_concentration.rb
index a34acd65..5189b056 100644
--- a/db/migrate/20160511191823_change_precision_of_concentration.rb
+++ b/db/migrate/20160511191823_change_precision_of_concentration.rb
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
class ChangePrecisionOfConcentration < ActiveRecord::Migration
def change
- change_column :isolates, :concentration_orig, :decimal, :precision => 15, :scale => 2
- change_column :isolates, :concentration_copy, :decimal, :precision => 15, :scale => 2
+ change_column :isolates, :concentration_orig, :decimal, precision: 15, scale: 2
+ change_column :isolates, :concentration_copy, :decimal, precision: 15, scale: 2
end
end
diff --git a/db/migrate/20160529123449_add_partial_cons_count_to_contigs.rb b/db/migrate/20160529123449_add_partial_cons_count_to_contigs.rb
index ac330fc9..9963bb0b 100644
--- a/db/migrate/20160529123449_add_partial_cons_count_to_contigs.rb
+++ b/db/migrate/20160529123449_add_partial_cons_count_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPartialConsCountToContigs < ActiveRecord::Migration
def change
add_column :contigs, :partial_cons_count, :integer
diff --git a/db/migrate/20160603084804_add_aligned_peak_indices_to_primer_reads.rb b/db/migrate/20160603084804_add_aligned_peak_indices_to_primer_reads.rb
index 0fd4f807..150ce397 100644
--- a/db/migrate/20160603084804_add_aligned_peak_indices_to_primer_reads.rb
+++ b/db/migrate/20160603084804_add_aligned_peak_indices_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAlignedPeakIndicesToPrimerReads < ActiveRecord::Migration
def change
add_column :primer_reads, :aligned_peak_indices, :integer, array: true
diff --git a/db/migrate/20160607140007_create_species_xml_uploaders.rb b/db/migrate/20160607140007_create_species_xml_uploaders.rb
index 1008a8a3..245cf293 100644
--- a/db/migrate/20160607140007_create_species_xml_uploaders.rb
+++ b/db/migrate/20160607140007_create_species_xml_uploaders.rb
@@ -1,7 +1,8 @@
+# frozen_string_literal: true
+
class CreateSpeciesXmlUploaders < ActiveRecord::Migration
def change
create_table :species_xml_uploaders do |t|
-
t.timestamps null: false
end
end
diff --git a/db/migrate/20160607140336_add_attachment_uploaded_file_to_species_xml_uploaders.rb b/db/migrate/20160607140336_add_attachment_uploaded_file_to_species_xml_uploaders.rb
index fd8f6ed9..53bc8b01 100644
--- a/db/migrate/20160607140336_add_attachment_uploaded_file_to_species_xml_uploaders.rb
+++ b/db/migrate/20160607140336_add_attachment_uploaded_file_to_species_xml_uploaders.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAttachmentUploadedFileToSpeciesXmlUploaders < ActiveRecord::Migration
def self.up
change_table :species_xml_uploaders do |t|
diff --git a/db/migrate/20160609122522_create_divisions.rb b/db/migrate/20160609122522_create_divisions.rb
index f6892a1e..5cb5f781 100644
--- a/db/migrate/20160609122522_create_divisions.rb
+++ b/db/migrate/20160609122522_create_divisions.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateDivisions < ActiveRecord::Migration
def change
create_table :divisions do |t|
diff --git a/db/migrate/20160609122800_create_subdivisions.rb b/db/migrate/20160609122800_create_subdivisions.rb
index 96ad778f..b9b1b65c 100644
--- a/db/migrate/20160609122800_create_subdivisions.rb
+++ b/db/migrate/20160609122800_create_subdivisions.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateSubdivisions < ActiveRecord::Migration
def change
create_table :subdivisions do |t|
diff --git a/db/migrate/20160609122903_create_taxonomic_classes.rb b/db/migrate/20160609122903_create_taxonomic_classes.rb
index 9e487514..ec723035 100644
--- a/db/migrate/20160609122903_create_taxonomic_classes.rb
+++ b/db/migrate/20160609122903_create_taxonomic_classes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateTaxonomicClasses < ActiveRecord::Migration
def change
create_table :taxonomic_classes do |t|
diff --git a/db/migrate/20160609130939_add_class_id_to_orders.rb b/db/migrate/20160609130939_add_class_id_to_orders.rb
index d8fe1730..63882b0c 100644
--- a/db/migrate/20160609130939_add_class_id_to_orders.rb
+++ b/db/migrate/20160609130939_add_class_id_to_orders.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddClassIdToOrders < ActiveRecord::Migration
def change
add_column :orders, :taxonomic_class_id, :integer
diff --git a/db/migrate/20160609131329_add_subdivision_id_to_taxonomic_classes.rb b/db/migrate/20160609131329_add_subdivision_id_to_taxonomic_classes.rb
index 285cd5dc..2d3a1bb2 100644
--- a/db/migrate/20160609131329_add_subdivision_id_to_taxonomic_classes.rb
+++ b/db/migrate/20160609131329_add_subdivision_id_to_taxonomic_classes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSubdivisionIdToTaxonomicClasses < ActiveRecord::Migration
def change
add_column :taxonomic_classes, :subdivision_id, :integer
diff --git a/db/migrate/20160609133011_add_position_to_subdivisions.rb b/db/migrate/20160609133011_add_position_to_subdivisions.rb
index 8ee1072b..affd38c7 100644
--- a/db/migrate/20160609133011_add_position_to_subdivisions.rb
+++ b/db/migrate/20160609133011_add_position_to_subdivisions.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddPositionToSubdivisions < ActiveRecord::Migration
def change
add_column :subdivisions, :position, :integer
diff --git a/db/migrate/20160627170221_add_overlap_length_to_contigs.rb b/db/migrate/20160627170221_add_overlap_length_to_contigs.rb
index f5ad3424..567355e0 100644
--- a/db/migrate/20160627170221_add_overlap_length_to_contigs.rb
+++ b/db/migrate/20160627170221_add_overlap_length_to_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddOverlapLengthToContigs < ActiveRecord::Migration
def change
add_column :contigs, :overlap_length, :integer, default: 15
diff --git a/db/migrate/20160905163301_add_comment_to_isolate.rb b/db/migrate/20160905163301_add_comment_to_isolate.rb
index fb038224..4cc51a54 100644
--- a/db/migrate/20160905163301_add_comment_to_isolate.rb
+++ b/db/migrate/20160905163301_add_comment_to_isolate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddCommentToIsolate < ActiveRecord::Migration
def change
add_column :isolates, :comment_orig, :text
diff --git a/db/migrate/20170619101312_create_contig_pde_uploader.rb b/db/migrate/20170619101312_create_contig_pde_uploader.rb
index 1f8bb187..a33542f8 100644
--- a/db/migrate/20170619101312_create_contig_pde_uploader.rb
+++ b/db/migrate/20170619101312_create_contig_pde_uploader.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateContigPdeUploader < ActiveRecord::Migration[5.0]
def change
create_table :contig_pde_uploaders do |t|
diff --git a/db/migrate/20170620124842_remove_pde_from_contigs.rb b/db/migrate/20170620124842_remove_pde_from_contigs.rb
index e5338d45..73b8581e 100644
--- a/db/migrate/20170620124842_remove_pde_from_contigs.rb
+++ b/db/migrate/20170620124842_remove_pde_from_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemovePdeFromContigs < ActiveRecord::Migration[5.0]
def up
remove_column :contigs, :pde, :text
diff --git a/db/migrate/20170920100203_add_reference_to_marker_sequence.rb b/db/migrate/20170920100203_add_reference_to_marker_sequence.rb
index 94890399..47345cb7 100644
--- a/db/migrate/20170920100203_add_reference_to_marker_sequence.rb
+++ b/db/migrate/20170920100203_add_reference_to_marker_sequence.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddReferenceToMarkerSequence < ActiveRecord::Migration[5.0]
def up
add_column :marker_sequences, :reference, :string
diff --git a/db/migrate/20170922091324_change_precision_of_location_data.rb b/db/migrate/20170922091324_change_precision_of_location_data.rb
index 3909a156..7e87f1f2 100644
--- a/db/migrate/20170922091324_change_precision_of_location_data.rb
+++ b/db/migrate/20170922091324_change_precision_of_location_data.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class ChangePrecisionOfLocationData < ActiveRecord::Migration[5.0]
def up
- change_column :individuals, :latitude, :decimal, :precision => 15, :scale => 6
- change_column :individuals, :longitude, :decimal, :precision => 15, :scale => 6
+ change_column :individuals, :latitude, :decimal, precision: 15, scale: 6
+ change_column :individuals, :longitude, :decimal, precision: 15, scale: 6
end
def down
diff --git a/db/migrate/20171018120345_create_contig_searches.rb b/db/migrate/20171018120345_create_contig_searches.rb
index 66f76af9..383e2a62 100644
--- a/db/migrate/20171018120345_create_contig_searches.rb
+++ b/db/migrate/20171018120345_create_contig_searches.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateContigSearches < ActiveRecord::Migration[5.0]
def up
create_table :contig_searches do |t|
diff --git a/db/migrate/20171018133939_change_types_in_contig_search.rb b/db/migrate/20171018133939_change_types_in_contig_search.rb
index bcf8a8f9..997e2e77 100644
--- a/db/migrate/20171018133939_change_types_in_contig_search.rb
+++ b/db/migrate/20171018133939_change_types_in_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeTypesInContigSearch < ActiveRecord::Migration[5.0]
def self.up
remove_column :contig_searches, :min_age
diff --git a/db/migrate/20171018142430_add_attributes_to_contig_search.rb b/db/migrate/20171018142430_add_attributes_to_contig_search.rb
index 285b7604..c83c01fd 100644
--- a/db/migrate/20171018142430_add_attributes_to_contig_search.rb
+++ b/db/migrate/20171018142430_add_attributes_to_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAttributesToContigSearch < ActiveRecord::Migration[5.0]
def up
add_column :contig_searches, :unassembled, :boolean
diff --git a/db/migrate/20171027123414_change_types_in_contig_search_to_date.rb b/db/migrate/20171027123414_change_types_in_contig_search_to_date.rb
index a61d5a5f..1b620f50 100644
--- a/db/migrate/20171027123414_change_types_in_contig_search_to_date.rb
+++ b/db/migrate/20171027123414_change_types_in_contig_search_to_date.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeTypesInContigSearchToDate < ActiveRecord::Migration[5.0]
def self.up
change_column :contig_searches, :min_age, :date
diff --git a/db/migrate/20171102131258_change_booleans_in_contig_search.rb b/db/migrate/20171102131258_change_booleans_in_contig_search.rb
index 3edefc2d..26b41891 100644
--- a/db/migrate/20171102131258_change_booleans_in_contig_search.rb
+++ b/db/migrate/20171102131258_change_booleans_in_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeBooleansInContigSearch < ActiveRecord::Migration[5.0]
def up
change_column :contig_searches, :assembled, :string
diff --git a/db/migrate/20171107114403_change_id_attributes_in_contig_search.rb b/db/migrate/20171107114403_change_id_attributes_in_contig_search.rb
index a30a74e9..2ff9f62b 100644
--- a/db/migrate/20171107114403_change_id_attributes_in_contig_search.rb
+++ b/db/migrate/20171107114403_change_id_attributes_in_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeIdAttributesInContigSearch < ActiveRecord::Migration[5.0]
def up
rename_column :contig_searches, :order_id, :order
diff --git a/db/migrate/20171107143211_add_title_to_contig_search.rb b/db/migrate/20171107143211_add_title_to_contig_search.rb
index 4bf56b0d..e3a4af11 100644
--- a/db/migrate/20171107143211_add_title_to_contig_search.rb
+++ b/db/migrate/20171107143211_add_title_to_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddTitleToContigSearch < ActiveRecord::Migration[5.0]
def up
add_column :contig_searches, :title, :string
diff --git a/db/migrate/20171204141837_create_overview_all_taxa_matviews.rb b/db/migrate/20171204141837_create_overview_all_taxa_matviews.rb
index 8be6a5e5..be539a1a 100644
--- a/db/migrate/20171204141837_create_overview_all_taxa_matviews.rb
+++ b/db/migrate/20171204141837_create_overview_all_taxa_matviews.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateOverviewAllTaxaMatviews < ActiveRecord::Migration[5.0]
def change
create_view :overview_all_taxa_matviews, materialized: true
diff --git a/db/migrate/20171207133553_update_overview_all_taxa_matviews_to_version_2.rb b/db/migrate/20171207133553_update_overview_all_taxa_matviews_to_version_2.rb
index 5eceec72..e8f99a53 100644
--- a/db/migrate/20171207133553_update_overview_all_taxa_matviews_to_version_2.rb
+++ b/db/migrate/20171207133553_update_overview_all_taxa_matviews_to_version_2.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UpdateOverviewAllTaxaMatviewsToVersion2 < ActiveRecord::Migration[5.0]
def change
update_view :overview_all_taxa_matviews, version: 2, revert_to_version: 1, materialized: true
diff --git a/db/migrate/20171213104138_update_overview_all_taxa_matviews_to_version_3.rb b/db/migrate/20171213104138_update_overview_all_taxa_matviews_to_version_3.rb
index fae4703e..8b768303 100644
--- a/db/migrate/20171213104138_update_overview_all_taxa_matviews_to_version_3.rb
+++ b/db/migrate/20171213104138_update_overview_all_taxa_matviews_to_version_3.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
class UpdateOverviewAllTaxaMatviewsToVersion3 < ActiveRecord::Migration[5.0]
def change
update_view :overview_all_taxa_matviews,
- version: 3,
- revert_to_version: 2,
- materialized: true
+ version: 3,
+ revert_to_version: 2,
+ materialized: true
end
end
diff --git a/db/migrate/20171213141704_create_overview_finished_taxa_matviews.rb b/db/migrate/20171213141704_create_overview_finished_taxa_matviews.rb
index 44d2cfc3..db81aba5 100644
--- a/db/migrate/20171213141704_create_overview_finished_taxa_matviews.rb
+++ b/db/migrate/20171213141704_create_overview_finished_taxa_matviews.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateOverviewFinishedTaxaMatviews < ActiveRecord::Migration[5.0]
def change
create_view :overview_finished_taxa_matviews, materialized: true
diff --git a/db/migrate/20180111122659_update_overview_all_taxa_matviews_to_version_4.rb b/db/migrate/20180111122659_update_overview_all_taxa_matviews_to_version_4.rb
index c0e6362f..866a7f17 100644
--- a/db/migrate/20180111122659_update_overview_all_taxa_matviews_to_version_4.rb
+++ b/db/migrate/20180111122659_update_overview_all_taxa_matviews_to_version_4.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class UpdateOverviewAllTaxaMatviewsToVersion4 < ActiveRecord::Migration[5.0]
def change
update_view :overview_all_taxa_matviews,
diff --git a/db/migrate/20180111123732_update_overview_finished_taxa_matviews_to_version_2.rb b/db/migrate/20180111123732_update_overview_finished_taxa_matviews_to_version_2.rb
index 6f16d4b6..b81b98d9 100644
--- a/db/migrate/20180111123732_update_overview_finished_taxa_matviews_to_version_2.rb
+++ b/db/migrate/20180111123732_update_overview_finished_taxa_matviews_to_version_2.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
class UpdateOverviewFinishedTaxaMatviewsToVersion2 < ActiveRecord::Migration[5.0]
def change
update_view :overview_finished_taxa_matviews,
- version: 2,
- revert_to_version: 1,
- materialized: true
+ version: 2,
+ revert_to_version: 1,
+ materialized: true
end
end
diff --git a/db/migrate/20180111125140_update_overview_finished_taxa_matviews_to_version_3.rb b/db/migrate/20180111125140_update_overview_finished_taxa_matviews_to_version_3.rb
index 905e4dfb..a1cb3d95 100644
--- a/db/migrate/20180111125140_update_overview_finished_taxa_matviews_to_version_3.rb
+++ b/db/migrate/20180111125140_update_overview_finished_taxa_matviews_to_version_3.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
class UpdateOverviewFinishedTaxaMatviewsToVersion3 < ActiveRecord::Migration[5.0]
def change
update_view :overview_finished_taxa_matviews,
- version: 3,
- revert_to_version: 2,
- materialized: true
+ version: 3,
+ revert_to_version: 2,
+ materialized: true
end
end
diff --git a/db/migrate/20180112101532_update_overview_finished_taxa_matviews_to_version_4.rb b/db/migrate/20180112101532_update_overview_finished_taxa_matviews_to_version_4.rb
index ffe2e14e..834d8327 100644
--- a/db/migrate/20180112101532_update_overview_finished_taxa_matviews_to_version_4.rb
+++ b/db/migrate/20180112101532_update_overview_finished_taxa_matviews_to_version_4.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
class UpdateOverviewFinishedTaxaMatviewsToVersion4 < ActiveRecord::Migration[5.0]
def change
update_view :overview_finished_taxa_matviews,
- version: 4,
- revert_to_version: 3,
- materialized: true
+ version: 4,
+ revert_to_version: 3,
+ materialized: true
end
end
diff --git a/db/migrate/20180115103305_update_overview_finished_taxa_matviews_to_version_5.rb b/db/migrate/20180115103305_update_overview_finished_taxa_matviews_to_version_5.rb
index 9a60dc0d..02611cbd 100644
--- a/db/migrate/20180115103305_update_overview_finished_taxa_matviews_to_version_5.rb
+++ b/db/migrate/20180115103305_update_overview_finished_taxa_matviews_to_version_5.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
class UpdateOverviewFinishedTaxaMatviewsToVersion5 < ActiveRecord::Migration[5.0]
def change
update_view :overview_finished_taxa_matviews,
- version: 5,
- revert_to_version: 4,
- materialized: true
+ version: 5,
+ revert_to_version: 4,
+ materialized: true
end
end
diff --git a/db/migrate/20180117150033_add_roles_to_users.rb b/db/migrate/20180117150033_add_roles_to_users.rb
index 44814e22..7a65dfc2 100644
--- a/db/migrate/20180117150033_add_roles_to_users.rb
+++ b/db/migrate/20180117150033_add_roles_to_users.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddRolesToUsers < ActiveRecord::Migration[5.0]
def change
add_column :users, :admin, :boolean
diff --git a/db/migrate/20180122164030_add_supervisor_to_user.rb b/db/migrate/20180122164030_add_supervisor_to_user.rb
index 7afb74b1..6c5913a7 100644
--- a/db/migrate/20180122164030_add_supervisor_to_user.rb
+++ b/db/migrate/20180122164030_add_supervisor_to_user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddSupervisorToUser < ActiveRecord::Migration[5.0]
def change
add_column :users, :supervisor, :boolean
diff --git a/db/migrate/20180124130027_add_lab_id_to_user.rb b/db/migrate/20180124130027_add_lab_id_to_user.rb
index c24ad3ac..2d7992ff 100644
--- a/db/migrate/20180124130027_add_lab_id_to_user.rb
+++ b/db/migrate/20180124130027_add_lab_id_to_user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddLabIdToUser < ActiveRecord::Migration[5.0]
def change
add_column :users, :lab_id, :integer
diff --git a/db/migrate/20180124133256_add_user_id_to_contig_search.rb b/db/migrate/20180124133256_add_user_id_to_contig_search.rb
index 1f769883..11c149ef 100644
--- a/db/migrate/20180124133256_add_user_id_to_contig_search.rb
+++ b/db/migrate/20180124133256_add_user_id_to_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddUserIdToContigSearch < ActiveRecord::Migration[5.0]
def change
add_column :contig_searches, :user_id, :integer
diff --git a/db/migrate/20180320143645_create_marker_sequence_searches.rb b/db/migrate/20180320143645_create_marker_sequence_searches.rb
index e2209a32..71339be7 100644
--- a/db/migrate/20180320143645_create_marker_sequence_searches.rb
+++ b/db/migrate/20180320143645_create_marker_sequence_searches.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateMarkerSequenceSearches < ActiveRecord::Migration[5.0]
def change
create_table :marker_sequence_searches do |t|
diff --git a/db/migrate/20180321102252_add_attributes_to_marker_sequence_search.rb b/db/migrate/20180321102252_add_attributes_to_marker_sequence_search.rb
index b807b3f7..69dad1d2 100644
--- a/db/migrate/20180321102252_add_attributes_to_marker_sequence_search.rb
+++ b/db/migrate/20180321102252_add_attributes_to_marker_sequence_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAttributesToMarkerSequenceSearch < ActiveRecord::Migration[5.0]
def up
add_column :marker_sequence_searches, :user_id, :integer
diff --git a/db/migrate/20180323103303_change_datatype_marker_sequence_search_marker.rb b/db/migrate/20180323103303_change_datatype_marker_sequence_search_marker.rb
index 2936d882..0aa76c9e 100644
--- a/db/migrate/20180323103303_change_datatype_marker_sequence_search_marker.rb
+++ b/db/migrate/20180323103303_change_datatype_marker_sequence_search_marker.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeDatatypeMarkerSequenceSearchMarker < ActiveRecord::Migration[5.0]
def up
change_column :marker_sequence_searches, :marker, :string
diff --git a/db/migrate/20180411081530_update_overview_finished_taxa_matviews_to_version_6.rb b/db/migrate/20180411081530_update_overview_finished_taxa_matviews_to_version_6.rb
index 0a67f25a..bd99c77c 100644
--- a/db/migrate/20180411081530_update_overview_finished_taxa_matviews_to_version_6.rb
+++ b/db/migrate/20180411081530_update_overview_finished_taxa_matviews_to_version_6.rb
@@ -1,8 +1,10 @@
+# frozen_string_literal: true
+
class UpdateOverviewFinishedTaxaMatviewsToVersion6 < ActiveRecord::Migration[5.0]
def change
update_view :overview_finished_taxa_matviews,
- version: 6,
- revert_to_version: 5,
- materialized: true
+ version: 6,
+ revert_to_version: 5,
+ materialized: true
end
end
diff --git a/db/migrate/20180416072622_create_responsibilities.rb b/db/migrate/20180416072622_create_responsibilities.rb
index b1bc5163..6e636854 100644
--- a/db/migrate/20180416072622_create_responsibilities.rb
+++ b/db/migrate/20180416072622_create_responsibilities.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateResponsibilities < ActiveRecord::Migration[5.0]
def change
create_table :responsibilities do |t|
diff --git a/db/migrate/20180416075103_create_join_table_responsibility_user.rb b/db/migrate/20180416075103_create_join_table_responsibility_user.rb
index b3de2705..8afd3ac4 100644
--- a/db/migrate/20180416075103_create_join_table_responsibility_user.rb
+++ b/db/migrate/20180416075103_create_join_table_responsibility_user.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTableResponsibilityUser < ActiveRecord::Migration[5.0]
def change
create_join_table :responsibilities, :users do |t|
- t.index [:responsibility_id, :user_id]
+ t.index %i[responsibility_id user_id]
end
end
end
diff --git a/db/migrate/20180416093136_add_role_to_user.rb b/db/migrate/20180416093136_add_role_to_user.rb
index ae75f4fd..111cdb42 100644
--- a/db/migrate/20180416093136_add_role_to_user.rb
+++ b/db/migrate/20180416093136_add_role_to_user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddRoleToUser < ActiveRecord::Migration[5.0]
def change
add_column :users, :role, :integer
diff --git a/db/migrate/20180416093403_remove_unused_attributes_from_user.rb b/db/migrate/20180416093403_remove_unused_attributes_from_user.rb
index 2722a85c..f5e80135 100644
--- a/db/migrate/20180416093403_remove_unused_attributes_from_user.rb
+++ b/db/migrate/20180416093403_remove_unused_attributes_from_user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveUnusedAttributesFromUser < ActiveRecord::Migration[5.0]
def change
remove_column :users, :admin
diff --git a/db/migrate/20180416123308_create_join_table_primer_project.rb b/db/migrate/20180416123308_create_join_table_primer_project.rb
index f989f917..73c4a0dd 100644
--- a/db/migrate/20180416123308_create_join_table_primer_project.rb
+++ b/db/migrate/20180416123308_create_join_table_primer_project.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTablePrimerProject < ActiveRecord::Migration[5.0]
def change
create_join_table :primers, :projects do |t|
- t.index [:primer_id, :project_id]
+ t.index %i[primer_id project_id]
end
end
end
diff --git a/db/migrate/20180416123337_create_join_table_marker_project.rb b/db/migrate/20180416123337_create_join_table_marker_project.rb
index 97c4a1ac..f40f6c3d 100644
--- a/db/migrate/20180416123337_create_join_table_marker_project.rb
+++ b/db/migrate/20180416123337_create_join_table_marker_project.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTableMarkerProject < ActiveRecord::Migration[5.0]
def change
create_join_table :markers, :projects do |t|
- t.index [:marker_id, :project_id]
+ t.index %i[marker_id project_id]
end
end
end
diff --git a/db/migrate/20180416123357_create_join_table_marker_sequence_project.rb b/db/migrate/20180416123357_create_join_table_marker_sequence_project.rb
index 91815381..dad9309e 100644
--- a/db/migrate/20180416123357_create_join_table_marker_sequence_project.rb
+++ b/db/migrate/20180416123357_create_join_table_marker_sequence_project.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTableMarkerSequenceProject < ActiveRecord::Migration[5.0]
def change
create_join_table :marker_sequences, :projects do |t|
- t.index [:marker_sequence_id, :project_id], name: 'index_marker_sequences_projects'
+ t.index %i[marker_sequence_id project_id], name: 'index_marker_sequences_projects'
end
end
end
diff --git a/db/migrate/20180416125519_add_default_project_to_user.rb b/db/migrate/20180416125519_add_default_project_to_user.rb
index 465dee18..d1da9012 100644
--- a/db/migrate/20180416125519_add_default_project_to_user.rb
+++ b/db/migrate/20180416125519_add_default_project_to_user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddDefaultProjectToUser < ActiveRecord::Migration[5.0]
def change
add_column :users, :default_project_id, :integer
diff --git a/db/migrate/20180418071549_create_join_table_freezer_project.rb b/db/migrate/20180418071549_create_join_table_freezer_project.rb
index c80818de..24557b5b 100644
--- a/db/migrate/20180418071549_create_join_table_freezer_project.rb
+++ b/db/migrate/20180418071549_create_join_table_freezer_project.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTableFreezerProject < ActiveRecord::Migration[5.0]
def change
create_join_table :freezers, :projects do |t|
- t.index [:freezer_id, :project_id]
+ t.index %i[freezer_id project_id]
end
end
end
diff --git a/db/migrate/20180418071616_create_join_table_lab_rack_project.rb b/db/migrate/20180418071616_create_join_table_lab_rack_project.rb
index 9811f572..f8ce1977 100644
--- a/db/migrate/20180418071616_create_join_table_lab_rack_project.rb
+++ b/db/migrate/20180418071616_create_join_table_lab_rack_project.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTableLabRackProject < ActiveRecord::Migration[5.0]
def change
create_join_table :lab_racks, :projects do |t|
- t.index [:lab_rack_id, :project_id]
+ t.index %i[lab_rack_id project_id]
end
end
end
diff --git a/db/migrate/20180418071641_create_join_table_micronic_plate_project.rb b/db/migrate/20180418071641_create_join_table_micronic_plate_project.rb
index 9b83dc60..69d32071 100644
--- a/db/migrate/20180418071641_create_join_table_micronic_plate_project.rb
+++ b/db/migrate/20180418071641_create_join_table_micronic_plate_project.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTableMicronicPlateProject < ActiveRecord::Migration[5.0]
def change
create_join_table :micronic_plates, :projects do |t|
- t.index [:micronic_plate_id, :project_id], name: 'index_micronic_plates_projects'
+ t.index %i[micronic_plate_id project_id], name: 'index_micronic_plates_projects'
end
end
end
diff --git a/db/migrate/20180418071707_create_join_table_plant_plate_project.rb b/db/migrate/20180418071707_create_join_table_plant_plate_project.rb
index b12967f8..cf02b58b 100644
--- a/db/migrate/20180418071707_create_join_table_plant_plate_project.rb
+++ b/db/migrate/20180418071707_create_join_table_plant_plate_project.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTablePlantPlateProject < ActiveRecord::Migration[5.0]
def change
create_join_table :plant_plates, :projects do |t|
- t.index [:plant_plate_id, :project_id]
+ t.index %i[plant_plate_id project_id]
end
end
end
diff --git a/db/migrate/20180418085911_add_lab_rack_to_plant_plate.rb b/db/migrate/20180418085911_add_lab_rack_to_plant_plate.rb
index 8d312bc8..596c412b 100644
--- a/db/migrate/20180418085911_add_lab_rack_to_plant_plate.rb
+++ b/db/migrate/20180418085911_add_lab_rack_to_plant_plate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddLabRackToPlantPlate < ActiveRecord::Migration[5.0]
def change
add_reference :plant_plates, :lab_rack, foreign_key: true
diff --git a/db/migrate/20180418142452_create_join_table_project_shelf.rb b/db/migrate/20180418142452_create_join_table_project_shelf.rb
index 14a8bcd3..289d99bf 100644
--- a/db/migrate/20180418142452_create_join_table_project_shelf.rb
+++ b/db/migrate/20180418142452_create_join_table_project_shelf.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTableProjectShelf < ActiveRecord::Migration[5.0]
def change
create_join_table :projects, :shelves do |t|
- t.index [:project_id, :shelf_id]
+ t.index %i[project_id shelf_id]
end
end
end
diff --git a/db/migrate/20180418142950_add_freezer_to_shelf.rb b/db/migrate/20180418142950_add_freezer_to_shelf.rb
index 649fca00..baf8a9ae 100644
--- a/db/migrate/20180418142950_add_freezer_to_shelf.rb
+++ b/db/migrate/20180418142950_add_freezer_to_shelf.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddFreezerToShelf < ActiveRecord::Migration[5.0]
def change
add_reference :shelves, :freezer, foreign_key: true
diff --git a/db/migrate/20180424090248_add_project_to_contig_search.rb b/db/migrate/20180424090248_add_project_to_contig_search.rb
index 493af9af..861bf865 100644
--- a/db/migrate/20180424090248_add_project_to_contig_search.rb
+++ b/db/migrate/20180424090248_add_project_to_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddProjectToContigSearch < ActiveRecord::Migration[5.0]
def change
add_reference :contig_searches, :project, foreign_key: true
diff --git a/db/migrate/20180424090325_add_project_to_marker_sequence_search.rb b/db/migrate/20180424090325_add_project_to_marker_sequence_search.rb
index ba304ca6..7337a842 100644
--- a/db/migrate/20180424090325_add_project_to_marker_sequence_search.rb
+++ b/db/migrate/20180424090325_add_project_to_marker_sequence_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddProjectToMarkerSequenceSearch < ActiveRecord::Migration[5.0]
def change
add_reference :marker_sequence_searches, :project, foreign_key: true
diff --git a/db/migrate/20180516123145_add_attachment_search_result_archive_to_contig_searches.rb b/db/migrate/20180516123145_add_attachment_search_result_archive_to_contig_searches.rb
index 399f3d5c..a3385b8b 100644
--- a/db/migrate/20180516123145_add_attachment_search_result_archive_to_contig_searches.rb
+++ b/db/migrate/20180516123145_add_attachment_search_result_archive_to_contig_searches.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddAttachmentSearchResultArchiveToContigSearches < ActiveRecord::Migration[5.0]
def self.up
change_table :contig_searches do |t|
diff --git a/db/migrate/20180518091457_create_pg_search_documents.rb b/db/migrate/20180518091457_create_pg_search_documents.rb
index 64a491e1..b03e6069 100644
--- a/db/migrate/20180518091457_create_pg_search_documents.rb
+++ b/db/migrate/20180518091457_create_pg_search_documents.rb
@@ -1,16 +1,18 @@
+# frozen_string_literal: true
+
class CreatePgSearchDocuments < ActiveRecord::Migration[5.0]
def self.up
- say_with_time("Creating table for pg_search multisearch") do
+ say_with_time('Creating table for pg_search multisearch') do
create_table :pg_search_documents do |t|
t.text :content
- t.belongs_to :searchable, :polymorphic => true, :index => true
+ t.belongs_to :searchable, polymorphic: true, index: true
t.timestamps null: false
end
end
end
def self.down
- say_with_time("Dropping table for pg_search multisearch") do
+ say_with_time('Dropping table for pg_search multisearch') do
drop_table :pg_search_documents
end
end
diff --git a/db/migrate/20180518095542_add_pg_trgm_extension_to_db.rb b/db/migrate/20180518095542_add_pg_trgm_extension_to_db.rb
index 2ad7e7de..eb000a70 100644
--- a/db/migrate/20180518095542_add_pg_trgm_extension_to_db.rb
+++ b/db/migrate/20180518095542_add_pg_trgm_extension_to_db.rb
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class AddPgTrgmExtensionToDb < ActiveRecord::Migration[5.0]
def change
- execute "create extension pg_trgm;"
+ execute 'create extension pg_trgm;'
end
end
diff --git a/db/migrate/20180528142049_drop_overview_all_taxa_matview_to_overview_all_taxa.rb b/db/migrate/20180528142049_drop_overview_all_taxa_matview_to_overview_all_taxa.rb
index f90e138a..fedc3ac4 100644
--- a/db/migrate/20180528142049_drop_overview_all_taxa_matview_to_overview_all_taxa.rb
+++ b/db/migrate/20180528142049_drop_overview_all_taxa_matview_to_overview_all_taxa.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DropOverviewAllTaxaMatviewToOverviewAllTaxa < ActiveRecord::Migration[5.0]
def change
drop_view :overview_all_taxa_matviews, materialized: true
diff --git a/db/migrate/20180528143409_drop_overview_finished_taxa_matview.rb b/db/migrate/20180528143409_drop_overview_finished_taxa_matview.rb
index 3c0354c4..74c72949 100644
--- a/db/migrate/20180528143409_drop_overview_finished_taxa_matview.rb
+++ b/db/migrate/20180528143409_drop_overview_finished_taxa_matview.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DropOverviewFinishedTaxaMatview < ActiveRecord::Migration[5.0]
def change
drop_view :overview_finished_taxa_matviews, materialized: true
diff --git a/db/migrate/20180607132126_add_has_species_to_marker_sequence_searches.rb b/db/migrate/20180607132126_add_has_species_to_marker_sequence_searches.rb
index da9aebe2..4aad948c 100644
--- a/db/migrate/20180607132126_add_has_species_to_marker_sequence_searches.rb
+++ b/db/migrate/20180607132126_add_has_species_to_marker_sequence_searches.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddHasSpeciesToMarkerSequenceSearches < ActiveRecord::Migration[5.0]
def change
add_column :marker_sequence_searches, :has_species, :boolean
diff --git a/db/migrate/20180608122922_add_higher_order_taxon_to_marker_sequence_search.rb b/db/migrate/20180608122922_add_higher_order_taxon_to_marker_sequence_search.rb
index 3a11644f..3a80a2f8 100644
--- a/db/migrate/20180608122922_add_higher_order_taxon_to_marker_sequence_search.rb
+++ b/db/migrate/20180608122922_add_higher_order_taxon_to_marker_sequence_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddHigherOrderTaxonToMarkerSequenceSearch < ActiveRecord::Migration[5.0]
def change
add_column :marker_sequence_searches, :higher_order_taxon, :string
diff --git a/db/migrate/20180615090349_create_mislabel_analyses.rb b/db/migrate/20180615090349_create_mislabel_analyses.rb
index cce91567..8dc9d243 100644
--- a/db/migrate/20180615090349_create_mislabel_analyses.rb
+++ b/db/migrate/20180615090349_create_mislabel_analyses.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateMislabelAnalyses < ActiveRecord::Migration[5.0]
def change
create_table :mislabel_analyses do |t|
diff --git a/db/migrate/20180615090753_create_mislabels.rb b/db/migrate/20180615090753_create_mislabels.rb
index 63648754..b9ad1d51 100644
--- a/db/migrate/20180615090753_create_mislabels.rb
+++ b/db/migrate/20180615090753_create_mislabels.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateMislabels < ActiveRecord::Migration[5.0]
def change
create_table :mislabels do |t|
diff --git a/db/migrate/20180615091448_create_join_table_marker_sequences_mislabel_analyses.rb b/db/migrate/20180615091448_create_join_table_marker_sequences_mislabel_analyses.rb
index 1c0a89f4..37861023 100644
--- a/db/migrate/20180615091448_create_join_table_marker_sequences_mislabel_analyses.rb
+++ b/db/migrate/20180615091448_create_join_table_marker_sequences_mislabel_analyses.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
class CreateJoinTableMarkerSequencesMislabelAnalyses < ActiveRecord::Migration[5.0]
def change
create_join_table :marker_sequences, :mislabel_analyses do |t|
- t.index [:marker_sequence_id, :mislabel_analysis_id], name: 'index_marker_sequences_mislabel_analyses'
+ t.index %i[marker_sequence_id mislabel_analysis_id], name: 'index_marker_sequences_mislabel_analyses'
end
end
end
diff --git a/db/migrate/20180615091603_add_mislabels_to_marker_sequences.rb b/db/migrate/20180615091603_add_mislabels_to_marker_sequences.rb
index 190a7eab..c05ada45 100644
--- a/db/migrate/20180615091603_add_mislabels_to_marker_sequences.rb
+++ b/db/migrate/20180615091603_add_mislabels_to_marker_sequences.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddMislabelsToMarkerSequences < ActiveRecord::Migration[5.0]
def change
add_reference :mislabels, :marker_sequence, foreign_key: true
diff --git a/db/migrate/20180621112511_add_solved_to_mislabels.rb b/db/migrate/20180621112511_add_solved_to_mislabels.rb
index 2663f258..7d34de73 100644
--- a/db/migrate/20180621112511_add_solved_to_mislabels.rb
+++ b/db/migrate/20180621112511_add_solved_to_mislabels.rb
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
class AddSolvedToMislabels < ActiveRecord::Migration[5.0]
def change
- add_column :mislabels, :solved, :boolean, :default => false
+ add_column :mislabels, :solved, :boolean, default: false
add_column :mislabels, :solved_by, :integer
add_column :mislabels, :solved_at, :datetime
end
diff --git a/db/migrate/20180621122934_add_has_warnings_to_marker_sequence_search.rb b/db/migrate/20180621122934_add_has_warnings_to_marker_sequence_search.rb
index b6a18d24..992dba96 100644
--- a/db/migrate/20180621122934_add_has_warnings_to_marker_sequence_search.rb
+++ b/db/migrate/20180621122934_add_has_warnings_to_marker_sequence_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddHasWarningsToMarkerSequenceSearch < ActiveRecord::Migration[5.0]
def change
add_column :marker_sequence_searches, :has_warnings, :integer
diff --git a/db/migrate/20180622121926_add_has_warnings_to_contig_search.rb b/db/migrate/20180622121926_add_has_warnings_to_contig_search.rb
index f83cd88c..948b8e3b 100644
--- a/db/migrate/20180622121926_add_has_warnings_to_contig_search.rb
+++ b/db/migrate/20180622121926_add_has_warnings_to_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddHasWarningsToContigSearch < ActiveRecord::Migration[5.0]
def change
add_column :contig_searches, :has_warnings, :integer
diff --git a/db/migrate/20180628115013_add_attributes_to_mislabel_analysis.rb b/db/migrate/20180628115013_add_attributes_to_mislabel_analysis.rb
index 1e273a77..53361969 100644
--- a/db/migrate/20180628115013_add_attributes_to_mislabel_analysis.rb
+++ b/db/migrate/20180628115013_add_attributes_to_mislabel_analysis.rb
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
class AddAttributesToMislabelAnalysis < ActiveRecord::Migration[5.0]
def change
- add_column :mislabel_analyses, :automatic, :boolean, :default => false
+ add_column :mislabel_analyses, :automatic, :boolean, default: false
add_reference :mislabel_analyses, :marker, foreign_key: true
end
end
diff --git a/db/migrate/20180629094941_add_total_seq_number_to_mislabel_analysis.rb b/db/migrate/20180629094941_add_total_seq_number_to_mislabel_analysis.rb
index 016ebea1..a26908ee 100644
--- a/db/migrate/20180629094941_add_total_seq_number_to_mislabel_analysis.rb
+++ b/db/migrate/20180629094941_add_total_seq_number_to_mislabel_analysis.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddTotalSeqNumberToMislabelAnalysis < ActiveRecord::Migration[5.0]
def change
add_column :mislabel_analyses, :total_seq_number, :integer
diff --git a/db/migrate/20180629112840_add_has_issue_to_individuals.rb b/db/migrate/20180629112840_add_has_issue_to_individuals.rb
index 91f9f24d..a15ab51d 100644
--- a/db/migrate/20180629112840_add_has_issue_to_individuals.rb
+++ b/db/migrate/20180629112840_add_has_issue_to_individuals.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddHasIssueToIndividuals < ActiveRecord::Migration[5.0]
def change
add_column :individuals, :has_issue, :boolean
diff --git a/db/migrate/20180629120118_create_individual_searches.rb b/db/migrate/20180629120118_create_individual_searches.rb
index b49131fd..86e37cdd 100644
--- a/db/migrate/20180629120118_create_individual_searches.rb
+++ b/db/migrate/20180629120118_create_individual_searches.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class CreateIndividualSearches < ActiveRecord::Migration[5.0]
def change
create_table :individual_searches do |t|
diff --git a/db/migrate/20180629122812_change_attributes_of_individual_search.rb b/db/migrate/20180629122812_change_attributes_of_individual_search.rb
index ddb0f80c..4c8be34c 100644
--- a/db/migrate/20180629122812_change_attributes_of_individual_search.rb
+++ b/db/migrate/20180629122812_change_attributes_of_individual_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeAttributesOfIndividualSearch < ActiveRecord::Migration[5.0]
def change
add_reference :individual_searches, :project, foreign_key: true
diff --git a/db/migrate/20180629124238_change_has_species_of_individual_search.rb b/db/migrate/20180629124238_change_has_species_of_individual_search.rb
index 049f5d30..577484cc 100644
--- a/db/migrate/20180629124238_change_has_species_of_individual_search.rb
+++ b/db/migrate/20180629124238_change_has_species_of_individual_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class ChangeHasSpeciesOfIndividualSearch < ActiveRecord::Migration[5.0]
def change
change_column :individual_searches, :has_species, 'integer USING CAST(has_issue AS integer)'
diff --git a/db/migrate/20180718141806_add_checksum_to_primer_reads.rb b/db/migrate/20180718141806_add_checksum_to_primer_reads.rb
index cc7014c1..3d1bd619 100644
--- a/db/migrate/20180718141806_add_checksum_to_primer_reads.rb
+++ b/db/migrate/20180718141806_add_checksum_to_primer_reads.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddChecksumToPrimerReads < ActiveRecord::Migration[5.0]
def change
add_column :primer_reads, :chromatogram_fingerprint, :string
diff --git a/db/migrate/20180921081203_add_update_and_creation_constraints_to_ms_search.rb b/db/migrate/20180921081203_add_update_and_creation_constraints_to_ms_search.rb
index b1fa36bc..ff4275da 100644
--- a/db/migrate/20180921081203_add_update_and_creation_constraints_to_ms_search.rb
+++ b/db/migrate/20180921081203_add_update_and_creation_constraints_to_ms_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddUpdateAndCreationConstraintsToMsSearch < ActiveRecord::Migration[5.0]
def change
add_column :marker_sequence_searches, :min_age, :date
diff --git a/db/migrate/20181010123611_add_verified_by_to_contig_search.rb b/db/migrate/20181010123611_add_verified_by_to_contig_search.rb
index f846b9c3..94291abf 100644
--- a/db/migrate/20181010123611_add_verified_by_to_contig_search.rb
+++ b/db/migrate/20181010123611_add_verified_by_to_contig_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddVerifiedByToContigSearch < ActiveRecord::Migration[5.0]
def change
add_column :contig_searches, :verified_by, :string
diff --git a/db/migrate/20181010124944_add_verified_by_to_marker_sequence_search.rb b/db/migrate/20181010124944_add_verified_by_to_marker_sequence_search.rb
index ae7947d4..1d058fc9 100644
--- a/db/migrate/20181010124944_add_verified_by_to_marker_sequence_search.rb
+++ b/db/migrate/20181010124944_add_verified_by_to_marker_sequence_search.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddVerifiedByToMarkerSequenceSearch < ActiveRecord::Migration[5.0]
def change
add_column :marker_sequence_searches, :verified_by, :string
diff --git a/db/migrate/20181016135130_drop_alignments.rb b/db/migrate/20181016135130_drop_alignments.rb
index b625ec03..b23d72ba 100644
--- a/db/migrate/20181016135130_drop_alignments.rb
+++ b/db/migrate/20181016135130_drop_alignments.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DropAlignments < ActiveRecord::Migration[5.0]
def up
drop_table :alignments
diff --git a/db/migrate/20181016154851_drop_status.rb b/db/migrate/20181016154851_drop_status.rb
index 7abf129a..ce545c48 100644
--- a/db/migrate/20181016154851_drop_status.rb
+++ b/db/migrate/20181016154851_drop_status.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class DropStatus < ActiveRecord::Migration[5.0]
def up
drop_table :statuses
diff --git a/db/migrate/20181017083633_rename_xml_uploader.rb b/db/migrate/20181017083633_rename_xml_uploader.rb
index 7312f96d..fe4fce8a 100644
--- a/db/migrate/20181017083633_rename_xml_uploader.rb
+++ b/db/migrate/20181017083633_rename_xml_uploader.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameXmlUploader < ActiveRecord::Migration[5.0]
def self.up
rename_table :xml_uploaders, :specimen_exporters
diff --git a/db/migrate/20181017084242_rename_species_xml_uploader.rb b/db/migrate/20181017084242_rename_species_xml_uploader.rb
index 1d8d722d..ce9e8a11 100644
--- a/db/migrate/20181017084242_rename_species_xml_uploader.rb
+++ b/db/migrate/20181017084242_rename_species_xml_uploader.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameSpeciesXmlUploader < ActiveRecord::Migration[5.0]
def self.up
rename_table :species_xml_uploaders, :species_exporters
diff --git a/db/migrate/20181017085059_rename_exporter_uploaded_file.rb b/db/migrate/20181017085059_rename_exporter_uploaded_file.rb
index 894ae603..24ffec26 100644
--- a/db/migrate/20181017085059_rename_exporter_uploaded_file.rb
+++ b/db/migrate/20181017085059_rename_exporter_uploaded_file.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RenameExporterUploadedFile < ActiveRecord::Migration[5.0]
def self.rename_attachment(table, old, new)
attachment_columns = [['file_name', :string], ['content_type', :string], ['file_size', :integer], ['updated_at', :datetime]]
diff --git a/db/migrate/20181018093520_remove_partial_cons_text_columns_from_contigs.rb b/db/migrate/20181018093520_remove_partial_cons_text_columns_from_contigs.rb
index e3b4c727..aa9df11b 100644
--- a/db/migrate/20181018093520_remove_partial_cons_text_columns_from_contigs.rb
+++ b/db/migrate/20181018093520_remove_partial_cons_text_columns_from_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemovePartialConsTextColumnsFromContigs < ActiveRecord::Migration[5.0]
def change
remove_column :contigs, :partial_cons1, :text
diff --git a/db/migrate/20181018094614_remove_unused_columns_from_contigs.rb b/db/migrate/20181018094614_remove_unused_columns_from_contigs.rb
index c3de5962..05a0370b 100644
--- a/db/migrate/20181018094614_remove_unused_columns_from_contigs.rb
+++ b/db/migrate/20181018094614_remove_unused_columns_from_contigs.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class RemoveUnusedColumnsFromContigs < ActiveRecord::Migration[5.0]
def change
remove_column :contigs, :aligned_cons, :string
diff --git a/db/schema.rb b/db/schema.rb
index f065dfc0..4127cddc 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@@ -10,729 +12,728 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20181018094614) do
-
+ActiveRecord::Schema.define(version: 20_181_018_094_614) do
# These are extensions that must be enabled in order to support this database
- enable_extension "plpgsql"
- enable_extension "pg_stat_statements"
- enable_extension "pg_trgm"
-
- create_table "centroid_sequences", force: :cascade do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
-
- create_table "clusters", force: :cascade do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
-
- create_table "contig_pde_uploaders", force: :cascade do |t|
- t.string "uploaded_file_file_name"
- t.string "uploaded_file_content_type"
- t.integer "uploaded_file_file_size"
- t.datetime "uploaded_file_updated_at"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
-
- create_table "contig_searches", force: :cascade do |t|
- t.string "species"
- t.string "order"
- t.string "specimen"
- t.string "family"
- t.string "verified"
- t.string "marker"
- t.string "name"
- t.string "assembled"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.date "min_age"
- t.date "max_age"
- t.date "min_update"
- t.date "max_update"
- t.string "title"
- t.integer "user_id"
- t.integer "project_id"
- t.string "search_result_archive_file_name"
- t.string "search_result_archive_content_type"
- t.integer "search_result_archive_file_size"
- t.datetime "search_result_archive_updated_at"
- t.integer "has_warnings"
- t.string "verified_by"
- t.index ["project_id"], name: "index_contig_searches_on_project_id", using: :btree
- end
-
- create_table "contigs", force: :cascade do |t|
- t.string "name", limit: 255
- t.text "consensus"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "marker_sequence_id"
- t.integer "isolate_id"
- t.integer "marker_id"
- t.boolean "assembled"
- t.boolean "assembly_tried"
- t.text "fas"
- t.boolean "verified", default: false
- t.integer "verified_by"
- t.datetime "verified_at"
- t.string "comment"
- t.boolean "imported", default: false
- t.integer "partial_cons_count"
- t.integer "overlap_length", default: 15
- t.integer "allowed_mismatch_percent", default: 5
- end
-
- create_table "contigs_projects", id: false, force: :cascade do |t|
- t.integer "contig_id"
- t.integer "project_id"
- end
-
- create_table "copies", force: :cascade do |t|
- t.string "well_pos_plant_plate"
- t.integer "lab_nr"
- t.integer "micronic_tube_id"
- t.string "well_pos_micronic_plate"
- t.decimal "concentration"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "delayed_jobs", force: :cascade do |t|
- t.integer "priority", default: 0, null: false
- t.integer "attempts", default: 0, null: false
- t.text "handler", null: false
- t.text "last_error"
- t.datetime "run_at"
- t.datetime "locked_at"
- t.datetime "failed_at"
- t.string "locked_by", limit: 255
- t.string "queue", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
- end
-
- create_table "divisions", force: :cascade do |t|
- t.string "name"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
-
- create_table "families", force: :cascade do |t|
- t.string "name", limit: 255
- t.string "author", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "order_id"
- end
-
- create_table "families_projects", id: false, force: :cascade do |t|
- t.integer "family_id"
- t.integer "project_id"
- end
-
- create_table "freezers", force: :cascade do |t|
- t.string "freezercode", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "lab_id"
- end
-
- create_table "freezers_projects", id: false, force: :cascade do |t|
- t.integer "freezer_id", null: false
- t.integer "project_id", null: false
- t.index ["freezer_id", "project_id"], name: "index_freezers_projects_on_freezer_id_and_project_id", using: :btree
- end
-
- create_table "genera", force: :cascade do |t|
- t.string "name", limit: 255
- t.string "author", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "helps", force: :cascade do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "higher_order_taxa", force: :cascade do |t|
- t.string "name", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "german_name", limit: 255
- t.integer "position"
- end
-
- create_table "higher_order_taxa_markers", id: false, force: :cascade do |t|
- t.integer "higher_order_taxon_id"
- t.integer "marker_id"
- end
-
- create_table "higher_order_taxa_projects", id: false, force: :cascade do |t|
- t.integer "higher_order_taxon_id"
- t.integer "project_id"
- end
-
- create_table "individual_searches", force: :cascade do |t|
- t.string "title"
- t.integer "has_species"
- t.integer "has_problematic_location"
- t.integer "has_issue"
- t.string "specimen_id"
- t.string "DNA_bank_id"
- t.string "species"
- t.string "family"
- t.string "order"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "project_id"
- t.integer "user_id"
- t.index ["project_id"], name: "index_individual_searches_on_project_id", using: :btree
- t.index ["user_id"], name: "index_individual_searches_on_user_id", using: :btree
- end
-
- create_table "individuals", force: :cascade do |t|
- t.string "specimen_id", limit: 255
- t.string "DNA_bank_id", limit: 255
- t.string "collector", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.boolean "silica_gel"
- t.date "collected"
- t.integer "species_id"
- t.string "herbarium", limit: 255
- t.string "voucher", limit: 255
- t.string "country", limit: 255
- t.string "state_province", limit: 255
- t.text "locality"
- t.string "latitude_original", limit: 255
- t.string "longitude_original", limit: 255
- t.string "elevation", limit: 255
- t.string "exposition", limit: 255
- t.text "habitat"
- t.string "substrate", limit: 255
- t.string "life_form", limit: 255
- t.string "collection_nr", limit: 255
- t.string "collection_date", limit: 255
- t.string "determination", limit: 255
- t.string "revision", limit: 255
- t.string "confirmation", limit: 255
- t.text "comments"
- t.decimal "latitude", precision: 15, scale: 6
- t.decimal "longitude", precision: 15, scale: 6
- t.boolean "has_issue"
- end
-
- create_table "individuals_projects", id: false, force: :cascade do |t|
- t.integer "individual_id"
- t.integer "project_id"
- end
-
- create_table "isolates", force: :cascade do |t|
- t.string "well_pos_plant_plate", limit: 255
- t.string "micronic_tube_id", limit: 255
- t.string "well_pos_micronic_plate", limit: 255
- t.decimal "concentration"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.boolean "isCopy"
- t.integer "tissue_id"
- t.integer "micronic_plate_id"
- t.integer "plant_plate_id"
- t.integer "individual_id"
- t.string "dna_bank_id", limit: 255
- t.string "lab_nr", limit: 255
- t.boolean "negative_control", default: false
- t.integer "lab_id_orig"
- t.integer "lab_id_copy"
- t.datetime "isolation_date"
- t.integer "micronic_plate_id_orig"
- t.integer "micronic_plate_id_copy"
- t.string "well_pos_micronic_plate_orig"
- t.string "well_pos_micronic_plate_copy"
- t.decimal "concentration_orig", precision: 15, scale: 2
- t.decimal "concentration_copy", precision: 15, scale: 2
- t.string "micronic_tube_id_orig"
- t.string "micronic_tube_id_copy"
- t.integer "user_id"
- t.text "comment_orig"
- t.text "comment_copy"
- end
-
- create_table "isolates_projects", id: false, force: :cascade do |t|
- t.integer "isolate_id"
- t.integer "project_id"
- end
-
- create_table "issues", force: :cascade do |t|
- t.string "title", limit: 255
- t.text "description"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "primer_read_id"
- t.integer "contig_id"
- end
-
- create_table "issues_projects", id: false, force: :cascade do |t|
- t.integer "issue_id"
- t.integer "project_id"
- end
-
- create_table "lab_racks", force: :cascade do |t|
- t.string "rackcode", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "freezer_id"
- t.string "rack_position"
- t.string "shelf"
- end
-
- create_table "lab_racks_projects", id: false, force: :cascade do |t|
- t.integer "lab_rack_id", null: false
- t.integer "project_id", null: false
- t.index ["lab_rack_id", "project_id"], name: "index_lab_racks_projects_on_lab_rack_id_and_project_id", using: :btree
- end
-
- create_table "labs", force: :cascade do |t|
- t.string "labcode", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "labs_projects", id: false, force: :cascade do |t|
- t.integer "lab_id"
- t.integer "project_id"
- end
-
- create_table "marker_sequence_searches", force: :cascade do |t|
- t.string "name"
- t.string "verified"
- t.string "species"
- t.string "order"
- t.string "specimen"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "user_id"
- t.string "title"
- t.string "family"
- t.string "marker"
- t.integer "min_length"
- t.integer "max_length"
- t.integer "project_id"
- t.boolean "has_species"
- t.string "higher_order_taxon"
- t.integer "has_warnings"
- t.date "min_age"
- t.date "max_age"
- t.date "min_update"
- t.date "max_update"
- t.string "verified_by"
- t.index ["project_id"], name: "index_marker_sequence_searches_on_project_id", using: :btree
- end
-
- create_table "marker_sequences", force: :cascade do |t|
- t.string "name", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "genbank", limit: 255
- t.text "sequence"
- t.integer "isolate_id"
- t.integer "marker_id"
- t.string "reference"
- end
-
- create_table "marker_sequences_mislabel_analyses", id: false, force: :cascade do |t|
- t.integer "marker_sequence_id", null: false
- t.integer "mislabel_analysis_id", null: false
- t.index ["marker_sequence_id", "mislabel_analysis_id"], name: "index_marker_sequences_mislabel_analyses", using: :btree
- end
-
- create_table "marker_sequences_projects", id: false, force: :cascade do |t|
- t.integer "marker_sequence_id", null: false
- t.integer "project_id", null: false
- t.index ["marker_sequence_id", "project_id"], name: "index_marker_sequences_projects", using: :btree
- end
-
- create_table "markers", force: :cascade do |t|
- t.string "name", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "expected_reads"
- t.boolean "is_gbol"
- t.string "alt_name"
- end
-
- create_table "markers_projects", id: false, force: :cascade do |t|
- t.integer "marker_id", null: false
- t.integer "project_id", null: false
- t.index ["marker_id", "project_id"], name: "index_markers_projects_on_marker_id_and_project_id", using: :btree
- end
-
- create_table "micronic_plates", force: :cascade do |t|
- t.string "micronic_plate_id", limit: 255
- t.string "name", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "location_in_rack", limit: 255
- t.integer "lab_rack_id"
- end
-
- create_table "micronic_plates_projects", id: false, force: :cascade do |t|
- t.integer "micronic_plate_id", null: false
- t.integer "project_id", null: false
- t.index ["micronic_plate_id", "project_id"], name: "index_micronic_plates_projects", using: :btree
- end
-
- create_table "mislabel_analyses", force: :cascade do |t|
- t.string "title"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.boolean "automatic", default: false
- t.integer "marker_id"
- t.integer "total_seq_number"
- t.index ["marker_id"], name: "index_mislabel_analyses_on_marker_id", using: :btree
- end
-
- create_table "mislabels", force: :cascade do |t|
- t.string "level"
- t.decimal "confidence"
- t.string "proposed_label"
- t.string "proposed_path"
- t.string "path_confidence"
- t.integer "mislabel_analysis_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "marker_sequence_id"
- t.boolean "solved", default: false
- t.integer "solved_by"
- t.datetime "solved_at"
- t.index ["marker_sequence_id"], name: "index_mislabels_on_marker_sequence_id", using: :btree
- t.index ["mislabel_analysis_id"], name: "index_mislabels_on_mislabel_analysis_id", using: :btree
- end
-
- create_table "news", force: :cascade do |t|
- t.string "title", limit: 255
- t.text "body"
- t.datetime "published"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "ngs_runs", force: :cascade do |t|
- t.integer "quality_threshold"
- t.integer "tag_mismates"
- t.integer "primer_mismatches"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "name"
- t.string "fastq_file_name"
- t.string "fastq_content_type"
- t.integer "fastq_file_size"
- t.datetime "fastq_updated_at"
- t.integer "higher_order_taxon_id"
- t.string "set_tag_map_file_name"
- t.string "set_tag_map_content_type"
- t.integer "set_tag_map_file_size"
- t.datetime "set_tag_map_updated_at"
- t.index ["higher_order_taxon_id"], name: "index_ngs_runs_on_higher_order_taxon_id", using: :btree
- end
-
- create_table "ngs_runs_projects", id: false, force: :cascade do |t|
- t.integer "ngs_run_id", null: false
- t.integer "project_id", null: false
- t.index ["ngs_run_id", "project_id"], name: "index_ngs_runs_projects_on_ngs_run_id_and_project_id", using: :btree
- end
-
- create_table "oders", force: :cascade do |t|
- t.string "name", limit: 255
- t.string "author", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "orders", force: :cascade do |t|
- t.string "name", limit: 255
- t.string "author", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "higher_order_taxon_id"
- t.integer "taxonomic_class_id"
- end
-
- create_table "orders_projects", id: false, force: :cascade do |t|
- t.integer "order_id"
- t.integer "project_id"
- end
-
- create_table "partial_cons", force: :cascade do |t|
- t.text "sequence"
- t.text "aligned_sequence"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "contig_id"
- t.integer "aligned_qualities", array: true
- end
-
- create_table "pg_search_documents", force: :cascade do |t|
- t.text "content"
- t.string "searchable_type"
- t.integer "searchable_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["searchable_type", "searchable_id"], name: "index_pg_search_documents_on_searchable_type_and_searchable_id", using: :btree
- end
-
- create_table "plant_plates", force: :cascade do |t|
- t.string "name", limit: 255
- t.integer "how_many"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "location_in_rack", limit: 255
- t.integer "lab_rack_id"
- t.index ["lab_rack_id"], name: "index_plant_plates_on_lab_rack_id", using: :btree
- end
-
- create_table "plant_plates_projects", id: false, force: :cascade do |t|
- t.integer "plant_plate_id", null: false
- t.integer "project_id", null: false
- t.index ["plant_plate_id", "project_id"], name: "index_plant_plates_projects_on_plant_plate_id_and_project_id", using: :btree
- end
-
- create_table "primer_pos_on_genomes", force: :cascade do |t|
- t.text "note"
- t.integer "position"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "primer_reads", force: :cascade do |t|
- t.string "name", limit: 255
- t.text "sequence"
- t.string "pherogram_url", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "chromatogram_file_name", limit: 255
- t.string "chromatogram_content_type", limit: 255
- t.integer "chromatogram_file_size"
- t.datetime "chromatogram_updated_at"
- t.integer "primer_id"
- t.integer "isolate_id"
- t.integer "contig_id"
- t.integer "trimmedReadEnd"
- t.integer "trimmedReadStart"
- t.integer "qualities", array: true
- t.boolean "reverse"
- t.text "aligned_seq"
- t.boolean "used_for_con"
- t.text "quality_string"
- t.integer "position"
- t.boolean "assembled"
- t.integer "partial_con_id"
- t.integer "aligned_qualities", array: true
- t.integer "window_size", default: 10
- t.integer "count_in_window", default: 8
- t.integer "min_quality_score", default: 30
- t.integer "atrace", array: true
- t.integer "ctrace", array: true
- t.integer "gtrace", array: true
- t.integer "ttrace", array: true
- t.integer "peak_indices", array: true
- t.boolean "processed", default: false
- t.integer "base_count"
- t.string "comment"
- t.boolean "overwritten", default: false
- t.integer "aligned_peak_indices", array: true
- t.string "chromatogram_fingerprint"
- end
-
- create_table "primer_reads_projects", id: false, force: :cascade do |t|
- t.integer "primer_read_id"
- t.integer "project_id"
- end
-
- create_table "primers", force: :cascade do |t|
- t.string "name", limit: 255
- t.string "sequence", limit: 255
- t.boolean "reverse"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.text "notes"
- t.integer "marker_id"
- t.string "labcode", limit: 255
- t.string "author", limit: 255
- t.string "alt_name", limit: 255
- t.string "target_group", limit: 255
- t.string "tm", limit: 255
- t.integer "position"
- end
-
- create_table "primers_projects", id: false, force: :cascade do |t|
- t.integer "primer_id", null: false
- t.integer "project_id", null: false
- t.index ["primer_id", "project_id"], name: "index_primers_projects_on_primer_id_and_project_id", using: :btree
- end
-
- create_table "projects", force: :cascade do |t|
- t.string "name", limit: 255
- t.text "description"
- t.datetime "start"
- t.datetime "due"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "projects_shelves", id: false, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "shelf_id", null: false
- t.index ["project_id", "shelf_id"], name: "index_projects_shelves_on_project_id_and_shelf_id", using: :btree
- end
-
- create_table "projects_species", id: false, force: :cascade do |t|
- t.integer "project_id"
- t.integer "species_id"
- end
-
- create_table "projects_tag_primer_maps", id: false, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "tag_primer_map_id", null: false
- t.index ["project_id", "tag_primer_map_id"], name: "index_projects_tag_primer_maps", using: :btree
- end
-
- create_table "projects_users", id: false, force: :cascade do |t|
- t.integer "project_id"
- t.integer "user_id"
- end
-
- create_table "responsibilities", force: :cascade do |t|
- t.string "name"
- t.text "description"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
-
- create_table "responsibilities_users", id: false, force: :cascade do |t|
- t.integer "responsibility_id", null: false
- t.integer "user_id", null: false
- t.index ["responsibility_id", "user_id"], name: "index_responsibilities_users_on_responsibility_id_and_user_id", using: :btree
- end
-
- create_table "shelves", force: :cascade do |t|
- t.string "name", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "freezer_id"
- t.index ["freezer_id"], name: "index_shelves_on_freezer_id", using: :btree
- end
-
- create_table "species", force: :cascade do |t|
- t.string "author", limit: 255
- t.string "genus_name", limit: 255
- t.string "species_epithet", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "family_id"
- t.string "infraspecific", limit: 255
- t.text "comment"
- t.string "german_name", limit: 255
- t.string "author_infra", limit: 255
- t.string "synonym", limit: 255
- t.string "composed_name", limit: 255
- t.string "species_component"
- end
-
- create_table "species_exporters", force: :cascade do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "species_export_file_name"
- t.string "species_export_content_type"
- t.integer "species_export_file_size"
- t.datetime "species_export_updated_at"
- end
-
- create_table "specimen_exporters", force: :cascade do |t|
- t.string "specimen_export_file_name"
- t.string "specimen_export_content_type"
- t.integer "specimen_export_file_size"
- t.datetime "specimen_export_updated_at"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "subdivisions", force: :cascade do |t|
- t.string "name"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "position"
- t.string "german_name"
- end
-
- create_table "tag_primer_maps", force: :cascade do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "ngs_run_id"
- t.string "tag_primer_map_file_name"
- t.string "tag_primer_map_content_type"
- t.integer "tag_primer_map_file_size"
- t.datetime "tag_primer_map_updated_at"
- t.string "name"
- t.string "tag"
- t.index ["ngs_run_id"], name: "index_tag_primer_maps_on_ngs_run_id", using: :btree
- end
-
- create_table "taxonomic_classes", force: :cascade do |t|
- t.string "name"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "subdivision_id"
- t.string "german_name"
- end
-
- create_table "tissues", force: :cascade do |t|
- t.string "name", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "txt_uploaders", force: :cascade do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "uploaded_file_file_name"
- t.string "uploaded_file_content_type"
- t.integer "uploaded_file_file_size"
- t.datetime "uploaded_file_updated_at"
- end
-
- create_table "users", force: :cascade do |t|
- t.string "email", limit: 255, default: "", null: false
- t.string "encrypted_password", limit: 255, default: "", null: false
- t.string "reset_password_token", limit: 255
- t.datetime "reset_password_sent_at"
- t.datetime "remember_created_at"
- t.integer "sign_in_count", default: 0, null: false
- t.datetime "current_sign_in_at"
- t.datetime "last_sign_in_at"
- t.string "current_sign_in_ip", limit: 255
- t.string "last_sign_in_ip", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "name", limit: 255
- t.integer "lab_id"
- t.integer "role"
- t.integer "default_project_id"
- t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
- t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
- end
-
- add_foreign_key "contig_searches", "projects"
- add_foreign_key "individual_searches", "projects"
- add_foreign_key "individual_searches", "users"
- add_foreign_key "marker_sequence_searches", "projects"
- add_foreign_key "mislabel_analyses", "markers"
- add_foreign_key "mislabels", "marker_sequences"
- add_foreign_key "ngs_runs", "higher_order_taxa"
- add_foreign_key "plant_plates", "lab_racks"
- add_foreign_key "shelves", "freezers"
+ enable_extension 'plpgsql'
+ enable_extension 'pg_stat_statements'
+ enable_extension 'pg_trgm'
+
+ create_table 'centroid_sequences', force: :cascade do |t|
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ end
+
+ create_table 'clusters', force: :cascade do |t|
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ end
+
+ create_table 'contig_pde_uploaders', force: :cascade do |t|
+ t.string 'uploaded_file_file_name'
+ t.string 'uploaded_file_content_type'
+ t.integer 'uploaded_file_file_size'
+ t.datetime 'uploaded_file_updated_at'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ end
+
+ create_table 'contig_searches', force: :cascade do |t|
+ t.string 'species'
+ t.string 'order'
+ t.string 'specimen'
+ t.string 'family'
+ t.string 'verified'
+ t.string 'marker'
+ t.string 'name'
+ t.string 'assembled'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.date 'min_age'
+ t.date 'max_age'
+ t.date 'min_update'
+ t.date 'max_update'
+ t.string 'title'
+ t.integer 'user_id'
+ t.integer 'project_id'
+ t.string 'search_result_archive_file_name'
+ t.string 'search_result_archive_content_type'
+ t.integer 'search_result_archive_file_size'
+ t.datetime 'search_result_archive_updated_at'
+ t.integer 'has_warnings'
+ t.string 'verified_by'
+ t.index ['project_id'], name: 'index_contig_searches_on_project_id', using: :btree
+ end
+
+ create_table 'contigs', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.text 'consensus'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'marker_sequence_id'
+ t.integer 'isolate_id'
+ t.integer 'marker_id'
+ t.boolean 'assembled'
+ t.boolean 'assembly_tried'
+ t.text 'fas'
+ t.boolean 'verified', default: false
+ t.integer 'verified_by'
+ t.datetime 'verified_at'
+ t.string 'comment'
+ t.boolean 'imported', default: false
+ t.integer 'partial_cons_count'
+ t.integer 'overlap_length', default: 15
+ t.integer 'allowed_mismatch_percent', default: 5
+ end
+
+ create_table 'contigs_projects', id: false, force: :cascade do |t|
+ t.integer 'contig_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'copies', force: :cascade do |t|
+ t.string 'well_pos_plant_plate'
+ t.integer 'lab_nr'
+ t.integer 'micronic_tube_id'
+ t.string 'well_pos_micronic_plate'
+ t.decimal 'concentration'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'delayed_jobs', force: :cascade do |t|
+ t.integer 'priority', default: 0, null: false
+ t.integer 'attempts', default: 0, null: false
+ t.text 'handler', null: false
+ t.text 'last_error'
+ t.datetime 'run_at'
+ t.datetime 'locked_at'
+ t.datetime 'failed_at'
+ t.string 'locked_by', limit: 255
+ t.string 'queue', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.index %w[priority run_at], name: 'delayed_jobs_priority', using: :btree
+ end
+
+ create_table 'divisions', force: :cascade do |t|
+ t.string 'name'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ end
+
+ create_table 'families', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.string 'author', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'order_id'
+ end
+
+ create_table 'families_projects', id: false, force: :cascade do |t|
+ t.integer 'family_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'freezers', force: :cascade do |t|
+ t.string 'freezercode', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'lab_id'
+ end
+
+ create_table 'freezers_projects', id: false, force: :cascade do |t|
+ t.integer 'freezer_id', null: false
+ t.integer 'project_id', null: false
+ t.index %w[freezer_id project_id], name: 'index_freezers_projects_on_freezer_id_and_project_id', using: :btree
+ end
+
+ create_table 'genera', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.string 'author', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'helps', force: :cascade do |t|
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'higher_order_taxa', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.string 'german_name', limit: 255
+ t.integer 'position'
+ end
+
+ create_table 'higher_order_taxa_markers', id: false, force: :cascade do |t|
+ t.integer 'higher_order_taxon_id'
+ t.integer 'marker_id'
+ end
+
+ create_table 'higher_order_taxa_projects', id: false, force: :cascade do |t|
+ t.integer 'higher_order_taxon_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'individual_searches', force: :cascade do |t|
+ t.string 'title'
+ t.integer 'has_species'
+ t.integer 'has_problematic_location'
+ t.integer 'has_issue'
+ t.string 'specimen_id'
+ t.string 'DNA_bank_id'
+ t.string 'species'
+ t.string 'family'
+ t.string 'order'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.integer 'project_id'
+ t.integer 'user_id'
+ t.index ['project_id'], name: 'index_individual_searches_on_project_id', using: :btree
+ t.index ['user_id'], name: 'index_individual_searches_on_user_id', using: :btree
+ end
+
+ create_table 'individuals', force: :cascade do |t|
+ t.string 'specimen_id', limit: 255
+ t.string 'DNA_bank_id', limit: 255
+ t.string 'collector', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.boolean 'silica_gel'
+ t.date 'collected'
+ t.integer 'species_id'
+ t.string 'herbarium', limit: 255
+ t.string 'voucher', limit: 255
+ t.string 'country', limit: 255
+ t.string 'state_province', limit: 255
+ t.text 'locality'
+ t.string 'latitude_original', limit: 255
+ t.string 'longitude_original', limit: 255
+ t.string 'elevation', limit: 255
+ t.string 'exposition', limit: 255
+ t.text 'habitat'
+ t.string 'substrate', limit: 255
+ t.string 'life_form', limit: 255
+ t.string 'collection_nr', limit: 255
+ t.string 'collection_date', limit: 255
+ t.string 'determination', limit: 255
+ t.string 'revision', limit: 255
+ t.string 'confirmation', limit: 255
+ t.text 'comments'
+ t.decimal 'latitude', precision: 15, scale: 6
+ t.decimal 'longitude', precision: 15, scale: 6
+ t.boolean 'has_issue'
+ end
+
+ create_table 'individuals_projects', id: false, force: :cascade do |t|
+ t.integer 'individual_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'isolates', force: :cascade do |t|
+ t.string 'well_pos_plant_plate', limit: 255
+ t.string 'micronic_tube_id', limit: 255
+ t.string 'well_pos_micronic_plate', limit: 255
+ t.decimal 'concentration'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.boolean 'isCopy'
+ t.integer 'tissue_id'
+ t.integer 'micronic_plate_id'
+ t.integer 'plant_plate_id'
+ t.integer 'individual_id'
+ t.string 'dna_bank_id', limit: 255
+ t.string 'lab_nr', limit: 255
+ t.boolean 'negative_control', default: false
+ t.integer 'lab_id_orig'
+ t.integer 'lab_id_copy'
+ t.datetime 'isolation_date'
+ t.integer 'micronic_plate_id_orig'
+ t.integer 'micronic_plate_id_copy'
+ t.string 'well_pos_micronic_plate_orig'
+ t.string 'well_pos_micronic_plate_copy'
+ t.decimal 'concentration_orig', precision: 15, scale: 2
+ t.decimal 'concentration_copy', precision: 15, scale: 2
+ t.string 'micronic_tube_id_orig'
+ t.string 'micronic_tube_id_copy'
+ t.integer 'user_id'
+ t.text 'comment_orig'
+ t.text 'comment_copy'
+ end
+
+ create_table 'isolates_projects', id: false, force: :cascade do |t|
+ t.integer 'isolate_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'issues', force: :cascade do |t|
+ t.string 'title', limit: 255
+ t.text 'description'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'primer_read_id'
+ t.integer 'contig_id'
+ end
+
+ create_table 'issues_projects', id: false, force: :cascade do |t|
+ t.integer 'issue_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'lab_racks', force: :cascade do |t|
+ t.string 'rackcode', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'freezer_id'
+ t.string 'rack_position'
+ t.string 'shelf'
+ end
+
+ create_table 'lab_racks_projects', id: false, force: :cascade do |t|
+ t.integer 'lab_rack_id', null: false
+ t.integer 'project_id', null: false
+ t.index %w[lab_rack_id project_id], name: 'index_lab_racks_projects_on_lab_rack_id_and_project_id', using: :btree
+ end
+
+ create_table 'labs', force: :cascade do |t|
+ t.string 'labcode', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'labs_projects', id: false, force: :cascade do |t|
+ t.integer 'lab_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'marker_sequence_searches', force: :cascade do |t|
+ t.string 'name'
+ t.string 'verified'
+ t.string 'species'
+ t.string 'order'
+ t.string 'specimen'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.integer 'user_id'
+ t.string 'title'
+ t.string 'family'
+ t.string 'marker'
+ t.integer 'min_length'
+ t.integer 'max_length'
+ t.integer 'project_id'
+ t.boolean 'has_species'
+ t.string 'higher_order_taxon'
+ t.integer 'has_warnings'
+ t.date 'min_age'
+ t.date 'max_age'
+ t.date 'min_update'
+ t.date 'max_update'
+ t.string 'verified_by'
+ t.index ['project_id'], name: 'index_marker_sequence_searches_on_project_id', using: :btree
+ end
+
+ create_table 'marker_sequences', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.string 'genbank', limit: 255
+ t.text 'sequence'
+ t.integer 'isolate_id'
+ t.integer 'marker_id'
+ t.string 'reference'
+ end
+
+ create_table 'marker_sequences_mislabel_analyses', id: false, force: :cascade do |t|
+ t.integer 'marker_sequence_id', null: false
+ t.integer 'mislabel_analysis_id', null: false
+ t.index %w[marker_sequence_id mislabel_analysis_id], name: 'index_marker_sequences_mislabel_analyses', using: :btree
+ end
+
+ create_table 'marker_sequences_projects', id: false, force: :cascade do |t|
+ t.integer 'marker_sequence_id', null: false
+ t.integer 'project_id', null: false
+ t.index %w[marker_sequence_id project_id], name: 'index_marker_sequences_projects', using: :btree
+ end
+
+ create_table 'markers', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'expected_reads'
+ t.boolean 'is_gbol'
+ t.string 'alt_name'
+ end
+
+ create_table 'markers_projects', id: false, force: :cascade do |t|
+ t.integer 'marker_id', null: false
+ t.integer 'project_id', null: false
+ t.index %w[marker_id project_id], name: 'index_markers_projects_on_marker_id_and_project_id', using: :btree
+ end
+
+ create_table 'micronic_plates', force: :cascade do |t|
+ t.string 'micronic_plate_id', limit: 255
+ t.string 'name', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.string 'location_in_rack', limit: 255
+ t.integer 'lab_rack_id'
+ end
+
+ create_table 'micronic_plates_projects', id: false, force: :cascade do |t|
+ t.integer 'micronic_plate_id', null: false
+ t.integer 'project_id', null: false
+ t.index %w[micronic_plate_id project_id], name: 'index_micronic_plates_projects', using: :btree
+ end
+
+ create_table 'mislabel_analyses', force: :cascade do |t|
+ t.string 'title'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.boolean 'automatic', default: false
+ t.integer 'marker_id'
+ t.integer 'total_seq_number'
+ t.index ['marker_id'], name: 'index_mislabel_analyses_on_marker_id', using: :btree
+ end
+
+ create_table 'mislabels', force: :cascade do |t|
+ t.string 'level'
+ t.decimal 'confidence'
+ t.string 'proposed_label'
+ t.string 'proposed_path'
+ t.string 'path_confidence'
+ t.integer 'mislabel_analysis_id'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.integer 'marker_sequence_id'
+ t.boolean 'solved', default: false
+ t.integer 'solved_by'
+ t.datetime 'solved_at'
+ t.index ['marker_sequence_id'], name: 'index_mislabels_on_marker_sequence_id', using: :btree
+ t.index ['mislabel_analysis_id'], name: 'index_mislabels_on_mislabel_analysis_id', using: :btree
+ end
+
+ create_table 'news', force: :cascade do |t|
+ t.string 'title', limit: 255
+ t.text 'body'
+ t.datetime 'published'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'ngs_runs', force: :cascade do |t|
+ t.integer 'quality_threshold'
+ t.integer 'tag_mismates'
+ t.integer 'primer_mismatches'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.string 'name'
+ t.string 'fastq_file_name'
+ t.string 'fastq_content_type'
+ t.integer 'fastq_file_size'
+ t.datetime 'fastq_updated_at'
+ t.integer 'higher_order_taxon_id'
+ t.string 'set_tag_map_file_name'
+ t.string 'set_tag_map_content_type'
+ t.integer 'set_tag_map_file_size'
+ t.datetime 'set_tag_map_updated_at'
+ t.index ['higher_order_taxon_id'], name: 'index_ngs_runs_on_higher_order_taxon_id', using: :btree
+ end
+
+ create_table 'ngs_runs_projects', id: false, force: :cascade do |t|
+ t.integer 'ngs_run_id', null: false
+ t.integer 'project_id', null: false
+ t.index %w[ngs_run_id project_id], name: 'index_ngs_runs_projects_on_ngs_run_id_and_project_id', using: :btree
+ end
+
+ create_table 'oders', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.string 'author', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'orders', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.string 'author', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'higher_order_taxon_id'
+ t.integer 'taxonomic_class_id'
+ end
+
+ create_table 'orders_projects', id: false, force: :cascade do |t|
+ t.integer 'order_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'partial_cons', force: :cascade do |t|
+ t.text 'sequence'
+ t.text 'aligned_sequence'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'contig_id'
+ t.integer 'aligned_qualities', array: true
+ end
+
+ create_table 'pg_search_documents', force: :cascade do |t|
+ t.text 'content'
+ t.string 'searchable_type'
+ t.integer 'searchable_id'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.index %w[searchable_type searchable_id], name: 'index_pg_search_documents_on_searchable_type_and_searchable_id', using: :btree
+ end
+
+ create_table 'plant_plates', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.integer 'how_many'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.string 'location_in_rack', limit: 255
+ t.integer 'lab_rack_id'
+ t.index ['lab_rack_id'], name: 'index_plant_plates_on_lab_rack_id', using: :btree
+ end
+
+ create_table 'plant_plates_projects', id: false, force: :cascade do |t|
+ t.integer 'plant_plate_id', null: false
+ t.integer 'project_id', null: false
+ t.index %w[plant_plate_id project_id], name: 'index_plant_plates_projects_on_plant_plate_id_and_project_id', using: :btree
+ end
+
+ create_table 'primer_pos_on_genomes', force: :cascade do |t|
+ t.text 'note'
+ t.integer 'position'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'primer_reads', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.text 'sequence'
+ t.string 'pherogram_url', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.string 'chromatogram_file_name', limit: 255
+ t.string 'chromatogram_content_type', limit: 255
+ t.integer 'chromatogram_file_size'
+ t.datetime 'chromatogram_updated_at'
+ t.integer 'primer_id'
+ t.integer 'isolate_id'
+ t.integer 'contig_id'
+ t.integer 'trimmedReadEnd'
+ t.integer 'trimmedReadStart'
+ t.integer 'qualities', array: true
+ t.boolean 'reverse'
+ t.text 'aligned_seq'
+ t.boolean 'used_for_con'
+ t.text 'quality_string'
+ t.integer 'position'
+ t.boolean 'assembled'
+ t.integer 'partial_con_id'
+ t.integer 'aligned_qualities', array: true
+ t.integer 'window_size', default: 10
+ t.integer 'count_in_window', default: 8
+ t.integer 'min_quality_score', default: 30
+ t.integer 'atrace', array: true
+ t.integer 'ctrace', array: true
+ t.integer 'gtrace', array: true
+ t.integer 'ttrace', array: true
+ t.integer 'peak_indices', array: true
+ t.boolean 'processed', default: false
+ t.integer 'base_count'
+ t.string 'comment'
+ t.boolean 'overwritten', default: false
+ t.integer 'aligned_peak_indices', array: true
+ t.string 'chromatogram_fingerprint'
+ end
+
+ create_table 'primer_reads_projects', id: false, force: :cascade do |t|
+ t.integer 'primer_read_id'
+ t.integer 'project_id'
+ end
+
+ create_table 'primers', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.string 'sequence', limit: 255
+ t.boolean 'reverse'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.text 'notes'
+ t.integer 'marker_id'
+ t.string 'labcode', limit: 255
+ t.string 'author', limit: 255
+ t.string 'alt_name', limit: 255
+ t.string 'target_group', limit: 255
+ t.string 'tm', limit: 255
+ t.integer 'position'
+ end
+
+ create_table 'primers_projects', id: false, force: :cascade do |t|
+ t.integer 'primer_id', null: false
+ t.integer 'project_id', null: false
+ t.index %w[primer_id project_id], name: 'index_primers_projects_on_primer_id_and_project_id', using: :btree
+ end
+
+ create_table 'projects', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.text 'description'
+ t.datetime 'start'
+ t.datetime 'due'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'projects_shelves', id: false, force: :cascade do |t|
+ t.integer 'project_id', null: false
+ t.integer 'shelf_id', null: false
+ t.index %w[project_id shelf_id], name: 'index_projects_shelves_on_project_id_and_shelf_id', using: :btree
+ end
+
+ create_table 'projects_species', id: false, force: :cascade do |t|
+ t.integer 'project_id'
+ t.integer 'species_id'
+ end
+
+ create_table 'projects_tag_primer_maps', id: false, force: :cascade do |t|
+ t.integer 'project_id', null: false
+ t.integer 'tag_primer_map_id', null: false
+ t.index %w[project_id tag_primer_map_id], name: 'index_projects_tag_primer_maps', using: :btree
+ end
+
+ create_table 'projects_users', id: false, force: :cascade do |t|
+ t.integer 'project_id'
+ t.integer 'user_id'
+ end
+
+ create_table 'responsibilities', force: :cascade do |t|
+ t.string 'name'
+ t.text 'description'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ end
+
+ create_table 'responsibilities_users', id: false, force: :cascade do |t|
+ t.integer 'responsibility_id', null: false
+ t.integer 'user_id', null: false
+ t.index %w[responsibility_id user_id], name: 'index_responsibilities_users_on_responsibility_id_and_user_id', using: :btree
+ end
+
+ create_table 'shelves', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'freezer_id'
+ t.index ['freezer_id'], name: 'index_shelves_on_freezer_id', using: :btree
+ end
+
+ create_table 'species', force: :cascade do |t|
+ t.string 'author', limit: 255
+ t.string 'genus_name', limit: 255
+ t.string 'species_epithet', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.integer 'family_id'
+ t.string 'infraspecific', limit: 255
+ t.text 'comment'
+ t.string 'german_name', limit: 255
+ t.string 'author_infra', limit: 255
+ t.string 'synonym', limit: 255
+ t.string 'composed_name', limit: 255
+ t.string 'species_component'
+ end
+
+ create_table 'species_exporters', force: :cascade do |t|
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.string 'species_export_file_name'
+ t.string 'species_export_content_type'
+ t.integer 'species_export_file_size'
+ t.datetime 'species_export_updated_at'
+ end
+
+ create_table 'specimen_exporters', force: :cascade do |t|
+ t.string 'specimen_export_file_name'
+ t.string 'specimen_export_content_type'
+ t.integer 'specimen_export_file_size'
+ t.datetime 'specimen_export_updated_at'
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'subdivisions', force: :cascade do |t|
+ t.string 'name'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.integer 'position'
+ t.string 'german_name'
+ end
+
+ create_table 'tag_primer_maps', force: :cascade do |t|
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.integer 'ngs_run_id'
+ t.string 'tag_primer_map_file_name'
+ t.string 'tag_primer_map_content_type'
+ t.integer 'tag_primer_map_file_size'
+ t.datetime 'tag_primer_map_updated_at'
+ t.string 'name'
+ t.string 'tag'
+ t.index ['ngs_run_id'], name: 'index_tag_primer_maps_on_ngs_run_id', using: :btree
+ end
+
+ create_table 'taxonomic_classes', force: :cascade do |t|
+ t.string 'name'
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.integer 'subdivision_id'
+ t.string 'german_name'
+ end
+
+ create_table 'tissues', force: :cascade do |t|
+ t.string 'name', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ end
+
+ create_table 'txt_uploaders', force: :cascade do |t|
+ t.datetime 'created_at', null: false
+ t.datetime 'updated_at', null: false
+ t.string 'uploaded_file_file_name'
+ t.string 'uploaded_file_content_type'
+ t.integer 'uploaded_file_file_size'
+ t.datetime 'uploaded_file_updated_at'
+ end
+
+ create_table 'users', force: :cascade do |t|
+ t.string 'email', limit: 255, default: '', null: false
+ t.string 'encrypted_password', limit: 255, default: '', null: false
+ t.string 'reset_password_token', limit: 255
+ t.datetime 'reset_password_sent_at'
+ t.datetime 'remember_created_at'
+ t.integer 'sign_in_count', default: 0, null: false
+ t.datetime 'current_sign_in_at'
+ t.datetime 'last_sign_in_at'
+ t.string 'current_sign_in_ip', limit: 255
+ t.string 'last_sign_in_ip', limit: 255
+ t.datetime 'created_at'
+ t.datetime 'updated_at'
+ t.string 'name', limit: 255
+ t.integer 'lab_id'
+ t.integer 'role'
+ t.integer 'default_project_id'
+ t.index ['email'], name: 'index_users_on_email', unique: true, using: :btree
+ t.index ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true, using: :btree
+ end
+
+ add_foreign_key 'contig_searches', 'projects'
+ add_foreign_key 'individual_searches', 'projects'
+ add_foreign_key 'individual_searches', 'users'
+ add_foreign_key 'marker_sequence_searches', 'projects'
+ add_foreign_key 'mislabel_analyses', 'markers'
+ add_foreign_key 'mislabels', 'marker_sequences'
+ add_foreign_key 'ngs_runs', 'higher_order_taxa'
+ add_foreign_key 'plant_plates', 'lab_racks'
+ add_foreign_key 'shelves', 'freezers'
end
diff --git a/db/seeds.rb b/db/seeds.rb
index 997068dd..86dc8249 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
diff --git a/lib/tasks/add_projects.rake b/lib/tasks/add_projects.rake
index e27741bf..27bc679c 100644
--- a/lib/tasks/add_projects.rake
+++ b/lib/tasks/add_projects.rake
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
namespace :data do
desc 'Add general project to all records.'
- task :add_general_project => :environment do
+ task add_general_project: :environment do
project = Project.find_or_create_by(name: 'All Records')
add_to_join_table(project, Individual.all.select(:id).find_each)
@@ -26,9 +28,9 @@ namespace :data do
end
desc 'Add GBOL5 project to all eligible records.'
- task :add_gbol5_project => :environment do
+ task add_gbol5_project: :environment do
project = Project.find_or_create_by(name: 'GBOL5')
- gbol_labs = %w(BGBM IEB NEES ZFMK Gießen)
+ gbol_labs = %w[BGBM IEB NEES ZFMK Gießen]
Shelf.update_all(freezer_id: Freezer.first.id)
@@ -42,11 +44,11 @@ namespace :data do
add_to_join_table(project, User.joins(:lab).merge(Lab.in_project(project.id)).select(:id))
add_to_join_table(project, Marker.where(is_gbol: true).select(:id))
add_to_join_table(project, Primer.joins(:marker).merge(Marker.in_project(project.id)).select(:id))
- add_to_join_table(project, Isolate.where("lab_nr ilike ?", "gbol%").or(Isolate.where("lab_nr ilike ?", "db%")).select(:id).find_each)
- add_to_join_table(project, Contig.where("name ilike ?", "gbol%").or(Contig.where("name ilike ?", "db%")).select(:id).find_each)
+ add_to_join_table(project, Isolate.where('lab_nr ilike ?', 'gbol%').or(Isolate.where('lab_nr ilike ?', 'db%')).select(:id).find_each)
+ add_to_join_table(project, Contig.where('name ilike ?', 'gbol%').or(Contig.where('name ilike ?', 'db%')).select(:id).find_each)
add_to_join_table(project, PrimerRead.joins(:contig).merge(Contig.in_project(project.id).select(:id)).select(:id).find_each)
add_to_join_table(project, Issue.joins(:primer_read).merge(PrimerRead.in_project(project.id)).select(:id) + Issue.joins(:contig).merge(Contig.in_project(project.id)).select(:id))
- add_to_join_table(project, MarkerSequence.where("name ilike ?", "gbol%").or(MarkerSequence.where("name ilike ?", "db%")).select(:id))
+ add_to_join_table(project, MarkerSequence.where('name ilike ?', 'gbol%').or(MarkerSequence.where('name ilike ?', 'db%')).select(:id))
add_to_join_table(project, Individual.joins(:isolates).merge(Isolate.in_project(project.id)).select(:id).find_each)
add_to_join_table(project, Species.all.select(:id).find_each)
@@ -56,7 +58,7 @@ namespace :data do
end
desc 'Add transects project to all eligible records.'
- task :add_transects_project => :environment do
+ task add_transects_project: :environment do
project = Project.find_or_create_by(name: '3transects')
users = ['Kai Müller', 'Dietmar Quandt', 'Sarah Wiechers']
@@ -76,11 +78,11 @@ namespace :data do
add_to_join_table(project, PlantPlate.all.select(:id))
add_to_join_table(project, Marker.all.select(:id))
add_to_join_table(project, Primer.joins(:marker).merge(Marker.in_project(project.id)).select(:id))
- add_to_join_table(project, Isolate.where("lab_nr like ?", "F%").or(Isolate.where("lab_nr like ?", "B%")).select(:id).find_each)
- add_to_join_table(project, Contig.where("name like ?", "F%").or(Contig.where("name like ?", "B%")).select(:id).find_each)
+ add_to_join_table(project, Isolate.where('lab_nr like ?', 'F%').or(Isolate.where('lab_nr like ?', 'B%')).select(:id).find_each)
+ add_to_join_table(project, Contig.where('name like ?', 'F%').or(Contig.where('name like ?', 'B%')).select(:id).find_each)
add_to_join_table(project, PrimerRead.joins(:contig).merge(Contig.in_project(project.id).select(:id)).select(:id).find_each)
add_to_join_table(project, Issue.joins(:primer_read).merge(PrimerRead.in_project(project.id)).select(:id) + Issue.joins(:contig).merge(Contig.in_project(project.id)).select(:id))
- add_to_join_table(project, MarkerSequence.where("name like ?", "F%").or(MarkerSequence.where("name like ?", "B%")).select(:id))
+ add_to_join_table(project, MarkerSequence.where('name like ?', 'F%').or(MarkerSequence.where('name like ?', 'B%')).select(:id))
end
private
@@ -91,11 +93,11 @@ namespace :data do
if record_class.name.casecmp(Project.name) == -1 # Record name comes first alphabetically
table_name = pluralized_name(record_class) + '_' + pluralized_name(Project)
values = records.map { |record| "(#{record.id},#{project.id})" }.join(',')
- ActiveRecord::Base.connection.execute("INSERT INTO #{table_name} (#{id_string(record_class)}, #{id_string(Project)}) VALUES #{values}") if !values.blank?
+ ActiveRecord::Base.connection.execute("INSERT INTO #{table_name} (#{id_string(record_class)}, #{id_string(Project)}) VALUES #{values}") unless values.blank?
else
table_name = pluralized_name(Project) + '_' + pluralized_name(record_class)
values = records.map { |record| "(#{project.id},#{record.id})" }.join(',')
- ActiveRecord::Base.connection.execute("INSERT INTO #{table_name} (#{id_string(Project)}, #{id_string(record_class)}) VALUES #{values}") if !values.blank?
+ ActiveRecord::Base.connection.execute("INSERT INTO #{table_name} (#{id_string(Project)}, #{id_string(record_class)}) VALUES #{values}") unless values.blank?
end
end
diff --git a/lib/tasks/base_counts.rake b/lib/tasks/base_counts.rake
index d2a0a4a7..89af34a1 100644
--- a/lib/tasks/base_counts.rake
+++ b/lib/tasks/base_counts.rake
@@ -1,18 +1,17 @@
+# frozen_string_literal: true
+
namespace :data do
desc "fill reads' basecount"
- task :base_counts => :environment do
-
- PrimerRead.where(:base_count => nil).find_each(batch_size: 100) do |p|
+ task base_counts: :environment do
+ PrimerRead.where(base_count: nil).find_each(batch_size: 100) do |p|
if p.sequence
- p.base_count= p.sequence.length
+ p.base_count = p.sequence.length
p.save!
puts p.name
end
end
- puts "Done."
-
+ puts 'Done.'
end
-
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/check_consensus_sequences.rake b/lib/tasks/check_consensus_sequences.rake
index 4f21548b..c254ea5c 100644
--- a/lib/tasks/check_consensus_sequences.rake
+++ b/lib/tasks/check_consensus_sequences.rake
@@ -1,7 +1,8 @@
-namespace :data do
+# frozen_string_literal: true
+namespace :data do
desc 'Compare contig consensus sequences and resulting marker sequences. Alert if different.'
- task :check_consensus_sequences => :environment do
+ task check_consensus_sequences: :environment do
puts 'Checking contig consensus sequences...'
contigs = Contig.gbol.includes(:marker_sequence, :partial_cons).where.not(marker_sequence: nil).select(:id, :name, :marker_sequence_id)
@@ -20,11 +21,9 @@ namespace :data do
no_sequence << contig.name
else
# Marker sequences are created from modified aligned_sequence of first partial con after verification
- partial_sequence = partial_sequence.gsub('?', '').gsub('-', '')
+ partial_sequence = partial_sequence.delete('?').delete('-')
- if marker_sequence != partial_sequence
- alert << contig.name
- end
+ alert << contig.name if marker_sequence != partial_sequence
end
end
end
@@ -36,4 +35,4 @@ namespace :data do
puts "#{ms_blank.size} contigs had no marker sequence."
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/check_faulty_isolates.rake b/lib/tasks/check_faulty_isolates.rake
index 263b4369..5c206db7 100644
--- a/lib/tasks/check_faulty_isolates.rake
+++ b/lib/tasks/check_faulty_isolates.rake
@@ -1,7 +1,8 @@
-namespace :data do
+# frozen_string_literal: true
+namespace :data do
desc 'Check if faulty isolates in db have primer reads associated'
- task :check_faulty_isolates => :environment do
+ task check_faulty_isolates: :environment do
puts 'Starting check for faulty isolates and plates...'
plate_names = [*49..51]
@@ -9,7 +10,7 @@ namespace :data do
plates_count = 0
- plate_names.each do | name |
+ plate_names.each do |name|
plates_count += 1 if PlantPlate.find_by_name(name.to_s)
end
@@ -29,15 +30,15 @@ namespace :data do
present = []
- gbol_numbers.each do | name |
- gbol_name = "gbol#{name.to_s}"
+ gbol_numbers.each do |name|
+ gbol_name = "gbol#{name}"
- isolate = Isolate.where("lab_nr ilike ?", gbol_name).first
+ isolate = Isolate.where('lab_nr ilike ?', gbol_name).first
isolates.add? isolate if isolate
present << name if isolate
- isolate&.contigs&.each do | contig |
+ isolate&.contigs&.each do |contig|
contigs_cnt += 1
primer_reads.add? isolate if contig&.primer_reads&.size&.nonzero?
end
@@ -56,9 +57,9 @@ namespace :data do
puts 'The same amount of isolates, contigs and marker sequences was found as expected.'
end
- if primer_reads.size > 0
+ unless primer_reads.empty?
puts "#{primer_reads.size} isolates with associated primer reads were found:"
- primer_reads.each {|isolate| print "#{isolate.lab_nr}, " }
+ primer_reads.each { |isolate| print "#{isolate.lab_nr}, " }
puts "\n\n"
end
@@ -66,22 +67,22 @@ namespace :data do
end
desc 'Delete incorrect isolate metadata'
- task :delete_incorrect_isolate_metadata => :environment do
+ task delete_incorrect_isolate_metadata: :environment do
'Starting deletion of incorrect metadata...'
# Delete incorrect specimen associations of isolates
gbol_numbers = [*4609..4896]
gbol_numbers.concat [*5665..7008]
- gbol_numbers.each do | name |
- gbol_name = "GBoL#{name.to_s}"
- isolate = Isolate.where("lab_nr ilike ?", gbol_name)
+ gbol_numbers.each do |name|
+ gbol_name = "GBoL#{name}"
+ isolate = Isolate.where('lab_nr ilike ?', gbol_name)
if isolate.size > 1
puts "More than one isolate with the name #{gbol_name} was found."
else
isolate = isolate.first
- isolate&.update(:individual_id => nil)
+ isolate&.update(individual_id: nil)
end
end
diff --git a/lib/tasks/create_analysis_files.rake b/lib/tasks/create_analysis_files.rake
index 5dde5d85..0637ff70 100644
--- a/lib/tasks/create_analysis_files.rake
+++ b/lib/tasks/create_analysis_files.rake
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
namespace :data do
desc 'Create fasta and taxon file from marker sequence search for further analyses.'
task :create_analysis_files, [:title] => [:environment] do |_, args|
length_minima = {
- 'ITS' => 485,
- 'rpl16' => 580,
- 'trnLF' => 516,
- 'trnK-matK' => 1188
+ 'ITS' => 485,
+ 'rpl16' => 580,
+ 'trnLF' => 516,
+ 'trnK-matK' => 1188
}
title = args[:title]
@@ -30,4 +32,4 @@ namespace :data do
f.write(search.taxon_file(false))
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/create_xls.rake b/lib/tasks/create_xls.rake
index ffcf5fc6..c5776b72 100644
--- a/lib/tasks/create_xls.rake
+++ b/lib/tasks/create_xls.rake
@@ -1,8 +1,8 @@
-namespace :data do
+# frozen_string_literal: true
+namespace :data do
desc 'export specimen info to ZFMK readable xls format'
- task :create_xls => :environment do
- SpecimenExport.perform_async(Project.where('name ilike ?', "%gbol%").first.id)
+ task create_xls: :environment do
+ SpecimenExport.perform_async(Project.where('name ilike ?', '%gbol%').first.id)
end
-
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake
index 9f53ce49..a4768efd 100644
--- a/lib/tasks/cucumber.rake
+++ b/lib/tasks/cucumber.rake
@@ -1,65 +1,66 @@
+# frozen_string_literal: true
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
+unless ARGV.any? { |a| a =~ /^gems/ } # Don't load anything when running the gems:* tasks
-unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
-
-vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
-$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
+ vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
+ $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
-begin
- require 'cucumber/rake/task'
+ begin
+ require 'cucumber/rake/task'
- namespace :cucumber do
- Cucumber::Rake::Task.new({:ok => 'test:prepare'}, 'Run features that should pass') do |t|
- t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
- t.fork = true # You may get faster startup if you set this to false
- t.profile = 'default'
- end
+ namespace :cucumber do
+ Cucumber::Rake::Task.new({ ok: 'test:prepare' }, 'Run features that should pass') do |t|
+ t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
+ t.fork = true # You may get faster startup if you set this to false
+ t.profile = 'default'
+ end
- Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t|
- t.binary = vendored_cucumber_bin
- t.fork = true # You may get faster startup if you set this to false
- t.profile = 'wip'
- end
+ Cucumber::Rake::Task.new({ wip: 'test:prepare' }, 'Run features that are being worked on') do |t|
+ t.binary = vendored_cucumber_bin
+ t.fork = true # You may get faster startup if you set this to false
+ t.profile = 'wip'
+ end
- Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t|
- t.binary = vendored_cucumber_bin
- t.fork = true # You may get faster startup if you set this to false
- t.profile = 'rerun'
- end
+ Cucumber::Rake::Task.new({ rerun: 'test:prepare' }, 'Record failing features and run only them if any exist') do |t|
+ t.binary = vendored_cucumber_bin
+ t.fork = true # You may get faster startup if you set this to false
+ t.profile = 'rerun'
+ end
- desc 'Run all features'
- task :all => [:ok, :wip]
+ desc 'Run all features'
+ task all: %i[ok wip]
- task :statsetup do
- require 'rails/code_statistics'
- ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
- ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
+ task :statsetup do
+ require 'rails/code_statistics'
+ ::STATS_DIRECTORIES << %w[Cucumber\ features features] if File.exist?('features')
+ ::CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features')
+ end
end
- end
- desc 'Alias for cucumber:ok'
- task :cucumber => 'cucumber:ok'
+ desc 'Alias for cucumber:ok'
+ task cucumber: 'cucumber:ok'
- task :default => :cucumber
+ task default: :cucumber
- task :features => :cucumber do
- STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
- end
+ task features: :cucumber do
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
+ end
- # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
- task 'test:prepare' do
- end
+ # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
+ task 'test:prepare' do
+ end
- task :stats => 'cucumber:statsetup'
-rescue LoadError
- desc 'cucumber rake task not available (cucumber not installed)'
- task :cucumber do
- abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
+ task stats: 'cucumber:statsetup'
+ rescue LoadError
+ desc 'cucumber rake task not available (cucumber not installed)'
+ task :cucumber do
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
+ end
end
-end
end
diff --git a/lib/tasks/database_operations.rake b/lib/tasks/database_operations.rake
index f50085d0..19d0c4d4 100644
--- a/lib/tasks/database_operations.rake
+++ b/lib/tasks/database_operations.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'net/http'
require 'nokogiri'
@@ -7,70 +9,68 @@ def get_state(i)
matches = i.locality.match(regex)
if matches
state_component = matches[1]
- i.update(:state_province => state_component)
+ i.update(state_province: state_component)
end
end
end
namespace :data do
-
- desc "Change precision of existing specimen location data records"
- task :change_location_data_precision => :environment do
+ desc 'Change precision of existing specimen location data records'
+ task change_location_data_precision: :environment do
cnt = 0
- puts "Changing location data precision..."
+ puts 'Changing location data precision...'
- Individual.find_each(:batch_size => 50) do |individual|
- individual.update(:latitude => individual.latitude&.round(6))
- individual.update(:longitude => individual.longitude&.round(6))
+ Individual.find_each(batch_size: 50) do |individual|
+ individual.update(latitude: individual.latitude&.round(6))
+ individual.update(longitude: individual.longitude&.round(6))
cnt += 1
end
puts "Done. Changed location data precision for #{cnt} records."
end
- desc "Create users"
- task :create_users => :environment do
- @user = User.new(:name => 'Tim Boehnert', :email => 'tim.boehnert@uni-bonn.de', :password => 'HMeWE98qRp3f', :password_confirmation => 'HMeWE98qRp3f')
+ desc 'Create users'
+ task create_users: :environment do
+ @user = User.new(name: 'Tim Boehnert', email: 'tim.boehnert@uni-bonn.de', password: 'HMeWE98qRp3f', password_confirmation: 'HMeWE98qRp3f')
@user.save
- @user2 = User.new(:name => 'Saskia Schlesak', :email => 'saskia.schlesak@googlemail.com', :password => 'tJ6knF6q3DZX', :password_confirmation => 'tJ6knF6q3DZX')
+ @user2 = User.new(name: 'Saskia Schlesak', email: 'saskia.schlesak@googlemail.com', password: 'tJ6knF6q3DZX', password_confirmation: 'tJ6knF6q3DZX')
@user2.save
- @user3 = User.new(:name => 'Gabriele Droege', :email => 'G.Droege@bgbm.org', :password => 'T3HqXUd4zVA2', :password_confirmation => 'T3HqXUd4zVA2')
+ @user3 = User.new(name: 'Gabriele Droege', email: 'G.Droege@bgbm.org', password: 'T3HqXUd4zVA2', password_confirmation: 'T3HqXUd4zVA2')
@user3.save
- puts "Done."
+ puts 'Done.'
end
- desc "destroy duplicate reads from non-verified contigs"
- task :destroy_duplicate_reads => :environment do
+ desc 'destroy duplicate reads from non-verified contigs'
+ task destroy_duplicate_reads: :environment do
# get list w duplicate reads FROM NON-VERIFIED CONTIGS ONLY
a = []
- PrimerRead.select("name").contig_not_verified.each do |i|
+ PrimerRead.select('name').contig_not_verified.each do |i|
a << i.name
end
- d = a.select{ |e| a.count(e) > 1 }.uniq
+ d = a.select { |e| a.count(e) > 1 }.uniq
# Iterate over duplicate read names:
d.each do |duplicate|
# Get all members of given duplicate list: # IGNORE THOSE FROM VERIFIED CONTIGS IN THIS DUPLICATE LIST
- dups = PrimerRead.contig_not_verified.where(:name => duplicate)
+ dups = PrimerRead.contig_not_verified.where(name: duplicate)
# Get first
- first_dup=dups.first
+ first_dup = dups.first
# puts "will keep #{first_dup.name} (#{first_dup.id})"
# Get all others
- #TODO: scary loop in which arr.elements are deleted (?) - fix!
+ # TODO: scary loop in which arr.elements are deleted (?) - fix!
- (1..dups.count-1).each do |i|
-
- curr_dup= dups[i]
+ (1..dups.count - 1).each do |i|
+ curr_dup = dups[i]
# puts "will destroy #{curr_dup.name} (#{curr_dup.id})"
@@ -83,55 +83,50 @@ namespace :data do
puts 'Done.'
end
- desc "fix empty state-province from DNABank- import"
- task :fix_state_province => :environment do
- Individual.where(:state_province => nil).each do |i|
+ desc 'fix empty state-province from DNABank- import'
+ task fix_state_province: :environment do
+ Individual.where(state_province: nil).each do |i|
get_state(i)
end
- Individual.where(:state_province => "").each do |i|
+ Individual.where(state_province: '').each do |i|
get_state(i)
end
end
- #TODO: scary loop in which arr.elements are deleted - fix!
+ # TODO: scary loop in which arr.elements are deleted - fix!
- desc "Merge multiple copies of same contigs into one with all associations & attributes"
- task :merge_duplicate_contigs => :environment do
+ desc 'Merge multiple copies of same contigs into one with all associations & attributes'
+ task merge_duplicate_contigs: :environment do
# get list w duplicates
- a=[]
- Contig.select("name").each do |i|
+ a = []
+ Contig.select('name').each do |i|
a << i.name
end
- d = a.select{ |e| a.count(e) > 1 }.uniq
+ d = a.select { |e| a.count(e) > 1 }.uniq
# iterate over duplicate lab_nrs:
d.each do |duplicate|
-
- #get all members of given duplicate list:
- dups=Contig.where(:name => duplicate).where(:verified_by => nil)
+ # get all members of given duplicate list:
+ dups = Contig.where(name: duplicate).where(verified_by: nil)
if dups.count > 1
- #get first
- first_dup=dups.first
+ # get first
+ first_dup = dups.first
- #get all others and compare to first
- (1..dups.count-1).each do |i|
- curr_dup= dups[i]
+ # get all others and compare to first
+ (1..dups.count - 1).each do |i|
+ curr_dup = dups[i]
puts "#{curr_dup.name} (#{curr_dup.id}) vs #{first_dup.name} ( #{first_dup.id} ):"
- if curr_dup.isolate
- first_dup.update(:isolate => curr_dup.isolate)
- end
+ first_dup.update(isolate: curr_dup.isolate) if curr_dup.isolate
- if curr_dup.marker
- first_dup.update(:marker => curr_dup.marker)
- end
+ first_dup.update(marker: curr_dup.marker) if curr_dup.marker
if curr_dup.marker_sequence
- first_dup.update(:marker_sequence => curr_dup.marker_sequence)
+ first_dup.update(marker_sequence: curr_dup.marker_sequence)
end
if curr_dup.partial_cons.count > 0
@@ -140,53 +135,46 @@ namespace :data do
end
end
- if curr_dup.primer_reads.count >0
+ if curr_dup.primer_reads.count > 0
curr_dup.primer_reads.each do |c|
first_dup.primer_reads << c
end
end
curr_dup.destroy
-
end
end
- puts ""
+ puts ''
end
- puts "Done."
-
+ puts 'Done.'
end
- #TODO: scary loop in which arr.elements are deleted - fix!
- desc "Merge multiple copies of same isolate into one with all associations & attributes"
- task :merge_duplicate_isolates => :environment do
-
+ # TODO: scary loop in which arr.elements are deleted - fix!
+ desc 'Merge multiple copies of same isolate into one with all associations & attributes'
+ task merge_duplicate_isolates: :environment do
# get list w duplicates
- a=[]
- Isolate.select("lab_nr").all.each do |i|
+ a = []
+ Isolate.select('lab_nr').all.each do |i|
a << i.lab_nr
end
- d=a.select{ |e| a.count(e) > 1 }.uniq
-
+ d = a.select { |e| a.count(e) > 1 }.uniq
# iterate over duplicate lab_nrs:
d.each do |duplicate_isolate|
+ # get all members of given duplicate list:
+ dups = Isolate.includes(individual: :species).where(lab_nr: duplicate_isolate)
- #get all members of given duplicate list:
- dups=Isolate.includes(:individual => :species).where(:lab_nr => duplicate_isolate)
-
- #get first
- first_dup=dups.first
+ # get first
+ first_dup = dups.first
- #get all others and compare to first
- (1..dups.count-1).each do |i|
- curr_dup= dups[i]
+ # get all others and compare to first
+ (1..dups.count - 1).each do |i|
+ curr_dup = dups[i]
puts "#{curr_dup.lab_nr} (#{curr_dup.id}) vs #{first_dup.lab_nr} ( #{first_dup.id} ):"
- if curr_dup.individual
- first_dup.update(:individual => curr_dup.individual)
- end
+ first_dup.update(individual: curr_dup.individual) if curr_dup.individual
if curr_dup.marker_sequences.count > 0
curr_dup.marker_sequences.each do |m|
@@ -194,43 +182,40 @@ namespace :data do
end
end
- if curr_dup.contigs.count >0
+ if curr_dup.contigs.count > 0
curr_dup.contigs.each do |c|
first_dup.contigs << c
end
end
curr_dup.destroy
-
end
- puts ""
+ puts ''
end
- puts "Done."
-
+ puts 'Done.'
end
desc 'Remove duplicate reads not associated with a contig'
- task :remove_duplicate_reads_without_contig => :environment do
+ task remove_duplicate_reads_without_contig: :environment do
puts 'Deleting duplicate primer reads not associated with a contig if one of the pair/group is associated with a contig...'
- names_with_multiple = PrimerRead.select(:name).group(:name).having("count(name) > 1").count.keys
+ names_with_multiple = PrimerRead.select(:name).group(:name).having('count(name) > 1').count.keys
primer_reads_cnt = PrimerRead.where(name: names_with_multiple).count
delete_cnt = 0
puts "#{primer_reads_cnt} duplicate reads were found."
- names_with_multiple.each do | read_name |
- duplicates = PrimerRead.where(:name => read_name)
+ names_with_multiple.each do |read_name|
+ duplicates = PrimerRead.where(name: read_name)
reads_wo_contig = []
- duplicates.each {|d| reads_wo_contig << d if !d.contig }
+ duplicates.each { |d| reads_wo_contig << d unless d.contig }
- if duplicates.size > reads_wo_contig.size && !reads_wo_contig.empty?
- reads_wo_contig.each do |read|
- delete_cnt += 1
- read.destroy!
- end
+ next unless duplicates.size > reads_wo_contig.size && !reads_wo_contig.empty?
+ reads_wo_contig.each do |read|
+ delete_cnt += 1
+ read.destroy!
end
end
@@ -238,24 +223,23 @@ namespace :data do
end
desc 'Remove older ones of a group of duplicate reads'
- task :delete_older_duplicate_reads => :environment do
+ task delete_older_duplicate_reads: :environment do
puts 'Deleting the older primer reads of a group of duplicates...'
- names_with_multiple = PrimerRead.select(:name).group(:name).having("count(name) > 1").count.keys
+ names_with_multiple = PrimerRead.select(:name).group(:name).having('count(name) > 1').count.keys
primer_reads_cnt = PrimerRead.where(name: names_with_multiple).count
delete_cnt = 0
puts "#{primer_reads_cnt} duplicate reads were found."
- names_with_multiple.each do | read_name |
- if read_name.match('\AF') # Only treat reads starting with an 'F'
- duplicates = PrimerRead.where(:name => read_name).order(created_at: :desc)
+ names_with_multiple.each do |read_name|
+ next unless read_name.match('\AF') # Only treat reads starting with an 'F'
+ duplicates = PrimerRead.where(name: read_name).order(created_at: :desc)
- # Delete all older reads, keep only newest one
- duplicates[1..-1].each do |r|
- r.destroy!
- delete_cnt += 1
- end
+ # Delete all older reads, keep only newest one
+ duplicates[1..-1].each do |r|
+ r.destroy!
+ delete_cnt += 1
end
end
@@ -263,7 +247,7 @@ namespace :data do
end
desc 'Migrate responsibilities from project to new model responsibilities'
- task :migrate_responsibilities => :environment do
+ task migrate_responsibilities: :environment do
Project.all.each do |project|
# Create new responsibilities from old project records
responsibility = Responsibility.new(name: project.name, description: project.description)
@@ -277,7 +261,7 @@ namespace :data do
end
desc 'Set user roles with new enum attribute'
- task :set_user_roles => :environment do
+ task set_user_roles: :environment do
User.update_all(role: 'user')
User.find_by_name('Sarah Wiechers').update(role: 'admin')
@@ -291,28 +275,27 @@ namespace :data do
end
desc 'Remove duplicate marker sequences not associated with a contig'
- task :remove_duplicate_sequences_without_contig => :environment do
+ task remove_duplicate_sequences_without_contig: :environment do
puts 'Deleting duplicate marker sequences not associated with a contig if one of the pair/group is associated with a contig...'
- names_with_multiple = MarkerSequence.select(:name).group(:name).having("count(name) > 1").count.keys
+ names_with_multiple = MarkerSequence.select(:name).group(:name).having('count(name) > 1').count.keys
sequences_count = MarkerSequence.where(name: names_with_multiple).count
delete_cnt = 0
puts "#{sequences_count} duplicate sequences were found."
names_with_multiple.each do |sequence_name|
- duplicates = MarkerSequence.where(:name => sequence_name)
+ duplicates = MarkerSequence.where(name: sequence_name)
sequences_without_contig = []
- duplicates.each { |d| sequences_without_contig << d if d.contigs.size == 0 }
+ duplicates.each { |d| sequences_without_contig << d if d.contigs.empty? }
- if duplicates.size > sequences_without_contig.size && !sequences_without_contig.empty?
- sequences_without_contig.each do |sequence|
- delete_cnt += 1
- sequence.destroy!
- end
+ next unless duplicates.size > sequences_without_contig.size && !sequences_without_contig.empty?
+ sequences_without_contig.each do |sequence|
+ delete_cnt += 1
+ sequence.destroy!
end
end
puts "#{delete_cnt} duplicate sequences could be deleted."
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/dna_bank.rake b/lib/tasks/dna_bank.rake
index ed80e421..217e83be 100644
--- a/lib/tasks/dna_bank.rake
+++ b/lib/tasks/dna_bank.rake
@@ -1,18 +1,17 @@
+# frozen_string_literal: true
+
require 'net/http'
require 'nokogiri'
namespace :data do
-
desc 'Get specimen info from DNA-Bank'
- task :fetch_DNABank_info => :environment do
- #Asterales
- list_with_UnitIDs="DB 10140".split("\n")
+ task fetch_DNABank_info: :environment do
+ # Asterales
+ list_with_UnitIDs = 'DB 10140'.split("\n")
counter = 1
list_with_UnitIDs.each do |unit_id|
- if counter > 1
- break
- end
+ break if counter > 1
service_url = "http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1#{unit_id}false"
@@ -45,14 +44,12 @@ namespace :data do
puts specimen_id
- if full_name
- puts full_name
- end
+ puts full_name if full_name
- # todo: altervative base on gbol_nr that now also gets stored in DNA Bank
+ # TODO: altervative base on gbol_nr that now also gets stored in DNA Bank
puts "------------------\n"
- rescue
+ rescue StandardError
end
counter += 1
@@ -62,69 +59,67 @@ namespace :data do
end
# not to be used for regular background processes; only for manually crafted queries where DNA-Bank number known and a specific range of DNA-Bank numbers manually entered below:
- desc "Get range of DNA-Bank numbers related to GBOL and extract all specimen info and associated isolates (GBOL-Nrs.)"
- task :get_all_DNABank => :environment do
-
- (10000..12350).each do |unit_id|
-
- service_url="http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1DB #{unit_id}false"
+ desc 'Get range of DNA-Bank numbers related to GBOL and extract all specimen info and associated isolates (GBOL-Nrs.)'
+ task get_all_DNABank: :environment do
+ (10_000..12_350).each do |unit_id|
+ service_url = "http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1DB #{unit_id}false"
url = URI.parse(service_url)
req = Net::HTTP::Get.new(url.to_s)
- res = Net::HTTP.start(url.host, url.port) { |http|
+ res = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
- }
+ end
- doc= Nokogiri::XML(res.body)
+ doc = Nokogiri::XML(res.body)
- full_name=nil
- collector=nil
- locality=nil
- longitude=nil
- latitude=nil
- specimen_id=nil
- herbarium=nil
- gbol_nr=nil
+ full_name = nil
+ collector = nil
+ locality = nil
+ longitude = nil
+ latitude = nil
+ specimen_id = nil
+ herbarium = nil
+ gbol_nr = nil
begin
unit = doc.at_xpath('//abcd21:Unit')
- specimen_id=unit.at_xpath('//abcd21:UnitAssociation/abcd21:UnitID').content
- full_name= unit.at_xpath('//abcd21:FullScientificNameString').content
- gbol_nr=unit.at_xpath('//abcd21:sampleDesignation').content
- herbarium=unit.at_xpath('//abcd21:SourceInstitutionCode').content
- collector= unit.at_xpath('//abcd21:GatheringAgent').content
- locality=unit.at_xpath('//abcd21:LocalityText').content
- longitude=unit.at_xpath('//abcd21:LongitudeDecimal').content
- latitude=unit.at_xpath('//abcd21:LatitudeDecimal').content
- rescue
+ specimen_id = unit.at_xpath('//abcd21:UnitAssociation/abcd21:UnitID').content
+ full_name = unit.at_xpath('//abcd21:FullScientificNameString').content
+ gbol_nr = unit.at_xpath('//abcd21:sampleDesignation').content
+ herbarium = unit.at_xpath('//abcd21:SourceInstitutionCode').content
+ collector = unit.at_xpath('//abcd21:GatheringAgent').content
+ locality = unit.at_xpath('//abcd21:LocalityText').content
+ longitude = unit.at_xpath('//abcd21:LongitudeDecimal').content
+ latitude = unit.at_xpath('//abcd21:LatitudeDecimal').content
+ rescue StandardError
end
puts unit_id
puts specimen_id
- if specimen_id
- individual = Individual.find_or_create_by(:specimen_id => specimen_id)
- else
- individual = Individual.create(:specimen_id => "")
- end
+ individual = if specimen_id
+ Individual.find_or_create_by(specimen_id: specimen_id)
+ else
+ Individual.create(specimen_id: '')
+ end
- individual.update(:DNA_bank_id => "DB #{unit_id}") unless individual.DNA_bank_id
+ individual.update(DNA_bank_id: "DB #{unit_id}") unless individual.DNA_bank_id
puts collector
- individual.update(:collector => collector.strip) if collector
+ individual.update(collector: collector.strip) if collector
puts locality
- individual.update(:locality => locality) if locality
+ individual.update(locality: locality) if locality
puts longitude
- individual.update(:longitude => longitude) if longitude
+ individual.update(longitude: longitude) if longitude
puts latitude
- individual.update(:latitude => latitude) if latiude
+ individual.update(latitude: latitude) if latiude
puts herbarium
- individual.update(:herbarium => herbarium) if herbarium
+ individual.update(herbarium: herbarium) if herbarium
if full_name
regex = /^(\w+\s+\w+)/
@@ -137,341 +132,287 @@ namespace :data do
sp = individual.species
if sp.nil?
- sp= Species.find_or_create_by(:species_component => species_component)
- individual.update(:species=>sp)
+ sp = Species.find_or_create_by(species_component: species_component)
+ individual.update(species: sp)
end
end
end
- #todo make case insensitive match:
-
- if gbol_nr
- # inconsistent in DNABank: sometimes lowercase, sometimes uppercase o in GBOL:
- if gbol_nr[2]=='O'
- gbol_nr[2]='o'
- end
- puts gbol_nr
- isolate = Isolate.find_or_create_by(:lab_nr => gbol_nr)
- isolate.update(:individual => individual)
- end
+ # TODO: make case insensitive match:
+ next unless gbol_nr
+ # inconsistent in DNABank: sometimes lowercase, sometimes uppercase o in GBOL:
+ gbol_nr[2] = 'o' if gbol_nr[2] == 'O'
+ puts gbol_nr
+ isolate = Isolate.find_or_create_by(lab_nr: gbol_nr)
+ isolate.update(individual: individual)
end
puts 'Done.'
end
- desc "Get all GBOL-Nrs that have no specimen assigned and extract all specimen info from DNABank, if corresponding GBOL-Nr exists there."
- task :get_DNABank_by_gbol_nr => :environment do
-
+ desc 'Get all GBOL-Nrs that have no specimen assigned and extract all specimen info from DNABank, if corresponding GBOL-Nr exists there.'
+ task get_DNABank_by_gbol_nr: :environment do
# get all gbol-nr where no specimen
- Isolate.where(:individual => nil).where('isolates.lab_nr ILIKE ?', "%GBOL%").each do |i|
-
+ Isolate.where(individual: nil).where('isolates.lab_nr ILIKE ?', '%GBOL%').each do |i|
# for each number, do a call for GBOL and GBoL versions:
- gbol_nr=i.lab_nr
+ gbol_nr = i.lab_nr
- gbol_nr_1=gbol_nr
+ gbol_nr_1 = gbol_nr
- gbol_nrs=[]
+ gbol_nrs = []
gbol_nrs[0] = gbol_nr_1
- if gbol_nr_1[2]=='O'
- gbol_nr_2=gbol_nr_1.clone
- gbol_nr_2[2]='o'
- gbol_nrs[1]=gbol_nr_2
+ if gbol_nr_1[2] == 'O'
+ gbol_nr_2 = gbol_nr_1.clone
+ gbol_nr_2[2] = 'o'
+ gbol_nrs[1] = gbol_nr_2
else
- gbol_nr_2=gbol_nr_1.clone
- gbol_nr_2[2]='O'
- gbol_nrs[1]=gbol_nr_2
+ gbol_nr_2 = gbol_nr_1.clone
+ gbol_nr_2[2] = 'O'
+ gbol_nrs[1] = gbol_nr_2
end
gbol_nrs[1] = gbol_nr_2
gbol_nrs.each do |gbol_nr|
-
puts "Query for #{gbol_nr}...\n"
- service_url="http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1#{gbol_nr}false"
+ service_url = "http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1#{gbol_nr}false"
url = URI.parse(service_url)
req = Net::HTTP::Get.new(url.to_s)
- res = Net::HTTP.start(url.host, url.port) { |http|
+ res = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
- }
+ end
- doc= Nokogiri::XML(res.body)
+ doc = Nokogiri::XML(res.body)
- full_name=nil
- collector=nil
- locality=nil
- longitude=nil
- latitude=nil
- specimen_id=nil
- herbarium=nil
+ full_name = nil
+ collector = nil
+ locality = nil
+ longitude = nil
+ latitude = nil
+ specimen_id = nil
+ herbarium = nil
begin
unit = doc.at_xpath('//abcd21:Unit')
- unit_id=doc.at_xpath('//abcd21:Unit/abcd21:UnitID').content # = DNA Bank nr
- specimen_id=unit.at_xpath('//abcd21:UnitAssociation/abcd21:UnitID').content
- full_name= unit.at_xpath('//abcd21:FullScientificNameString').content
- herbarium=unit.at_xpath('//abcd21:SourceInstitutionCode').content
- collector= unit.at_xpath('//abcd21:GatheringAgent').content
- locality=unit.at_xpath('//abcd21:LocalityText').content
- longitude=unit.at_xpath('//abcd21:LongitudeDecimal').content
- latitude=unit.at_xpath('//abcd21:LatitudeDecimal').content
-
- rescue
-
+ unit_id = doc.at_xpath('//abcd21:Unit/abcd21:UnitID').content # = DNA Bank nr
+ specimen_id = unit.at_xpath('//abcd21:UnitAssociation/abcd21:UnitID').content
+ full_name = unit.at_xpath('//abcd21:FullScientificNameString').content
+ herbarium = unit.at_xpath('//abcd21:SourceInstitutionCode').content
+ collector = unit.at_xpath('//abcd21:GatheringAgent').content
+ locality = unit.at_xpath('//abcd21:LocalityText').content
+ longitude = unit.at_xpath('//abcd21:LongitudeDecimal').content
+ latitude = unit.at_xpath('//abcd21:LatitudeDecimal').content
+ rescue StandardError
end
- if unit_id
- puts unit_id
- end
+ puts unit_id if unit_id
- if specimen_id
+ next unless specimen_id
- puts specimen_id
+ puts specimen_id
- individual = Individual.find_or_create_by(:specimen_id => specimen_id)
+ individual = Individual.find_or_create_by(specimen_id: specimen_id)
- if unit_id
- puts unit_id
- individual.update(:DNA_bank_id => unit_id )
- begin
- individual.isolates.each do |iso|
- iso.update(:dna_bank_id => unit_id)
- end
- rescue
+ if unit_id
+ puts unit_id
+ individual.update(DNA_bank_id: unit_id)
+ begin
+ individual.isolates.each do |iso|
+ iso.update(dna_bank_id: unit_id)
end
+ rescue StandardError
end
+ end
- puts collector
- if collector
- individual.update(:collector => collector.strip)
- end
+ puts collector
+ individual.update(collector: collector.strip) if collector
- puts locality
- if locality
- individual.update(:locality => locality)
- end
+ puts locality
+ individual.update(locality: locality) if locality
- puts longitude
- if longitude
- individual.update(:longitude => longitude)
- end
+ puts longitude
+ individual.update(longitude: longitude) if longitude
- puts latitude
- if latitude
- individual.update(:latitude => latitude)
- end
+ puts latitude
+ individual.update(latitude: latitude) if latitude
- puts herbarium
- if herbarium
- individual.update(:herbarium => herbarium)
- end
+ puts herbarium
+ individual.update(herbarium: herbarium) if herbarium
- if full_name
+ if full_name
- regex = /^(\w+\s+\w+)/
- matches = full_name.match(regex)
- if matches
- species_component = matches[1]
+ regex = /^(\w+\s+\w+)/
+ matches = full_name.match(regex)
+ if matches
+ species_component = matches[1]
- puts species_component
+ puts species_component
- sp=individual.species
+ sp = individual.species
- if sp.nil?
- sp= Species.find_or_create_by(:species_component => species_component)
- individual.update(:species => sp)
- end
+ if sp.nil?
+ sp = Species.find_or_create_by(species_component: species_component)
+ individual.update(species: sp)
end
-
end
- isolate = Isolate.where(:lab_nr => i.lab_nr).first
-
- if isolate
- isolate.update(:individual => individual)
- end
+ end
- break # no need to try alternative "gbol" spelling if already found a match
+ isolate = Isolate.where(lab_nr: i.lab_nr).first
- end
+ isolate&.update(individual: individual)
+ break # no need to try alternative "gbol" spelling if already found a match
end
-
end
- puts "Done."
-
+ puts 'Done.'
end
- desc "Get all specimens with as specimen id, try to get an isolate from this specimen with a gbol-nr, and extract all specimen info from DNABank, if corresponding GBOL-Nr exists there."
- task :get_DNABank_by_specimen_without_id => :environment do
-
+ desc 'Get all specimens with as specimen id, try to get an isolate from this specimen with a gbol-nr, and extract all specimen info from DNABank, if corresponding GBOL-Nr exists there.'
+ task get_DNABank_by_specimen_without_id: :environment do
# get all gbol-nr where such specimen
- Individual.where(:specimen_id => "").each do |individual|
-
+ Individual.where(specimen_id: '').each do |individual|
# for each number, do a call for GBOL and GBoL versions:
begin
- gbol_nr=individual.isolates.first.lab_nr
+ gbol_nr = individual.isolates.first.lab_nr
- gbol_nr_1=gbol_nr
+ gbol_nr_1 = gbol_nr
- gbol_nrs=[]
+ gbol_nrs = []
gbol_nrs[0] = gbol_nr_1
-
- if gbol_nr_1[2]=='O'
- gbol_nr_2=gbol_nr_1.clone
- gbol_nr_2[2]='o'
- gbol_nrs[1]=gbol_nr_2
+ if gbol_nr_1[2] == 'O'
+ gbol_nr_2 = gbol_nr_1.clone
+ gbol_nr_2[2] = 'o'
+ gbol_nrs[1] = gbol_nr_2
else
- gbol_nr_2=gbol_nr_1.clone
- gbol_nr_2[2]='O'
- gbol_nrs[1]=gbol_nr_2
+ gbol_nr_2 = gbol_nr_1.clone
+ gbol_nr_2[2] = 'O'
+ gbol_nrs[1] = gbol_nr_2
end
gbol_nrs[1] = gbol_nr_2
gbol_nrs.each do |gbol_nr|
-
puts "Query for #{gbol_nr}...\n"
- service_url="http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1#{gbol_nr}false"
+ service_url = "http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1#{gbol_nr}false"
url = URI.parse(service_url)
req = Net::HTTP::Get.new(url.to_s)
- res = Net::HTTP.start(url.host, url.port) { |http|
+ res = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
- }
+ end
- doc= Nokogiri::XML(res.body)
+ doc = Nokogiri::XML(res.body)
- full_name=nil
- collector=nil
- locality=nil
- longitude=nil
- latitude=nil
- specimen_id=nil
- herbarium=nil
+ full_name = nil
+ collector = nil
+ locality = nil
+ longitude = nil
+ latitude = nil
+ specimen_id = nil
+ herbarium = nil
begin
unit = doc.at_xpath('//abcd21:Unit')
- unit_id=doc.at_xpath('//abcd21:Unit/abcd21:UnitID').content # = DNA Bank nr
- specimen_id=unit.at_xpath('//abcd21:UnitAssociation/abcd21:UnitID').content
- full_name= unit.at_xpath('//abcd21:FullScientificNameString').content
- herbarium=unit.at_xpath('//abcd21:SourceInstitutionCode').content
- collector= unit.at_xpath('//abcd21:GatheringAgent').content
- locality=unit.at_xpath('//abcd21:LocalityText').content
- longitude=unit.at_xpath('//abcd21:LongitudeDecimal').content
- latitude=unit.at_xpath('//abcd21:LatitudeDecimal').content
- rescue
-# ignored
+ unit_id = doc.at_xpath('//abcd21:Unit/abcd21:UnitID').content # = DNA Bank nr
+ specimen_id = unit.at_xpath('//abcd21:UnitAssociation/abcd21:UnitID').content
+ full_name = unit.at_xpath('//abcd21:FullScientificNameString').content
+ herbarium = unit.at_xpath('//abcd21:SourceInstitutionCode').content
+ collector = unit.at_xpath('//abcd21:GatheringAgent').content
+ locality = unit.at_xpath('//abcd21:LocalityText').content
+ longitude = unit.at_xpath('//abcd21:LongitudeDecimal').content
+ latitude = unit.at_xpath('//abcd21:LatitudeDecimal').content
+ rescue StandardError
+ # ignored
end
- if unit_id
- puts unit_id
- end
+ puts unit_id if unit_id
- if specimen_id
+ next unless specimen_id
- individual.update(:specimen_id => specimen_id)
+ individual.update(specimen_id: specimen_id)
- puts specimen_id
+ puts specimen_id
- if unit_id
- puts unit_id
- individual.update(:DNA_bank_id => unit_id)
- end
+ if unit_id
+ puts unit_id
+ individual.update(DNA_bank_id: unit_id)
+ end
- puts collector
- if collector
- individual.update(:collector => collector.strip)
- end
+ puts collector
+ individual.update(collector: collector.strip) if collector
- puts locality
- if locality
- individual.update(:locality => locality)
- end
+ puts locality
+ individual.update(locality: locality) if locality
- puts longitude
- if longitude
- individual.update(:longitude => longitude)
- end
+ puts longitude
+ individual.update(longitude: longitude) if longitude
- puts latitude
- if latitude
- individual.update(:latitude => latitude)
- end
+ puts latitude
+ individual.update(latitude: latitude) if latitude
- puts herbarium
- if herbarium
- individual.update(:herbarium => herbarium)
- end
+ puts herbarium
+ individual.update(herbarium: herbarium) if herbarium
- if full_name
+ if full_name
- regex = /^(\w+\s+\w+)/
- matches = full_name.match(regex)
- if matches
- species_component = matches[1]
+ regex = /^(\w+\s+\w+)/
+ matches = full_name.match(regex)
+ if matches
+ species_component = matches[1]
- puts species_component
+ puts species_component
- sp=individual.species
+ sp = individual.species
- if sp.nil?
- sp= Species.find_or_create_by(:species_component => species_component)
- individual.update(:species => sp)
- end
+ if sp.nil?
+ sp = Species.find_or_create_by(species_component: species_component)
+ individual.update(species: sp)
end
-
end
- isolate = Isolate.where(:lab_nr => i.lab_nr).first
+ end
- if isolate
- isolate.update(:individual => individual)
- end
+ isolate = Isolate.where(lab_nr: i.lab_nr).first
- break # no need to try alternative "gbOl" spelling if already found a match
-
- end
+ isolate&.update(individual: individual)
+ break # no need to try alternative "gbOl" spelling if already found a match
end
- rescue
-# ignored
+ rescue StandardError
+ # ignored
end
-
end
- puts "Done."
-
+ puts 'Done.'
end
- desc "For given GBOL-Nrs, extract all specimen info from DNABank, if corresponding GBOL-Nr exists there."
- task :reset_DNABank_by_gbol_nr => :environment do
-
+ desc 'For given GBOL-Nrs, extract all specimen info from DNABank, if corresponding GBOL-Nr exists there.'
+ task reset_DNABank_by_gbol_nr: :environment do
outputstr = "Isolate ID\tGBOL-Nr (Lab-Nr)\tcurrent DNA-Bank-Nr\tcurrent specimen\tcurrent species\tfuture DNA-Bank-Nr\tfuture specimen\tfuture species\n"
- c=Isolate.all.count
- ctr=1
+ c = Isolate.all.count
+ ctr = 1
Isolate.all.each do |i|
# Isolate.find([11302, 11317, 9986]).each do |i|
progress = "#{ctr} / #{c}" + "\r"
puts progress
- specimen=""
- species=""
+ specimen = ''
+ species = ''
if i.individual
- specimen=i.individual.specimen_id
- if i.individual.species
- species=i.individual.species.species_component
- end
+ specimen = i.individual.specimen_id
+ species = i.individual.species.species_component if i.individual.species
end
gbol_nr = i.lab_nr
@@ -488,50 +429,49 @@ namespace :data do
puts "Query for #{gbol_nr}..."
- service_url="http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1#{gbol_nr}false"
+ service_url = "http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank&query=http://www.tdwg.org/schemas/abcd/2.1http://www.tdwg.org/schemas/abcd/2.1#{gbol_nr}false"
url = URI.parse(service_url)
req = Net::HTTP::Get.new(url.to_s)
- res = Net::HTTP.start(url.host, url.port) { |http|
+ res = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
- }
+ end
doc = Nokogiri::XML(res.body)
begin
unit = doc.at_xpath('//abcd21:Unit')
- unit_id=doc.at_xpath('//abcd21:Unit/abcd21:UnitID').content # = DNA Bank nr
- specimen_id=unit.at_xpath('//abcd21:UnitAssociation/abcd21:UnitID').content
- full_name= unit.at_xpath('//abcd21:FullScientificNameString').content
- herbarium=unit.at_xpath('//abcd21:SourceInstitutionCode').content
- collector= unit.at_xpath('//abcd21:GatheringAgent').content
- locality=unit.at_xpath('//abcd21:LocalityText').content
- longitude=unit.at_xpath('//abcd21:LongitudeDecimal').content
- latitude=unit.at_xpath('//abcd21:LatitudeDecimal').content
- rescue
+ unit_id = doc.at_xpath('//abcd21:Unit/abcd21:UnitID').content # = DNA Bank nr
+ specimen_id = unit.at_xpath('//abcd21:UnitAssociation/abcd21:UnitID').content
+ full_name = unit.at_xpath('//abcd21:FullScientificNameString').content
+ herbarium = unit.at_xpath('//abcd21:SourceInstitutionCode').content
+ collector = unit.at_xpath('//abcd21:GatheringAgent').content
+ locality = unit.at_xpath('//abcd21:LocalityText').content
+ longitude = unit.at_xpath('//abcd21:LongitudeDecimal').content
+ latitude = unit.at_xpath('//abcd21:LatitudeDecimal').content
+ rescue StandardError
# puts "Extraction not possible."
end
puts
if unit_id && i.dna_bank_id
- if unit_id.gsub(/\s+/, "") == i.dna_bank_id.gsub(/\s+/, "")
- #don't output anything - correction from upcoming DNABank query will not change anything
+ if unit_id.gsub(/\s+/, '') == i.dna_bank_id.gsub(/\s+/, '')
+ # don't output anything - correction from upcoming DNABank query will not change anything
else
- outputstr+= "#{i.id}\t#{i.lab_nr}\t#{i.dna_bank_id}\t#{specimen}\t#{species}\t"
- outputstr+= "#{unit_id}\t" #future dna_bank_id
+ outputstr += "#{i.id}\t#{i.lab_nr}\t#{i.dna_bank_id}\t#{specimen}\t#{species}\t"
+ outputstr += "#{unit_id}\t" # future dna_bank_id
if specimen_id
- outputstr+= "#{specimen_id}\t" #future specimen_id
- outputstr+= "#{full_name}\n" if full_name
+ outputstr += "#{specimen_id}\t" # future specimen_id
+ outputstr += "#{full_name}\n" if full_name
end
end
end
- ctr=ctr+1
+ ctr += 1
end
puts "#{outputstr}\n\nDone."
-
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/flag_specimens.rake b/lib/tasks/flag_specimens.rake
index 555851e7..c63a9c72 100644
--- a/lib/tasks/flag_specimens.rake
+++ b/lib/tasks/flag_specimens.rake
@@ -1,12 +1,13 @@
-namespace :data do
+# frozen_string_literal: true
- task :flag_specimen => :environment do
+namespace :data do
+ task flag_specimen: :environment do
individual_ids = Individual.joins(isolates: :marker_sequences).distinct.merge(MarkerSequence.with_warnings).pluck(:id)
individuals_with_issues = []
individual_ids.each do |individual_id|
sequences = MarkerSequence.joins(isolate: :individual).distinct.with_warnings.where('individuals.id = ?', individual_id)
- individuals_with_issues << individual_id if (sequences.size > 1)
+ individuals_with_issues << individual_id if sequences.size > 1
end
individuals_with_issues.each do |individual_id|
@@ -14,12 +15,12 @@ namespace :data do
end
end
- task :unflag_specimen => :environment do
+ task unflag_specimen: :environment do
individuals_with_flag = Individual.where(has_issue: true)
individuals_with_flag.each do |individual|
sequences = MarkerSequence.joins(isolate: :individual).distinct.with_warnings.where('individuals.id = ?', individual.id)
- individual.update(has_issue: false) if (sequences.size < 2)
+ individual.update(has_issue: false) if sequences.size < 2
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/get_aligned_peak_indices.rake b/lib/tasks/get_aligned_peak_indices.rake
index 5b88968e..c4a13756 100644
--- a/lib/tasks/get_aligned_peak_indices.rake
+++ b/lib/tasks/get_aligned_peak_indices.rake
@@ -1,22 +1,20 @@
-namespace :data do
-
- desc "get_aligned_peak_indices"
+# frozen_string_literal: true
- task :get_aligned_peak_indices => :environment do
+namespace :data do
+ desc 'get_aligned_peak_indices'
- total= PrimerRead.use_for_assembly.where(:aligned_peak_indices => nil).count
+ task get_aligned_peak_indices: :environment do
+ total = PrimerRead.use_for_assembly.where(aligned_peak_indices: nil).count
- ctr=0
- PrimerRead.use_for_assembly.where( :aligned_peak_indices => nil).select(:id, :trimmedReadStart, :aligned_qualities, :aligned_peak_indices, :peak_indices).find_in_batches(batch_size: 100) do |batch|
+ ctr = 0
+ PrimerRead.use_for_assembly.where(aligned_peak_indices: nil).select(:id, :trimmedReadStart, :aligned_qualities, :aligned_peak_indices, :peak_indices).find_in_batches(batch_size: 100) do |batch|
batch.each do |pr|
- ctr+=1
+ ctr += 1
puts "#{ctr} / #{total}"
pr.get_aligned_peak_indices
end
end
- puts "Done."
-
+ puts 'Done.'
end
-
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/identification_success.rake b/lib/tasks/identification_success.rake
index 73150127..e1ae766f 100644
--- a/lib/tasks/identification_success.rake
+++ b/lib/tasks/identification_success.rake
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
namespace :data do
desc 'Calculate identification success of marker'
- task :identification_success, [:marker] => [:environment] do |t, args|
+ task :identification_success, [:marker] => [:environment] do |_t, args|
marker = Marker.find_by_name(args[:marker])
sequences = MarkerSequence.joins(isolate: [individual: :species])
diff --git a/lib/tasks/mark_negative_controls.rake b/lib/tasks/mark_negative_controls.rake
index 29bc9e7c..b82f2b69 100644
--- a/lib/tasks/mark_negative_controls.rake
+++ b/lib/tasks/mark_negative_controls.rake
@@ -1,86 +1,83 @@
+# frozen_string_literal: true
+
namespace :data do
desc "fill reads' basecount"
- task :mark_negative_controls => :environment do
-
- controls=[
- 'GBoL96',
- 'GBoL192',
- 'GBoL288',
- 'GBoL384',
- 'GBoL480',
- 'GBoL576',
- 'GBoL672',
- 'GBoL768',
- 'GBoL864',
- 'GBoL960',
- 'GBoL1056',
- 'GBoL1152',
- 'GBoL1248',
- 'GBoL1344',
- 'GBoL1440',
- 'GBoL1536',
- 'GBoL1632',
- 'GBoL1728',
- 'GBoL1824',
- 'GBoL1920',
- 'GBoL2016',
- 'GBoL2112',
- 'GBoL2208',
- 'GBoL2304',
- 'GBoL2400',
- 'GBoL2496',
- 'GBoL2592',
- 'GBoL2688',
- 'GBoL2784',
- 'GBoL2880',
- 'GBoL2976',
- 'GBoL3072',
- 'GBoL3168',
- 'GBoL3264',
- 'GBoL3360',
- 'GBoL3456',
- 'GBoL3552',
- 'GBoL3648',
- 'GBoL3744',
- 'GBoL3840',
- 'GBoL3936',
- 'GBoL4032',
- 'GBoL4128',
- 'GBoL4224',
- 'GBoL4320',
- 'GBoL4416',
- 'GBoL4512',
- 'GBoL4608',
- 'GBoL4704',
- 'GBoL4800',
- 'GBoL4896',
- 'GBoL4992',
- 'GBoL5088',
- 'GBoL5184',
- 'GBoL5280',
- 'GBoL5376',
- 'GBoL5472',
- 'GBoL5568',
- 'GBoL5664',
- 'GBoL5760',
- 'GBoL5856',
- 'GBoL5952',
- 'GBoL6048',
- 'GBoL6144',
- 'GBoL6240',
- 'GBoL6336'
+ task mark_negative_controls: :environment do
+ controls = %w[
+ GBoL96
+ GBoL192
+ GBoL288
+ GBoL384
+ GBoL480
+ GBoL576
+ GBoL672
+ GBoL768
+ GBoL864
+ GBoL960
+ GBoL1056
+ GBoL1152
+ GBoL1248
+ GBoL1344
+ GBoL1440
+ GBoL1536
+ GBoL1632
+ GBoL1728
+ GBoL1824
+ GBoL1920
+ GBoL2016
+ GBoL2112
+ GBoL2208
+ GBoL2304
+ GBoL2400
+ GBoL2496
+ GBoL2592
+ GBoL2688
+ GBoL2784
+ GBoL2880
+ GBoL2976
+ GBoL3072
+ GBoL3168
+ GBoL3264
+ GBoL3360
+ GBoL3456
+ GBoL3552
+ GBoL3648
+ GBoL3744
+ GBoL3840
+ GBoL3936
+ GBoL4032
+ GBoL4128
+ GBoL4224
+ GBoL4320
+ GBoL4416
+ GBoL4512
+ GBoL4608
+ GBoL4704
+ GBoL4800
+ GBoL4896
+ GBoL4992
+ GBoL5088
+ GBoL5184
+ GBoL5280
+ GBoL5376
+ GBoL5472
+ GBoL5568
+ GBoL5664
+ GBoL5760
+ GBoL5856
+ GBoL5952
+ GBoL6048
+ GBoL6144
+ GBoL6240
+ GBoL6336
]
controls.each do |c|
- isolate=Isolate.where(:lab_nr => c).first
- if isolate
- isolate.update(:negative_control => true)
- end
+ isolate = Isolate.where(lab_nr: c).first
+ isolate&.update(negative_control: true)
end
- puts "Done."
-
+ puts 'Done.'
end
-
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/query_contigs_for_isolate_list.rake b/lib/tasks/query_contigs_for_isolate_list.rake
index da6c1244..359f25ee 100644
--- a/lib/tasks/query_contigs_for_isolate_list.rake
+++ b/lib/tasks/query_contigs_for_isolate_list.rake
@@ -1,15 +1,15 @@
+# frozen_string_literal: true
+
require 'net/http'
require 'nokogiri'
namespace :data do
+ desc 'For given GBOL-Nrs, check which contigs exist.'
- desc "For given GBOL-Nrs, check which contigs exist."
-
- task :query_contigs_for_isolate_list => :environment do
-
+ task query_contigs_for_isolate_list: :environment do
outputstr = "Isolate ID\tITS\ttrnK-matK\ttrnLF\trpl16\n"
- list_with_gbol_nrs="GBoL3457
+ list_with_gbol_nrs = "GBoL3457
GBoL3467
GBoL3459
GBoL3474
@@ -60,34 +60,27 @@ GBoL3541
".split("\n")
list_with_gbol_nrs.each do |i|
-
outputstr += "#{i}\t"
- isolate = Isolate.where(:lab_nr => i).first
+ isolate = Isolate.where(lab_nr: i).first
isolate.contigs.each do |c|
-
- if c.verified_at.nil?
- outputstr += "#{c.marker.name} "
- else
- outputstr += "#{c.marker.name} (verified)"
- end
+ outputstr += if c.verified_at.nil?
+ "#{c.marker.name} "
+ else
+ "#{c.marker.name} (verified)"
+ end
outputstr += "\t"
-
end
- outputstr+="\n"
-
-
+ outputstr += "\n"
end
puts outputstr
puts
- puts "Done."
-
+ puts 'Done.'
end
-
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/remove_searches.rake b/lib/tasks/remove_searches.rake
index 019942d1..440f309c 100644
--- a/lib/tasks/remove_searches.rake
+++ b/lib/tasks/remove_searches.rake
@@ -1,13 +1,13 @@
-namespace :data do
+# frozen_string_literal: true
+namespace :data do
desc 'Remove untitled contig searches older than a month'
- task :remove_old_searches => :environment do
- ContigSearch.where("created_at < ?", 1.month.ago).where(title: nil).delete_all
+ task remove_old_searches: :environment do
+ ContigSearch.where('created_at < ?', 1.month.ago).where(title: nil).delete_all
end
desc 'Remove all untitled contig searches'
- task :remove_untitled_searches => :environment do
+ task remove_untitled_searches: :environment do
ContigSearch.where(title: nil).delete_all
end
-
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/reupload_chromatograms.rake b/lib/tasks/reupload_chromatograms.rake
index 578a989b..220cb3a5 100644
--- a/lib/tasks/reupload_chromatograms.rake
+++ b/lib/tasks/reupload_chromatograms.rake
@@ -1,9 +1,10 @@
+# frozen_string_literal: true
+
require 'net/http'
namespace :data do
-
desc 'Delete faulty primer reads and import them again correctly'
- task :reimport_chromatograms => :environment do
+ task reimport_chromatograms: :environment do
nil_reads = PrimerRead.where(sequence: nil)
# download chromatograms of records without sequence
@@ -16,4 +17,4 @@ namespace :data do
# destroy all reads without sequence
PrimerRead.where(sequence: nil).destroy_all
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/script_runner.rake b/lib/tasks/script_runner.rake
index bd7f390d..067e3e62 100644
--- a/lib/tasks/script_runner.rake
+++ b/lib/tasks/script_runner.rake
@@ -1,13 +1,14 @@
-namespace :data do
+# frozen_string_literal: true
- task :run_python => :environment do
+namespace :data do
+ task run_python: :environment do
file = Rails.root.join('lib', 'sativa_test_files', 'python_test.py')
output = `python #{file}`
puts output
end
- desc "Runs a SATIVA mislabel analysis"
- task :run_sativa => :environment do
+ desc 'Runs a SATIVA mislabel analysis'
+ task run_sativa: :environment do
# SATIVA only understands relative file paths and has to be called inside the directory with the analysis data
analysis_dir = Rails.root.join('lib', 'sativa_test_files')
alignment_file = 'gbol5_caryophyllales_ITS_aligned.fasta'
@@ -17,5 +18,4 @@ namespace :data do
`python /home/sarah/SATIVA/sativa/sativa.py -s #{alignment_file} -t #{tax_file} -x BOT`
end
end
-
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/sequence_quality.rake b/lib/tasks/sequence_quality.rake
index 45a291d8..da8f6559 100644
--- a/lib/tasks/sequence_quality.rake
+++ b/lib/tasks/sequence_quality.rake
@@ -1,7 +1,8 @@
-namespace :data do
+# frozen_string_literal: true
+namespace :data do
desc 'Get information about verified marker sequences (with associated species) and contigs in database'
- task :sequence_info_verified => [:environment, :general_info] do
+ task sequence_info_verified: %i[environment general_info] do
marker_sequences = MarkerSequence.gbol.has_species.verified
contigs = Contig.gbol.verified.joins(:primer_reads)
@@ -9,7 +10,7 @@ namespace :data do
end
desc 'Get information about all gbol5 marker sequences and contigs in database'
- task :sequence_info_gbol => [:environment, :general_info] do
+ task sequence_info_gbol: %i[environment general_info] do
marker_sequences = MarkerSequence.gbol
contigs = Contig.joins(:primer_reads).gbol
@@ -17,13 +18,13 @@ namespace :data do
end
desc 'Get general information about gbol5 marker sequences and contigs in database'
- task :general_info => :environment do
+ task general_info: :environment do
marker_sequences = MarkerSequence.gbol
puts "Number of marker sequences: #{marker_sequences.size}"
puts "Number of verified marker sequences in database: #{marker_sequences.verified.size}"
puts "Number of verified marker sequences with associated species in database: #{marker_sequences.has_species.verified.length}"
puts "Number of marker sequences without associated contigs: #{marker_sequences.includes(:contigs).where(contigs: { id: nil }).size}"
- puts "Number of marker sequences without associated isolate: #{marker_sequences.includes(:isolate).where( isolate: nil ).size}"
+ puts "Number of marker sequences without associated isolate: #{marker_sequences.includes(:isolate).where(isolate: nil).size}"
puts ''
contigs = Contig.gbol
@@ -35,7 +36,7 @@ namespace :data do
puts ''
end
- task :duplicate_sequences => :environment do
+ task duplicate_sequences: :environment do
gbol_sequences = MarkerSequence.gbol
ms_with_contig = gbol_sequences.joins(:contigs).distinct
@@ -50,10 +51,10 @@ namespace :data do
end
desc 'Get the number of species with more than 1, 2, 3, 4 or 5 sequences per marker'
- task :sequences_per_species => :environment do
+ task sequences_per_species: :environment do
# TODO: Exclude cases where one individual has multiple isolates or one isolate has multiple sequences per marker
species = Species.joins(individuals: [isolates: :marker_sequences]).distinct
- columns = %w(min_one gt_one gt_two gt_three gt_four gt_five)
+ columns = %w[min_one gt_one gt_two gt_three gt_four gt_five]
its = {}
rpl16 = {}
trnk_matk = {}
@@ -80,7 +81,7 @@ namespace :data do
end
desc 'Get the number of species with only a single sequence per marker'
- task :singletons_per_marker => :environment do
+ task singletons_per_marker: :environment do
species = Species.joins(individuals: [isolates: :marker_sequences]).distinct
species_cnt = species.size
@@ -97,7 +98,7 @@ namespace :data do
end
desc 'Get the average number of specimen per species'
- task :specimen_per_species => :environment do
+ task specimen_per_species: :environment do
species_cnt = Species.all.size
specimen_cnt = Individual.all.size
@@ -124,7 +125,7 @@ namespace :data do
# MarkerSequence.joins(isolate: [individual: :species]).distinct.order('species.species_component').group('species.species_component').count
end
- task :get_high_quality_sequences => :environment do
+ task get_high_quality_sequences: :environment do
sequences = MarkerSequence.gbol # Only GBOL5 sequences
# sequences = MarkerSequence.gbol.joins(isolate: {individual: {species: {family: :order}}}).where("orders.name ilike ?", "%Caryophyllales%")
puts "Number of GBOL5 sequences: #{sequences.size}"
@@ -155,7 +156,7 @@ namespace :data do
end
# Check sequences for stop codons
- stop_codons = %w(tag tga taa)
+ stop_codons = %w[tag tga taa]
# sequence = Bio::Sequence::NA.new(MarkerSequence.gbol.first.sequence)
# codons = sequence.codon_usage
# stop_codons.each { |codon| puts codons[codon] }
@@ -169,8 +170,8 @@ namespace :data do
def species_count_with_exact_ms_count(species, marker_id, ms_count)
species.where(individuals: { isolates: { marker_sequences: { marker: marker_id } } })
- .group(:id)
- .having('count(marker_sequences) = ?', ms_count).length
+ .group(:id)
+ .having('count(marker_sequences) = ?', ms_count).length
end
def get_information(marker_sequences, contigs)
@@ -189,17 +190,16 @@ namespace :data do
if sequences.size.positive?
sequence_count[marker.name] = sequences.size
sequence_length_avg[marker.name] = sequences.average('length(sequence)').to_f.round(2)
- sequence_length_min[marker.name] = sequences.select(:sequence, 'length(sequence)').where.not(:sequence => nil).order('length(sequence) asc').first.sequence.length
- sequence_length_max[marker.name] = sequences.select(:sequence, 'length(sequence)').where.not(:sequence => nil).order('length(sequence) desc').first.sequence.length
+ sequence_length_min[marker.name] = sequences.select(:sequence, 'length(sequence)').where.not(sequence: nil).order('length(sequence) asc').first.sequence.length
+ sequence_length_max[marker.name] = sequences.select(:sequence, 'length(sequence)').where.not(sequence: nil).order('length(sequence) desc').first.sequence.length
end
- if contigs_marker.size.positive?
- primer_read_counts = contigs_marker.group(:id).count('primer_reads.id') # TODO: only count assembled reads
+ next unless contigs_marker.size.positive?
+ primer_read_counts = contigs_marker.group(:id).count('primer_reads.id') # TODO: only count assembled reads
- reads_per_contig_avg[marker.name] = (primer_read_counts.values.sum / primer_read_counts.values.size.to_f).round(2)
- reads_per_contig_min[marker.name] = primer_read_counts.values.min
- reads_per_contig_max[marker.name] = primer_read_counts.values.max
- end
+ reads_per_contig_avg[marker.name] = (primer_read_counts.values.sum / primer_read_counts.values.size.to_f).round(2)
+ reads_per_contig_min[marker.name] = primer_read_counts.values.min
+ reads_per_contig_max[marker.name] = primer_read_counts.values.max
end
puts 'Number of sequences per marker:'
@@ -226,7 +226,7 @@ namespace :data do
has_ms = false
s.individuals.each do |i|
i.isolates.each do |iso|
- has_ms = iso.marker_sequences.where(:marker_id => marker_id).any? ? true : has_ms
+ has_ms = iso.marker_sequences.where(marker_id: marker_id).any? ? true : has_ms
end
end
count += 1 if has_ms
diff --git a/lib/tasks/ssh.rake b/lib/tasks/ssh.rake
index ac3bd827..eeb874f3 100644
--- a/lib/tasks/ssh.rake
+++ b/lib/tasks/ssh.rake
@@ -1,10 +1,12 @@
+# frozen_string_literal: true
+
namespace :data do
require 'net/ssh'
require 'net/scp'
require 'net/sftp'
desc 'Check how many sequences were created or updated since last analysis and redo analysis if necessary'
- task :check_new_marker_sequences => :environment do
+ task check_new_marker_sequences: :environment do
# TODO: Do analyses for all existing projects (except all_records)
Marker.gbol_marker.each do |marker|
puts "Checking if analysis is necessary for #{marker.name}..."
@@ -20,7 +22,7 @@ namespace :data do
end
desc 'Check if recent SATIVA results exist and download them'
- task :download_sativa_results => :environment do
+ task download_sativa_results: :environment do
Marker.gbol_marker.each do |marker|
puts "Checking if analysis results exist for #{marker.name}..."
@@ -107,4 +109,4 @@ namespace :data do
def current_time
Time.now.strftime('%H:%M:%S')
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/update_location_data.rake b/lib/tasks/update_location_data.rake
index 52adbdeb..cbb34425 100644
--- a/lib/tasks/update_location_data.rake
+++ b/lib/tasks/update_location_data.rake
@@ -1,11 +1,11 @@
+# frozen_string_literal: true
+
require 'net/http'
require 'nokogiri'
-
namespace :data do
-
desc 'Update Specimen Location Data'
- task :update_location_data => :environment do
+ task update_location_data: :environment do
spreadsheet = Roo::Excelx.new('/home/sarah/apps/gbol5/current/GBOL_2015_Koordinaten_Korrektur.xlsx')
header = spreadsheet.row(1)
no_specimen = []
@@ -19,18 +19,18 @@ namespace :data do
isolate_lab_nr = row['GBoL Isolation No.']
latitude = row['Latitude (calc.)']&.to_d
longitude = row['Longitude (calc.)']&.to_d
- specimen = Individual.find_by_id(Isolate.where(:lab_nr => isolate_lab_nr).first&.individual_id)
+ specimen = Individual.find_by_id(Isolate.where(lab_nr: isolate_lab_nr).first&.individual_id)
if specimen
if latitude&.nonzero? && specimen.latitude != latitude
- specimen.update(:latitude => latitude)
- specimen.update(:latitude_original => row['Latitude (calc.)'])
+ specimen.update(latitude: latitude)
+ specimen.update(latitude_original: row['Latitude (calc.)'])
lat_cnt += 1
end
if longitude&.nonzero? && specimen.longitude != longitude
- specimen.update(:longitude => longitude)
- specimen.update(:longitude_original => row['Longitude (calc.)'])
+ specimen.update(longitude: longitude)
+ specimen.update(longitude_original: row['Longitude (calc.)'])
long_cnt += 1
end
@@ -43,4 +43,4 @@ namespace :data do
puts "Done. Updated latitude data for #{lat_cnt} specimen and longitude data for #{long_cnt}."\
"\nNo specimens are assigned to the following #{no_specimen.length} isolates: #{no_specimen}"
end
-end
\ No newline at end of file
+end
diff --git a/lib/tasks/work_statistics.rake b/lib/tasks/work_statistics.rake
index 55d92e15..8cded86a 100644
--- a/lib/tasks/work_statistics.rake
+++ b/lib/tasks/work_statistics.rake
@@ -1,7 +1,8 @@
-namespace :data do
+# frozen_string_literal: true
+namespace :data do
desc 'Do work statistics for and Lab with '
- task :work_statistics_yearly, [:year, :labcode] => [:environment] do |t, args|
+ task :work_statistics_yearly, %i[year labcode] => [:environment] do |_t, args|
lab_prefixes = { nees: 'gbol', bgbm: 'db' }
range = Time.new(args[:year].to_i, 1, 1).all_year
@@ -9,17 +10,17 @@ namespace :data do
puts prefix
- isolates = Isolate.where("lab_nr ilike ?", "#{prefix}%")
- .where(:created_at => range)
+ isolates = Isolate.where('lab_nr ilike ?', "#{prefix}%")
+ .where(created_at: range)
.select(:id, :lab_nr)
- contigs = Contig.where("contigs.name ilike ?", "#{prefix}%")
+ contigs = Contig.where('contigs.name ilike ?', "#{prefix}%")
.where(verified_at: range)
.select(:id, :name)
- reads = PrimerRead.where("primer_reads.name ilike ?", "#{prefix}%")
- .where(:created_at => range)
+ reads = PrimerRead.where('primer_reads.name ilike ?', "#{prefix}%")
+ .where(created_at: range)
.select(:id, :name)
- marker_sequences = MarkerSequence.where("marker_sequences.name ilike ?", "#{prefix}%")
- .where(:created_at => range)
+ marker_sequences = MarkerSequence.where('marker_sequences.name ilike ?', "#{prefix}%")
+ .where(created_at: range)
.select(:id, :sequence, :name)
puts "Calculating activities for #{range.first.year} in lab #{args[:labcode]}...\n"
@@ -57,14 +58,14 @@ namespace :data do
end
desc 'Do work statistics'
- task :work_statistics_total => [:environment] do |t, args|
+ task work_statistics_total: [:environment] do |_t, _args|
gbol_marker = Marker.gbol_marker
- puts "Calculating activities in total..."
+ puts 'Calculating activities in total...'
all_isolates_count = Isolate.all.size
- isolates_bonn_cnt = Isolate.where("lab_nr ilike ?", "%gbol%").size
- isolates_berlin_cnt = Isolate.where("lab_nr ilike ?", "%db%").size
+ isolates_bonn_cnt = Isolate.where('lab_nr ilike ?', '%gbol%').size
+ isolates_berlin_cnt = Isolate.where('lab_nr ilike ?', '%db%').size
other_isolates_count = all_isolates_count - isolates_bonn_cnt - isolates_berlin_cnt
puts "Number of isolates: #{all_isolates_count} (total), #{isolates_bonn_cnt} (Bonn), #{isolates_berlin_cnt} (Berlin), #{other_isolates_count} (not assigned to a lab)"
@@ -73,7 +74,7 @@ namespace :data do
gbol_marker.each do |marker|
sequence_cnt_per_marker[marker.name] = MarkerSequence.where(marker_id: marker.id).size
- verified_count_per_marker[marker.name] = Isolate.joins(contigs: :marker).where(contigs: { verified: true , marker_id: marker.id}).count('contigs.id')
+ verified_count_per_marker[marker.name] = Isolate.joins(contigs: :marker).where(contigs: { verified: true, marker_id: marker.id }).count('contigs.id')
end
puts "Number of barcode sequences per marker: #{sequence_cnt_per_marker}"