FinucaneLab / pops

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting this error when I am running step 2 of pops

akhilpampana opened this issue · comments

Hello,

I have generated magma output and tried to run pops and I am getting this error. Can you help me out with how to deal with this error?

Error:
raise KeyError(
KeyError: "Passing list-likes to .loc or [] with any missing labels is no longer supported. The following labels were missing: Index(['ENSG00000008128', 'ENSG00000116721', 'ENSG00000239810',\n 'ENSG00000179172', 'ENSG00000120952',\n ...\n 'ENSG00000130826', 'ENSG00000130830', 'ENSG00000203870',\n 'ENSG00000185010', 'ENSG00000288722'],\n dtype='object', name='ENSGID', length=1302). See https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"`

Regards
Akhil

This issue needs to be handled by the authors of PoPS. I have it taken care by ensuring that all datasets used throughout the process are ensembl based and any references to entrez gene IDs are replaced at relevant places.

I replaced the Entrez ids with the ensemble id, but I still am getting this error.

FYI I don't have this issue running the older version of the code on the add-license-1 branch; AFAIK it used to be the master branch before they swapped them for some reason. I've been successfully running off of this code for a little while now.

Hello Chris, Do u have that branch forked in ur GitHub page?

No, I just cloned the repo and checked out that branch.

Got it. Thank you, I will check to see if that helps me.

I think I could able to fix this issue. I have updated the code as suggested in this https://stackoverflow.com/questions/61291741/passing-list-likes-to-loc-or-with-any-missing-labels-is-no-longer-supported

I have updated lines 202, 239, 256, 313, 354, 435, 771, 786, 812, and 865 in pops.py in the latest version with the suggestion from here https://stackoverflow.com/a/65046686.

i.e changed everything which have df.loc[row_indices] to df.loc[df.index.intersection(row_indices),:]

Do not change .loc in line 365 - it will throw an error
pred = mat.dot(coefs_df.loc[coefs_df.index.interaction(cols)].beta.values)
AttributeError: 'Index' object has no attribute 'interaction'

Thank you so much for the help and I hope it resolves the issue from your end. Authors may need to look into it as there are some functions in the code that are deprecated.