Skip to content

Commit

Permalink
Merge pull request #1597 from sanger/tnanoseq_fix_27th_feb
Browse files Browse the repository at this point in the history
BUGFIX separated export file download for tnanoseq to fetch diluent_volume from request
  • Loading branch information
andrewsparkes authored Feb 28, 2024
2 parents 16b58cd + 2eb170c commit 526b4b3
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<%
purpose_config = Settings.purposes.fetch(@plate.purpose.uuid, {})
rows_array = []
@plate.wells_in_columns.each do |well|
well.transfer_requests_as_target.each do |transfer_req|
# NB. Making assumption here that name field on asset is for a plate well
# and contains a plate barcode and well position e.g. DN12345678:A1
name_array = transfer_req.source_asset.name.split(':')
# Diluent volume stored on request
# Want volume displayed to 2 decimal places
request = Array(well.aliquots&.first&.request)&.first
diluent_volume = request.poly_metadata.select { |md| md.key == 'diluent_volume' }.first&.value&.to_f&.round(2) || nil

if name_array.length == 2
rows_array << [
name_array[0],
name_array[1],
@plate.labware_barcode.human,
well.position['name'],
transfer_req.volume.round(2),
diluent_volume
]
end
end
end
%>
<% rows_array.sort_by{ |a| WellHelpers.well_coordinate(a[1]) }.each do |row| %>
<%= CSV.generate_line row, row_sep: "" %>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%# This is a generic picking file for a Hamilton robot for variable volume plate dilutions, using requests %>
<%= render(partial: 'dilutions_headers', locals: { workflow: @workflow }) %>
<%= render(partial: 'dilutions_with_variable_volume_and_request_diluent_rows_to_csv', locals: { plate: @plate }) %>
34 changes: 18 additions & 16 deletions app/views/exports/targeted_nanoseq_pcr_xp_merged_file.csv.erb
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<%= CSV.generate_line ['Original Plate Barcode', 'Original Well ID', 'Concentration (nM)', 'Sanger Sample ID', 'Supplier Sample Name', 'Input amount available (fmol)', 'Input amount desired (fmol)', 'New Plate Barcode', 'New Well ID', 'Concentration (ng/ul)', 'Hyb Panel'], row_sep: "" %>
<% row_array = [] %>
<% @plate.wells_in_columns.each_with_index do |well, well_index| %>
<% unless well.empty? %>
<% request = Array(well.aliquots.first.request).first %>
<% sample = well.aliquots.first.sample %>
<% sample_id = sample.sanger_sample_id %>
<% supplier_sample_name = sample.sample_metadata.supplier_name %>
<% md_original_plate_barcode = request.poly_metadata.select { |md| md.key == 'original_plate_barcode' }.first&.value || nil %>
<% md_original_well_id = request.poly_metadata.select { |md| md.key == 'original_well_id' }.first&.value || nil %>
<% md_concentration_nm = request.poly_metadata.select { |md| md.key == 'concentration_nm' }.first&.value || nil %>
<% md_input_amount_available = request.poly_metadata.select { |md| md.key == 'input_amount_available' }.first&.value || nil %>
<% md_input_amount_desired = request.poly_metadata.select { |md| md.key == 'input_amount_desired' }.first&.value || nil %>
<% md_hyb_panel = request.poly_metadata.select { |md| md.key == 'hyb_panel' }.first&.value || nil %>
<% row_array.push([md_original_plate_barcode, md_original_well_id, md_concentration_nm, sample_id, supplier_sample_name, md_input_amount_available, md_input_amount_desired, @plate.human_barcode, well.location, well.latest_concentration&.value, md_hyb_panel]) %>
<% end %>
<% end %>
<%
row_array = []
@plate.wells_in_columns.each_with_index do |well, well_index|
unless well.empty?
request = Array(well.aliquots.first.request).first
sample = well.aliquots.first.sample
sample_id = sample.sanger_sample_id
supplier_sample_name = sample.sample_metadata.supplier_name
md_original_plate_barcode = request.poly_metadata.select { |md| md.key == 'original_plate_barcode' }.first&.value || nil
md_original_well_id = request.poly_metadata.select { |md| md.key == 'original_well_id' }.first&.value || nil
md_concentration_nm = request.poly_metadata.select { |md| md.key == 'concentration_nm' }.first&.value || nil
md_input_amount_available = request.poly_metadata.select { |md| md.key == 'input_amount_available' }.first&.value || nil
md_input_amount_desired = request.poly_metadata.select { |md| md.key == 'input_amount_desired' }.first&.value || nil
md_hyb_panel = request.poly_metadata.select { |md| md.key == 'hyb_panel' }.first&.value || nil
row_array.push([md_original_plate_barcode, md_original_well_id, md_concentration_nm, sample_id, supplier_sample_name, md_input_amount_available, md_input_amount_desired, @plate.human_barcode, well.location, well.latest_concentration&.value, md_hyb_panel])
end
end
%>
<% column_order = (1..12).to_a.product(('A'..'H').to_a).map(&:reverse).map(&:join) %>
<% sorted_row_array = row_array.sort_by! { |row| [row[0], column_order.index(row[1])] } %>
<% sorted_row_array.each do |row| %>
Expand Down
4 changes: 2 additions & 2 deletions config/exports/exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ hamilton_ltn_al_lib_to_qc1:
plate_includes: wells.transfer_requests_as_target.source_asset
workflow: Cherry Pick
hamilton_ltn_al_lib_to_ltn_al_lib_dil:
csv: hamilton_variable_volume_dilutions_with_well_diluents
plate_includes: wells.transfer_requests_as_target.source_asset
csv: hamilton_variable_volume_dilutions_with_request_diluents
plate_includes: wells.transfer_requests_as_target.source_asset,wells.aliquots.request.poly_metadata
workflow: Sample Dilution
cellaca_input_file:
csv: cellaca_input_file
Expand Down
36 changes: 28 additions & 8 deletions docs/creators.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Labware creators are responsible for creating new labware from a parent labware.

