Module: IlluminaC::Requests::Helpers

Included in:
IlluminaC::Requests
Defined in:
app/models/illumina_c/requests.rb

Instance Method Summary collapse

Instance Method Details

#create_request_typesObject


29
30
31
32
33
34
35
36
# File 'app/models/illumina_c/requests.rb', line 29

def create_request_types
  each_request_type do |params|
    RequestType.create!(params)
  end
  IlluminaC::PlatePurposes::STOCK_PLATE_PURPOSE_TO_OUTER_REQUEST.each do |purpose, request|
    RequestType.find_by(key: request).acceptable_plate_purposes << Purpose.find_by(name: purpose)
  end
end

#destroy_request_typesObject


45
46
47
48
49
# File 'app/models/illumina_c/requests.rb', line 45

def destroy_request_types
  each_request_type do |params|
    RequestType.find_by(name: params[:name]).destroy
  end
end

#each_request_typeObject


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'app/models/illumina_c/requests.rb', line 51

def each_request_type
  [
    {
      name: 'Illumina-C Library Creation PCR',
      key: 'illumina_c_pcr',
      for_multiplexing: true,
      request_class_name: 'IlluminaC::Requests::PcrLibraryRequest',
      target_purpose: Purpose.find_by(name: 'ILC Lib Pool Norm')
    },
    {
      name: 'Illumina-C Library Creation No PCR',
      key: 'illumina_c_nopcr',
      for_multiplexing: true,
      request_class_name: 'IlluminaC::Requests::NoPcrLibraryRequest',
      target_purpose: Purpose.find_by(name: 'ILC Lib Pool Norm')
    },
    {
      name: 'Illumina-C Library Creation PCR No Pooling',
      key: 'illumina_c_pcr_no_pool',
      request_class_name: 'IlluminaC::Requests::PcrLibraryRequest',
      for_multiplexing: false
    },
    {
      name: 'Illumina-C Library Creation No PCR No Pooling',
      key: 'illumina_c_no_pcr_no_pool',
      request_class_name: 'IlluminaC::Requests::NoPcrLibraryRequest',
      for_multiplexing: false
    },
    {
      name: 'Illumina-C Chromium library creation',
      key: 'illumina_c_chromium_library',
      request_class_name: 'IlluminaC::Requests::LibraryRequest', # See class deprecation notice above
      for_multiplexing: true,
      target_purpose: Purpose.find_by(name: 'ILC Lib Pool Norm')
    },
    {
      name: 'Illumina-C Multiplexing',
      key: 'illumina_c_multiplexing',
      request_class_name: 'Request::AutoMultiplexing',
      for_multiplexing: true,
      target_purpose: Purpose.find_by(name: 'ILC Lib Pool Norm')
    }
  ].each do |params|
    params.merge!(
      asset_type: 'Well',
      order: 1,
      initial_state: 'pending',
      billable: true,
      product_line: ProductLine.find_by(name: 'Illumina-C')
    )
    yield(params)
  end
end

#update_request_typesObject


38
39
40
41
42
43
# File 'app/models/illumina_c/requests.rb', line 38

def update_request_types
  each_request_type do |params|
    key = params.delete(:key)
    RequestType.find_by(key: key).update!(params)
  end
end