ChiLiubio / microeco

An R package for data analysis in microbial community ecology
GNU General Public License v3.0
181 stars 55 forks source link

Error in cal_network: Invalid edge ID when retrieving edge endpoints. Invalid value (microeco V 1.4.0) #327

Open Microbeventurer opened 4 months ago

Microbeventurer commented 4 months ago

Hello! I have been running into an issue where I am able to generate a network by the trans_network function but when running the cal_network function I recieve the following error:

MDVWLB$cal_network(COR_p_thres=0.05, COR_cut=0.6) ---------------- 2024-02-28 23:33:37.274166 : Start ---------------- Perform p value adjustment with fdr method ... Error in ends(network, x) : At vendor/cigraph/src/graph/type_common.c:123 : Invalid edge ID when retrieving edge endpoints. Invalid value

I have been able to get this line of code to work with other datasets: it seems that the issue might be in the dataset being used, but I am not an expert on this. I am at my wits end with this issue, so any help is appreciated.

Code: '''MDVWLB<-trans_network$new(dataset = mecoCHEMO, cor_method ="sparcc", use_sparcc_method = "SpiecEasi",filter_thres = 0.002,taxa_level = "OTU") MDVWLB$cal_network(COR_p_thres=0.05, COR_cut=0.6)'''

mecoMDV_data.zip

ChiLiubio commented 4 months ago

Hi. I found the reason is all the correlation coefficients larger than COR_cut parameter are not significant under current COR_p_thres parameter. When I try to run MDVWLB$cal_network(COR_p_thres = 0.1, COR_cut = 0.2), it is ok. To verify this, you can use MDVWLB$res_cor_p$cor to get correlation coefficient table and MDVWLB$res_cor_p$p to get the p value table. I will add the error message output in the code. Thanks for your issue.

Best, Chi