{include:LabwareCreators::StampedPlate}

Used directly in 116 purposes:
CLCM DNA End Prep, CLCM DNA Lib PCR XP, CLCM RNA End Prep, CLCM RNA Lib PCR XP, CLCM RT PreAmp, GBS Stock, GBS-96 Stock, GnT MDA Norm, GnT Pico End Prep, GnT Pico-XP, GnT scDNA, GnT Stock, LB Cap Lib, LB Cap Lib PCR, LB Cap Lib PCR-XP, LB cDNA, LB cDNA XP, LB Cherrypick, LB End Prep, LB Lib PCR-XP, LB Post Shear, LB Shear, LBB Cherrypick, LBB Enriched BCR, LBB Enriched BCR HT, LBB Enriched TCR, LBB Enriched TCR HT, LBB Lib-XP, LBB Ligation, LBC 3pV3 GEX Frag 2XP, LBC 3pV3 GEX PCR 2XP, LBC 5p GEX Frag 2XP, LBC 5p GEX PCR 2XP, LBC BCR Enrich1 2XSPRI, LBC BCR Enrich2 2XSPRI, LBC BCR Post PCR, LBC Stock, LBC TCR Enrich1 2XSPRI, LBC TCR Enrich2 2XSPRI, LBC TCR Post PCR, LBR Cherrypick, LBR Frag, LBR Frag cDNA, LBR Globin, LBR Globin DNase, LBR mRNA Cap, LBR Ribo DNase, LBR RiboGlobin DNase, LCA 10X cDNA, LCA PBMC, LCA PBMC Bank, LCMB Cherrypick, LCMB End Prep, LCMB Lib PCR-XP, LDS AL Lib, LDS Cherrypick, LDS Lib PCR XP, LDS Stock, LDS Stock XP, LHR End Prep, LHR PCR 1, LHR PCR 2, LHR RT, LHR-384 AL Lib, LHR-384 End Prep, LHR-384 PCR 1, LHR-384 PCR 2, LHR-384 RT, LHR-384 XP, LRC HT 5p cDNA PCR, LRC HT 5p cDNA PCR XP, LRC HT 5p Chip, LRC HT 5p GEMs, LRC PBMC Cryostor, LRC PBMC Defrost PBS, LRC PBMC Pools, LRC PBMC Pools Input, LSW-96 Stock, LTHR PCR 1, LTHR PCR 2, LTHR RT-S, LTHR-384 PCR 1, LTHR-384 PCR 2, LTN AL Lib, LTN Cherrypick, LTN Lib PCR XP, LTN Post Shear, LTN Shear, LTN Stock, LTN Stock XP, PF Cherrypicked, PF End Prep, PF Lib XP, PF Lib XP2, PF Post Shear, PF Post Shear XP, PF Shear, PF-384 End Prep, PF-384 Lib XP2, pWGS-384 AL Lib, pWGS-384 End Prep, RVI Cap Lib, RVI Cap Lib PCR, RVI Cap Lib PCR XP, RVI cDNA XP, RVI Cherrypick, RVI Lib PCR XP, RVI Lig Bind, RVI RT, scRNA cDNA-XP, scRNA End Prep, scRNA Stock, scRNA-384 cDNA-XP, scRNA-384 End Prep, scRNA-384 Stock, and Tag Plate - 384
Used directly in 112 purposes:
CLCM DNA End Prep, CLCM DNA Lib PCR XP, CLCM RNA End Prep, CLCM RNA Lib PCR XP, CLCM RT PreAmp, GBS Stock, GBS-96 Stock, GnT MDA Norm, GnT Pico End Prep, GnT Pico-XP, GnT scDNA, GnT Stock, LB Cap Lib, LB Cap Lib PCR, LB Cap Lib PCR-XP, LB cDNA, LB cDNA XP, LB Cherrypick, LB End Prep, LB Lib PCR-XP, LB Post Shear, LB Shear, LBB Cherrypick, LBB Lib-XP, LBB Ligation, LBC 3pV3 GEX Frag 2XP, LBC 3pV3 GEX PCR 2XP, LBC 5p GEX Frag 2XP, LBC 5p GEX PCR 2XP, LBC BCR Enrich1 2XSPRI, LBC BCR Enrich2 2XSPRI, LBC BCR Post PCR, LBC Stock, LBC TCR Enrich1 2XSPRI, LBC TCR Enrich2 2XSPRI, LBC TCR Post PCR, LBR Cherrypick, LBR Frag, LBR Frag cDNA, LBR Globin, LBR Globin DNase, LBR mRNA Cap, LBR Ribo DNase, LBR RiboGlobin DNase, LCA 10X cDNA, LCA PBMC, LCA PBMC Bank, LCMB Cherrypick, LCMB End Prep, LCMB Lib PCR-XP, LDS AL Lib, LDS Cherrypick, LDS Lib PCR XP, LDS Stock, LDS Stock XP, LHR End Prep, LHR PCR 1, LHR PCR 2, LHR RT, LHR-384 AL Lib, LHR-384 End Prep, LHR-384 PCR 1, LHR-384 PCR 2, LHR-384 RT, LHR-384 XP, LRC HT 5p cDNA PCR, LRC HT 5p cDNA PCR XP, LRC HT 5p Chip, LRC HT 5p GEMs, LRC PBMC Cryostor, LRC PBMC Defrost PBS, LRC PBMC Pools, LRC PBMC Pools Input, LSW-96 Stock, LTHR PCR 1, LTHR PCR 2, LTHR RT-S, LTHR-384 PCR 1, LTHR-384 PCR 2, LTN AL Lib, LTN Cherrypick, LTN Lib PCR XP, LTN Post Shear, LTN Shear, LTN Stock, LTN Stock XP, PF Cherrypicked, PF End Prep, PF Lib XP, PF Lib XP2, PF Post Shear, PF Post Shear XP, PF Shear, PF-384 End Prep, PF-384 Lib XP2, pWGS-384 AL Lib, pWGS-384 End Prep, RVI Cap Lib, RVI Cap Lib PCR, RVI Cap Lib PCR XP, RVI cDNA XP, RVI Cherrypick, RVI Lib PCR XP, RVI Lig Bind, RVI RT, scRNA cDNA-XP, scRNA End Prep, scRNA Stock, scRNA-384 cDNA-XP, scRNA-384 End Prep, scRNA-384 Stock, and Tag Plate - 384

