McMinds-Lab / devil-variant-pipeline

Pipeline to process NGS data and perform joint variant calling
0 stars 0 forks source link

implement .env files #1

Open rmcminds opened 3 years ago

rmcminds commented 3 years ago

allow a user to specify input and output file/folder locations by filling in a .env file.

I would put *.env in .gitignore so that these file paths are not public, and then make a template file such as 1_qc.env.txt or full_pipeline.env.txt or something, that the user could easily modify with their own options and rename to e.g. full_pipeline.env.

Your scripts would then either read the file and get the info they need from it, or otherwise the file could simply be sourced at the beginning of your scripts, with it setting environmental variables or whatever

D-gallinson commented 3 years ago

I like the idea of separating absolute paths from the scripts using them, plus I have a few global vars (such as batch) which are used throughout all my scripts. I suppose pipeline.env could store global paths and then each script would have its own .env file with script-specific variables?

D-gallinson commented 3 years ago

I was able to store all variables in three .env files:

I had to provide an absolute path to the dir containing the .env files though in order to ensure I could run the scripts from anywhere. I also included a convenience Env class in utility.py to read in .env variables