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

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?, #downstream_aliquots_updated?, #initialize, #sample_manifest_updated?, #samples_updated?, #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.


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

def substitutions=(value)
  @substitutions = value
end

Instance Method Details

#aliquots_transferred?Boolean

Returns:

  • (Boolean)

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

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


40
41
42
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 40

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

#disable_match_expectationObject


55
56
57
# File 'app/sample_manifest_excel/sample_manifest_excel/upload/processor/multiplexed_library_tube.rb', line 55

def disable_match_expectation
  false
end

#processed?Boolean

Returns:

  • (Boolean)

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

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

#run(tag_group) ⇒ Object


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

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


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

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 << row.aliquot.substitution_hash if row.reuploaded?
  end
  update_downstream_aliquots unless no_substitutions?
end