libraries/FlowCytometryHelper.rb
# Associate a matrix containing all `uploads` to `collection`.
# The upload matrix will map exactly to the sample matrix of
# `collection`, and it will be associated to `collection` as a value
# of `key_name`
#
# @param [String] key_name  the key that the upload matrix will
#           be associated under
# @param [Collection] collection  what the upload matrix will be
#           associated to
# @param [Array<Upload>] uploads  An Array containing several Uploads
# @effects  associates all the given uploads to `collection` as a 2D array inside a singleton hash
Associate a matrix containing all `uploads` to `collection`.
Associate a matrix containing all ` uploads ` to ` collection ` .
def associate_uploads_to_plate(key_name:, collection:, uploads:)
    ot = collection.object_type
    uploads_well_matrix = Array.new(ot.rows) { Array.new(ot.columns) { EMPTY } }
    uploads.each do |up|
      alpha_coord = up.name[0..2]
      r_i, c_i = get_rc_from_alpha_coords(alpha_coord: alpha_coord)
      uploads_well_matrix[r_i][c_i] = up.id
    end
    collection_associations = AssociationMap.new(collection)
    unless collection_associations.get(key_name).nil?
      i = 0
      i += 1 until collection_associations.get("#{key_name}_#{i}").nil?
      key_name = "#{key_name}_#{i}"
    end
    collection_associations.put(key_name, {'upload_matrix' => uploads_well_matrix })
    collection_associations.save
  end
def associate_uploads_to_plate ( key_name : , collection : , uploads : ) ot = collection . object_type uploads_well_matrix = Array . new ( ot . rows ) { Array . new ( ot . columns ) { EMPTY } } uploads . each do | up | alpha_coord = up . name [ 0 .. 2 ] r_i , c_i = get_rc_from_alpha_coords ( alpha_coord : alpha_coord ) uploads_well_matrix [ r_i ] [ c_i ] = up . id end collection_associations = AssociationMap . new ( collection ) unless collection_associations . get ( key_name ) . nil? i = 0 i += 1 until collection_associations . get ( "#{key_name}_#{i}" ) . nil? key_name = "#{key_name}_#{i}" end collection_associations . put ( key_name , { 'upload_matrix' => uploads_well_matrix } ) collection_associations . save end
Associate a matrix containing all `uploads` to `collection`.
Associate a matrix containing all ` uploads ` to ` collection ` .
# ensure we aren't overwriting an existing association
key_name
collection
uploads
uploads An Array containing several Uploads
uploads An Array containing several Uploads
effects
associates all the given uploads to `collection` as a 2D array inside a singleton hash
associates all the given uploads to ` collection ` as a 2D array inside a singleton hash