choderalab / assaytools

Modeling and Bayesian analysis of fluorescence and absorbance assays.
http://assaytools.readthedocs.org
GNU Lesser General Public License v2.1
18 stars 11 forks source link

[WIP] Adjusting platereader.py for spectra #48

Closed sonyahanson closed 8 years ago

sonyahanson commented 8 years ago

Making adjustments to platereader.py so we can use it to read spectra. This first commit should work fine to get a dictionary of the data. Will make a few more to clean up other things and be able to easily isolate single wavelengths for analysis.

To be adjusted further in the future for compatibility with the rest of what we're doing with the API.

jchodera commented 8 years ago

Cool! I've been making use of platereader in my PR and am happy to adapt as needed!

sonyahanson commented 8 years ago

This probably broke some of your stuff, I removed the previous row and column selection functions.

sonyahanson commented 8 years ago

Added a new extract_data function that can be use for both singlet and spectra xml files:

gefitinib_abl_singlet_A = platereader.extract_data(singlet_file, '350_TopRead', 'A')

bosutinib_abl_spectra_480 = platereader.extract_data(spectra_file, 'em280', 'A', wavelength='480')

The disadvantage here is that you have to know the section name, which so far I've been checking using: singlet_data = platereader.read_icontrol_xml(singlet_file) singlet_data.viewkeys()

Maybe it would be better to extract data using the parameters instead of the section title, as mentioned in #41. This would require changing or adding to read_icontrol_xml, which right now just pulls in the data by section name, making a dictionary of dictionaries.

jchodera commented 8 years ago

Not a problem! I can rework mine if you want to merge this now, but see the comments in the other PR with questions about how we represent different gains and whether we should really be using section names.

sonyahanson commented 8 years ago

Maybe it would be better to extract data using the parameters instead of the section title, as mentioned in #41. This would require changing or adding to read_icontrol_xml, which right now just pulls in the data by section name, making a dictionary of dictionaries.

jchodera commented 8 years ago

Whoops, I had missed that. It sounds like we both think that is the better option!

The only important consideration from my end is that I have to have some way of getting a unique key for each wavelength involved, and also knowing what gain fluorescence measurements are taken with. In my current PR, I use a key like "280:nanometers" for a wavelength. The code will then figure out what wavelengths are in use automatically.

sonyahanson commented 8 years ago

Hmmm. So right now, extract_data gives a list of values and the selection used to pull them out rather than a dictionary, which is possibly not so great. Below is the output where data[0] is the values and data[1] is the selection:

[[471.0, 418.0, 322.0, 231.0, 167.0, 139.0, 96.0, 83.0, 78.0, 76.0, 79.0, 70.0], 'A']

I was just going by our current usage of platereader.py, but certainly it could be a bit nicer have a dictionary, if this isn't cumbersome to use in analysis. It would not be hard to instead return:

{'A1': 471.0, 'A10': 76.0, 'A11': 79.0, 'A12': 70.0, 'A2': 418.0, 'A3': 322.0, 'A4': 231.0, 'A5': 167.0, 'A6': 139.0, 'A7': 96.0, 'A8': 83.0, 'A9': 78.0}

If this is appealing, I can not merge until this change is made.

jchodera commented 8 years ago

That would be super useful!

sonyahanson commented 8 years ago

Done.

jchodera commented 8 years ago

Any idea why the tests are still failing?

sonyahanson commented 8 years ago

Fixed.

jchodera commented 8 years ago

Thanks!