Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key Error when using own data #62

Closed
hannahetompkins opened this issue Feb 19, 2021 · 13 comments
Closed

Key Error when using own data #62

hannahetompkins opened this issue Feb 19, 2021 · 13 comments

Comments

@hannahetompkins
Copy link

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
Copy link

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
Copy link
Collaborator

votti commented Feb 25, 2021

Hey you two,

I think the first error of @hannahetompkins key error, 'name' is related to this issue on imctools:
BodenmillerGroup/imctools#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
Copy link

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
Copy link
Collaborator

votti commented Feb 26, 2021

@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
Copy link

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
Copy link
Collaborator

votti commented Feb 26, 2021

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

@rachel662
Copy link

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

Book3.xlsx

@votti
Copy link
Collaborator

votti commented Mar 5, 2021

@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
Copy link
Collaborator

votti commented Mar 5, 2021

@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
Copy link

rachel662 commented Mar 6, 2021

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
Copy link

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
Copy link
Collaborator

votti commented May 10, 2021

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
Copy link
Contributor

Closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants