andersen-lab / Freyja

Depth-weighted De-Mixing
BSD 2-Clause "Simplified" License
102 stars 29 forks source link

Random seed for freyja boot for consistent results #229

Closed ktmeaton closed 5 months ago

ktmeaton commented 5 months ago

Is your feature request related to a problem? Please describe. I'm doing some testing and validation on freyja boot, and would love a way to control the randomness, so that I can get the exact same results each run.

Describe the solution you'd like Would it be possible to add a seed parameter to the CLI for freyja boot, something like --seed 123456? And then perhaps that seed could be passed along to perform_bootstrap and bootstrap_parallel with numpy.random.seed?

Describe alternatives you've considered I'm mostly working with the freyja Docker images and conda, so I'm trying to avoid doing any dependency modification myself. But if this feature isn't really helpful for anyone else, I can probably figure out another way!

Additional context I'm working with freyja in a Nextflow pipeline, and have created some test datasets as "controls" so that users can validate and compare their observed results vs. the expected results. For freyja demix, this works great, because the results never change on subsequent runs. But the lineages and abundaces of freyja boot change slightly each time without a seed for numpy.

Thanks! Katherine

mariaelf97 commented 5 months ago

Thanks for your suggestion, we will add this feature soon.