BodenmillerGroup / steinbock

A toolkit for processing multiplexed tissue images
https://bodenmillergroup.github.io/steinbock
MIT License
49 stars 14 forks source link

two sets of images with slightly different panels #253

Closed Will760 closed 3 months ago

Will760 commented 3 months ago

Dear Team,

I am analysing some IMC images using the steinbock platform. I have two sets of different images with panels that are 99% the same, the only difference being that on one, aSMA is on 141pr and the other aSMA is on 209Bi, with a different marker in the 141pr spot. The different marker in the 141pr spot isnt working so happy to get rid of it. Problem is, when I edit my panel.csv, I understand the channel is the part that the pipeline cares about (and that the name is the bit that can be altered with), and so when I set one to 0 (not keep) and one to 1 (keep) i get the error message "Error: Duplicated values for 'channel' in panel.csv". see below.

image image

Am I best running the two sets of images through the pipeline in separate runs and then merging the csv file mannualy before proceeding with analysis? or is there a better way to do this?

best wishes,

Will

jwindhager commented 3 months ago

@Milad4849 hope its ok that I chime in here, got a similar question recently.


Hi @Will760,

Although considered a hack/not officially supported, I would propose the following:

Preprocess the images separately. Specifically, for each dataset:

  1. Create a panel from the mcd/txt raw data using steinbock preprocess imc panel
  2. Edit the panel file such that only the relevant channels are being kept (set keep=0 for the others) and reorder the panel file rows such that the channel order of the extracted images is exactly the same for both datasets. Note the following paragraph in the IMC image conversion documentation:

    To convert .mcd/.txt files in the raw data directory to TIFF and filter hot pixels:

    steinbock preprocess imc images --hpf 50

    This will extract images from raw files (source directory defaults to raw) and save them at the specified location (defaults to img). Each image corresponds to one acquisition in one file, with the image channels filtered (keep column) and sorted (channel column) according to the steinbock panel file at the specified location (defaults to panel.csv).

  3. Extract the images using steinbock preprocess imc images as usual and check that the number and order of the channels in the extracted images are as expected.

Now, merge the two datasets by copying/moving all images from one data/working directory to the other. Continue with the processing of the combined data as usual. Note that either panel file should work from this point onwards, as channels are solely identified by the name column (feel free to rename channels as necessary) and only rows with keep=1 are considered.

I hope this is clear/helps.

Will760 commented 3 months ago

Hi @jwindhager,

Thank you very much for the speedy response. When you say reorder the channels in the separate .csv files, do you mean rename the the two aSMA channels to be the same metaal . For example, should I rename both channels (Pr141 and Bi209) to 141Pr and make the order the same or are you just suggesting I overwrite the "Pr141" cell in excel with "Bi209" so that the order of markers is the same (but no longer necessarily in order of atomic mass).

Apologies if I am being stupid here.

Best wishes,

Will

Will760 commented 3 months ago

The latter looking like this: image

jwindhager commented 3 months ago

Hi @Will760, I take it you've resolved this issue?