nathanieljevans / cyclicIF_registration

Registration pipeline for cyclic immuno-fluorescence.
MIT License
0 stars 0 forks source link

`restich_cores.py` failing #25

Open nathanieljevans opened 3 years ago

nathanieljevans commented 3 years ago

I've narrowed the issue down to qc.resitch_core()

The issue seems to be that there are more than one dapi R0 "positions" for each core.

This code...


    # we'll use the R0 dapi core positions as the core mapping 
    c1R0_res = dat[lambda x: (x['round'] == 'R0') & (x['color_channel'] == 'c1')]#[['core','center_x','center_y','width', 'height']].drop_duplicates().set_index('core')

    #! DELETE THIS WHEN DONE VVV
    import pandas as pd
    pd.set_option("display.max_rows", None, "display.max_columns", None)
    print(c1R0_res[c1R0_res['core'] == 0].head())
    #! DELETE THIS WHEN DONE ^^^

Prints this...


           status  core round color_channel  \
9014  unregistered     0    R0            c1
9015  unregistered     0    R0            c1
9016  unregistered     0    R0            c1
9017  unregistered     0    R0            c1
9018  unregistered     0    R0            c1

                                           path  \
9014  unregistered_core=0_round=R0_color=c1.tif
9015  unregistered_core=0_round=R0_color=c1.tif
9016  unregistered_core=0_round=R0_color=c1.tif
9017  unregistered_core=0_round=R0_color=c1.tif
9018  unregistered_core=0_round=R0_color=c1.tif

                                               img_name  \
9014  R0_AF488.AF555.AF647.AF750_D2_2020_09_30__9157...
9015  R0_AF488.AF555.AF647.AF750_D2_2020_09_30__9157...
9016  R0_AF488.AF555.AF647.AF750_D2_2020_09_30__9157...
9017  R0_AF488.AF555.AF647.AF750_D2_2020_09_30__9157...
9018  R0_AF488.AF555.AF647.AF750_D2_2020_09_30__9157...

                      protein  center_x  center_y  width  height  \
9014  AF488.AF555.AF647.AF750      1849      1714    245     185
9015  AF488.AF555.AF647.AF750      1215      2548    172      93
9016  AF488.AF555.AF647.AF750       732      2368     98     117
9017  AF488.AF555.AF647.AF750      2985       188    163      57
9018  AF488.AF555.AF647.AF750       739       880    105      99

      Volume (nm^3)  Elongation  Flatness  \
9014       1.104028    1.821324  1.821324
9015       0.536107    1.941235  1.941235
9016       0.384811    1.218527  1.218527
9017       0.363686    2.894790  2.894790
9018       0.285481    1.751271  1.751271

      Oriented Bounding Box Minimum Size(nm)  \
9014                                0.995794
9015                                0.589749
9016                                0.639676
9017                                0.371496
9018                                0.472863

      Oriented Bounding Box Maximum Size(nm)  Intensity Mean  \
9014                                1.713394        9.475986
9015                                1.120265       13.782174
9016                                0.768076       10.669851
9017                                1.059755        9.008713
9018                                0.784676       13.249371

      Intensity Standard Deviation  Intensity Skewness  component slide_name  \
9014                     19.516343            8.173697         16         D2
9015                     13.829060            1.286701         90         D2
9016                     10.331128            1.720395         95         D2
9017                     33.604453            5.303410         96         D2
9018                     48.683772            4.632920         97         D2

            date  scan_id scene note  jacaard_coef  dice_coef  \
9014  2020-09-30     9157  None  ORG           NaN        NaN
9015  2020-09-30     9157  None  ORG           NaN        NaN
9016  2020-09-30     9157  None  ORG           NaN        NaN
9017  2020-09-30     9157  None  ORG           NaN        NaN
9018  2020-09-30     9157  None  ORG           NaN        NaN

      volume_similarity  false_pos_err  false_neg_err  hausdorff_dist  \
9014                NaN            NaN            NaN             NaN
9015                NaN            NaN            NaN             NaN
9016                NaN            NaN            NaN             NaN
9017                NaN            NaN            NaN             NaN
9018                NaN            NaN            NaN             NaN

                                        registered_path
9014  /mnt/e/CycIF_analysis/registration_outputs/6-D...
9015  /mnt/e/CycIF_analysis/registration_outputs/6-D...
9016  /mnt/e/CycIF_analysis/registration_outputs/6-D...
9017  /mnt/e/CycIF_analysis/registration_outputs/6-D...
9018  /mnt/e/CycIF_analysis/registration_outputs/6-D...

So, all the cores are here but there are multiple components... and we should have just one.

nathanieljevans commented 3 years ago

variables core and component should be the same - or at least keyed to each other right?

nathanieljevans commented 3 years ago

Perhaps the clustering algortihm is causing this... look in match.py

nathanieljevans commented 3 years ago

aggregate_results.csv has multiple rows for the same core-round, but with very slightly differing QC metric values.