libraries/PlateReaderHelper.rb
# Finds where an alpha_coordinate is in a 96 Well plate
#
# @param alpha_coord [array or string] can be a single alpha_coordinate or a list of alpha_coordinate strings ie: 'A1' or ['A1','H7']
# @return rc_list [Array] a list of [r,c] coordinates that describe where the alpha_coord(s) are in a 96 well matrix
Finds where an alpha_coordinate is in a 96 Well plate
Finds where an alpha_coordinate is in a 96 Well plate
def find_rc_from_alpha_coord(alpha_coord)
    coordinates_96 = ('A'..'H').to_a.map {|row| (1..12).to_a.map {|col| row + col.to_s}} 
    rc_list = []
    if alpha_coord.instance_of? Array
      alpha_coord.each {|a_coord|
        (!a_coord.nil?) ? coordinates_96.map.each_with_index { |row, r_idx| row.each_index.select {|col| row[col] == a_coord.upcase}.each { |c_idx| rc_list.push([r_idx, c_idx]) } } : next
      }
    else
      coordinates_96.map.each_with_index { |row, r_idx| row.each_index.select {|col| row[col] == alpha_coord.upcase}.each { |c_idx| rc_list.push([r_idx, c_idx]) } }
    end
    return rc_list
  end
def find_rc_from_alpha_coord ( alpha_coord ) coordinates_96 = ( 'A' .. 'H' ) . to_a . map { | row | ( 1 .. 12 ) . to_a . map { | col | row + col . to_s } } rc_list = [ ] if alpha_coord . instance_of? Array alpha_coord . each { | a_coord | ( ! a_coord . nil? ) ? coordinates_96 . map . each_with_index { | row , r_idx | row . each_index . select { | col | row [ col ] == a_coord . upcase } . each { | c_idx | rc_list . push ( [ r_idx , c_idx ] ) } } : next } else coordinates_96 . map . each_with_index { | row , r_idx | row . each_index . select { | col | row [ col ] == alpha_coord . upcase } . each { | c_idx | rc_list . push ( [ r_idx , c_idx ] ) } } end return rc_list end
Finds where an alpha_coordinate is in a 96 Well plate
Finds where an alpha_coordinate is in a 96 Well plate
# look for where alpha coord is 2-D array coord # alpha_coord = alpha_coord.map {|a| a.upcase}
rc_list  a list of [r,c] coordinates that describe where the alpha_coord(s) are in a 96 well matrix
rc_list a list of [ r c ] coordinates that describe where the alpha_coord ( s ) are in a 96 well matrix
Array
alpha_coord
can be a single alpha_coordinate or a list of alpha_coordinate strings ie: 'A1' or ['A1','H7']
can be a single alpha_coordinate or a list of alpha_coordinate strings ie : ' A1 ' or [ ' A1 ' ' H7 ' ]