Class: OpenTrons::Pipette

Inherits:
Object
  • Object
show all
Defined in:
lib/opentrons/instruments.rb

Direct Known Subclasses

MultiPipette

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(protocol, instruments, model, mount: "left", tip_racks: [], tip_model: nil) ⇒ Pipette



77
78
79
80
81
82
83
84
85
# File 'lib/opentrons/instruments.rb', line 77

def initialize(protocol, instruments, model, mount: "left", tip_racks: [], tip_model: nil)
  @protocol = protocol
  @instruments = instruments
  @model = model

  @mount = mount
  @tip_racks = tip_racks
  @tip_model = tip_model
end

Instance Attribute Details

#instrumentsObject

Returns the value of attribute instruments.



75
76
77
# File 'lib/opentrons/instruments.rb', line 75

def instruments
  @instruments
end

#modelObject

Returns the value of attribute model.



75
76
77
# File 'lib/opentrons/instruments.rb', line 75

def model
  @model
end

#mountObject

Returns the value of attribute mount.



75
76
77
# File 'lib/opentrons/instruments.rb', line 75

def mount
  @mount
end

#protocolObject

Returns the value of attribute protocol.



75
76
77
# File 'lib/opentrons/instruments.rb', line 75

def protocol
  @protocol
end

#tip_modelObject

Returns the value of attribute tip_model.



75
76
77
# File 'lib/opentrons/instruments.rb', line 75

def tip_model
  @tip_model
end

#tip_racksObject

Returns the value of attribute tip_racks.



75
76
77
# File 'lib/opentrons/instruments.rb', line 75

def tip_racks
  @tip_racks
end

Instance Method Details

#aspirate(volume, location) ⇒ Object



102
103
104
105
106
# File 'lib/opentrons/instruments.rb', line 102

def aspirate(volume, location)
  command = Aspirate.new(self, volume, location)
  protocol.commands.command_list << command
  return command
end

#blowout(location) ⇒ Object



193
194
195
196
197
# File 'lib/opentrons/instruments.rb', line 193

def blowout(location)
  command = Blowout.new(self, location)
  protocol.commands.command_list << command
  return command
end

#delay(wait, message: "") ⇒ Object



199
200
201
202
203
# File 'lib/opentrons/instruments.rb', line 199

def delay(wait, message: "")
  command = Delay.new(wait, message)
  protocol.commands.command_list << command
  return command
end

#dispense(volume, location) ⇒ Object



108
109
110
111
112
# File 'lib/opentrons/instruments.rb', line 108

def dispense(volume, location)
  command = Dispense.new(self, volume, location)
  protocol.commands.command_list << command
  return command
end

#drop_tip(location = false) ⇒ Object



180
181
182
183
184
185
# File 'lib/opentrons/instruments.rb', line 180

def drop_tip(location=false)
  location = protocol.trash.wells(0) if !location
  command = DropTip.new(self, location)
  protocol.commands.command_list << command
  return command
end

#get_next_tip(multi: false) ⇒ Object

For whatever reason, air gap has no location in Python API but has a location in the JSON schema. Not implemented for now. def air_gap(volume, location) command = Aspirate.new(self, volume, location) self.protocol.commands << command return command end



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/opentrons/instruments.rb', line 122

def get_next_tip(multi: false)
  location = nil
  catch :tip_found do
    tip_racks.each do |tip_rack|
      tip_rack.well_list.each do |column|
        if multi
          if column.all? {|x| x.tip}
            location = column[0]
            throw :tip_found
          end
        else
          column.each do |x|
            if x.tip
              location = x
              throw :tip_found
            end
          end
        end
      end
    end
    return false
  end

  return location
end

#inspectObject



98
99
100
# File 'lib/opentrons/instruments.rb', line 98

def inspect
  to_s
end

#pick_up_tip(location = false) ⇒ Object



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/opentrons/instruments.rb', line 148

def pick_up_tip(location=false)
  if !location
    tip_location = self.get_next_tip()
    # If no tip found and tip model is provided, create a tip rack.

    if !tip_location
      if tip_model
        tip_racks << protocol.labware.load(tip_model, protocol.labware.free_slots[-1], 'Auto-generated-tip-rack')
      else
        raise ArgumentError.new "pick_up_tip called without location and pipette is out of tips."
      end
    end
    tip_location = self.get_next_tip()
    location = tip_location
  end

  if location.is_a? Array
    well = location[0]
  else
    well = location
  end

  if !(well.tip)
    puts "Warning: Already picked up tip at #{location}."
  else
    well.tip = false
  end

  command = PickUpTip.new(self, location)
  protocol.commands.command_list << command
  return command
end

#to_hashObject



87
88
89
90
91
92
# File 'lib/opentrons/instruments.rb', line 87

def to_hash
  as_hash = {}
  as_hash["mount"] = mount
  as_hash["model"] = model
  return as_hash
end

#to_sObject



94
95
96
# File 'lib/opentrons/instruments.rb', line 94

def to_s
  "<OpenTrons::Pipette:0x#{self.__id__.to_s(16)}>"
end

#touch_tip(location) ⇒ Object



187
188
189
190
191
# File 'lib/opentrons/instruments.rb', line 187

def touch_tip(location)
  command = TouchTip.new(self, location)
  protocol.commands.command_list << command
  return command
end