Skip to content

Error for the quick start tutorial, I use Python 3.13.7 #150

@yudalang3

Description

@yudalang3

ValueError Traceback (most recent call last)
Cell In[7], line 1
----> 1 pyWGCNA_5xFAD.analyseWGCNA(show=False)

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/PyWGCNA/wgcna.py:470, in WGCNA.analyseWGCNA(self, order, geneList, show, alternative)
468 else:
469 for module in modules:
--> 470 self.barplotModuleEigenGene(module, metadata, colorBar=metadata[-1], show=show)
471 print("\tDone..\n")
473 if self.save:

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/PyWGCNA/wgcna.py:3133, in WGCNA.barplotModuleEigenGene(self, moduleName, metadata, combine, colorBar, show)
3131 else:
3132 palette = cat[[colorBar]].copy()
-> 3133 palette[[colorBar]] = palette[[colorBar]].astype('int')
3134 palette[colorBar] = palette[colorBar].apply(lambda x: mcolors.to_hex(self.metadataColors[colorBar].to_rgba(float(x))) if pd.notna(x) else "#FFFFFF")
3135 palette = palette[colorBar].values

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/pandas/core/generic.py:6662, in NDFrame.astype(self, dtype, copy, errors)
6656 results = [
6657 ser.astype(dtype, copy=copy, errors=errors) for _, ser in self.items()
6658 ]
6660 else:
6661 # else, only a single dtype is given
-> 6662 new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
6663 res = self._constructor_from_mgr(new_data, axes=new_data.axes)
6664 return res.finalize(self, method="astype")

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/pandas/core/internals/managers.py:430, in BaseBlockManager.astype(self, dtype, copy, errors)
427 elif using_copy_on_write():
428 copy = False
--> 430 return self.apply(
431 "astype",
432 dtype=dtype,
433 copy=copy,
434 errors=errors,
435 using_cow=using_copy_on_write(),
436 )

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/pandas/core/internals/managers.py:363, in BaseBlockManager.apply(self, f, align_keys, **kwargs)
361 applied = b.apply(f, **kwargs)
362 else:
--> 363 applied = getattr(b, f)(**kwargs)
364 result_blocks = extend_blocks(applied, result_blocks)
366 out = type(self).from_blocks(result_blocks, self.axes)

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/pandas/core/internals/blocks.py:784, in Block.astype(self, dtype, copy, errors, using_cow, squeeze)
781 raise ValueError("Can not squeeze with more than one column.")
782 values = values[0, :] # type: ignore[call-overload]
--> 784 new_values = astype_array_safe(values, dtype, copy=copy, errors=errors)
786 new_values = maybe_coerce_values(new_values)
788 refs = None

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/pandas/core/dtypes/astype.py:237, in astype_array_safe(values, dtype, copy, errors)
234 dtype = dtype.numpy_dtype
236 try:
--> 237 new_values = astype_array(values, dtype, copy=copy)
238 except (ValueError, TypeError):
239 # e.g. _astype_nansafe can fail on object-dtype of strings
240 # trying to convert to float
241 if errors == "ignore":

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/pandas/core/dtypes/astype.py:182, in astype_array(values, dtype, copy)
179 values = values.astype(dtype, copy=copy)
181 else:
--> 182 values = _astype_nansafe(values, dtype, copy=copy)
184 # in pandas we don't store numpy str dtypes, so convert to object
185 if isinstance(dtype, np.dtype) and issubclass(values.dtype.type, str):

File ~/projects/wnt_activate_esti/.venv/lib/python3.13/site-packages/pandas/core/dtypes/astype.py:133, in _astype_nansafe(arr, dtype, copy, skipna)
129 raise ValueError(msg)
131 if copy or arr.dtype == object or dtype == object:
132 # Explicit copy, or required since NumPy can't view from / to object.
--> 133 return arr.astype(dtype, copy=True)
135 return arr.astype(dtype, copy=copy)

ValueError: invalid literal for int() with base 10: '5xFADHEMI'

When run the pyWGCNA_5xFAD.analyseWGCNA(show=False)

Why the official codes have the error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions