Skip to content

Commit

Permalink
fixing some checks in options
Browse files Browse the repository at this point in the history
  • Loading branch information
joshfactorial committed May 31, 2024
1 parent d650d2b commit c62f156
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions neat/read_simulator/utils/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ def check_and_log_error(keyname, value_to_check, lowval, highval):
pass
elif lowval != "exists" and highval:
if not (lowval <= value_to_check <= highval):
raise ValueError(f'@{keyname} must be between {lowval} and {highval}.\nYour input: {value_to_check}')
mssg = f'`{keyname}` must be between {lowval} and {highval} (input: {value_to_check}).'
_LOG.error(mssg)
raise ValueError(mssg)

elif lowval == "exists" and value_to_check:
validate_input_path(value_to_check)

Expand All @@ -204,11 +207,22 @@ def read(self):
# if it's already set to the default value, ignore.
if value == default or value == ".":
continue

# Now we check that the type is correct and it is in range, depending on the type defined for it
# check for empty
if value is None:
if key == "reference":
mssg = "Must entered a value for `reference` in config"
_LOG.error(mssg)
raise ValueError(mssg)
else:
_LOG.warning(f"No value entered for `{key}`, skipping.")
continue

# Now we check that the type is correct, and it is in range, depending on the type defined for it
# If it passes that it gets put into the args dictionary.
if value != type_of_var(value):
raise ValueError(f"Incorrect type for value entered for {key}: {type_of_var} (found: {value})")
mssg = f"Incorrect type for value entered for {key}: {type_of_var} (found: {value})"
_LOG.error(mssg)
raise ValueError(mssg)

self.check_and_log_error(key, value, criteria1, criteria2)
self.args[key] = value
Expand Down
2 changes: 1 addition & 1 deletion neat/read_simulator/utils/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def convert_masking(self, error_model: SequencingErrorModel):
modified_segment += base
else:
modified_segment += repeat_bases[i % 6]
self.num_ns += 1
self.quality_array[i] = bad_score
else:
modified_segment = MutableSeq(raw_sequence)

Expand Down

0 comments on commit c62f156

Please sign in to comment.