Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/sanger/limber into dpl95…
Browse files Browse the repository at this point in the history
…1_ruby_3
  • Loading branch information
emrojo committed Nov 6, 2023
2 parents 74a8444 + 5602382 commit 1aef723
Show file tree
Hide file tree
Showing 17 changed files with 957 additions and 255 deletions.
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.38.0
3.39.0
159 changes: 83 additions & 76 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,67 +28,67 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
actioncable (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.4)
actionpack (= 7.0.4)
activejob (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
actionmailbox (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.4)
actionpack (= 7.0.4)
actionview (= 7.0.4)
activejob (= 7.0.4)
activesupport (= 7.0.4)
actionmailer (7.0.7.2)
actionpack (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activesupport (= 7.0.7.2)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.4)
actionview (= 7.0.4)
activesupport (= 7.0.4)
rack (~> 2.0, >= 2.2.0)
actionpack (7.0.7.2)
actionview (= 7.0.7.2)
activesupport (= 7.0.7.2)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.4)
actionpack (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
actiontext (7.0.7.2)
actionpack (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.4)
activesupport (= 7.0.4)
actionview (7.0.7.2)
activesupport (= 7.0.7.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.4)
activesupport (= 7.0.4)
activejob (7.0.7.2)
activesupport (= 7.0.7.2)
globalid (>= 0.3.6)
activemodel (7.0.4)
activesupport (= 7.0.4)
activerecord (7.0.4)
activemodel (= 7.0.4)
activesupport (= 7.0.4)
activestorage (7.0.4)
actionpack (= 7.0.4)
activejob (= 7.0.4)
activerecord (= 7.0.4)
activesupport (= 7.0.4)
activemodel (7.0.7.2)
activesupport (= 7.0.7.2)
activerecord (7.0.7.2)
activemodel (= 7.0.7.2)
activesupport (= 7.0.7.2)
activestorage (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activesupport (= 7.0.7.2)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.4)
activesupport (7.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -124,6 +124,7 @@ GEM
crack (0.4.5)
rexml
crass (1.0.6)
date (3.3.3)
diff-lcs (1.5.0)
docile (1.4.0)
erubi (1.12.0)
Expand Down Expand Up @@ -160,8 +161,8 @@ GEM
faraday (~> 1.0)
ffi (1.15.5)
formatador (1.1.0)
globalid (1.0.1)
activesupport (>= 5.0)
globalid (1.2.1)
activesupport (>= 6.1)
guard (2.18.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
Expand All @@ -178,7 +179,7 @@ GEM
rspec (>= 2.99.0, < 4.0)
hashdiff (1.0.1)
hashie (5.0.0)
i18n (1.13.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
inline_svg (1.8.0)
activesupport (>= 3.0)
Expand All @@ -196,32 +197,36 @@ GEM
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.21.3)
loofah (2.21.4)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
lumberjack (1.2.8)
mail (2.7.1)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.8.2)
minitest (5.18.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.20.0)
msgpack (1.5.1)
multi_json (1.15.0)
multipart-post (2.2.3)
nenv (0.3.0)
net-imap (0.3.1)
net-imap (0.4.2)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.1.3)
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-smtp (0.4.0)
net-protocol
nio4r (2.5.9)
nokogiri (1.15.2)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
notiffany (0.1.3)
Expand All @@ -240,42 +245,44 @@ GEM
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.0.0)
puma (6.0.0)
puma (6.3.1)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.4)
rack-mini-profiler (3.0.0)
rack (>= 1.2.0)
rack-proxy (0.7.4)
rack
rack-test (2.0.2)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.4)
actioncable (= 7.0.4)
actionmailbox (= 7.0.4)
actionmailer (= 7.0.4)
actionpack (= 7.0.4)
actiontext (= 7.0.4)
actionview (= 7.0.4)
activejob (= 7.0.4)
activemodel (= 7.0.4)
activerecord (= 7.0.4)
activestorage (= 7.0.4)
activesupport (= 7.0.4)
rails (7.0.7.2)
actioncable (= 7.0.7.2)
actionmailbox (= 7.0.7.2)
actionmailer (= 7.0.7.2)
actionpack (= 7.0.7.2)
actiontext (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activemodel (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
bundler (>= 1.15.0)
railties (= 7.0.4)
railties (= 7.0.7.2)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
railties (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -372,8 +379,8 @@ GEM
state_machines (0.6.0)
thor (1.2.1)
tilt (2.0.11)
timeout (0.3.0)
tzinfo (2.0.5)
timeout (0.4.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
Expand All @@ -394,14 +401,14 @@ GEM
semantic_range (>= 2.3.0)
webrick (1.7.0)
websocket (1.2.9)
websocket-driver (0.7.5)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.28)
webrick (~> 1.7.0)
zeitwerk (2.6.8)
zeitwerk (2.6.12)

PLATFORMS
ruby
Expand Down
4 changes: 4 additions & 0 deletions app/sequencescape/sequencescape/api/v2/well.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def latest_live_cell_count
latest_qc(key: 'live_cell_count', units: 'cells/ml')
end

def latest_cell_viability
latest_qc(key: 'viability', units: '%')
end

def latest_qc(key:, units:)
qc_results.to_a # Convert to array to resolve any api queries. Otherwise select fails to work.
.select { |qc| qc.key.casecmp(key).zero? }
Expand Down
81 changes: 81 additions & 0 deletions app/views/exports/pbmc_bank_tubes_content_report.csv.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<%# This is a report of the contents of the tubes in the PBMC Bank plate %>
<%# Based on app/views/exports/hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare.csv.erb %>
<%= CSV.generate_line ['Workflow', @workflow], row_sep: '' %>

<%=
CSV.generate_line [
'Well name',
'Donor ID',
'Stock barcode',
'FluidX barcode',
'Extraction and freeze date',
'Sequencing or contingency',
'Cell count (cells/ml)',
'Viability (%)',
'Volume (µl)',
'Study name',
'Collection site'
],
row_sep: ''
%>
<%
rows_array = []
@plate.wells_in_columns.each do |source_well|
# skip if well empty (not all wells have samples in them)
next if source_well.empty?

# skip if well not in passed state
next unless source_well.passed?

# skip if no downstream tubes for this well (not set up children in Limber yet)
next if source_well.downstream_tubes.empty?

child_tube_v1 = source_well.downstream_tubes.last
child_tube_v2 =
Sequencescape::Api::V2.tube_with_custom_includes(
'custom_metadatum_collection',
nil,
barcode: child_tube_v1.labware_barcode.machine
)

next unless child_tube_v2 && child_tube_v2.custom_metadatum_collection

# get tube metadata from child_tube
metadata = child_tube_v2.custom_metadatum_collection.metadata

next unless metadata

tube_rack_barcode = metadata['tube_rack_barcode']
tube_rack_position = metadata['tube_rack_position']

next unless tube_rack_barcode && tube_rack_position

sample_uuid = source_well.aliquots.first.sample.uuid
source_well_posn = source_well.position['name']

sample_metadata = source_well.aliquots.first.sample.sample_metadata

# donor_id is sourced from the sample metadata provided by Sequencescape
donor_id = sample_metadata.respond_to?(:donor_id) ? sample_metadata.donor_id : nil
child_tube_purpose = child_tube_v2.purpose.name
destination = ((child_tube_purpose == 'LRC Blood Seq') ? 'Sequencing' : 'Contingency')
volume = 135

rows_array << [
source_well.name, # Well name
donor_id, # Donor ID
@ancestor_tubes[sample_uuid].labware_barcode.human, # LRC Blood Vac purpose barcode
child_tube_v2.barcode, # FluidX barcode
child_tube_v2.created_at, # Extraction and freeze date
destination, # Sequencing or contingency
source_well.latest_live_cell_count.value, # Cell count
source_well.latest_cell_viability.value, # Viability
volume, # Volume
source_well.aliquots.first.study.name, # Study name
source_well.aliquots.first.sample.sample_metadata&.collected_by # Collection site
]
end
%>
<% rows_array.sort_by{ |a| WellHelpers.well_coordinate(a[0]) }.each do |row| %>
<%= CSV.generate_line(row.map(&:to_s), row_sep: '').html_safe %>
<% end %>
9 changes: 9 additions & 0 deletions config/exports/exports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,12 @@ hamilton_lrc_blood_bank_to_lrc_pbmc_bank:
- wells.transfer_requests_as_target.source_asset
ancestor_tube_purpose: LRC Blood Vac
ancestor_purpose: LRC Blood Bank
pbmc_bank_tubes_content_report:
csv: pbmc_bank_tubes_content_report
workflow: scRNA Core PBMC Bank
plate_includes:
- wells.downstream_tubes
- wells.aliquots
- wells.aliquots.sample
- wells.aliquots.sample.sample_metadata
ancestor_tube_purpose: LRC Blood Vac
2 changes: 2 additions & 0 deletions config/purposes/scrna_core_cell_extraction.wip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ LRC PBMC Bank:
id: hamilton_lrc_blood_bank_to_lrc_pbmc_bank
- name: 'Download Hamilton LRC PBMC Bank plate to LRC Bank Seq and Spare tubes CSV'
id: hamilton_lrc_pbmc_bank_to_lrc_bank_seq_and_spare
- name: 'Download PBMC Bank Tubes Content Report'
id: pbmc_bank_tubes_content_report
:qc_thresholds:
viability:
units: '%'
Expand Down
Loading

0 comments on commit 1aef723

Please sign in to comment.