Class: UatActions::GenerateTagGroup

Inherits:
UatActions show all
Defined in:
app/uat_actions/uat_actions/generate_tag_group.rb

Overview

Will construct plates with well_count wells filled with samples

Constant Summary

Constants inherited from UatActions

CATEGORY_LIST

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from UatActions

all, category, find, form_field, form_fields, #form_fields, grouped_and_sorted_uat_actions, id, inherited, permitted, #report, #save, to_partial_path, uat_actions

Class Method Details

.defaultUatActions::GenerateTagGroup

Returns a default copy of the UatAction which will be used to fill in the form

Returns:



52
53
54
# File 'app/uat_actions/uat_actions/generate_tag_group.rb', line 52

def self.default
  new(size: 384)
end

Instance Method Details

#create_tag_group(name, adapter_type) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
# File 'app/uat_actions/uat_actions/generate_tag_group.rb', line 72

def create_tag_group(name, adapter_type)
  tag_group = TagGroup.create!(name: name, adapter_type_id: adapter_type&.id)

  tag_group.tags.build(
    OligoEnumerator
      .new(size.to_i, tag_sequence_offset.to_i)
      .each_with_index
      .map { |oligo, map_id| { oligo: oligo, map_id: map_id + 1 } }
  )
  tag_group.save
end

#existing_tagsObject



84
85
86
# File 'app/uat_actions/uat_actions/generate_tag_group.rb', line 84

def existing_tags
  @tag_group.tags.count
end

#performBoolean

[perform description]

Returns:

  • (Boolean)

    Returns true if the action was successful, false otherwise



60
61
62
63
64
65
66
67
68
69
70
# File 'app/uat_actions/uat_actions/generate_tag_group.rb', line 60

def perform
  # Called by the controller once the form is filled in. Add your actual actions here.
  # All the form fields are accessible as simple attributes.
  # Return true if everything works
  report[:name] = name
  return true if existing_tag_group

  adapter_type = TagGroup::AdapterType.find_by(name: adapter_type_name)

  create_tag_group(name, adapter_type)
end