コード例 #1
0
ファイル: crossover.py プロジェクト: dg310012/Sequoya
    def find_length_of_the_largest_sequence(self, solution: MSASolution):
        max_length = solution.get_length_of_sequence(0)

        for i in range(1, solution.number_of_variables):
            length_of_sequence_i = solution.get_length_of_sequence(i)
            if max_length < length_of_sequence_i:
                max_length = length_of_sequence_i

        return max_length
コード例 #2
0
ファイル: crossover.py プロジェクト: dg310012/Sequoya
 def fill_sequences_with_gaps_to_reach_the_max_sequence_length(
         self, solution: MSASolution, max_length: int,
         cutting_points: list):
     for i in range(solution.number_of_variables):
         sequence_length = solution.get_length_of_sequence(i)
         if sequence_length != max_length:
             for j in range(sequence_length, max_length):
                 if cutting_points[i] == -1:
                     solution.add_gap_to_sequence_at_index(
                         seq_index=i, gap_position=sequence_length - 1)
                 else:
                     solution.add_gap_to_sequence_at_index(
                         seq_index=i, gap_position=cutting_points[i] + 1)