labsyspharm / mcmicro

Multiple-choice microscopy pipeline
https://mcmicro.org/
MIT License
98 stars 58 forks source link

Does this pipeline support PhenoCycler-Fusion Codex format? #541

Open liuyangzzu opened 4 months ago

liuyangzzu commented 4 months ago

I have a new data format called PhenoCycler-Fusion. Can MIMICRO handle this type of image data (.qptiff)? Thank you!

ArtemSokolov commented 4 months ago

Hi @liuyangzzu,

MCMICRO is Bio-Formats compatible: https://bio-formats.readthedocs.io/en/v7.2.0/supported-formats.html If you instrument adheres to the Bio-Formats standards, MCMICRO should theoretically run on your data.

You can control what file extensions MCMICRO looks for in your params.yml.

liuyangzzu commented 4 months ago

Hi,

I am working with PhenoCycler-Fusion CODEX image data, specifically *.qptiff files. According to the documentation available at Bio-Formats Documentation, these files should be compatible with Bio-Formats.

However, I've encountered an issue where the first registration step in your pipeline fails when I attempt to process these files. Could you please let me know if you have any test cases or examples that involve processing this specific type of file? Your guidance on how to successfully navigate this issue would be greatly appreciated.

Thank you in advance.

Best regards, Yang

ArtemSokolov commented 4 months ago

Hi @liuyangzzu,

Can you please share the error message you are getting, as well as your params.yml?

We do not have a test case for that particular instrument, but based on the bio-formats documentation, it looks like a multi-file format. Can you try specifying the following in your params.yml:

workflow:
  multi-formats: qptiff
liuyangzzu commented 4 months ago

Thank you for quick response. My QPTIFF image is a single file contains 41 channels. I got below error message.

executor >  local (1)
[-        ] process > illumination                -
[84/271f7e] process > registration:ashlar (1)     [100%] 1 of 1, failed: 1 ✘
[-        ] process > background:backsub          -
[-        ] process > dearray:coreograph          -
[-        ] process > dearray:roadie:runTask      -
[-        ] process > segmentation:roadie:runTask -
[-        ] process > segmentation:worker         -
[-        ] process > segmentation:s3seg          -
[-        ] process > quantification:mcquant      -
[-        ] process > downstream:worker           -
[-        ] process > viz:autominerva             -
Error executing process > 'registration:ashlar (1)'

Caused by:
  Process `registration:ashlar (1)` terminated with an error exit status (1)

Command executed:

  ashlar 'raw/FV_UC-01.qptiff'  -m 30  -o jax_data_test.ome.tif

Command exit status:
  1

  + ashlar raw/FV_UC-01.qptiff -m 30 -o jax_data_test.ome.tif
  WARNING: Stage coordinates undefined; falling back to (0, 0).
  Stitching and registering input images
  Cycle 0:
      reading raw/FV_UC-01.qptiff
  Traceback (most recent call last):
    File "/usr/local/bin/ashlar", line 8, in <module>
      sys.exit(main())
    File "/usr/local/lib/python3.10/dist-packages/ashlar/scripts/ashlar.py", line 226, in main
      return process_single(
    File "/usr/local/lib/python3.10/dist-packages/ashlar/scripts/ashlar.py", line 262, in process_single
      edge_aligner.run()
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 505, in run
      self.check_overlaps()
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 527, in check_overlaps
      for t1, t2 in self.neighbors_graph.edges
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 473, in neighbors_graph
      max_distance = aligner.metadata.size.max() + 1
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 108, in size
      raise ValueError("Image series must all have the same dimensions")
  ValueError: Image series must all have the same dimensions
jmuhlich commented 3 months ago

Those files are pre-stitched and heavily pre-processed for visual review, not quantification. You can try placing the qptiff in the registration folder and starting mcmicro from segmentation but the quantification results may not be satisfactory due to the pre-processing.

liuyangzzu commented 3 months ago

Hi,

I have put my QPTIFF files in registration/ folder, and use start-at: segmentation in params.yml file.

But the pipeline failed with error message:

 -- Check script '/home/liuya/.nextflow/assets/labsyspharm/mcmicro/main.nf' at line: 88 or see '.nextflow.log' file for more details

[-        ] process > illumination                -
[-        ] process > registration:ashlar         -
[-        ] process > background:backsub          -
[-        ] process > dearray:coreograph          -
[-        ] process > dearray:roadie:runTask      -
[-        ] process > segmentation:roadie:runTask -
[-        ] process > segmentation:worker         -
[-        ] process > segmentation:s3seg          -
[-        ] process > quantification:mcquant      -
[-        ] process > downstream:worker           -
[-        ] process > viz:autominerva             -
No pre-stitched image in /projects/li-lab/yang/codex2/data/jax_data_test/registration

 -- Check script '/home/liuya/.nextflow/assets/labsyspharm/mcmicro/main.nf' at line: 88 or see '.nextflow.log' file for more details
ArtemSokolov commented 3 months ago

Hi @jmuhlich and @liuyangzzu,

The issue is here: https://github.com/labsyspharm/mcmicro/blob/master/main.nf#L87 It will only look for files with the following extensions in the registration folder: "*.{ome.tiff,ome.tif,tif,tiff,btf}"

I am not super familiar with the QPTIFF format. What will happen if you do:

import tifffile
img = tifffile.imread('myimage.qptiff', key=0)

Will it load the first (in 0-based indexing) channel as expected?

If so, then we can probably just augment that line to also look for qptiff files. If the above doesn't work as expected, then we need to build a bioformats -> .ome.tiff converter for pre-stitched images.

(The imread() call above is basically how all downstream modules read individual channels from a stitched and registered OME-TIFF.)