Hi all, I've been running into a problem at the R...
# mcmicro
k
Hi all, I've been running into a problem at the Registration stage with Ashlar. I essentially have a 7 channel ome.tif file, some metadata for which is:
Copy code
Pixels 0: {'SizeX': 20615, 'SizeY': 9836, 'SizeC': 7, 'PhysicalSizeX': '0.4967232235932544', 'PhysicalSizeY': '0.4967232235932544', 'UnitX': 'µm', 'UnitY': 'µm', 'Type': 'float'}

Unique values per field:
SizeX: {20615}
SizeY: {9836}
SizeC: {7}
PhysicalSizeX: {'0.4967232235932544'}
PhysicalSizeY: {'0.4967232235932544'}
UnitX: {'µm'}
UnitY: {'µm'}
Type: {'float'}
I had to make some changes in order to get it past the `omevalidation`module, such as the addition of minimal planes (one per Z/C/T slice), changed OME-XML Pixels Type="unint16" to work with Ashlar, replaced some non-ASCII characters (like µ) with um to be ASCII safe. However, I now appear to be running into the following error:
Copy code
ERROR ~ Error executing process > 'NFCORE_MCMICRO:MCMICRO:ASHLAR (TMA)'

Caused by:
  Process `NFCORE_MCMICRO:MCMICRO:ASHLAR (TMA)` terminated with an error exit status (1)


Command executed:

  ashlar \
      -o TMA.ome.tif \
      image1/TMA-6-plex-planes.tif \
      --maximum-shift 30 \
       \
  
  
  sed -i -E 's/UUID="urn:uuid:[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}"/                                                    /g' TMA.ome.tif
  
  cat <<-END_VERSIONS > versions.yml
  "NFCORE_MCMICRO:MCMICRO:ASHLAR":
      ashlar: $(ashlar --version | sed 's/^.*ashlar //' )
  END_VERSIONS

Command exit status:
  1

Command output:
  Stitching and registering input images
  Cycle 0:
      reading image1/TMA-6-plex-planes.tif
  
  
  Merging tiles and writing to TMA.ome.tif
  Cycle 0:
      Channel 0:
  
          merging tile 1/1
  Generating pyramid
      Level 1 (4 x 10308)
  
          processing channel 1/1
      Level 2 (2 x 5154)

