class SequenceServer::Routes
Controller.
Public Instance Methods
display_large_result_warning?(xml_file_size)
click to toggle source
# File lib/sequenceserver/routes.rb, line 336 def display_large_result_warning?(xml_file_size) threshold = SequenceServer.config[:large_result_warning_threshold].to_i return false unless threshold.positive? return false if params[:bypass_file_size_warning] == 'true' xml_file_size > threshold end
large_result_warning_payload(jid)
click to toggle source
# File lib/sequenceserver/routes.rb, line 345 def large_result_warning_payload(jid) { user_warning: 'LARGE_RESULT', download_links: [ { name: 'Standard Tabular Report', url: "download/#{jid}.std_tsv" }, { name: 'Full Tabular Report', url: "/download/#{jid}.full_tsv" }, { name: 'Results in XML', url: "/download/#{jid}.xml" }, { name: 'Pairwise', url: "/download/#{jid}.pairwise" }, ] } end
root_path_prefix()
click to toggle source
# File lib/sequenceserver/routes.rb, line 358 def root_path_prefix settings.root_path_prefix.to_s end
update_searchdata_from_job(searchdata)
click to toggle source
Get the query sequences, selected databases, and advanced params used.
# File lib/sequenceserver/routes.rb, line 311 def update_searchdata_from_job(searchdata) job = fetch_job(params[:job_id]) return { error: 'Job not found' }.to_json if job.nil? return if job.imported_xml_file # Only read job.qfile if we are not going to use Database.retrieve. searchdata[:query] = File.read(job.qfile) unless params[:query] # Which databases to pre-select. searchdata[:preSelectedDbs] = job.databases # job.advanced may be nil in case of old jobs. In this case, we do not # override searchdata so that default advanced parameters can be applied. # Note that, job.advanced will be an empty string if a user deletes the # default advanced parameters from the advanced params input field. In # this case, we do want the advanced params input field to be empty when # the user hits the back button. Thus we do not test for empty string. method = job.method.to_sym if job.advanced && job.advanced != searchdata.dig(:options, method, :default, :attributes).to_a.join(' ') searchdata[:options] = searchdata[:options].deep_copy searchdata[:options][method]['last search'] = { attributes: [job.advanced] } end end
Private Instance Methods
fetch_job(job_id)
click to toggle source
# File lib/sequenceserver/routes.rb, line 365 def fetch_job(job_id) Job.fetch(job_id) end