ggirelli / pygpseq

Python3 package to analyse GPSeq images and manage TIFF files.
MIT License
2 stars 1 forks source link

Better error message when only one channel tiff is missing #2

Closed tomkal closed 6 years ago

tomkal commented 6 years ago

This issue affects

What did you do (e.g., steps to reproduce)

gpseq_anim -d dapi -s cy5 -t 36 --note "TK GPSeq YFISH IMR90 deconvolved, center as percentile" --center-as-percentile -r '/home/bicro/Desktop/Backup_in_progress/user_folder_HD1/Tomek/microscopy_pipeline/IMR90_111217/IMR90_Data_input' '/home/bicro/Desktop/Backup_in_progress/user_folders_HD2/Tomek/microscopy_pipeline/IMR90_080518/Data_output' --sigma-smooth 0.05 -n

What did you expect to happen?

Get to the end of the pipeline.

What happened instead?

Missing DNA channel broke execution.

Additional information

/home/bicro/Desktop/ggcode/pygpseq/pygpseq/anim/series.py in get_channel(self=<pygpseq.anim.series.Series object>, ch_name=('dapi',), log='    > Reading channel "(\'dapi\',)"...\n', **kwargs={'adaptive_neighbourhood': 101, 'an_type': 3, 'aspect': (300.0, 216.6, 216.6), 'basedir': '/home/bicro/Desktop/Backup_in_progress/user_fold.../IMR90_111217/IMR90_Data_input/iTK165_021217_001/', 'calc_n_surface': False, 'cdescr': {}, 'center_as_percentile': True, 'cond_name': 'iTK165_021217_001', 'correctCA': False, 'debugging': False, ...})
    311         if None == log: log = ""
    312         log += self.printout('Reading channel "' + str(ch_name) + '"...', 2)
    313 
    314         # Read channel
    315         f = self.find_channel(ch_name)
--> 316         imch = imt.read_tiff(os.path.join(self.basedir, f[0]))
        imch = undefined
        self.basedir = '/home/bicro/Desktop/Backup_in_progress/user_fold.../IMR90_111217/IMR90_Data_input/iTK165_021217_001/'
        f = {}
    317         imch = imt.slice_k_d_img(imch, 3)
    318 
    319         # Deconvolved images correction
    320         if 'rescale_deconvolved' in kwargs.keys():

KeyError: 0
ggirelli commented 6 years ago

Hej Tomek, thank you for the ticket. I have improved the error message and set it at the beginning of the pipeline (initialization). This way you can easily spot the missing images and correct without losing any time. The change will be released in v3.0.4. Cheers!