Command error:
  Matplotlib created a temporary cache directory at /tmp/matplotlib-hzx5ns53 because the default path (/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
  Fontconfig error: No writable cache directories
  WARNING: Stage coordinates undefined; falling back to (0, 0).
  WARNING: Could not align enough edges, proceeding anyway with original stage positions.
  Stitching and registering input images
  Cycle 0:
      reading image1/TMA-6-plex-planes.tif
  
  
  Merging tiles and writing to TMA.ome.tif
  Cycle 0:
      Channel 0:
  
          merging tile 1/1
  Generating pyramid
      Level 1 (4 x 10308)
  
          processing channel 1/1
      Level 2 (2 x 5154)
  Traceback (most recent call last):
    File "/usr/local/bin/ashlar", line 10, in <module>
      sys.exit(main())
    File "/usr/local/lib/python3.10/site-packages/ashlar/scripts/ashlar.py", line 226, in main
      return process_single(
    File "/usr/local/lib/python3.10/site-packages/ashlar/scripts/ashlar.py", line 296, in process_single
      writer.run()
    File "/usr/local/lib/python3.10/site-packages/ashlar/reg.py", line 1302, in run
      tiff.write(
    File "/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py", line 3330, in write
      iteritem, dataiter = peek_iterator(dataiter)
    File "/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py", line 23934, in peek_iterator
      first = next(iterator)
    File "/usr/local/lib/python3.10/site-packages/ashlar/reg.py", line 1248, in subres_tiles
      zimg = zarr.open(tiff.aszarr(series=0, level=level-1, squeeze=False))
    File "/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py", line 4665, in aszarr
      return series.aszarr(level=level, **kwargs)
    File "/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py", line 12534, in aszarr
      return ZarrTiffStore(self, level=level, **kwargs)
    File "/usr/local/lib/python3.10/site-packages/tifffile/tifffile.py", line 12961, in __init__
      self._data = [self._data[level]]
  IndexError: list index out of range

Work dir:
  /home/kai/Desktop/mcmicro/work/fc/eb0e8c4edcacff432b09a7c4baee57

Container:
  quay.io/biocontainers/ashlar:1.19.0--pyhdfd78af_0

Tip: when you have fixed the problem you can continue the execution adding the option `-resume` to the run command line

 -- Check '.nextflow.log' file for details
ERROR ~ Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting

 -- Check '.nextflow.log' file for details
To the best of my understanding, this happening because the ome tiff I'm providing doesn't actually have pyramid levels? I've tried using a slightly more recent version of the ashlar container than in current dev workflow (https://quay.io/biocontainers/ashlar:1.19.0--pyhdfd78af_0), however, this seems to have had little effect. If it helps, the OME_XML metadata is as follows:
Copy code
<OME xmlns="http://www.openmicroscopy.org/Schemas/OME/2016-06" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Creator="OME Bio-Formats 6.2.0" UUID="urn:uuid:5b569c8d-23c2-47fd-9445-5ab17eb3997a" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2016-06 http://www.openmicroscopy.org/Schemas/OME/2016-06/ome.xsd"><Image ID="Image:0"><Pixels BigEndian="true" DimensionOrder="XYCZT" ID="Pixels:0" Interleaved="true" PhysicalSizeX="0.4967232235932544" PhysicalSizeXUnit="um" PhysicalSizeY="0.4967232235932544" PhysicalSizeYUnit="um" SizeC="7" SizeT="1" SizeX="20615" SizeY="9836" SizeZ="1" Type="uint16"><Channel Color="65280" ID="Channel:0:0" Name="DAPI" SamplesPerPixel="7"><LightPath /></Channel><Channel Color="-65536" ID="Channel:0:1" Name="Opal 520" SamplesPerPixel="7"><LightPath /></Channel><Channel Color="-16777216" ID="Channel:0:2" Name="Opal 570" SamplesPerPixel="7"><LightPath /></Channel><Channel Color="16776960" ID="Channel:0:3" Name="Opal 620" SamplesPerPixel="7"><LightPath /></Channel><Channel Color="-16711936" ID="Channel:0:4" Name="Opal 690" SamplesPerPixel="7"><LightPath /></Channel><Channel Color="16711680" ID="Channel:0:5" Name="Opal 480" SamplesPerPixel="7"><LightPath /></Channel><Channel Color="793726720" ID="Channel:0:6" Name="Autofluorescence" SamplesPerPixel="7"><LightPath /></Channel><TiffData FirstC="0" FirstT="0" FirstZ="0" IFD="0" PlaneCount="1"><UUID FileName="Stitched new.ome.tif">urn:uuid:5b569c8d-23c2-47fd-9445-5ab17eb3997a</UUID></TiffData><Plane TheC="0" TheZ="0" TheT="0" /><Plane TheC="1" TheZ="0" TheT="0" /><Plane TheC="2" TheZ="0" TheT="0" /><Plane TheC="3" TheZ="0" TheT="0" /><Plane TheC="4" TheZ="0" TheT="0" /><Plane TheC="5" TheZ="0" TheT="0" /><Plane TheC="6" TheZ="0" TheT="0" /></Pixels></Image><StructuredAnnotations><MapAnnotation ID="Annotation:Resolution:0" Namespace="openmicroscopy.org/PyramidResolution"><Value><M K="1">5153 2459</M><M K="2">1288 614</M></Value></MapAnnotation></StructuredAnnotations></OME>
Any guidance/advice is massively appreciated, and apologies in advance if I've missed something deeply obvious or forgot to include something, I admit a complete novice when it comes to mcmicro and mIF! I'm very happy to also figure out a way to supply the actual TIFF file, but think it's a bit big to upload directly to slack. 🙂 All the best, Kai
j
Hi Kai, Your image is already stitched, not raw tiles. We don't currently support starting with a stitched image, but that will be implemented soon. In the meantime you could try the legacy mcmicro 1.0: https://mcmicro.org/
Note
SizeX="20615" SizeY="9836"
in the xml
I thought we had checked for that in
omevalidation
but I will need to revisit the code.
🙌 1
k
Hi Jeremy! Appreciate the response! Again apologies if this is a naive question, but is it possible to "unstitch" the image such that it could be run through the pipeline? 🙂
j
No, we will eventually provide an "alternative on-ramp" for stitched images but for now you should use mcmicro 1.0.
The example images in the test profile are indeed ome-tiff, but it's confusing because they contain multiple raw tile images rather than one pre-stitched image like people are probably used to seeing.
The intent is for people to feed in the original file format their microscope captured its raw tiles in. We used ome-tiff to store the example images (with tiles) because it's an open format and easier for someone to explore and easy for us to write out.
One other problem you're going to encounter with nf-core mcmicro is the segmentation modules use an incredible amount of RAM. The tiny test image is OK but normal size images like yours will need hundreds of GB. I have a solution in the works that breaks the image up into overlapping pieces first, but it's not quite ready.
mcmicro 1.0 segmention still uses a lot of RAM but the default
unmicst
segmenter is less greedy than the others
i
just commenting to say I’m also interested in the “alternative on-ramp” option. ideally right before cellpose I think… any estimate when that will be ready?
j
Sorry no firm timeline. I'd like to get it done before the end of the calendar year but I can't offer much beyond that.
If you want to keep on top of updates, you could opt in to notifications from these github issues: Overall pipeline support for alternate on-ramps: https://github.com/nf-core/mcmicro/issues/37 Specific support for skipping registration and going straight to segmentation: https://github.com/nf-core/mcmicro/issues/64
i
Thanks, keep up the great work 🙏