diff --git a/app/uat_actions/uat_actions/generate_tubes.rb b/app/uat_actions/uat_actions/generate_tubes.rb index 03cba1c767..aba72d9a42 100644 --- a/app/uat_actions/uat_actions/generate_tubes.rb +++ b/app/uat_actions/uat_actions/generate_tubes.rb @@ -48,7 +48,10 @@ def perform sanger_sample_id: sample_name, studies: [study], sample_metadata_attributes: { - supplier_name: sample_name + supplier_name: sample_name, + collected_by: UatActions::StaticRecords.collection_site, + donor_id: "#{sample_name}_donor", + sample_common_name: 'human' } ), study: study diff --git a/config/default_records/request_types/014_limber_scrna_core_cdna_prep_request_types.yml b/config/default_records/request_types/014_limber_scrna_core_cdna_prep_request_types.yml index 2137f389da..8cc4d0525e 100644 --- a/config/default_records/request_types/014_limber_scrna_core_cdna_prep_request_types.yml +++ b/config/default_records/request_types/014_limber_scrna_core_cdna_prep_request_types.yml @@ -15,7 +15,8 @@ limber_scrna_core_cdna_prep_gem_x_5p: acceptable_purposes: - LRC Bank Seq - LRC Bank Spare - - LRC Bank Input + - LRC Bank Input 1ml + - LRC Bank Input 08ml limber_scrna_core_cdna_prep_gem_x_5p_gems_input: name: scRNA Core cDNA Prep GEM-X 5p GEMs Input asset_type: Well diff --git a/config/default_records/tube_purposes/008_scrna_core_cdna_prep_tube_purposes.yml b/config/default_records/tube_purposes/008_scrna_core_cdna_prep_tube_purposes.yml index 9b61e245ae..a822c8e054 100644 --- a/config/default_records/tube_purposes/008_scrna_core_cdna_prep_tube_purposes.yml +++ b/config/default_records/tube_purposes/008_scrna_core_cdna_prep_tube_purposes.yml @@ -12,7 +12,12 @@ LRC Bank Spare: target_type: SampleTube stock_plate: false -LRC Bank Input: +LRC Bank Input 1ml: + type: Tube::Purpose + target_type: SampleTube + stock_plate: true + +LRC Bank Input 08ml: type: Tube::Purpose target_type: SampleTube stock_plate: true diff --git a/config/initializers/scrna_config.rb b/config/initializers/scrna_config.rb index 5e477097bc..9b3e8ae1d1 100644 --- a/config/initializers/scrna_config.rb +++ b/config/initializers/scrna_config.rb @@ -33,7 +33,7 @@ # Key for the required number of cells metadata stored on Study (in poly_metadata) study_required_number_of_cells_per_sample_in_pool_key: 'scrna_core_pbmc_donor_pooling_required_number_of_cells', # Default viability threshold when passing/failing samples (in percent) - viability_default_threshold: 65, + viability_default_threshold: 50, # Default total cell count threshold when passing/failing samples total_cell_count_default_threshold: 50_000, # Key for the number of cells per chip well metadata stored on pool wells (in poly_metadata) diff --git a/spec/uat_actions/generate_tubes_spec.rb b/spec/uat_actions/generate_tubes_spec.rb index 6d377ecdfc..9183eecc09 100644 --- a/spec/uat_actions/generate_tubes_spec.rb +++ b/spec/uat_actions/generate_tubes_spec.rb @@ -19,10 +19,31 @@ before { allow(AssetBarcode).to receive(:new_barcode).and_return('2') } - it 'can be performed' do + it 'performs the action successfully' do expect(uat_action.perform).to be true + end + + it 'returns the expected barcode in the report' do + uat_action.perform expect(uat_action.report['tube_0']).to eq report['tube_0'] - expect(Tube.find_by_barcode(report['tube_0']).aliquots.first.study).to eq study + end + + it 'assigns the correct study to the tube' do + uat_action.perform + tube = Tube.find_by_barcode(report['tube_0']) + expect(tube.aliquots.first.study).to eq study + end + + it 'sets the correct sample metadata values' do + uat_action.perform + tube = Tube.find_by_barcode(report['tube_0']) + sample_metadata = tube.aliquots.first.sample.sample_metadata + expect(sample_metadata).to have_attributes( + supplier_name: 'sample_NT2P_0', + collected_by: UatActions::StaticRecords.collection_site, + donor_id: 'sample_NT2P_0_donor', + sample_common_name: 'human' + ) end end @@ -38,12 +59,29 @@ before { allow(AssetBarcode).to receive(:new_barcode).and_return('3', '4', '5') } - it 'can be performed' do + it 'performs the action successfully' do expect(uat_action.perform).to be true + end + + it 'returns the expected barcodes in the report' do + uat_action.perform expect(uat_action.report['tube_0']).to eq report['tube_0'] expect(uat_action.report['tube_1']).to eq report['tube_1'] expect(uat_action.report['tube_2']).to eq report['tube_2'] end + + it 'sets the correct sample metadata values for each tube' do + uat_action.perform + uat_action.report.each_with_index do |(_key, barcode), i| + sample_metadata = Tube.find_by_barcode(barcode).aliquots.first.sample.sample_metadata + expect(sample_metadata).to have_attributes( + supplier_name: "sample_#{barcode}_#{i}", + collected_by: UatActions::StaticRecords.collection_site, + donor_id: "sample_#{barcode}_#{i}_donor", + sample_common_name: 'human' + ) + end + end end context 'when creating the tube with a fluidx foreign barcode' do @@ -55,17 +93,38 @@ foreign_barcode_type: 'FluidX' } end - let(:report) do + let(:expected_report) do # Tube NT6T created with foreign barcode based on machine barcode { 'tube_0' => 'SA00006844' } end before { allow(AssetBarcode).to receive(:new_barcode).and_return('6') } - it 'can be performed' do + it 'performs the action successfully' do expect(uat_action.perform).to be true - expect(uat_action.report['tube_0']).to eq report['tube_0'] - expect(Tube.find_by_barcode(report['tube_0']).aliquots.first.study).to eq study + end + + it 'returns the expected barcode in the report' do + uat_action.perform + expect(uat_action.report['tube_0']).to eq expected_report['tube_0'] + end + + it 'assigns the correct study to the tube' do + uat_action.perform + tube = Tube.find_by_barcode(expected_report['tube_0']) + expect(tube.aliquots.first.study).to eq study + end + + it 'sets the correct sample metadata values' do + uat_action.perform + tube = Tube.find_by_barcode(expected_report['tube_0']) + sample_metadata = tube.aliquots.first.sample.sample_metadata + expect(sample_metadata).to have_attributes( + supplier_name: 'sample_NT6T_0', + collected_by: UatActions::StaticRecords.collection_site, + donor_id: 'sample_NT6T_0_donor', + sample_common_name: 'human' + ) end end end