labsyspharm / mcmicro

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

Input structure to run .nd2 files as FOVs #512

Open Boehmin opened 1 year ago

Boehmin commented 1 year ago

I've been trying to run the stitching+registration on my data: .nd2 files, FOVs saved individually: In total 8 rounds a 47 FOVs a 5 channels each

Going through some of the issues on github I saw that some others had similar file structures (img_cycle_FOV.filename), however reading through the ashlar documentation I read that only one image file should be processed per cycle?

How do I go about supplying the right information in params.yml for the ashlar module in mcmicro to recognise that I have multiple FOVs? Is this possible? Attached are myparams.yml and markers.csv the way I ran them currently. markers.csv myparams.txt

That's the error I receive (full nextflow log attached nextflowlog.txt ):

Command exit status:
  1

Command output:

          merging tile 1/1
  Cycle 194:
      Channel 0:

          merging tile 1/1
      Channel 1:

          merging tile 1/1
      Channel 2:

          merging tile 1/1
      Channel 3:

          merging tile 1/1
      Channel 4:

          merging tile 1/1
  Cycle 195:
      Channel 0:

          merging tile 1/1
      Channel 1:

          merging tile 1/1
      Channel 2:

          merging tile 1/1
      Channel 3:

          merging tile 1/1
      Channel 4:

          merging tile 1/1
  Cycle 196:
      Channel 0:

          merging tile 1/1
      Channel 1:

          merging tile 1/1
      Channel 2:

          merging tile 1/1
      Channel 3:

          merging tile 1/1
      Channel 4:

          merging tile 1/1

Command error:
  Cycle 196:
      Channel 0:

          merging tile 1/1
      Channel 1:

          merging tile 1/1
      Channel 2:

          merging tile 1/1
      Channel 3:

          merging tile 1/1
      Channel 4:

          merging tile 1/1Traceback (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 212, in main
      return process_single(
    File "/usr/local/lib/python3.10/dist-packages/ashlar/scripts/ashlar.py", line 277, in process_single
      writer.run()
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 1228, in run
      tiff.write(
    File "/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py", line 3049, in write
      iteritem, dataiter = peek_iterator(dataiter)
    File "/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py", line 21409, in peek_iterator
      first = next(iterator)
    File "/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py", line 21413, in newiter
      yield from iterator
    File "/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py", line 21413, in newiter
      yield from iterator
    File "/usr/local/lib/python3.10/dist-packages/tifffile/tifffile.py", line 21413, in newiter
      yield from iterator
    [Previous line repeated 981 more times]
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 1180, in base_tiles
      img = mosaic.assemble_channel(channel)
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 1088, in assemble_channel
      img = self.aligner.reader.read(c=channel, series=si)
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 405, in read
      dtype = self.metadata.pixel_dtype
    File "/usr/local/lib/python3.10/dist-packages/ashlar/reg.py", line 304, in pixel_dtype
      return self._pixel_dtypes[self._metadata.getPixelsType(0).value]
    File "jnius/jnius_export_class.pxi", line 885, in jnius.JavaMethod.__call__
    File "jnius/jnius_export_class.pxi", line 967, in jnius.JavaMethod.call_method
    File "jnius/jnius_conversion.pxi", line 240, in jnius.convert_jobject_to_python
    File "/usr/local/lib/python3.10/dist-packages/jnius/reflect.py", line 203, in autoclass
      cls = MetaJavaClass.get_javaclass(jniname, classparams=(include_protected, include_private))
    File "jnius/jnius_export_class.pxi", line 164, in jnius.MetaJavaClass.get_javaclass
  RecursionError: maximum recursion depth exceeded in comparison

Work dir:
  /scicore/home/rueegg/boehm0002/miniconda3/envs/nextflow/work/9b/3ff3a47792c4b7d4cc97a922918444

Tip: you can replicate the issue by changing to the process work dir and entering the command `bash .command.run`

 -- Check '.nextflow.log' file for details
ArtemSokolov commented 1 year ago

@jmuhlich, @Yu-AnChen Should this be handled using the fileseries interface?

Boehmin commented 1 year ago

@ArtemSokolov are you referring to the Galaxy workflow? This I haven`t tried yet.

ArtemSokolov commented 1 year ago

No, ASHLAR has an undocumented feature called fileseries, which lets you explicitly map parts of the filename to tile number and cycle number.

Some discussions about it can be found in:

MCMICRO doesn't wrap this feature, so you would need to run ASHLAR "by hand" (using instructions at https://github.com/labsyspharm/ashlar). However, once you have a registered image, you can place it into the registration/ subfolder of your project and add the following to your params.yml to run the rest of the pipeline:

workflow:
  start-at: segmentation
Boehmin commented 1 year ago

Thank you for the advice, I will try this! I do not acquire images in a conventional grid so I`m waiting for some support from the ASHLAR team.