Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Y24-083 cell counting driver file lrc pbs defrost plate #1750

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions app/views/exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca.csv.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<%# This template generates Hamilton LRC PBMC Defrost PBS to Cellaca CSV download. %>
<%= CSV.generate_line [
'Workflow',
@workflow
],
row_sep: ''
%>
<%= CSV.generate_line [], row_sep: "" %>
<%=
CSV.generate_line [
'Plate Barcode',
'Well Position',
'Vac Tube Barcode',
'Sample Name',
'Well Name'
], row_sep: ''
%>
<%
rows_array = []
filtered_wells = @plate.wells_in_columns.reject { |well| well.empty? || well.failed? }
filtered_wells.each do | well |
sample = well.aliquots.first.sample
row = [
@plate.labware_barcode.human,
well.location,
sample.sample_metadata.supplier_name,
sample.name,
well.name
]
rows_array << row
end
%>
<% rows_array.each do |row| %>
<%= CSV.generate_line row, row_sep: "" %>
<% end %>
12 changes: 7 additions & 5 deletions config/exports/exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,26 +193,28 @@ hamilton_lrc_gem_x_5p_cherrypick_to_lrc_gem_x_5p_gex_dil:
csv: hamilton_fixed_volume_dilutions
plate_includes: wells.transfer_requests_as_target.source_asset
workflow: Sample Dilution

hamilton_lrc_pbmc_defrost_pbs_to_cellaca:
csv: hamilton_lrc_pbmc_defrost_pbs_to_cellaca
workflow: scRNA Core LRC PBMC Defrost PBS Cell Count
plate_includes:
- wells.qc_results
- wells.transfer_requests_as_target.source_asset
- wells.aliquots.study.poly_metadata
hamilton_lrc_pbmc_bank_to_cellaca_common: &hamilton_lrc_pbmc_bank_to_cellaca_common
workflow: scRNA Core LRC PBMC Bank Cell Count
plate_includes:
- wells.aliquots
- wells.aliquots.sample
- wells.aliquots.sample.sample_metadata

hamilton_lrc_pbmc_bank_to_cellaca_4_count:
<<: *hamilton_lrc_pbmc_bank_to_cellaca_common
csv: hamilton_lrc_pbmc_bank_to_cellaca_4_count

hamilton_lrc_pbmc_bank_to_cellaca_6_count:
<<: *hamilton_lrc_pbmc_bank_to_cellaca_common
csv: hamilton_lrc_pbmc_bank_to_cellaca_6_count

hamilton_lrc_pbmc_bank_to_cellaca_12_count:
<<: *hamilton_lrc_pbmc_bank_to_cellaca_common
csv: hamilton_lrc_pbmc_bank_to_cellaca_12_count

hamilton_lrc_pbmc_bank_to_cellaca_all_count:
<<: *hamilton_lrc_pbmc_bank_to_cellaca_common
csv: hamilton_lrc_pbmc_bank_to_cellaca_all_count
18 changes: 2 additions & 16 deletions config/purposes/scrna_core_cdna_prep.wip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,8 @@ LRC PBMC Defrost PBS:
:asset_type: plate
:label_template: plate_quad_qc # creates QC4 barcodes
:file_links:
- name: 'Download Cellaca Input QC1'
id: cellaca_input_file
params:
page: 0
- name: 'Download Cellaca Input QC2'
id: cellaca_input_file
params:
page: 1
- name: 'Download Cellaca Input QC3'
id: cellaca_input_file
params:
page: 2
- name: 'Download Cellaca Input QC4'
id: cellaca_input_file
params:
page: 3
- name: 'Download Cellaca Count CSV'
id: hamilton_lrc_pbmc_defrost_pbs_to_cellaca
:qc_thresholds:
viability:
units: '%'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# frozen_string_literal: true

RSpec.describe 'exports/hamilton_lrc_pbmc_defrost_pbs_to_cellaca.csv.erb' do
has_a_working_api

let(:wells) do
(1..12).map do |index| # one-based index
supplier_name = "vac-tube-barcode-#{index}"
sample_metadata = create(:v2_sample_metadata, supplier_name: supplier_name)
sample = create(:v2_sample, sample_metadata: sample_metadata)
aliquots = [create(:v2_aliquot, sample: sample)]
location = WellHelpers.well_at_column_index(index - 1)
create(:v2_well, aliquots: aliquots, location: location)
end
end

let(:plate) do
# Empty wells will be filtered out.
wells[0].aliquots = []
wells[1].aliquots = []

# Failed wells will be filtered out.
wells[2].state = 'failed'
wells[3].state = 'failed'

create(:v2_plate, wells: wells)
end

let(:workflow) { 'scRNA Core LRC PBMC Defrost PBS Cell Count' }

let(:expected_content) do
header = [
['Workflow', workflow],
[],
['Plate Barcode', 'Well Position', 'Vac Tube Barcode', 'Sample Name', 'Well Name']
]
body =
(5..12).map do |index| # one-based index
well = plate.wells_in_columns[index - 1]
sample = well.aliquots.first.sample
[plate.labware_barcode.human, well.location, sample.sample_metadata.supplier_name, sample.name, well.name]
end
header + body
end

before do
assign(:plate, plate)
assign(:workflow, workflow)
end

it 'renders the expected content' do
rows = CSV.parse(render)
expect(rows.size).to eq(11) # 8 body + 3 header rows
expect(rows).to eq(expected_content)
end
end
Loading