labsyspharm / quantification

Quantification module for mcmicro
https://github.com/labsyspharm/mcmicro
9 stars 13 forks source link

Path handling fails - have you seen this before? #2

Closed DenisSch closed 4 years ago

DenisSch commented 4 years ago

@JoshuaHess12 New issue when running on exemplar-002


{'mask_dir': '/Users/denis/exemplar-002/segmentation/1/', 'z_stacks': ['/Users/denis/exemplar-002/dearray/1.tif'], 'channel_names': '/Users/denis/exemplar-002/My_channels.csv', 'output': ['/Users/denis/exemplar-002/feature_extraction'], 'suffix': ['cellMask']}
Extracting sinle-cell data for /Users/denis/exemplar-002/dearray/1.tif...
Traceback (most recent call last):
  File "/Users/denis/Desktop/Josh/quantification/CommandSingleCellExtraction.py", line 11, in <module>
    SingleCellDataExtraction.MultiExtractSingleCells(**args)
  File "/Users/denis/Desktop/Josh/quantification/SingleCellDataExtraction.py", line 188, in MultiExtractSingleCells
    ExtractSingleCells(mask_dir,z_stack,channel_names,output[0],suffix[0])
  File "/Users/denis/Desktop/Josh/quantification/SingleCellDataExtraction.py", line 170, in ExtractSingleCells
    mask, z_stack, channel_names = PrepareData(mask_name,z_stack,channel_names)
  File "/Users/denis/Desktop/Josh/quantification/SingleCellDataExtraction.py", line 89, in PrepareData
    z_stack = skimage.io.imread(im_name,plugin='tifffile')
  File "/opt/anaconda3/lib/python3.7/site-packages/skimage/io/_io.py", line 61, in imread
    img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
  File "/opt/anaconda3/lib/python3.7/site-packages/skimage/io/manage_plugins.py", line 210, in call_plugin
    return func(*args, **kwargs)
  File "/opt/anaconda3/lib/python3.7/site-packages/skimage/io/_plugins/tifffile_plugin.py", line 37, in imread
    with TiffFile(fname, **kwargs_tiff) as tif:
  File "/opt/anaconda3/lib/python3.7/site-packages/skimage/external/tifffile/tifffile.py", line 1328, in __init__
    name=name, offset=offset, size=size)
  File "/opt/anaconda3/lib/python3.7/site-packages/skimage/external/tifffile/tifffile.py", line 3517, in __init__
    self.open()
  File "/opt/anaconda3/lib/python3.7/site-packages/skimage/external/tifffile/tifffile.py", line 3569, in open
    raise ValueError("The first parameter must be a file name, "
ValueError: The first parameter must be a file name, seekable binary stream, or FileHandle
DenisSch commented 4 years ago

The nextflow pipeline requires direct calling of individual mask / image - never a folder. Is the issue here that it expects multiple files? Can we adapt it so we have one mask, one image - no suffix?

JoshuaHess12 commented 4 years ago

I think we could modify the module to do that. The current setup will search the mask directory (mask_dir) for the image name produced by adding the suffix string to the z-stack image file. So the images must be named the same, except for the suffix added to the end of the mask image.

What are the names of the z-stack and mask that you are running?

On Thu, Mar 5, 2020 at 2:53 PM DenisSch notifications@github.com wrote:

The nextflow pipeline requires direct calling of individual mask / image - never a folder. Is the issue here that it expects multiple files? Can we adapt it so we have one mask, one image - no suffix?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DenisSch/quantification/issues/2?email_source=notifications&email_token=ALCXKJDMW54TF3565O44LTLRF77J3A5CNFSM4LCRGZWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN6VHAQ#issuecomment-595415938, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALCXKJA6KNUHWZCAIUW4GZ3RF77J3ANCNFSM4LCRGZWA .

JoshuaHess12 commented 4 years ago

With the current input above, the mask should be named '1cellMask.tif' in the current module.

On Thu, Mar 5, 2020 at 3:04 PM Joshua Hess joshmhess12@gmail.com wrote:

I think we could modify the module to do that. The current setup will search the mask directory (mask_dir) for the image name produced by adding the suffix string to the z-stack image file. So the images must be named the same, except for the suffix added to the end of the mask image.

What are the names of the z-stack and mask that you are running?

On Thu, Mar 5, 2020 at 2:53 PM DenisSch notifications@github.com wrote:

The nextflow pipeline requires direct calling of individual mask / image

  • never a folder. Is the issue here that it expects multiple files? Can we adapt it so we have one mask, one image - no suffix?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DenisSch/quantification/issues/2?email_source=notifications&email_token=ALCXKJDMW54TF3565O44LTLRF77J3A5CNFSM4LCRGZWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN6VHAQ#issuecomment-595415938, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALCXKJA6KNUHWZCAIUW4GZ3RF77J3ANCNFSM4LCRGZWA .

DenisSch commented 4 years ago

I think since I am giving the full path, this step below creates issues: https://github.com/DenisSch/quantification/blob/b6bb8491cd2c29eaae13b9f813c45aca801a070c/SingleCellDataExtraction.py#L82

JoshuaHess12 commented 4 years ago

I created a pull request to insert the full path for the masks instead of searching the directory for the z-stack name+suffix. For example, try

--masks '/Users/denis/exemplar-002/segmentation/1/1_cellMask.tif', --z_stacks: '/Users/denis/exemplar-002/dearray/1.tif', --channel_names '/Users/denis/exemplar-002/My_channels.csv', --output '/Users/denis/exemplar-002/feature_extraction

for your command line input.

On Thu, Mar 5, 2020 at 3:17 PM DenisSch notifications@github.com wrote:

I think since I am giving the full path, this step below creates issues:

https://github.com/DenisSch/quantification/blob/b6bb8491cd2c29eaae13b9f813c45aca801a070c/SingleCellDataExtraction.py#L82

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DenisSch/quantification/issues/2?email_source=notifications&email_token=ALCXKJFOXC5CDWSA3LIFPPDRGACGZA5CNFSM4LCRGZWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN6X4LY#issuecomment-595426863, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALCXKJAFVJQRGRNS4BXNGVDRGACGZANCNFSM4LCRGZWA .

DenisSch commented 4 years ago

Thank you - I am currently working on a fix as well, so I will merge soon.