We would appreciate a review on <https://github.co...
# microscopy
j
We would appreciate a review on https://github.com/nf-core/modules/pull/8749 -- @Alex wrote this new module for for the bioformats
showinf
tool for extracting OME-XML from supported image file formats (including proprietary vendor formats supported by bioformats). It's initially intended for the #C047HKB4RPC pipeline but we think other microscopy pipelines will benefit too.
👍 2
f
@Tong LI @Ken Brewer This sounds pretty similar to what we had talked about during the #C08P26ZAZM4 dev meeting about extracting metadata from ome-tiffs directly.
t
Yes. Just wondering is there a easy way to parse this output xml as easy as parsing an csv file? If not, how will the metadata propagate in the downstream?
f
@Jeremy Muhlich Do you guys have any tooling to parse the ome.xml into a channel with a meta.map or something similar?
j
Yes but I think it's highly pipeline-dependent so we have that in a local subworkflow in mcmicro
The XML is of course tree-like and has a lot of cross-references so it's not obvious or trivial to convert into a tabular meta-map type structure in a generic way
For our use case with reading raw tiled scans, each tile is one
<Image>
element in the XML with its own metadata, but we want one meta-map entry for the whole acquisition. So the subworkflow Alex wrote extracts all those Image entries and verifies that the dimensions, pixel type, exposure times, etc. are all identical for every Image, then either returns a single map with those values or raises an error. Then there's another validation step that ensures certain values in those maps are equal across all samples in the samplesheet.
👍 2
Generally, the code uses groovy's XmlSlurper to parse the XML
👍 1
The parsing code is here if you want to see what it looks like https://github.com/nf-core/mcmicro/blob/dev/modules/local/omevalidation/main.nf
f
Awesome, thanks for that context, that is really helpful! Basically @Ken Brewer has been looking into different ways to process cellpainting data with multiple different images / channels for plate based assays etc and @Tong LI had suggested to use the ome.xml metadata directly instead of entering this metadata via the samplesheet. But this might be tricky as you rightly point out!
Is there already testdata in nf-core/testdatasets with ome metadata for mcmicro that I can use to test out this parsing? Or would the classic
exemplar-001
also work?
t
lol, I am taking a shortcut by only re-saving the
xml,image_name, and index
into a csv file. https://github.com/cellgeni/nf-modules/blob/main/subworkflows/sanger-cellgeni/preprocess_tiles/main.nf#L15C1-L19C10 and I am relying on the downstream process to read directly from the master xml for analysis with correct metadata.
j
The tests in the above-referenced PR use the cycif-tonsil example image I added to testdata back when we started mcmicro
.../imaging/ome-tiff/cycif-tonsil-cycle1.ome.tif
(also
cycle2
and
cycle3
)
exemplar-001 would work too but it's not in testdata (kind of large for that)