Skip to content

Commit 043fe0f

Browse files
Merge pull request #181 from ncsa/develop
Develop
2 parents eaf63c1 + 4514a12 commit 043fe0f

3 files changed

Lines changed: 32 additions & 31 deletions

File tree

neat/cli/cli.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ def main(parser: argparse.ArgumentParser, arguments: list[str]) -> int:
107107
except SystemExit:
108108
return 2
109109

110-
log_file = Path(f'{args.log_name}').with_suffix('.log').resolve()
111-
log_file.unlink(missing_ok=True)
112-
log_file.touch()
113-
print(f"NEAT run log: {log_file}")
110+
log_file = None
111+
if not args.no_log:
112+
log_file = Path(f'{args.log_name}').with_suffix('.log').resolve()
113+
log_file.unlink(missing_ok=True)
114+
log_file.touch()
115+
print(f"NEAT run log: {log_file}")
114116

115117
setup_logging(
116118
omit_log=args.no_log,

neat/read_simulator/single_runner.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -119,32 +119,32 @@ def read_simulator_single(
119119
contig_name,
120120
contig_index,
121121
)
122-
123-
# Writing an intermediate bam that is sorted, to make compiling them together at the end easier.
124-
bam_handle = local_output_file_writer.files_to_write[local_output_file_writer.bam]
125-
for read_data in reads_to_write:
126-
read1 = read_data[0]
127-
read2 = read_data[1]
128-
if read1:
129-
local_output_file_writer.write_bam_record(
130-
read1,
131-
contig_index,
132-
bam_handle,
133-
local_options.read_len
134-
)
135-
if read2:
136-
local_output_file_writer.write_bam_record(
137-
read2,
138-
contig_index,
139-
bam_handle,
140-
local_options.read_len
141-
)
142-
bam_handle.flush()
143-
bam_handle.close()
144-
sorted_bam = local_output_file_writer.bam.with_suffix(".sorted.bam")
145-
pysam.sort("-@", str(local_options.threads), "-o", str(sorted_bam), str(local_output_file_writer.bam))
146-
os.rename(str(sorted_bam), str(local_output_file_writer.bam))
147-
_LOG.info(f"bam for thread {thread_idx} written")
122+
if local_options.produce_bam:
123+
# Writing an intermediate bam that is sorted, to make compiling them together at the end easier.
124+
bam_handle = local_output_file_writer.files_to_write[local_output_file_writer.bam]
125+
for read_data in reads_to_write:
126+
read1 = read_data[0]
127+
read2 = read_data[1]
128+
if read1:
129+
local_output_file_writer.write_bam_record(
130+
read1,
131+
contig_index,
132+
bam_handle,
133+
local_options.read_len
134+
)
135+
if read2:
136+
local_output_file_writer.write_bam_record(
137+
read2,
138+
contig_index,
139+
bam_handle,
140+
local_options.read_len
141+
)
142+
bam_handle.flush()
143+
bam_handle.close()
144+
sorted_bam = local_output_file_writer.bam.with_suffix(".sorted.bam")
145+
pysam.sort("-@", str(local_options.threads), "-o", str(sorted_bam), str(local_output_file_writer.bam))
146+
os.rename(str(sorted_bam), str(local_output_file_writer.bam))
147+
_LOG.info(f"bam for thread {thread_idx} written")
148148

149149
local_output_file_writer.flush_and_close_files()
150150
file_dict = {

neat/read_simulator/utils/options.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ def from_cli(output_dir: Path,
234234
'rng_seed': (int, None, None, None),
235235
'min_mutations': (int, 0, None, None),
236236
'overwrite_output': (bool, False, None, None),
237-
'parallel_mode': (bool, False, None, None),
238237
'mode': (str, 'size', 'choice', ['size', 'contig']),
239238
'size': (int, 500000, None, None),
240239
'threads': (int, 1, 1, 1000),

0 commit comments

Comments
 (0)