mhorlbeck / ScreenProcessing

58 stars 31 forks source link

process_experiments.py 'Passing list-likes to .loc or [] with any missing labels is no longer supported' #15

Closed Norisad closed 1 year ago

Norisad commented 3 years ago

Hi,

I'm trying to use process_experiments.py to compute rho. Everything was fine computing gamma with the same library, etc.

But now I got this error. Don't know from here it come.

Maybe issue coming from indexing. https://stackoverflow.com/questions/61291741/passing-list-likes-to-loc-or-with-any-missing-labels-is-no-longer-supported.

I gave you the error lines : File "/gpfs/tagc/home/sadouni/crispr_project/test_processing_run344/process_experiments.py", line 555, in processExperimentsFromConfig(args.Config_File, args.Library_File_Directory, args.plot_extension.lower()) File "/gpfs/tagc/home/sadouni/crispr_project/test_processing_run344/process_experiments.py", line 249, in processExperimentsFromConfig geneTableCollapsed = scoreGeneByBestTranscript(geneTable) File "/gpfs/tagc/home/sadouni/crispr_project/test_processing_run344/process_experiments.py", line 273, in scoreGeneByBestTranscript curFrame = geneTable.loc[zip(bestTranscriptFrame.index,bestTranscriptFrame[tup]),tup]

KeyError: "Passing list-likes to .loc or [] with any missing labels is no longer supported. The following labels were missing: MultiIndex([('C19orf52', nan),\n ( 'ETS1', nan),\n ( 'FKBP1A', nan),\n ( 'KPNB1', nan),\n ( 'NDNL2', nan),\n ( 'RPS15', nan),\n ( 'WASH1', nan)],\n names=['gene', 'transcripts']). See https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"

Best

xbx2024 commented 2 years ago

I met the same problem, and I solved it referred to https://github.com/mhorlbeck/ScreenProcessing/pull/13 by change line273: curFrame = geneTable.loc[zip(bestTranscriptFrame.index,bestTranscriptFrame[tup]),tup] into : curFrame = geneTable.reindex(zip(bestTranscriptFrame.index,bestTranscriptFrame[tup]),axis=0).loc[:,tup]