Skip to content

Commit

Permalink
woltka_syndna_to_array
Browse files Browse the repository at this point in the history
  • Loading branch information
antgonza committed Nov 3, 2023
1 parent 79b63a0 commit 8ee0c99
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion qp_woltka/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
'input': ('artifact', ['per_sample_FASTQ'])
}
opt_params = {
'Database': [f"choice: [{db_path}]", db_path]
'Database': [f'choice: ["{db_path}"]', db_path]
}
outputs = {
'SynDNA hits': 'BIOM',
Expand Down
6 changes: 6 additions & 0 deletions qp_woltka/woltka.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ def woltka_to_array(files, output, database_bowtie2, prep, url, name):
return main_fp, merge_fp


def woltka_syndna_to_array(files, output, database_bowtie2, prep, url, name):
"""Creates files for submission of per sample bowtie2 and woltka_syndna
"""
raise ValueError('SynDNA not implemented')


def syndna_woltka(qclient, job_id, parameters, out_dir):
"""
"""
Expand Down
43 changes: 21 additions & 22 deletions scripts/start_woltka
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from subprocess import run, PIPE
from os.path import dirname

from qp_woltka import plugin
from qp_woltka.woltka import woltka_to_array
from qp_woltka.woltka import woltka_to_array, woltka_syndna_to_array
from qp_woltka.util import client_connect


Expand All @@ -36,32 +36,31 @@ def execute(url, job_id, out_dir):
job_id, "Step 1 of 4: Collecting info and generating submission")
artifact_id = parameters['input']
del parameters['input']
files, prep = qclient.artifact_and_preparation_files(artifact_id)

if command.lower.startswith('woltka'):
files, prep = qclient.artifact_and_preparation_files(artifact_id)

directory = {dirname(ffs['filepath']) for _, fs in files.items()
for ffs in fs if ffs is not None}
if len(directory) != 1:
msg = ('There is more than one input directory [%s]; please '
'contact qiita.help@gmail.com' % str(directory))
return False, None, msg
else:
directory = directory.pop()
directory = {dirname(ffs['filepath']) for _, fs in files.items()
for ffs in fs if ffs is not None}
if len(directory) != 1:
msg = ('There is more than one input directory [%s]; please '
'contact qiita.help@gmail.com' % str(directory))
return False, None, msg
else:
directory = directory.pop()

# Getting all the files from the database
if command.lower.startswith('woltka'):
main_fp, merge_fp = woltka_to_array(
files, out_dir, parameters['Database'], prep, url, job_id)

# Submitting jobs and returning id
main_job = run(['sbatch', main_fp], stdout=PIPE)
main_job_id = main_job.stdout.decode('utf8').split()[-1]
merge_job = run(['sbatch', '-d', f'afterany:{main_job_id}',
merge_fp], stdout=PIPE)
merge_job_id = merge_job.stdout.decode('utf8').split()[-1]
print(f'{main_job_id}, {merge_job_id}')
else:
raise ValueError('not implemented')
main_fp, merge_fp = woltka_syndna_to_array(
files, out_dir, parameters['Database'], prep, url, job_id)

# Submitting jobs and returning id
main_job = run(['sbatch', main_fp], stdout=PIPE)
main_job_id = main_job.stdout.decode('utf8').split()[-1]
merge_job = run(['sbatch', '-d', f'afterany:{main_job_id}',
merge_fp], stdout=PIPE)
merge_job_id = merge_job.stdout.decode('utf8').split()[-1]
print(f'{main_job_id}, {merge_job_id}')

qclient.update_job_step(
job_id, "Step 2 of 4: Aligning sequences")
Expand Down

0 comments on commit 8ee0c99

Please sign in to comment.