Skip to content

Commit

Permalink
Fix mut sequence output
Browse files Browse the repository at this point in the history
  • Loading branch information
ThijsMaas committed Feb 5, 2024
1 parent 968d6e7 commit 823fd75
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion iss/error_models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def mut_sequence(self, record, orientation):
'reverse'
Returns:
Seq: a sequence
SeqRecord: the read record with substitution errors
"""

# get the right subst_matrix
Expand Down
6 changes: 3 additions & 3 deletions iss/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def simulate_read(record, error_model, i, cpu_number, sequence_type):
# add the indels, the qual scores and modify the record accordingly
forward.seq = error_model.introduce_indels(forward, "forward", sequence, bounds)
forward = error_model.introduce_error_scores(forward, "forward")
forward.seq = error_model.mut_sequence(forward, "forward")
forward = error_model.mut_sequence(forward, "forward")

# generate the reverse read
# assign start position reverse read
Expand Down Expand Up @@ -187,7 +187,7 @@ def simulate_read(record, error_model, i, cpu_number, sequence_type):
# add the indels, the qual scores and modify the record accordingly
reverse.seq = error_model.introduce_indels(reverse, "reverse", sequence, bounds)
reverse = error_model.introduce_error_scores(reverse, "reverse")
reverse.seq = error_model.mut_sequence(reverse, "reverse")
reverse = error_model.mut_sequence(reverse, "reverse")

return (forward, reverse, forward.annotations["mutations"] + reverse.annotations["mutations"])

Expand Down Expand Up @@ -235,7 +235,7 @@ def worker_iterator(work, error_model, cpu_number, worker_prefix, seed, sequence
random.seed(seed + cpu_number)
np.random.seed(seed + cpu_number)

with forward_handle, reverse_handle:
with forward_handle, reverse_handle, mutation_handle:
for record, n_pairs, mode in work:
simulate_reads(
record=record,
Expand Down
2 changes: 1 addition & 1 deletion iss/test/test_error_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_mut_sequence():

read = SeqRecord(Seq(str("AAAAA" * 25)), id="read_1", description="test read")
read.letter_annotations["phred_quality"] = [5] * 125
read.seq = err_mod.mut_sequence(read, "forward")
read = err_mod.mut_sequence(read, "forward")
assert str(read.seq[:10]) == "AAAACAGAAA"


Expand Down

0 comments on commit 823fd75

Please sign in to comment.