xmuhuanglab / eNet

10 stars 7 forks source link

Some suggestions on improvement of eNet code #15

Closed nzx9581 closed 8 months ago

nzx9581 commented 8 months ago

Hi!

Firstly, thank you so much for providing this great tool to us. After using eNet for several days, I found some errors in your codes which could result in incorrect results.

  1. GPTab is null The same problem was mentioned before #8. I checked your code in utils.R, and it seems that the data.shuf at line 223 is a dgCMatrix but not a data.table, however, with=F only can be used for data.table object. People can get the result if removing with=F
  2. Incorrect use of variables You defined this function at line 155 and assigned GPTabFilt to GPTab. But you incorrectly call GPTabFilt instead of GPTab at line 165 within the BuildNetwork function, which could lead to weird results because 1) if GPTabFilt does not exist, the function could generate an error; 2) if GPTabFilt exits in your environment, the function will call this variable instead of the variable you define. So, the code at line 165 should be genes <- unique(GPTab$Gene). The same error is also found in line 173, line 202, line 213.
Abigail1l1l1l commented 8 months ago

Hi!

Firstly, thank you so much for providing this great tool to us. After using eNet for several days, I found some errors in your codes which could result in incorrect results.

  1. GPTab is null The same problem was mentioned before GPTab is NULL #8. I checked your code in utils.R, and it seems that the data.shuf at line 223 is a dgCMatrix but not a data.table, however, with=F only can be used for data.table object. People can get the result if removing with=F
  2. Incorrect use of variables You defined this function at line 155 and assigned GPTabFilt to GPTab. But you incorrectly call GPTabFilt instead of GPTab at line 165 within the BuildNetwork function, which could lead to weird results because 1) if GPTabFilt does not exist, the function could generate an error; 2) if GPTabFilt exits in your environment, the function will call this variable instead of the variable you define. So, the code at line 165 should be genes <- unique(GPTab$Gene). The same error is also found in line 173, line 202, line 213.

Hello, Zhixin. Thank you for your great suggestions. First, in line 223 of utils.R, we intended to use the sample() function to shuffle the order of cells. However, we mistakenly used the parameter 'with=F'. Although this does not affect the results, we will remove this parameter. Regarding the issue mentioned in https://github.com/xmuhuanglab/eNet/issues/8 earlier, I think it may be due to unsuccessful library of certain packages because when I repeated the analysis using the same code, I was able to obtain non-NULL results. Secondly, you are right about the problem with variable GPTabFilt; we will make sure to change its name accordingly.

nzx9581 commented 8 months ago

Dear Hongli, Thank you for correcting them. I will close this issue. Best, Zhixin