Comments (5)
I suggest you follow Quick_Start.ipynb
on the test data. To make sure your data is inserted in PyWGCNA correctly, try to look at pyWGCNA_5xFAD.geneExpr.to_df()
to make sure your gene_ids are stored as an index and your sample names are stored as a column.
Also please make sure you have the latest version of the package
at this time the latest version is v0.8.6 so you can run pip install PyWGCNA==v0.8.6
from pywgcna.
Hi,
I installed the latest version and am having issues loading the file.
ValueError Traceback (most recent call last)
/Users/yashsondhi/Dropbox/diel-rna-seq/Sondhi_etal_rna_seq_MS/scripts/PyWGCNA/tutorials/Quick_Start.ipynb Cell 2' in <cell line: 5>()
3 os.getcwd()
4 geneExp = '5xFAD_paper/expressionList_sorted.csv'
----> 5 pyWGCNA_5xFAD = PyWGCNA.WGCNA(name='5xFAD', species='mouse', geneExpPath=geneExp, save=True)
6 pyWGCNA_5xFAD.geneExpr.to_df().head(5)
File ~/opt/anaconda3/envs/wgcna/lib/python3.9/site-packages/PyWGCNA/wgcna.py:126, in WGCNA.init(self, name, TPMcutoff, powers, RsquaredCut, MeanCut, networkType, TOMType, minModuleSize, naColor, cut, MEDissThres, species, level, anndata, geneExp, geneExpPath, sep, save, outputPath)
116 def init(self, name='WGCNA',
117 TPMcutoff=1,
118 powers=None, RsquaredCut=0.9, MeanCut=100,
(...)
123 geneExpPath=None, sep=',',
124 save=False, outputPath=None):
--> 126 super().init(species=species, level=level, anndata=anndata, geneExp=geneExp,
127 geneExpPath=geneExpPath, sep=sep)
129 if powers is None:
130 powers = list(range(1, 11)) + list(range(11, 21, 2))
File ~/opt/anaconda3/envs/wgcna/lib/python3.9/site-packages/PyWGCNA/geneExp.py:69, in GeneExp.init(self, species, level, anndata, geneExp, geneExpPath, sep)
66 # drop sample id columns
67 expressionList = expressionList.drop([expressionList.columns[0]], axis=1)
---> 69 self.geneExpr = ad.AnnData(X=expressionList, obs=sampleInfo, var=geneInfo)
File ~/opt/anaconda3/envs/wgcna/lib/python3.9/site-packages/anndata/_core/anndata.py:291, in AnnData.init(self, X, obs, var, uns, obsm, varm, layers, raw, dtype, shape, filename, filemode, asview, obsp, varp, oidx, vidx)
289 self._init_as_view(X, oidx, vidx)
290 else:
--> 291 self._init_as_actual(
292 X=X,
293 obs=obs,
294 var=var,
295 uns=uns,
296 obsm=obsm,
297 varm=varm,
298 raw=raw,
299 layers=layers,
300 dtype=dtype,
301 shape=shape,
302 obsp=obsp,
303 varp=varp,
304 filename=filename,
305 filemode=filemode,
306 )
File ~/opt/anaconda3/envs/wgcna/lib/python3.9/site-packages/anndata/_core/anndata.py:435, in AnnData._init_as_actual(self, X, obs, var, uns, obsm, varm, varp, obsp, raw, layers, dtype, shape, filename, filemode)
433 elif not isinstance(X.columns, pd.RangeIndex):
434 x_indices.append(("var", "columns", X.columns))
--> 435 X = ensure_df_homogeneous(X, "X")
437 # ----------------------------------------------------------------------
438 # actually process the data
439 # ----------------------------------------------------------------------
440
441 # check data type of X
442 if X is not None:
File ~/opt/anaconda3/envs/wgcna/lib/python3.9/site-packages/anndata/utils.py:139, in ensure_df_homogeneous(df, name)
134 def ensure_df_homogeneous(
135 df: pd.DataFrame, name: str
136 ) -> Union[np.ndarray, sparse.csr_matrix]:
137 # TODO: rename this function, I would not expect this to return a non-dataframe
138 if all(isinstance(dt, pd.SparseDtype) for dt in df.dtypes):
--> 139 arr = df.sparse.to_coo().tocsr()
140 else:
141 arr = df.to_numpy()
File ~/opt/anaconda3/envs/wgcna/lib/python3.9/site-packages/pandas/core/arrays/sparse/accessor.py:337, in SparseFrameAccessor.to_coo(self)
334 import_optional_dependency("scipy")
335 from scipy.sparse import coo_matrix
--> 337 dtype = find_common_type(self._parent.dtypes.to_list())
338 if isinstance(dtype, SparseDtype):
339 dtype = dtype.subtype
File ~/opt/anaconda3/envs/wgcna/lib/python3.9/site-packages/pandas/core/dtypes/cast.py:1807, in find_common_type(types)
1790 """
1791 Find a common data type among the given dtypes.
1792
(...)
1804
1805 """
1806 if not types:
-> 1807 raise ValueError("no types given")
1809 first = types[0]
1811 # workaround for find_common_type([np.dtype('datetime64[ns]')] * 2)
1812 # => object
ValueError: no types given
from pywgcna.
Hi again,
Can you please check that you have the latest version of the input files, as well?
Unfotunelty, I can not reproduce your error but if you can tell me which version of anndata you used it might be helpful
from pywgcna.
I got a same issue like this:
Traceback (most recent call last):
File "WGCNA.py", line 3, in
pyWGCNA_5xFAD = PyWGCNA.WGCNA(name='5xFAD',
File "/home/tanygyun/.local/lib/python3.8/site-packages/PyWGCNA/wgcna.py", line 126, in init
super().init(species=species, level=level, anndata=anndata, geneExp=geneExp,
File "/home/tanygyun/.local/lib/python3.8/site-packages/PyWGCNA/geneExp.py", line 69, in init
self.geneExpr = ad.AnnData(X=expressionList, obs=sampleInfo, var=geneInfo)
File "/home/tanygyun/.local/lib/python3.8/site-packages/anndata/_core/anndata.py", line 291, in init
self._init_as_actual(
File "/home/tanygyun/.local/lib/python3.8/site-packages/anndata/_core/anndata.py", line 435, in _init_as_actual
X = ensure_df_homogeneous(X, "X")
File "/home/tanygyun/.local/lib/python3.8/site-packages/anndata/utils.py", line 139, in ensure_df_homogeneous
arr = df.sparse.to_coo().tocsr()
File "/home/tanygyun/.local/lib/python3.8/site-packages/pandas/core/arrays/sparse/accessor.py", line 337, in to_coo
dtype = find_common_type(self._parent.dtypes.to_list())
File "/home/tanygyun/.local/lib/python3.8/site-packages/pandas/core/dtypes/cast.py", line 1807, in find_common_type
raise ValueError("no types given")
ValueError: no types given
from pywgcna.
@1391794753 can you send me an example of the data you used it?
from pywgcna.
Related Issues (20)
- how to set figsize HOT 2
- SystemExit: All your genes ended up in one modules! Reconsider your input parameters in order to get more modules. HOT 6
- module_trait_relationships_heatmap HOT 4
- Pandas error HOT 4
- ask for some questions HOT 3
- Image too large. How suppress drawing when using pyWGCNA_obj.preprocess() ? HOT 3
- RecursionError when run pyWGCNA_ct.preprocess() HOT 1
- getDatTraits method might not be suitable for continuous traits. HOT 1
- How adjust parameter in functions??
- Genes and samples switched in goodSamplesGenes HOT 3
- error experienced in tutorial HOT 6
- Doubt on application HOT 1
- What other methods to define metadata colors are allowed, besides color labels ('black', 'pink', etc)? HOT 1
- Seeking help on `order` Parameter Usage and Metadata Color Settings HOT 13
- a issue for findModules() HOT 3
- findModules() inappropriately passes all kwargs to pickSoftThreshold() and cuttreeHybrid() HOT 2
- Re-naming modules HOT 1
- In the module Network Plot, Can we label the node as gene_name instead of gene_id ? HOT 2
- Several errors when performing findModules steps individually HOT 8
- 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pywgcna.