{LabwareCreators::StampedPlate View class documentation}

Expand Down Expand Up @@ -233,19 +233,19 @@ Labware creators are responsible for creating new labware from a parent labware.

{include:LabwareCreators::PartialStampedPlateWithoutDilution}

**This labware creator is unused**
Used directly in 4 purposes:
LBB Enriched BCR, LBB Enriched BCR HT, LBB Enriched TCR, and LBB Enriched TCR HT

{LabwareCreators::PartialStampedPlateWithoutDilution View class documentation}


## LabwareCreators::PcrCyclesBinnedPlate
## LabwareCreators::PcrCyclesBinnedPlateBase

{include:LabwareCreators::PcrCyclesBinnedPlate}
{include:LabwareCreators::PcrCyclesBinnedPlateBase}

Used directly in 2 purposes:
LDS AL Lib Dil and LTN AL Lib Dil
**This labware creator is unused**

{LabwareCreators::PcrCyclesBinnedPlate View class documentation}
{LabwareCreators::PcrCyclesBinnedPlateBase View class documentation}


## LabwareCreators::PlateWithPrimerPanel
Expand Down Expand Up @@ -307,6 +307,26 @@ Labware creators are responsible for creating new labware from a parent labware.
{LabwareCreators::NormalisedBinnedPlate View class documentation}


