mortazavilab / PyWGCNA

PyWGCNA is a Python package designed to do Weighted Gene Correlation Network analysis (WGCNA)
https://academic.oup.com/bioinformatics/advance-article/doi/10.1093/bioinformatics/btad415/7218311
MIT License
209 stars 48 forks source link

index out of bounds error #52

Closed kunalkathuria closed 1 year ago

kunalkathuria commented 1 year ago

Hi Again,

I am running into an error in module processing as pasted below. I loaded data from an Anndata object and ran it:

wgObj=wg.WGCNA(name='caudate_15',species='human',anndata=adata,save=True,outputPath=wdir) wgObj.preprocess() wgObj.saveWGCNA() wgObj.findModules()

adata AnnData object with n_obs × n_vars = 15 × 62703 obs: 'Sample_id', 'Age', 'Sex', 'PrimaryDx', 'Best_RIN_PFC'

Log:

Saving data to be True, checking requirements ... Figure directory does not exist! Creating figure directory! Pre-processing... Detecting genes and samples with too many missing values... MoTTY X11 proxy: Authorisation not recognised

In case you are trying to start a graphical application with "sudo", read this article in order to avoid this issue: https://blog.mobatek.net/post/how-to-keep-X11-display-after-su-or-sudo/

    Done pre-processing..

Saving WGCNA as caudate_15.p Run WGCNA... pickSoftThreshold: calculating connectivity for given powers... will use block size 938 Power SFT.R.sq slope truncated R.sq mean(k) median(k) max(k) 0 1 0.669481 1.05534 0.957384 31051.154672 34456.969227 38340.107901 1 2 0.497196 0.576056 0.965458 23742.416236 27164.831475 33212.334557 2 3 0.291156 0.315183 0.971497 19212.214492 22133.603972 29652.331155 3 4 0.114866 0.152961 0.977983 16080.835202 18386.478558 26944.114085 4 5 0.011362 0.041235 0.984779 13772.355995 15495.97514 24771.758022 5 6 0.016052 -0.04471 0.983994 11995.33809 13195.557949 22982.569073 6 7 0.112313 -0.113847 0.966303 10583.894625 11324.825903 21471.944854 7 8 0.249469 -0.171249 0.936059 9435.706678 9791.003668 20168.378655 8 9 0.390201 -0.222952 0.908155 8483.8443 8510.554845 19027.425415 9 10 0.504946 -0.266045 0.882287 7682.50703 7434.62295 18020.018942 10 11 0.593963 -0.304442 0.857825 6999.209965 6521.724537 17120.836504 11 13 0.71338 -0.371937 0.833508 5897.81059 5079.215524 15577.442657 12 15 0.772407 -0.426479 0.812742 5051.430162 4006.483937 14294.715799 13 17 0.798184 -0.476529 0.794877 4383.223243 3192.709391 13207.285919 14 19 0.808266 -0.5211 0.777081 3844.252587 2563.927356 12270.888872 No power detected to have scale free network! Found the best given power which is 19. calculating adjacency matrix ... Done..

calculating TOM similarity matrix ... Done..

Going through the merge tree... ..cutHeight not given, setting it to 0.995 ===> 99% of the (truncated) height range in dendro. Traceback (most recent call last): File "/users/kkathuri/nscripts/python/runWGCNA.v2.py", line 34, in wgObj.saveWGCNA() File "/users/kkathuri/.local/lib/python3.7/site-packages/PyWGCNA/wgcna.py", line 276, in findModules minClusterSize=self.minModuleSize) File "/users/kkathuri/.local/lib/python3.7/site-packages/PyWGCNA/wgcna.py", line 1377, in cutreeHybrid onBranch[int(gene)] = clust IndexError: index 47659 is out of bounds for axis 0 with size 47659

Any help appreciated! Thanks!

Kunal

nargesr commented 1 year ago

Hi,

Which version of PyWGCNA are you using?

kunalkathuria commented 1 year ago

Sorry for the delay in replying. I ran this data again with the latest version and didn't see the error. Thanks!