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
192 stars 46 forks source link

Pandas error #103

Closed yashraj59 closed 1 week ago

yashraj59 commented 3 weeks ago

When I try to call the PPI_network for a module, I get this pandas AttributeError error.


AttributeError Traceback (most recent call last) /scratch/yraj/ipykernel_57026/1589350224.py in ?() ----> 1 pyWGCNA_5xFAD.PPI_network(moduleName='black',species=9606)

~/.conda/envs/*/lib/python3.9/site-packages/PyWGCNA/wgcna.py in ?(self, species, moduleName, geneList, output_format) 3496 if not os.path.exists(f"{self.outputPath}figures/PPI/"): 3497 print(f"{WARNING}PPI directory does not exist!\nCreating PPI directory!{ENDC}") 3498 os.makedirs(f"{self.outputPath}figures/PPI/") 3499 -> 3500 res = WGCNA.request_PPI(genes=geneList, species=species) 3501 res.sort_values(by=["gene1"], axis=0, inplace=True) 3502 3503 string_api_url = "https://version-11-5.string-db.org/api"

~/.conda/envs/*/lib/python3.9/site-packages/PyWGCNA/wgcna.py in ?(genes, species) 3587 "limit": 5, 3588 "caller_identity": "www.awesome_app.org" # your app name 3589 } 3590 -> 3591 tmp = WGCNA.request_PPI_subset(params, request_url) 3592 count = count + 2000 3593 res = pd.concat([res, tmp], ignore_index=True) 3594

~/.conda/envs/*/lib/python3.9/site-packages/PyWGCNA/wgcna.py in ?(params, request_url) 3543 if response.status_code == 200: 3544 for line in response.text.strip().split("\n"): 3545 l = line.strip().split("\t") 3546 -> 3547 res = res.append({'gene1': l[2], 'gene2': l[3], 'score': l[5]}, 3548 ignore_index=True) 3549 3550 sleep(1)

~/.conda/envs/*/lib/python3.9/site-packages/pandas/core/generic.py in ?(self, name) 6200 and name not in self._accessors 6201 and self._info_axis._can_hold_identifiers_and_holds_name(name) 6202 ): 6203 return self[name] -> 6204 return object.getattribute(self, name)

AttributeError: 'DataFrame' object has no attribute 'append'

nargesr commented 3 weeks ago

Hi @yashraj59,

Can you tell me the version of PyWGCNA and Pandas? Also if you cand send me your PyWGCNA object that would be great

yashraj59 commented 2 weeks ago

Thanks for the reply, I won't be able to share the object but the versions are PyWGCNA==2.0.3, Pandas== 2.1.1 and the data is bulk RNAseq data.

nargesr commented 1 week ago

Hi @yashraj59

please upgrade it to the latest version of PyWGCNA(2.0.4) which is compatible with pandas (>2.0.0).

yashraj59 commented 1 week ago

Hi @yashraj59

please upgrade it to the latest version of PyWGCNA(2.0.4) which is compatible with pandas (>2.0.0).

Thank you, It is working now.