mehta-lab / multiSero

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

Write antigen report throws error #63

Closed gt8mar closed 4 years ago

gt8mar commented 4 years ago

Describe the bug See screenshot below. The bug is caused because there is nothing in the antigen_position array. In the metadata, there are "empty" and "Blank" entries where there aren't antigens. Perhaps these should be " " or "None"?

The function write_antigen_report() appears to have code to ignore the previous two entries, but not "empty" or "blank".

To Reproduce Steps to reproduce the behavior:

  1. Run folder: /ELISAarrayReader/images_cuttlefish/2020-05-02-13-49-02-COVID_May2_JVassay_FcIgGplate_images/rotated/ or "/ELISAarrayReader/images_cuttlefish/2020-05-01-17-29-54-COVID_May1_JBassay_images/rotated/
  2. Run pysero.py using pysero-fishy_registration (5-15-2020)

Expected behavior Error with screenshot below:

Screenshots

Issue_error_05172020

Operating environment (please complete the following information):

Additional context metadata file: "/ELISAarrayReader/images_cuttlefish/2020-05-02-13-49-02-COVID_May2_JVassay_FcIgGplate_images/rotated/pysero_output_data_metadata.xlsx"

bryantChhun commented 4 years ago

I've isolated the offender -- it's well E5 in that data. Specifically, the spot detection must be failing, resulting in "None" being written to the 96-well "od_well" array (it would also be "None" in Int-array and BG-array, if it got that far).

I think the solution here touches on other issues too -- we should report failed spots and handle them gracefully here. There's another slight issue here too: the "od_well" array is an 8x12 array (96-wells) of objects. It's initialized as such in metadata.py:

def _calc_empty_plate_const():

    constants.WELL_BG_ARRAY = np.empty((8, 12), dtype=object)
    constants.WELL_INT_ARRAY = np.empty((8, 12), dtype=object)
    constants.WELL_OD_ARRAY = np.empty((8, 12), dtype=object)

instead we could use:

def _calc_empty_plate_const():

    constants.WELL_BG_ARRAY = np.zeros((8, 12, row, col), dtype='float64')
    constants.WELL_INT_ARRAY = np.zeros((8, 12, row, col), dtype='float64')
    constants.WELL_OD_ARRAY = np.zeros((8, 12, row, col), dtype='float64')

Of course this needs to be tested. I'll start a new PR for that.

bryantChhun commented 4 years ago

Ok there are several ways to fix this but. One way that is currently in branch nonetype_well_registration is to check for None types and assign a value instead (-999 in this case)

The other problem that arose is, may1 and may2 data have antigens with very long names that causes excel errors. Excel complains when opening saying the data is corrupted, then attempts to repair it.

image

This second problem is not fixed.

bryantChhun commented 4 years ago

Problem is that spot detection failure causes the program to skip the entire well -- so no OD-well is written. There is now a check for Nonetype at the report-writing time.

fixed in PR #70