Commit c0ed69dc authored by Marc's avatar Marc
Browse files

add download_databases function to main.py,...

add download_databases function to main.py, download_databases_from_s3bucket.sh is run as subprocess
parent 8a66566f
#!/usr/bin/env python3
import argparse
import os
from psot.config import load_config
import subprocess
import copy
import shutil
from psot.nextflow import setup_execution_directory, execute_analysis
import tempfile
import sys
import json
from psot.config import load_config
from psot.nextflow import setup_execution_directory, execute_analysis
def main():
parser = argparse.ArgumentParser(description='Make bioinformatic observations on aminoacid sequences')
......@@ -54,6 +56,7 @@ def analyze(args, config):
execution = generate_execution(config, args)
if args.debug:
print(json.dumps(execution, indent=2))
download_databases(execution)
setup_execution_directory(execution)
error_code = execute_analysis(execution)
cleanup(execution)
......@@ -129,5 +132,19 @@ def show_analyses(config):
module = config['modules'][key]
print(' {0:<20} - {1}'.format(module['name'], module['info']))
def download_databases(execution):
script = execution['helpers_path'] + '/download_databases_from_s3bucket.sh'
logfile = execution['install_path'] + '/database_paths.log'
database_path = execution['database_path']
retcode = 1
try:
run_download_script = subprocess.run([script, logfile, database_path])
retcode = run_download_script.returncode
except OSError as e:
print("Execution failed:", e, file=sys.stderr)
return retcode
if __name__ == "__main__":
main()
......@@ -342,17 +342,17 @@ def generate_nextflow_config(execution):
fragments = []
if execution['docker']:
fragments.append('''docker {
fragments.append('''docker {{
enabled = 'true'
fixOwnership = 'true'
runOptions = '--volume={path}/databases'
}
runOptions = '--volume={path}:/databases'
}}
'''.format(path=database_path))
elif execution['singularity']:
fragments.append('''singularity {
fragments.append('''singularity {{
enabled = 'true'
runOptions = '--bind {path}:/databases'
}
}}
'''.format(path=database_path))
fragments.append('''process { ''')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment