#!/usr/bin/env python3

"""
Parallelized function for different scores.
"""

import src.score as sc


def parallelized_threading(name, dico_aligns, dope_arr, index_aa):
    """
    A parallelized function to pass several arguments.

    Args:
        name:   name of the alignment (studied template)
        dico_aligns:    dico containing all Alignment instances
        dope_arr:   2D numpy array containing the associated energy by
                    distance for two residus
        index_aa:   dict containing the index of the dope_arr for
                    each amino acid

    Returns:
        A tuple with the name of the template and its threading score
    """
    ev_threading = sc.Threading(dico_aligns[name])
    return (name, ev_threading.threaded(dope_arr, index_aa))


def parallelized_modelling(name, dico_aligns):
    """
    A parallelized function to pass several arguments.

    Args:
        name (string):  name of the alignment (studied template)
        dico_aligns (dict): dict containing all Alignment instances

    Returns:
        A tuple containing the name and the score of the template
    """
    ev_threading = sc.Modeller(dico_aligns[name])
    return (name, ev_threading.modelled())
