Skip to content

Commit

Permalink
Minor fixes - env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Ge94 committed Feb 4, 2024
1 parent ff723f3 commit a2756d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cluster_uploader_wrapper.py

#IntelliJ project structure files
*.iml
*.xml
Expand Down Expand Up @@ -71,6 +69,7 @@ venv/
ENV/
env.bak/
venv.bak/
.genome_uploader.config.env

# Rope project settings
.ropeproject
Expand All @@ -80,3 +79,6 @@ venv.bak/

# Ruff
.ruff_cache/

#personal
cluster_uploader_wrapper.py
18 changes: 6 additions & 12 deletions genomeuploader/genome_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,6 @@ def combine_ENA_info(genomeInfo, ENADict):

genomeInfo[g]["accessions"] = ','.join(genomeInfo[g]["accessions"])



def getAccessions(accessionsFile):
accessionDict = {}
with open(accessionsFile, 'r') as f:
Expand Down Expand Up @@ -826,15 +824,15 @@ def __init__(self, argv=sys.argv[1:]):
self.username = self.args.webin
self.password = self.args.password
else:
# Config file #
user_config = Path.home() / ".genome_uploader.config"
# Config file
user_config = Path.home() / ".genome_uploader.config.env"
if user_config.exists():
logger.debug(f"Loading the env variables from {user_config}")
logger.debug("Loading the env variables from ".format(user_config))
load_dotenv(str(user_config))
else:
cwd_config = Path.cwd() / ".genome_uploader.config"
cwd_config = Path.cwd() / ".genome_uploader.config.env"
if cwd_config.exists():
logger.debug(f"Loading the variables from the current directory {Path.cwd()}.genome_uploader.config")
logger.debug("Loading the variables from the current directory.")
load_dotenv(str(cwd_config))
else:
logger.debug("Trying to load env variables from the .env file")
Expand All @@ -857,11 +855,7 @@ def __init__(self, argv=sys.argv[1:]):

def parse_args(self, argv):
parser = argparse.ArgumentParser(formatter_class = argparse.ArgumentDefaultsHelpFormatter,
description="Allows to create xmls and manifest files for genome upload to ENA. " +
"--xmls and --manifests are needed to determine the action the script " +
"should perform. The use of more than one option is encouraged. To spare time, " +
"-xmls and -manifests should be called only if respective xml or manifest files " +
"do not already exist.")
description="Create xmls and manifest files for genome upload to ENA. ")

parser.add_argument('-u', '--upload_study', type=str, help="Study accession for genomes upload")
parser.add_argument('--genome_info', type=str, required=True, help="Genomes metadata file")
Expand Down

0 comments on commit a2756d2

Please sign in to comment.