Conversation
…ubmission types. also update the logic behind comparing aliquots
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5769 +/- ##
===========================================
- Coverage 87.36% 87.29% -0.07%
===========================================
Files 1477 1477
Lines 33526 33535 +9
Branches 3550 3552 +2
===========================================
- Hits 29290 29275 -15
- Misses 4215 4239 +24
Partials 21 21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
andrewsparkes
left a comment
There was a problem hiding this comment.
Looks good. Clear comments, thorough tests, thanks.
KatyTaylor
left a comment
There was a problem hiding this comment.
A few things to consider.
Would be good to test it on at least one plate from each of the mentioned pipelines.
| def under_represented_well_comments | ||
| request_with_under_represented_wells.flat_map do |request| | ||
| build_comments_for_request(request) | ||
| requests.flat_map do |batch_request| |
There was a problem hiding this comment.
| requests.flat_map do |batch_request| | |
| requests.flat_map do |sequencing_request| |
Think it's confusing to call this variable batch_request since that there is actually a different model / table called batch_request, and this is a request.
(Also applicable to naming in a couple of other methods).
There was a problem hiding this comment.
@KatyTaylor - they are actually batch_requests (which can be/usually are sequencing requests). As we are reading from the model Batch:
sequencescape/app/models/batch.rb
Line 44 in fd134ce
There was a problem hiding this comment.
Batch.last.requests.first.class
=> HiSeqSequencingRequest (a type of Request)
Batch.last.batch_requests.first.class
=> BatchRequest (not a type of Request - a join table)
| def under_rep_requests_for_lane(lane) | ||
| lane.ancestors.grep(Plate) | ||
| .flat_map(&:wells) | ||
| .flat_map(&:requests) |
There was a problem hiding this comment.
Above line will return duplicate Requests, as multiple Plates in a pipeline point to the same Request. Might also get some nils, as some Plates (e.g. first ones in a Pipeline, or ones that don't require Requests) will not point to a Request. Could do a .uniq.compact
| # @param batch_request [Request] the sequencing request whose position is used in the comment | ||
| # @return [Array<UnderRepWellComment>] comments built for the given lane | ||
| def build_comments_for_lane(lane, batch_request) | ||
| under_rep_requests_for_lane(lane).flat_map do |library_request| |
There was a problem hiding this comment.
Could mention in the comment that we are assuming it's a library_request as that is the known use case. The way it's retrieved does not enforce it.
| request.target_asset.aliquots.filter_map do |aliquot| | ||
| lane = request.asset.descendants.last | ||
| next unless aliquot_matches_lane?(lane, aliquot) | ||
| # @param library_request [Request] the library request whose target_asset well holds the aliquots |
There was a problem hiding this comment.
This is a limitation in the original design. Since we are storing the polymetadata on request, not well, it only works for plates that have a request 'finishing' in them. If you try to mark a well on an 'intermediate' plate as under-represented, this will assume that it came from a different plate. Think we need to state this explicitly somewhere and maybe code in some guards against it.
|
|
||
| UnderRepWellComment.new( | ||
| position: lane.source_request.position, | ||
| position: batch_request.position, |
There was a problem hiding this comment.
I think this is the Request, not the Batch Request, so you should pass through the Batch Request instead to get the position.
There was a problem hiding this comment.
There are actually batch requests type, that is why we can the read the position
There are actually batch requests type, that is why we can the read the position
There was a problem hiding this comment.
position can be accessed directly from the sequencing request as it's joined to batch request,
batch.requests.first.position or batch.request.first.batch_request.position
There was a problem hiding this comment.
OK I hadn't noticed that Request delegates position to BatchRequest in app/models/batch/request_behaviour.rb, so that's how it works 👍
Just some variable naming to make a bit clearer then.
| def aliquot_matches_lane?(lane, aliquot) | ||
| lane.aliquots.any? { |a| a.aliquot_index_value == aliquot.tag.map_id } | ||
| # @return [Aliquot, nil] the matching lane aliquot, or nil if no match is found | ||
| def find_matching_lane_aliquot(lane, aliquot) |
There was a problem hiding this comment.
Could use the equivalent? method on Aliquot. There's also a matches? method, but it allows the upstream aliquot to be untagged, which is less strict.
Co-authored-by: KatyTaylor <kt17@sanger.ac.uk>
I tested on the RNA pipeline but also with different scenarios |
Co-authored-by: KatyTaylor <kt17@sanger.ac.uk>
Closes #
Changes proposed in this pull request
Instructions for Reviewers
[All PRs] - Confirm PR template filled
[Feature Branches] - Review code
[Production Merges to
main]- Check story numbers included
- Check for debug code
- Check version