carpenter-singh-lab / 2023_Cimini_NatureProtocols

Optimizing the Cell Painting assay for image-based profiling
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

Exposure differences #12

Open bethac07 opened 2 years ago

bethac07 commented 2 years ago

We are trying to track down exposure times information for experiments where we tested low vs high exposure times - there are some weirdnesses I don't fully understand. But to avoid it getting lost, this is the code used to extract them and confirm that the files are being read correctly.

import os

dirlist =  os.listdir(os.curdir)
dirlist.sort()
for sub_dir in dirlist:
    if '__' in sub_dir:
        exposure_dict = {'Alexa 647':[],'Alexa 568':[], '488 long':[],'Alexa 488':[],'HOECHST 33342':[],'Brightfield CP':[]}
        print("subdir", sub_dir) 
        with open(sub_dir + "/Images/Index.idx.xml", "r") as xmlfile: 
            lines = xmlfile.readlines()
            name = False
            exp = False
            for line in lines: 
                if 'Oreintation' in line:
                    name = False
                    exp = False
                if "<ChannelName>" in line: 
                    name = line[line.find("<ChannelName>") + 13: line.rfind("<")]
                if '<ExposureTime Unit="s">' in line:
                    exp = line[line.find('Unit') + 9 : line.rfind("<")]
                    if name:
                        exposure_dict[name].append(exp)
        for k,v in exposure_dict.items():
            exp_list = list(set(v))
            exp_count_list = []
            for exp in exp_list:
                exp_count_list.append(len([x for x in v if x==exp]))
            print(k,exp_list)
Results for plates currently in figure ``` subdir 200921_193743-V__2020-09-21T13_34_13-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir 200921_193743-V__2020-09-21T14_50_14-Measurement2 Alexa 647 ['0.02'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir 200922_015124-V__2020-09-21T19_47_54-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir 200922_015124-V__2020-09-21T21_04_16-Measurement2 Alexa 647 ['0.02'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115125__2020-08-14T14_17_57-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115125__2020-08-15T07_02_34-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115126__2020-08-14T12_49_23-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115126__2020-08-15T05_34_05-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115128__2020-08-14T08_22_51-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115128__2020-08-15T03_38_52-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.02'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115132__2020-08-14T03_56_58-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115132__2020-08-15T01_25_14-Measurement2 Alexa 647 ['0.04'] Alexa 568 ['0.02'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115133__2020-08-14T02_28_12-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00115133__2020-08-15T08_31_19-Measurement2 Alexa 647 ['0.02'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116620__2020-09-21T23_47_59-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116620__2020-09-22T19_45_41-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116621__2020-09-22T01_15_42-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116621__2020-09-22T21_13_32-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116622__2020-09-18T15_18_26-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116622__2020-09-21T16_25_19-Measurement1 Alexa 647 ['0.02'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116624__2020-09-21T22_19_49-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116624__2020-09-22T18_17_35-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116625__2020-09-21T20_51_34-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116625__2020-09-22T10_04_13-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116627__2020-09-21T19_23_21-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116627__2020-09-22T08_35_56-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116628__2020-09-21T17_55_03-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116628__2020-09-22T07_07_34-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116629__2020-09-21T16_27_12-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116629__2020-09-22T05_39_49-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116630__2020-09-21T14_59_00-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116630__2020-09-22T04_11_32-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116631__2020-09-22T02_43_29-Measurement1 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] subdir BR00116631__2020-09-22T22_41_32-Measurement2 Alexa 647 ['0.01'] Alexa 568 ['0.01'] 488 long ['0.01'] Alexa 488 ['0.01'] HOECHST 33342 ['0.01'] Brightfield CP ['0.01'] ```