Commit 9c99ece0 authored by Marc's avatar Marc
Browse files

add "docker" and "singularity" programm arguments to psot; extend scripts and...

add "docker" and "singularity" programm arguments to psot; extend scripts and config files for blastp, ghostx and hmmer
parent c344cdf1
......@@ -14,6 +14,7 @@ analysis:
database: '/vol/biodb/uniprot/uniprot_sprot.fasta'
evalue: 1e-10
use_accession:
container: 'blastp_swissprot'
# The name of the result to json converter script. Must take one parameter, the
# result file from the analysis_script
......
......@@ -12,6 +12,7 @@ analysis:
script: 'run_ghostx.py'
parameters:
database: '/vol/biodb/ghostx/uniprot_sprot'
container: 'ghostx_swissprot'
# The name of the result to json converter script. Must take one parameter, the
# result file from the analysis_script
......
......@@ -16,6 +16,7 @@ analysis:
execution:
cluster:
chunksize: 200
container: 'hmmer_pfam_a'
# The name of the result to json converter script. Must take one parameter, the
# result file from the analysis_script
......
name: 'custom'
info: 'Profile that contains tools for testing and development'
modules:
signalp:
organism: 'euk'
name: 'custom2'
info: 'Profile that contains tools for more testing'
modules:
targetp:
organism_group: 'non-plant'
signalp:
organism: 'euk'
tmhmm:
name: 'custom3'
info: 'Profile that contains tools for even more testing'
modules:
targetp:
organism_group: 'non-plant'
signalp:
organism: 'euk'
tmhmm:
hmmer_pfam_a:
#!/usr/bin/env python3
import argparse
from psot import config
from os import system
from os import system,environ
blastp_tool = config.load_config()['tools'].get('blastp', 'blastp')
def find_tool_path():
from psot import config
return config.load_config()['tools'].get('blastp', 'blastp')
blastp_tool = ''
if 'INSIDE_CONTAINER' in environ:
blastp_tool = 'blastp'
else:
blastp_tool = find_tool_path()
parser = argparse.ArgumentParser(description='Identify homologues in the swissprot database')
parser.add_argument('--fasta', '-f', required=True, help='A fasta file with aminoacid sequences')
......
......@@ -2,13 +2,23 @@
import argparse
import re
from os import system,makedirs,path
from psot import config
from os import system,makedirs,path,environ
import subprocess
import json
cfg = config.load_config()
ghostx_tool = cfg['tools'].get('ghostx', 'ghostx')
def find_tool_path():
from psot import config
cfg = config.load_config()
return cfg['tools'].get('ghostx', 'ghostx'), cfg['helpers_path'] + '/reduce_fasta_headers_to_enumeration.py'
ghostx_tool = ''
reduce_headers_tool =''
if 'INSIDE_CONTAINER' in environ:
ghostx_tool = 'ghostx'
reduce_headers_tool = 'reduce_fasta_headers_to_enumeration.py'
else:
ghostx_tool, reduce_headers_tool = find_tool_path()
parser = argparse.ArgumentParser(description='Identify homologues in the swissprot database')
parser.add_argument('--fasta', '-f', required=True, help='A fasta file with aminoacid sequences')
......@@ -19,7 +29,6 @@ args = parser.parse_args()
makedirs(args.output, exist_ok=True)
# Swap fasta headers for unique numbers to save ghostx from dealing with complex headers
reduce_headers_tool = cfg['helpers_path'] + '/reduce_fasta_headers_to_enumeration.py'
subprocess.run([reduce_headers_tool, "-f", args.fasta, "-e", args.output + '/enum_headers.tsv'])
# Aproach:
......@@ -32,8 +41,8 @@ toolconfig = {
'database': args.database
}
# find version
output = subprocess.run([ghostx_tool], stderr=subprocess.PIPE)
text = output.stderr.decode('ascii')
output = subprocess.run([ghostx_tool], stdout=subprocess.PIPE)
text = output.stdout.decode('ascii')
result = re.search('version (.*)', text)
toolconfig['version'] = result.group(1)
......
#!/usr/bin/env python3
import argparse
import json
from psot import config
from os import system, makedirs
from os import system,makedirs,environ
def find_tool_path():
from psot import config
return config.load_config()['tools'].get('hmmscan', 'hmmscan')
hmmscan_tool = ''
hmmscan_tool = config.load_config()['tools'].get('hmmscan', 'hmmscan')
if 'INSIDE_CONTAINER' in environ:
hmmscan_tool = 'hmmscan'
else:
hmmscan_tool = find_tool_path()
parser = argparse.ArgumentParser(description='Search sequences against a profile database')
parser.add_argument('--fasta', '-f', required=True, help='A fasta file with aminoacid sequences')
......
......@@ -29,6 +29,11 @@ def main():
analyze_parser.add_argument('--debug', '-d', action='store_true', help='Debug mode, computation directory will not be removed after computation')
analyze_parser.add_argument('--execution_dir', '-e', help='Use the specified execution directory and do not delete it after the computation')
analyze_parser.add_argument('--use_cluster', '-C', action='store_true', help='Use compute cluster for execution')
images = analyze_parser.add_mutually_exclusive_group()
images.add_argument('--docker', '-D', action='store_true', help='Use docker image for computation')
images.add_argument('--singularity', '-S', action='store_true', help='Use singularity image for computation')
analyze_parser.set_defaults(func=analyze)
args = parser.parse_args()
......@@ -66,6 +71,8 @@ def generate_execution(config, args):
execution['fasta'] = os.path.abspath(args.fasta)
execution['output'] = os.path.abspath(args.output)
execution['install_path'] = config['install_path']
execution['docker'] = args.docker
execution['singularity'] = args.singularity
if 'venv' in config:
execution['venv'] = config['venv']
if args.execution_dir:
......
......@@ -244,14 +244,19 @@ def generate_nextflow_config(execution):
modules = execution['modules']
fragments = []
fragments.append('''docker.enabled = true''')
if execution['docker']:
fragments.append('''docker.enabled = true''')
elif execution['singularity']:
fragments.append('''singularity.enabled = true''')
fragments.append('''process { ''')
for m in modules:
config = {}
config['id'] = m['id']
if m['analysis']['container']:
if execution['docker'] or execution['singularity'] and 'container' in m['analysis']:
config['container'] = "container = " + "'" + m['analysis']['container'] + "'"
else:
config['container'] = ''
......
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