jianyangqt / gcta

GCTA software
GNU General Public License v3.0
84 stars 26 forks source link

Do not generate a random seed when one is specified via the command line #43

Closed HippocampusGirl closed 1 year ago

HippocampusGirl commented 1 year ago

Dear maintainers,

Currently, the --simu-seed command line flag does not lead to identical results when running the simulation multiple times.

As far as I can tell from the code, the intention in option.cpp is to use a randomly generated seed as a default. https://github.com/jianyangqt/gcta/blob/f22c624e6a6ca41577223da01756e58d569169e2/main/option.cpp#L98

With the aforementioned command line flag, that value can then be overwritten with a user-defined value. https://github.com/jianyangqt/gcta/blob/f22c624e6a6ca41577223da01756e58d569169e2/main/option.cpp#L601-L604

The value stored in simu_seed is then passed to GWAS_simu as the seed argument. https://github.com/jianyangqt/gcta/blob/f22c624e6a6ca41577223da01756e58d569169e2/main/gwas_simu.cpp#L85

In the current code, this seed argument is not used. Instead, a local variable Seed (capitalized) is defined and used to inform random number generation.

This means that the user-specified value will be ignored, and the simulation will be random every time.

This pull request removes this extra seed generation step, so that the --simu-seed can work as intended.

ShouyeLiu commented 1 year ago

Thanks for correcting it!