feldman4 / OpticalPooledScreens

Code and examples for optical pooled screens (updated protocol).
MIT License
11 stars 12 forks source link

Unicode-related bug? #20

Closed hikiami closed 1 year ago

hikiami commented 1 year ago

Hello,

I'm having trouble with Step 132 of Pooled genetic perturbation screens with image-based phenotypes (https://pubmed.ncbi.nlm.nih.gov/35022620/), which states: 'From within the experiment folder, execute the ops.io.format_input function to format the input files:'

I've adjusted the image file names in accordance with the sample 'input_files', in which no edits have been made, but I'm encountering the same error. I suspect there might be a Unicode-related bug. If you have any suggestions or solutions, I would greatly appreciate your guidance.

Here's the code I'm using:

python -m ops.io format_input input_files.xlsx --njobs=1 /Users/username/OpticalPooledScreens37/ops/io.py:129: DeprecationWarning: np.bool is a deprecated alias for the builtin bool. To silence this warning, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations if data.dtype == np.bool: Traceback (most recent call last): File "/Users/username/opt/anaconda3/envs/snakes37/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/Users/username/opt/anaconda3/envs/snakes37/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/username/OpticalPooledScreens37/ops/io.py", line 377, in fire.Fire(commands) File "/Users/username/OpticalPooledScreens37/venv/lib/python3.7/site-packages/fire/core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/Users/username/OpticalPooledScreens37/venv/lib/python3.7/site-packages/fire/core.py", line 471, in _Fire target=component.name) File "/Users/username/OpticalPooledScreens37/venv/lib/python3.7/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "/Users/username/OpticalPooledScreens37/ops/io.py", line 261, in format_input process_site(output_file,df_input) File "/Users/username/OpticalPooledScreens37/ops/io.py", line 253, in process_site save_stack(output_file,stacked) File "/Users/username/OpticalPooledScreens37/ops/io.py", line 176, in save_stack tag_50839 = ij_tag_50839(luts, display_ranges) File "/Users/username/OpticalPooledScreens37/ops/io.py", line 349, in ij_tag_50839 ]).encode('ascii') + d UnicodeEncodeError: 'ascii' codec can't encode character '\u0546' in position 16: ordinal not in range(128)

Thank you.

hikiami commented 1 year ago

Referring to my previous inquiry, I replaced the TIF files I placed in input/raw with the pre-formatted TiF files provided by the 'example pipeline' in this GitHub repository, and the code executed successfully. However, when I substituted these TIF files with ones captured by me, even though the filenames were identical, the code did not perform as expected.

Could there be an issue with the TIF files themselves in this case? Have you encountered similar cases before? If you have any insights, solutions, or recommendations for addressing this situation, I would greatly appreciate your guidance.

hikiami commented 1 year ago

Changing the format of the acquired TIF file from TIFF(color) to TIFF(grayscale) made the code work properly.