I am using the current source checked out of git in the last week, Python 3.11 and a current version of Pandas 2.0.3 , and I'm getting a strange type era which seems to be due to signatureanalyzer passing in a dictionary instead of a list to Pandas. I can't completely rule out something else being off (I am porting somebody else's code to a different environment and it did work in some past combination of packages but enough has changed. That said, Pandas does seem to have a reasonable complaint here
<calling code>
File "/home/ec2-user/src/getzlab-SignatureAnalyzer/signatureanalyzer/spectra.py", line 120, in get_spectra_from_maf
spectra = spectra.loc[context_use]
~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/ec2-user/.local/lib/python3.11/site-packages/pandas/core/indexing.py", line 1091, in __getitem__
check_dict_or_set_indexers(key)
File "/home/ec2-user/.local/lib/python3.11/site-packages/pandas/core/indexing.py", line 2627, in check_dict_or_set_indexers
raise TypeError(
TypeError: Passing a dict as an indexer is not supported. Use a list instead.
I had the library print out context_use and it is a 96 member dictionary of the four base pay sequences onto the integers 1..96. I presume that just the keys or values are supposed to be used for the index. I'll experiment with the library but I don't know if this previously worked or I have some other problem upstream. Any thoughts appreciated
pardon my debugging code, but the piece that breaks is
maf[context_form] = contig
spectra = maf.groupby([context_form, 'sample']).size().unstack().fillna(0).astype(int)
for c in context_use:
if c not in spectra.index:
spectra.loc[c] = 0
print(f"XXX: context_use={context_use}")
print(f"XXX: spectra cols = {spectra.columns}")
print(f"XXX: spectra rows = {spectra.shape[0]}")
spectra = spectra.loc[context_use]
adjusting the last line to pass in context_use.keys() allows it to run - I'm looking to see if that affects the output. Thoughts appreciated.
Thanks for bringing this to our attention! I think this is a pandas versioning issue. We edited the code to use context_use.keys(), so it should be working as intended now. Thanks again!
I am using the current source checked out of git in the last week, Python 3.11 and a current version of Pandas
2.0.3
, and I'm getting a strange type era which seems to be due to signatureanalyzer passing in a dictionary instead of a list to Pandas. I can't completely rule out something else being off (I am porting somebody else's code to a different environment and it did work in some past combination of packages but enough has changed. That said, Pandas does seem to have a reasonable complaint hereI had the library print out
context_use
and it is a 96 member dictionary of the four base pay sequences onto the integers 1..96. I presume that just the keys or values are supposed to be used for the index. I'll experiment with the library but I don't know if this previously worked or I have some other problem upstream. Any thoughts appreciatedpardon my debugging code, but the piece that breaks is
adjusting the last line to pass in
context_use.keys()
allows it to run - I'm looking to see if that affects the output. Thoughts appreciated.