BodenmillerGroup / ImcSegmentationPipeline

A pixel classification based multiplexed image segmentation pipeline
https://bodenmillergroup.github.io/ImcSegmentationPipeline/
MIT License
83 stars 35 forks source link

Key Error when using own data #62

Closed hannahetompkins closed 2 years ago

hannahetompkins commented 3 years ago

I get an issue when running cell above 'Generate the analysis stacks' using my own data. I get a key error, 'name' , in my data. Any help would be greatly appreciated!

rachel662 commented 3 years ago

Hi there, I also get a "Key Error: 89" in the cell above where it says ~"Copy one csv containing the channel order of the full stack in to the cellprofiler input folder"

I would also very much appreciate any help solving this problem! thanks Rachel

votti commented 3 years ago

Hey you two,

I think the first error of @hannahetompkins key error, 'name' is related to this issue on imctools: https://github.com/BodenmillerGroup/imctools/issues/108 We are investigating this and I give you feedback asap.

The `Key error: 89' seems like the a different error to me: are you sure that you actually have the mass 89 measured in your data? If not you should remove this from the 'panel' configuration csv file.

rachel662 commented 3 years ago

Hey there, thanks so much for your help with another dataset I have another error I am running in to Error in 17 11 2020 Rita lung_s0_a10_ac.ome.tiff Traceback (most recent call last): File "C:\Users\Rache\anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 2895, in get_loc return self._engine.get_loc(casted_key) File "pandas_libs\index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc File "pandas_libs\index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc File "pandas_libs\hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas_libs\hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'ilastik'

The above exception was the direct cause of the following exception:

Thanks so much for all your help - I really appreciate your time Rachel

votti commented 3 years ago

@hannahetompkins : this is really an issue with Imctools v2. The issue is identified and we know a potential solution. So this should be fixed shortly. Thanks for your patience!

@rachel662 : This is due to an error in your panel.csv file (the file you have set as file_path_csv_panel, eg '../config/example_panel.csv'). This comma separated csv file needs to have a column called ilastik that indicates with 0 and 1 which channels should be used for the ilastik stack, eg all channels which have a signal that allows to judge if a pixel is in the nucleus or cytoplasm of a cell.

Could it be that your panel file is lacking this? Please make sure the file is formated exactly like the example.

I hope this helps!

rachel662 commented 3 years ago

Hi there, my panel is formatted correctly with an ilastik column - so not exactly sure why this error is happening

thanks so much again Rachel

votti commented 3 years ago

Would you be able to share the panel? You could remove everything but the metal an the ilastik column. Best

rachel662 commented 3 years ago

Hi there yes of course - here it is attached Thanks so much Rachel

Book3.xlsx

votti commented 3 years ago

@Rachel: Sorry for taking so long, I had a super busy week.

So, the devil is in the detail: the issue is that you had "ilastik " as a column - so ilastik + a trailling space!

image

Removing this space and saving it as comma separated .csv should work.

Best, Vito

votti commented 3 years ago

@hannahetompkins : The key error with the 'name' should be fixed in the latest version of imctools (v2.1.5). If you update imctools things should work again. Sorry for the inconvenience!

rachel662 commented 3 years ago

Hi Vito, no don't worry at all thanks so much for your help! this did fix this issue, Sorry to bother you with yet another question but another error then came up, this time

KeyError: 'Bi209'

I checked the spacing and I think there's no trailing space, so was wondering if there's a way to solve this?

thanks so much again Rachel

jparkinson375 commented 3 years ago

Just jumping in here to say that I am having a similar error.

I am running through the first steps of the analysis of a standard Hyperion dataset and when running the following

%%time ome2analysis.omefolder_to_analysisfolder(folder_path_ome, folder_path_analysis, panel_csv_file=file_path_csv_panel, analysis_stacks=(list_analysis_stacks), metalcolumn=csv_panel_metal)

in the Jupyter Notebook I get an error saying:

Error in mouse_test8_lung_170321_s0_a3_ac.ome.tiff Traceback (most recent call last): File "C:\Users\James\miniconda3\envs\ImcSegmentationPipeline\lib\site-packages\imctools\converters\ome2analysis.py", line 159, in omefolder_to_analysisfolder omefile_2_analysisfolder( File "C:\Users\James\miniconda3\envs\ImcSegmentationPipeline\lib\site-packages\imctools\converters\ome2analysis.py", line 104, in omefile_2_analysisfolder acquisition_data.save_tiff( File "C:\Users\James\miniconda3\envs\ImcSegmentationPipeline\lib\site-packages\imctools\data\acquisitiondata.py", line 158, in save_tiff order = self.acquisition.get_name_indices(names) File "C:\Users\James\miniconda3\envs\ImcSegmentationPipeline\lib\site-packages\imctools\data\acquisition.py", line 235, in get_name_indices return [order_dict[n] for n in names] File "C:\Users\James\miniconda3\envs\ImcSegmentationPipeline\lib\site-packages\imctools\data\acquisition.py", line 235, in return [order_dict[n] for n in names] KeyError: 'Nd143'

Interestingly this does not seem to cause any issues as it still generates all of the images for import into HistoCAT and the rest of the notebook runs without any errors. However, I have not checked whether the Ilastik and Cellprofiler sections work as expected though.

If I remove Nd143 from the panel.csv file the same error appears but for Nd144, this then repeats if I remove Nd144 as well.

Could this relate to Rachel's error above?

Cheers, James

votti commented 3 years ago

Hi James,

Sorry for taking so long: The meaning of this error is, that according to the metadata your panel.csv, there should be a metal channel Nd143 in you image acquisitions. However this channel was not acquired in your data and is thus missing, causing this error.

I will open an issue in Imctools to give a more readable error message in these cases. Best, Vito

nilseling commented 2 years ago

Closing due to inactivity