Closed cliftonlewis closed 2 years ago
After check back over this error again, I think this error may be due to the sc.read having the validate=False flag as it hid the fact that error was in the formatting of the integrated results loom file as just I tested it without and this the error I get.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-10-861eb679c1d3> in <module>
----> 1 adata = sc.read_loom( f_test_loom)
2 adata.obs.columns
3 # drop the embeddings and extra attributes from the obs object
4 adata.obs.drop( ['Embedding','Embeddings_X','Embeddings_Y','RegulonsAUC'], axis=1, inplace=True )
/home/shared/anaconda3/envs/scenic3/lib/python3.6/site-packages/anndata/compat/__init__.py in inner_f(*args, **kwargs)
251 extra_args = len(args) - len(all_args)
252 if extra_args <= 0:
--> 253 return f(*args, **kwargs)
254
255 # extra_args > 0
/home/shared/anaconda3/envs/scenic3/lib/python3.6/site-packages/anndata/_io/read.py in read_loom(filename, sparse, cleanup, X_name, obs_names, obsm_names, var_names, varm_names, dtype, obsm_mapping, varm_mapping, **kwargs)
259 from loompy import connect
260
--> 261 with connect(filename, "r", **kwargs) as lc:
262 if X_name not in lc.layers.keys():
263 X_name = ""
/home/shared/anaconda3/envs/scenic3/lib/python3.6/site-packages/loompy/loompy.py in connect(filename, mode, validate, spec_version)
1147 Note: if validation is requested, an exception is raised if validation fails.
1148 """
-> 1149 return LoomConnection(filename, mode, validate=validate, spec_version=spec_version)
/home/shared/anaconda3/envs/scenic3/lib/python3.6/site-packages/loompy/loompy.py in __init__(self, filename, mode, validate, spec_version)
83 lv = loompy.LoomValidator(version=spec_version)
84 if not lv.validate(filename):
---> 85 raise ValueError("\n".join(lv.errors) + f"\n{filename} does not appead to be a valid Loom file according to Loom spec version '{spec_version}'")
86
87 self._file = h5py.File(filename, mode)
ValueError: Row attribute 'Regulons' dtype [('Abd-B_(+)', '<i8'), ('Abl_(+)', '<i8'), ('Antp_(+)', '<i8'), ('Argk_(+)', '<i8'), ('Atf3_(+)', '<i8'), ('Atf6_(+)', '<i8'), ('Awh_(+)', '<i8'), ('B-H1_(+)', '<i8'), ('BEAF-32_(+)', '<i8'), ('Bgb_(+)', '<i8'), ('Blimp-1_(+)', '<i8'), ('BtbVII_(+)', '<i8'), ('C15_(+)', '<i8'), ('CG10654_(+)', '<i8'), ('CG12018_(+)', '<i8'), ('CG12605_(+)', '<i8'), ('CG16779_(+)', '<i8'), ('CG17829_(+)', '<i8'), ('CG32532_(+)', '<i8'), ('CG34367_(+)', '<i8'), ('CG44247_(+)', '<i8'), ('CG5245_(+)', '<i8'), ('CG8319_(+)', '<i8'), ('Clk_(+)', '<i8'), ('CrebA_(+)', '<i8'), ('CrebB_(+)', '<i8'), ('D_(+)', '<i8'), ('D19B_(+)', '<i8'), ('Dif_(+)', '<i8'), ('Doc1_(+)', '<i8'), ('Dp_(+)', '<i8'), ('Dref_(+)', '<i8'), ('E_(bx)_(+)', '<i8'), ('E_(spl)m5-HLH_(+)', '<i8'), ('E_(spl)mbeta-HLH_(+)', '<i8'), ('E_(spl)mgamma-HLH_(+)', '<i8'), ('E2f1_(+)', '<i8'), ('E5_(+)', '<i8'), ('EcR_(+)', '<i8'), ('Ets21C_(+)', '<i8'), ('Ets65A_(+)', '<i8'), ('Ets96B_(+)', '<i8'), ('FoxK_(+)', '<i8'), ('H15_(+)', '<i8'), ('HDAC1_(+)', '<i8'), ('HLH3B_(+)', '<i8'), ('Hnf4_(+)', '<i8'), ('Hr3_(+)', '<i8'), ('Hr38_(+)', '<i8'), ('Hr78_(+)', '<i8'), ('Jra_(+)', '<i8'), ('Kdm4B_(+)', '<i8'), ('Kr_(+)', '<i8'), ('Lim1_(+)', '<i8'), ('Max_(+)', '<i8'), ('Mef2_(+)', '<i8'), ('Mitf_(+)', '<i8'), ('Mnt_(+)', '<i8'), ('Myb_(+)', '<i8'), ('Myc_(+)', '<i8'), ('NFAT_(+)', '<i8'), ('Nf-YC_(+)', '<i8'), ('Nf1_(+)', '<i8'), ('Oli_(+)', '<i8'), ('Pdp1_(+)', '<i8'), ('Psi_(+)', '<i8'), ('Ptx1_(+)', '<i8'), ('Rb97D_(+)', '<i8'), ('Rel_(+)', '<i8'), ('Rfx_(+)', '<i8'), ('Rx_(+)', '<i8'), ('SREBP_(+)', '<i8'), ('Sox102F_(+)', '<i8'), ('Sox14_(+)', '<i8'), ('SoxN_(+)', '<i8'), ('Spps_(+)', '<i8'), ('Stat92E_(+)', '<i8'), ('Su_(H)_(+)', '<i8'), ('Tet_(+)', '<i8'), ('TfIIB_(+)', '<i8'), ('Trf2_(+)', '<i8'), ('Trl_(+)', '<i8'), ('Usf_(+)', '<i8'), ('Usp39_(+)', '<i8'), ('Vsx1_(+)', '<i8'), ('Xbp1_(+)', '<i8'), ('Zif_(+)', '<i8'), ('abd-A_(+)', '<i8'), ('acj6_(+)', '<i8'), ('ap_(+)', '<i8'), ('ase_(+)', '<i8'), ('awd_(+)', '<i8'), ('bap_(+)', '<i8'), ('bi_(+)', '<i8'), ('bowl_(+)', '<i8'), ('bru3_(+)', '<i8'), ('bs_(+)', '<i8'), ('bsh_(+)', '<i8'), ('cbt_(+)', '<i8'), ('cnc_(+)', '<i8'), ('croc_(+)', '<i8'), ('crol_(+)', '<i8'), ('dimm_(+)', '<i8'), ('dpn_(+)', '<i8'), ('ems_(+)', '<i8'), ('en_(+)', '<i8'), ('eve_(+)', '<i8'), ('ey_(+)', '<i8'), ('fd96Ca_(+)', '<i8'), ('fkh_(+)', '<i8'), ('foxo_(+)', '<i8'), ('gcm_(+)', '<i8'), ('gcm2_(+)', '<i8'), ('grh_(+)', '<i8'), ('h_(+)', '<i8'), ('ham_(+)', '<i8'), ('hth_(+)', '<i8'), ('inv_(+)', '<i8'), ('kay_(+)', '<i8'), ('kn_(+)', '<i8'), ('l_(1)sc_(+)', '<i8'), ('l_(3)neo38_(+)', '<i8'), ('lbl_(+)', '<i8'), ('lola_(+)', '<i8'), ('luna_(+)', '<i8'), ('maf-S_(+)', '<i8'), ('mid_(+)', '<i8'), ('mirr_(+)', '<i8'), ('mor_(+)', '<i8'), ('nej_(+)', '<i8'), ('opa_(+)', '<i8'), ('otp_(+)', '<i8'), ('pad_(+)', '<i8'), ('pan_(+)', '<i8'), ('pb_(+)', '<i8'), ('pnr_(+)', '<i8'), ('pnt_(+)', '<i8'), ('repo_(+)', '<i8'), ('ro_(+)', '<i8'), ('scro_(+)', '<i8'), ('sd_(+)', '<i8'), ('slou_(+)', '<i8'), ('slp1_(+)', '<i8'), ('sna_(+)', '<i8'), ('so_(+)', '<i8'), ('sqz_(+)', '<i8'), ('sr_(+)', '<i8'), ('srl_(+)', '<i8'), ('srp_(+)', '<i8'), ('svp_(+)', '<i8'), ('teq_(+)', '<i8'), ('tj_(+)', '<i8'), ('tll_(+)', '<i8'), ('toe_(+)', '<i8'), ('trx_(+)', '<i8'), ('tsu_(+)', '<i8'), ('tup_(+)', '<i8'), ('unc-4_(+)', '<i8'), ('usp_(+)', '<i8'), ('wor_(+)', '<i8'), ('z_(+)', '<i8'), ('zfh2_(+)', '<i8')] is not allowed
Column attribute 'Clusterings' dtype [('0', '<i8')] is not allowed
Column attribute 'Embedding' dtype [('_X', '<f4'), ('_Y', '<f4')] is not allowed
Column attribute 'Embeddings_X' dtype [('1', '<f4'), ('2', '<f4'), ('3', '<f8'), ('4', '<f8')] is not allowed
Column attribute 'Embeddings_Y' dtype [('1', '<f4'), ('2', '<f4'), ('3', '<f8'), ('4', '<f8')] is not allowed
Column attribute 'RegulonsAUC' dtype [('Abd-B_(+)', '<f8'), ('Abl_(+)', '<f8'), ('Antp_(+)', '<f8'), ('Argk_(+)', '<f8'), ('Atf3_(+)', '<f8'), ('Atf6_(+)', '<f8'), ('Awh_(+)', '<f8'), ('B-H1_(+)', '<f8'), ('BEAF-32_(+)', '<f8'), ('Bgb_(+)', '<f8'), ('Blimp-1_(+)', '<f8'), ('BtbVII_(+)', '<f8'), ('C15_(+)', '<f8'), ('CG10654_(+)', '<f8'), ('CG12018_(+)', '<f8'), ('CG12605_(+)', '<f8'), ('CG16779_(+)', '<f8'), ('CG17829_(+)', '<f8'), ('CG32532_(+)', '<f8'), ('CG34367_(+)', '<f8'), ('CG44247_(+)', '<f8'), ('CG5245_(+)', '<f8'), ('CG8319_(+)', '<f8'), ('Clk_(+)', '<f8'), ('CrebA_(+)', '<f8'), ('CrebB_(+)', '<f8'), ('D_(+)', '<f8'), ('D19B_(+)', '<f8'), ('Dif_(+)', '<f8'), ('Doc1_(+)', '<f8'), ('Dp_(+)', '<f8'), ('Dref_(+)', '<f8'), ('E_(bx)_(+)', '<f8'), ('E_(spl)m5-HLH_(+)', '<f8'), ('E_(spl)mbeta-HLH_(+)', '<f8'), ('E_(spl)mgamma-HLH_(+)', '<f8'), ('E2f1_(+)', '<f8'), ('E5_(+)', '<f8'), ('EcR_(+)', '<f8'), ('Ets21C_(+)', '<f8'), ('Ets65A_(+)', '<f8'), ('Ets96B_(+)', '<f8'), ('FoxK_(+)', '<f8'), ('H15_(+)', '<f8'), ('HDAC1_(+)', '<f8'), ('HLH3B_(+)', '<f8'), ('Hnf4_(+)', '<f8'), ('Hr3_(+)', '<f8'), ('Hr38_(+)', '<f8'), ('Hr78_(+)', '<f8'), ('Jra_(+)', '<f8'), ('Kdm4B_(+)', '<f8'), ('Kr_(+)', '<f8'), ('Lim1_(+)', '<f8'), ('Max_(+)', '<f8'), ('Mef2_(+)', '<f8'), ('Mitf_(+)', '<f8'), ('Mnt_(+)', '<f8'), ('Myb_(+)', '<f8'), ('Myc_(+)', '<f8'), ('NFAT_(+)', '<f8'), ('Nf-YC_(+)', '<f8'), ('Nf1_(+)', '<f8'), ('Oli_(+)', '<f8'), ('Pdp1_(+)', '<f8'), ('Psi_(+)', '<f8'), ('Ptx1_(+)', '<f8'), ('Rb97D_(+)', '<f8'), ('Rel_(+)', '<f8'), ('Rfx_(+)', '<f8'), ('Rx_(+)', '<f8'), ('SREBP_(+)', '<f8'), ('Sox102F_(+)', '<f8'), ('Sox14_(+)', '<f8'), ('SoxN_(+)', '<f8'), ('Spps_(+)', '<f8'), ('Stat92E_(+)', '<f8'), ('Su_(H)_(+)', '<f8'), ('Tet_(+)', '<f8'), ('TfIIB_(+)', '<f8'), ('Trf2_(+)', '<f8'), ('Trl_(+)', '<f8'), ('Usf_(+)', '<f8'), ('Usp39_(+)', '<f8'), ('Vsx1_(+)', '<f8'), ('Xbp1_(+)', '<f8'), ('Zif_(+)', '<f8'), ('abd-A_(+)', '<f8'), ('acj6_(+)', '<f8'), ('ap_(+)', '<f8'), ('ase_(+)', '<f8'), ('awd_(+)', '<f8'), ('bap_(+)', '<f8'), ('bi_(+)', '<f8'), ('bowl_(+)', '<f8'), ('bru3_(+)', '<f8'), ('bs_(+)', '<f8'), ('bsh_(+)', '<f8'), ('cbt_(+)', '<f8'), ('cnc_(+)', '<f8'), ('croc_(+)', '<f8'), ('crol_(+)', '<f8'), ('dimm_(+)', '<f8'), ('dpn_(+)', '<f8'), ('ems_(+)', '<f8'), ('en_(+)', '<f8'), ('eve_(+)', '<f8'), ('ey_(+)', '<f8'), ('fd96Ca_(+)', '<f8'), ('fkh_(+)', '<f8'), ('foxo_(+)', '<f8'), ('gcm_(+)', '<f8'), ('gcm2_(+)', '<f8'), ('grh_(+)', '<f8'), ('h_(+)', '<f8'), ('ham_(+)', '<f8'), ('hth_(+)', '<f8'), ('inv_(+)', '<f8'), ('kay_(+)', '<f8'), ('kn_(+)', '<f8'), ('l_(1)sc_(+)', '<f8'), ('l_(3)neo38_(+)', '<f8'), ('lbl_(+)', '<f8'), ('lola_(+)', '<f8'), ('luna_(+)', '<f8'), ('maf-S_(+)', '<f8'), ('mid_(+)', '<f8'), ('mirr_(+)', '<f8'), ('mor_(+)', '<f8'), ('nej_(+)', '<f8'), ('opa_(+)', '<f8'), ('otp_(+)', '<f8'), ('pad_(+)', '<f8'), ('pan_(+)', '<f8'), ('pb_(+)', '<f8'), ('pnr_(+)', '<f8'), ('pnt_(+)', '<f8'), ('repo_(+)', '<f8'), ('ro_(+)', '<f8'), ('scro_(+)', '<f8'), ('sd_(+)', '<f8'), ('slou_(+)', '<f8'), ('slp1_(+)', '<f8'), ('sna_(+)', '<f8'), ('so_(+)', '<f8'), ('sqz_(+)', '<f8'), ('sr_(+)', '<f8'), ('srl_(+)', '<f8'), ('srp_(+)', '<f8'), ('svp_(+)', '<f8'), ('teq_(+)', '<f8'), ('tj_(+)', '<f8'), ('tll_(+)', '<f8'), ('toe_(+)', '<f8'), ('trx_(+)', '<f8'), ('tsu_(+)', '<f8'), ('tup_(+)', '<f8'), ('unc-4_(+)', '<f8'), ('usp_(+)', '<f8'), ('wor_(+)', '<f8'), ('z_(+)', '<f8'), ('zfh2_(+)', '<f8')] is not allowed
For help, see http://linnarssonlab.org/loompy/format/
drosophilalarval_scenic_integrated-output_test.loom does not appead to be a valid Loom file according to Loom spec version '2.0.1'
I'm still unsure how I would go about fixing the error even though I seem to manage to work through it by following the alternative path suggested at the start of the tutorial
@cliftonlewis
Yes, for your second post, this is expected when turning off validation, since the loom file we create in this pipeline does not conform to loom specifications and will fail validation (due to the inclusion of the RegulonsAUC matrix, and other column attributes listed in that error). So it's necessary to turn validation off when loading the loom with Scanpy or loompy. This drop columns step just to clean up the adata obs object. If you're following the SCENIC protocols tutorial for PBMCs, then you can just skip this section; it's just a demonstration, and the adata object isn't really used for the rest of the tutorial.
I haven't seen this TypeError: invalid type promotion
error before. But you have also omitted the list of package versions you have in your environment, so it makes it hard to help. Could be something with your version of Scanpy, Pandas, Loompy, etc..
Thanks @cflerin
Yeah the standard approach is fine so I'll just stick with that. Cheers
Describe the bug A clear and concise description of what the bug is.
Steps to reproduce the behavior
drop the embeddings and extra attributes from the obs object
adata.obs.drop( ['Embedding','Embeddings_X','Embeddings_Y','RegulonsAUC'], axis=1, inplace=True )
Expected behavior A clear and concise description of what you expected to happen. I was hoping someone could explain this error to me as I can't seem to understand why I have gotten this. Cheers Please complete the following information: