libraries/HighThroughputHelper.rb
# Slice sorted cultures array to fit the dimensions of the given collection
Slice sorted cultures array to fit the dimensions of the given collection
Slice sorted cultures array to fit the dimensions of the given collection
def format_cultures_to_object_type(sorted_cultures:, object_type:)
    matrix_arr = sorted_cultures.each_slice(object_type.columns).map do |slice|
      slice = format_slice(slice, object_type.columns)
      Matrix.columns(slice) 
    end
    max_rows = object_type.rows
    stack_arr_idx = 0
    matricies_to_stack = Array.new(15) {[]} 
    matrix_arr.map do |m| 
      max_rows -= m.row_count
      if max_rows > 0
        matricies_to_stack[stack_arr_idx].push(m)
      else
        stack_arr_idx += 1
        matricies_to_stack[stack_arr_idx].push(m)
        max_rows = object_type.rows - m.row_count
      end
    end
    formatted_matricies = matricies_to_stack.select {|i| !i.empty? }.map {|matrix_arr| vstack_matrix_array(matrix_arr: matrix_arr) }
    return formatted_matricies
  end
def format_cultures_to_object_type ( sorted_cultures : , object_type : ) matrix_arr = sorted_cultures . each_slice ( object_type . columns ) . map do | slice | slice = format_slice ( slice , object_type . columns ) Matrix . columns ( slice ) end max_rows = object_type . rows stack_arr_idx = 0 matricies_to_stack = Array . new ( 15 ) { [ ] } matrix_arr . map do | m | max_rows -= m . row_count if max_rows > 0 matricies_to_stack [ stack_arr_idx ] . push ( m ) else stack_arr_idx += 1 matricies_to_stack [ stack_arr_idx ] . push ( m ) max_rows = object_type . rows - m . row_count end end formatted_matricies = matricies_to_stack . select { | i | ! i . empty? } . map { | matrix_arr | vstack_matrix_array ( matrix_arr : matrix_arr ) } return formatted_matricies end
Slice sorted cultures array to fit the dimensions of the given collection
Slice sorted cultures array to fit the dimensions of the given collection
# After the columns/reps have been sliced I want to prevent replicates from getting placed on different collections # TODO: 15 is arbitray, essentially max amount of plates per op
sorted_cultures
object_type