Skip to content

Commit

Permalink
Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
yoldas committed Dec 22, 2024
1 parent 372b2a7 commit ce071ee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

module Submission::ScrnaCoreCdnaPrepFeasibilityCalculator

def calculate_full_allowance(number_of_cells_per_chip_well)
# "Full allowance" = ( "Chip loading volume" * 2) + 25
# 2 is because this is for 2 runs
Expand All @@ -12,7 +11,6 @@ def calculate_full_allowance(number_of_cells_per_chip_well)
scrna_config[:wastage_volume]
end


def calculate_chip_loading_volume(number_of_cells_per_chip_well)
# "Chip loading volume" = "Number of cells per chip well" / "Chip loading concentration"
number_of_cells_per_chip_well / scrna_config[:desired_chip_loading_concentration]
Expand Down
41 changes: 28 additions & 13 deletions app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# rubocop:disable Metrics/ModuleLength
module Submission::ScrnaCoreCdnaPrepFeasibilityValidator

include Submission::ScrnaCoreCdnaPrepFeasibilityCalculator

HEADER_BARCODE = 'barcode' unless defined?(HEADER_BARCODE)
Expand Down Expand Up @@ -168,22 +167,38 @@ def validate_scrna_core_cdna_prep_full_allowance
final_resuspension_volume = calculate_resuspension_volume(number_of_samples_in_smallest_pool)
full_allowance = calculate_full_allowance(number_of_cells_per_chip_well)

return if final_resuspension_volume >= full_allowance

warnings.add(
:spreadsheet,
I18n.t(
'warnings.full_allowance',
study_name: study_name,
project_name: project_name,
number_of_samples_in_smallest_pool: number_of_samples_in_smallest_pool,
final_resuspension_volume: final_resuspension_volume,
full_allowance: full_allowance
)
next if final_resuspension_volume >= full_allowance

add_warning_scrna_core_cdna_prep_full_allowance(
study_name,
project_name,
number_of_samples_in_smallest_pool,
final_resuspension_volume,
full_allowance
)
end
end

def add_warning_scrna_core_cdna_prep_full_allowance(
study_name,
project_name,
number_of_samples_in_smallest_pool,
final_resuspension_volume,
full_allowance
)
warnings.add(
:spreadsheet,
I18n.t(
'warnings.full_allowance',
study_name:,
project_name:,
number_of_samples_in_smallest_pool:,
final_resuspension_volume:,
full_allowance:
)
)
end

def calculate_number_of_samples_in_smallest_pool(rows)
barcodes, well_locations = extract_barcodes_and_well_locations(rows)
number_of_samples = calculate_total_number_of_samples(barcodes, well_locations)
Expand Down

0 comments on commit ce071ee

Please sign in to comment.