Class: SampleManifestExcel::Upload::Processor::MultiplexedLibraryTube

Inherits:
Base
  • Object
show all
Includes:
Tags::Validator::Uniqueness
Defined in:
app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb

Overview

Processed slightly differently from Base Checks that the tags are unique If valid transfers aliquots from library tubes to multiplexed library tubes. *If manifest was reuploaded, updates downstream aliquots (instead of transfer) TODO: had to explicitly specify the namespace for Base here otherwise it picks up Upload::Base

Constant Summary

Constants inherited from Base

Base::MANDATORY_FIELDS

Instance Attribute Summary collapse

Attributes inherited from Base

#upload

Instance Method Summary collapse

Methods included from Tags::Validator::Uniqueness

#check_tags

Methods included from Tags::ClashesFinder

#create_tags_clashes_message, #find_tags_clash

Methods inherited from Base

#aliquots_updated?, #create_samples_if_not_present, #downstream_aliquots_updated?, #initialize, #sample_manifest_updated?, #samples_updated?, #samples_valid?, #substitutions, #type, #update_sample_manifest

Constructor Details

This class inherits a constructor from SampleManifestExcel::Upload::Processor::Base

Instance Attribute Details

#substitutions=(value) ⇒ Object (writeonly)

Sets the attribute substitutions

Parameters:

  • value

    the value to set the attribute substitutions to.



15
16
17
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 15

def substitutions=(value)
  @substitutions = value
end

Instance Method Details

#aliquots_transferred?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 46

def aliquots_transferred?
  upload.rows.all?(&:aliquot_transferred?) || log_error_and_return_false('Could not transfer aliquots.')
end

#cancel_unprocessed_external_library_creation_requestsObject

if partial manifest was uploaded, we do not want to give an option to upload the remaining samples the reason is if aliquots were transferred downstream, it is difficult to find all downstream tubes and add the remaining aliquots there Also it does not make sense in real life



38
39
40
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 38

def cancel_unprocessed_external_library_creation_requests
  upload.sample_manifest.pending_external_library_creation_requests.each(&:cancel!)
end

#disable_match_expectationObject



50
51
52
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 50

def disable_match_expectation
  false
end

#processed?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 42

def processed?
  samples_updated? && aliquots_updated? && sample_manifest_updated? && aliquots_transferred?
end

#run(tag_group) ⇒ Object



17
18
19
20
21
22
23
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 17

def run(tag_group)
  return false unless valid?

  update_samples_and_aliquots(tag_group)
  cancel_unprocessed_external_library_creation_requests
  update_sample_manifest
end

#update_samples_and_aliquots(tag_group) ⇒ Object



25
26
27
28
29
30
31
32
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 25

def update_samples_and_aliquots(tag_group)
  upload.rows.each do |row|
    row.update_sample(tag_group, upload.override)
    row.transfer_aliquot # Requests are smart enough to only transfer once
    substitutions.concat(row.aliquots.filter_map(&:substitution_hash)) if row.reuploaded?
  end
  update_downstream_aliquots unless no_substitutions?
end