mehta-lab / multiSero

serological measurements from multiplexed ELISA assays
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Nonetype well registration #70

Closed bryantChhun closed 4 years ago

bryantChhun commented 4 years ago

BUG FIX 1) This PR fixes issue #63, which describes a complaint that the od_well object is not subscriptable. This occurs when there is a well registration failure, causing the od_well to not be written. Later, when all the od_wells are pulled for report generation, the error is thrown.

2) This PR also fixes another bug regarding MockRegionprop -- if the shape of the supplied image is different from the shape of the "disk" mask, it will throw an error. This occurred in rare cases where the spot centroid is near an image edge, and sometimes other cases.

3) A secondary problem occurred when trying to fix this:

Solution 1) The Nonetype problem is solved by including a check at the time of report generation. Now, when None is found for the well, it will return -999 (rather than attempt to subscript). 2) This PR modifies the way MockRegionprop automatically calculates median intensity. It now includes a shape check before attempting to slice into the supplied image data. 3) This PR also contains a check on that length and will auto-truncate if necessary.

codecov-commenter commented 4 years ago

Codecov Report

Merging #70 into master will increase coverage by 0.68%. The diff coverage is 19.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #70      +/-   ##
==========================================
+ Coverage   35.80%   36.49%   +0.68%     
==========================================
  Files          23       24       +1     
  Lines        1606     1625      +19     
==========================================
+ Hits          575      593      +18     
- Misses       1031     1032       +1     
Flag Coverage Δ
#unittests 36.49% <19.44%> (+0.68%) :arrow_up:
Impacted Files Coverage Δ
array_analyzer/load/debug_plots.py 14.28% <0.00%> (-0.15%) :arrow_down:
array_analyzer/transform/point_registration.py 7.86% <0.00%> (ø)
array_analyzer/workflows/interpolation_wf.py 24.24% <0.00%> (ø)
array_analyzer/workflows/registration_workflow.py 20.00% <0.00%> (-0.23%) :arrow_down:
array_analyzer/extract/img_processing.py 12.82% <5.00%> (+0.06%) :arrow_up:
array_analyzer/load/report.py 23.33% <18.75%> (+9.04%) :arrow_up:
array_analyzer/utils/mock_regionprop.py 27.27% <20.00%> (+0.60%) :arrow_up:
tests/test_debug_plots.py 100.00% <100.00%> (ø)
tests/test_metadata.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 601efec...ce916be. Read the comment docs.

bryantChhun commented 4 years ago

@jennyfolkesson please take a look at the new commits. In particular, let me know what you think about the changes to MockRegionProp -- such as the shape check on image/mask. For some tests I ran on difficult data, this check definitely gets used (writes '-1' as median intensity).

EDIT: actually, I just noticed in your other PR that you've made this change to MockRegionProp already. We can switch to yours if it handles this problem appropriately too. Maybe ignore this PR's version of MockRegionProp