## LabwareCreators::PcrCyclesBinnedPlateForDuplexSeq

{include:LabwareCreators::PcrCyclesBinnedPlateForDuplexSeq}

Used directly in 1 purposes:
LDS AL Lib Dil

{LabwareCreators::PcrCyclesBinnedPlateForDuplexSeq View class documentation}


## LabwareCreators::PcrCyclesBinnedPlateForTNanoSeq

{include:LabwareCreators::PcrCyclesBinnedPlateForTNanoSeq}

Used directly in 1 purposes:
LTN AL Lib Dil

{LabwareCreators::PcrCyclesBinnedPlateForTNanoSeq View class documentation}


## LabwareCreators::CustomPooledTubes

{include:LabwareCreators::CustomPooledTubes}
Expand Down
20 changes: 20 additions & 0 deletions docs/presenters.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,26 @@ GBS Stock, GBS-96 Stock, and scRNA-384 Stock
{Presenters::MinimalStockPlatePresenter View class documentation}


### Presenters::PcrCyclesBinnedPlateUsingRequestMetadataPresenter

{include:Presenters::PcrCyclesBinnedPlateUsingRequestMetadataPresenter}

Used directly in 1 purposes:
LTN AL Lib Dil

{Presenters::PcrCyclesBinnedPlateUsingRequestMetadataPresenter View class documentation}


### Presenters::PcrCyclesBinnedPlateUsingWellMetadataPresenter

{include:Presenters::PcrCyclesBinnedPlateUsingWellMetadataPresenter}

Used directly in 1 purposes:
LDS AL Lib Dil

{Presenters::PcrCyclesBinnedPlateUsingWellMetadataPresenter View class documentation}


### Presenters::PcrPresenter

{include:Presenters::PcrPresenter}
Expand Down
9 changes: 8 additions & 1 deletion spec/controllers/exports_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
it_behaves_like 'a csv view'
end

RSpec.shared_examples 'a hamilton variable volume dilutions with request diluents view' do
let(:expected_template) { 'hamilton_variable_volume_dilutions_with_request_diluents' }

it_behaves_like 'a csv view'
end

RSpec.shared_examples 'a hamilton cherrypick dilutions view' do
let(:expected_template) { 'hamilton_cherrypick_dilutions' }

Expand Down Expand Up @@ -233,9 +239,10 @@
end

context 'where csv id requested is hamilton_ltn_al_lib_to_ltn_al_lib_dil.csv' do
let(:includes) { 'wells.transfer_requests_as_target.source_asset,wells.aliquots.request.poly_metadata' }
let(:csv_id) { 'hamilton_ltn_al_lib_to_ltn_al_lib_dil' }

it_behaves_like 'a hamilton variable volume dilutions with well diluents view'
it_behaves_like 'a hamilton variable volume dilutions with request diluents view'
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/config/exports/exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ hamilton_ltn_al_lib_to_qc1:
plate_includes: wells.transfer_requests_as_target.source_asset
workflow: Cherry Pick
hamilton_ltn_al_lib_to_ltn_al_lib_dil:
csv: hamilton_variable_volume_dilutions_with_well_diluents
csv: hamilton_variable_volume_dilutions_with_request_diluents
plate_includes: wells.transfer_requests_as_target.source_asset
workflow: Sample Dilution
lcmb_pcr_xp_concentrations_for_custom_pooling:
Expand Down

0 comments on commit 526b4b3

Please sign in to comment.