Skip to content

Commit 2add1c7

Browse files
Merge pull request #170 from ncsa/feature/integrate_parallel_into_sim
Feature/integrate parallel into sim
2 parents b611877 + 5bda226 commit 2add1c7

24 files changed

Lines changed: 784 additions & 1277 deletions

config_template/simple_template.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@ rng_seed: .
2626
min_mutations: .
2727
overwrite_output: .
2828

29-
outdir: .
30-
final_prefix: .
31-
by: .
29+
mode: .
3230
size: .
3331
jobs: .
34-
neat_cmd: .
35-
samtools: .
3632
cleanup_splits: .
3733
reuse_splits: .

config_template/template_neat_config.yml

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -140,43 +140,38 @@ min_mutations: .
140140
# type: bool | required = no | default = false
141141
overwrite_output: .
142142

143-
# Top-level output directory for splits, per-chunk outputs, and stitched results.
144-
# Relative paths are interpreted against the CURRENT WORKING DIRECTORY.
145-
# If omitted (or set to .), it defaults to: <cwd>/<config_stem>_parallel
146-
# type = string | required: no
147-
outdir: .
148-
149-
# Location (prefix, no extension) for stitched outputs.
150-
# If relative, it is resolved under outdir (i.e., <outdir>/<final_prefix>*).
151-
# Default is "stitched/final".
152-
# type = string | required: no | default = stitched/final
153-
final_prefix: .
154-
155143
# How to split the input reference for parallelization
144+
# If parallel_mode = false, this option has no effect.
156145
# type = string | required: no | default = contig | values: contig, size
157-
by: .
146+
mode: .
158147

159148
# Target chunk size if by = size (overlap = read_len * 2).
160-
# Default is 500000 when by = size.
149+
# Default is 500000 when by = size. Not used for by = contig.
161150
# type = int | required: no | default = 500000 (when by=size)
162151
size: .
163152

164-
# Maximum number of concurrent NEAT jobs
165-
# type = int | required: no | default = (CPU count)
166-
jobs: .
167-
168-
# Command used to launch the simulator (CLI mode)
169-
# type = string | required: no | default = "neat read-simulator"
170-
neat_cmd: .
171-
172-
# Path to samtools (binary name if on PATH)
173-
# type = string | required: no | default = samtools
174-
samtools: .
153+
# Maximum number of concurrent NEAT jobs (threads or hyperthreads) to run.
154+
# Note that assigning a value higher than your available number of threads
155+
# could result in performance issues in the computer running the job.
156+
# If parallel_mode = false, this option has no effect.
157+
# type = int | required: no | default = all available.
158+
threads: .
175159

176160
# Delete the 'splits' directory after stitching completes
161+
# Note if parallel_mode = false, this option has no effect.
177162
# type = bool | required: no | default = false
178163
cleanup_splits: .
179164

180-
# Reuse existing files in 'splits' and skip the split step
181-
# type = bool | required: no | default = false
165+
# Reuse existing files in 'splits' and skip the split step. This
166+
# option should be a path to the directory containing the splits.
167+
# Note if parallel_mode = None, this option has no effect.
168+
# type = str | required: no | default = None
182169
reuse_splits: .
170+
171+
# For recombining bams, you will need to have samtools installed
172+
# if no installation path is specified here, Python will check
173+
# for an installation of samtools in PATH. If Python can't
174+
# find it, it will throw an error and exit.
175+
# Note if parallel_mode = None, or produce_bam = false, this option has no effect,
176+
# and will not be checked
177+
samtools: .

neat/cli/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ def main(parser: argparse.ArgumentParser, arguments: list[str]) -> int:
138138
else:
139139
end = time.time()
140140
log.info(
141-
f"command finished successfully; execution took {(end - start)/60:.2f} m"
141+
f"command finished successfully; execution took {(end - start)*1000:.2f} ms\nd"
142+
)
143+
log.info(
144+
f"command finished successfully; execution took {(end - start) / 60:.2f} m"
142145
)
143146
return 0
144147

neat/cli/commands/options.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44

55
__all__ = ["output_group"]
66

7+
import os
8+
79
from .base import Group
810

911
output_group = Group("output", is_mutually_exclusive=True, required=True)
1012
output_group.add_argument(
1113
"-o",
12-
"--output",
13-
dest="output",
14+
"--output_dir",
15+
dest="output_dir",
1416
type=str,
15-
help="Path (including filename prefix) to the output file",
16-
default=None
17+
help="Path to the output directory. Will create if not present.",
18+
default=os.getcwd()
1719
)
20+
21+
output_group.add_argument(
22+
"-p",
23+
"--prefix",
24+
dest="prefix",
25+
type=str,
26+
help="Prefix to use to name files",
27+
default="neat_sim"
28+
)

neat/cli/commands/parallel.py

Lines changed: 0 additions & 142 deletions
This file was deleted.

neat/cli/commands/read_simulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ def execute(self, arguments: argparse.Namespace):
4444
4545
:param arguments: The namespace with arguments and their values.
4646
"""
47-
read_simulator_runner(arguments.config, arguments.output)
47+
read_simulator_runner(arguments.config, arguments.output_dir, arguments.prefix)

neat/common/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,4 @@ def validate_output_path(path: str | Path, is_file: bool = True, overwrite: bool
182182
_LOG.error(f"cannot write to '{path}', access denied")
183183
sys.exit(11)
184184
else:
185-
path.parent.mkdir(parents=True, exist_ok=True)
185+
path.mkdir(parents=True, exist_ok=True)

neat/parallel_read_simulator/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)