# Path: abpytools/analysis/analysis_helper_functions.py
# def load_alignment_algorithm(algorithm):
#     if algorithm.lower() == 'needleman_wunsch':
#         return needleman_wunsch
# 
#     else:
#         raise ValueError("Unknown algorithm")
# 
# def load_substitution_matrix(substitution_matrix):
# 
#     abpytools_directory = Home().homedir
# 
#     if substitution_matrix in SUPPORTED_SUBSITUTION_MATRICES:
#         with open('{}/data/{}.txt'.format(abpytools_directory, substitution_matrix), 'rb') as f:
#             matrix = cPickle.load(f)
#     else:
#         raise ValueError("Unknown substitution matrix")
# 
#     return matrix


from .analysis_helper_functions import load_alignment_algorithm, load_substitution_matrix
            result = self._align(self.target, seq, **kwargs)
            self._aligned_collection[seq.name] = result[0]
            self._alignment_scores[seq.name] = result[1]

        self._aligned = True

    def print_aligned_sequences(self):

        if not self._aligned:
            raise ValueError("Method align_sequences must be called first to perform alignment.")

        final_string = self._aligned_sequences_string()

        print(*final_string, sep='\n')

    @property
    def target_sequence(self):
        return self.target.sequence

    @property
    def aligned_sequences(self):
        return self._aligned_collection

    @property
    def score(self):
        return self._alignment_scores

    def _align(self, seq_1, seq_2, **kwargs):

        # loads the function object that is then called

# Path: abpytools/analysis/analysis_helper_functions.py
# def load_alignment_algorithm(algorithm):
#     if algorithm.lower() == 'needleman_wunsch':
#         return needleman_wunsch
# 
#     else:
#         raise ValueError("Unknown algorithm")
# 
# def load_substitution_matrix(substitution_matrix):
# 
#     abpytools_directory = Home().homedir
# 
#     if substitution_matrix in SUPPORTED_SUBSITUTION_MATRICES:
#         with open('{}/data/{}.txt'.format(abpytools_directory, substitution_matrix), 'rb') as f:
#             matrix = cPickle.load(f)
#     else:
#         raise ValueError("Unknown substitution matrix")
# 
#     return matrix


# Path: abpytools/analysis/sequence_alignment.py
from .analysis_helper_functions import load_alignment_algorithm, load_substitution_matrix

            result = self._align(self.target, seq, **kwargs)
            self._aligned_collection[seq.name] = result[0]
            self._alignment_scores[seq.name] = result[1]

        self._aligned = True

    def print_aligned_sequences(self):

        if not self._aligned:
            raise ValueError("Method align_sequences must be called first to perform alignment.")

        final_string = self._aligned_sequences_string()

        print(*final_string, sep='\n')

    @property
    def target_sequence(self):
        return self.target.sequence

    @property
    def aligned_sequences(self):
        return self._aligned_collection

    @property
    def score(self):
        return self._alignment_scores

    def _align(self, seq_1, seq_2, **kwargs):

        # loads the function object that is then called

        self._algorithm_function = load_alignment_algorithm(self._algorithm)