Skip to content

Commit

Permalink
Fix _recombine_symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
soldatmat committed Mar 4, 2024
1 parent 4a6b770 commit c9a9670
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/mutagenesis/recombination.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ function (m::Recombination)(parents::AbstractVector{Vector{Char}})
@assert DESilico.same_length_sequences(parents)
length(parents) == 0 && return Vector{Vector{Char}}([])
alphabets = m.alphabet_extractor(parents)
mutant_library = _recombine_symbols(alphabets, parents[1])
_recombine_symbols(alphabets)
end

function _recombine_symbols(
alphabets::Vector{Set{Char}},
first_parent::AbstractVector{Char},
)
mutant_library = Vector{Vector{Char}}([copy(first_parent)])
for position in 1:length(first_parent)
sequence = map(alphabet -> [symbol for symbol in alphabet][1], alphabets)
mutant_library = Vector{Vector{Char}}([sequence])
for position in 1:length(alphabets)
new_mutants = Vector{Vector{Char}}([])
for mutant in mutant_library
for symbol in alphabets[position]
Expand Down
4 changes: 1 addition & 3 deletions test/unit/mutagenesis/recombination.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
Set(['A']),
Set(['B', 'D']),
]
first_parent = ['A', 'A', 'B']
mutants = DESilico._recombine_symbols(alphabets, first_parent)
mutants = DESilico._recombine_symbols(alphabets)
@test length(mutants) == 4
@test Set(mutants) == Set([
['A', 'A', 'B'],
['A', 'A', 'D'],
['C', 'A', 'B'],
['C', 'A', 'D'],
])
@test first_parent == ['A', 'A', 'B']
end

@testset "Constructors" begin
Expand Down

0 comments on commit c9a9670

Please sign in to comment.