def fetch_mga_scores(mga_vec,
                     codon_pos,
                     default_mga=None):
    """Get MGAEntropy scores from pre-computed scores in array.

    Parameters
    ----------
    mga_vec : np.array
        numpy vector containing MGA Entropy conservation scores for residues
    codon_pos: list of int
        position of codon in protein sequence
    default_mga: float or None, default=None
        value to use if MGA entropy score not available for a given mutation.
        Drop mutations if no default specified.

    Returns
    -------
    mga_ent_scores : np.array
        score results for MGA entropy conservation
    """
    # keep only positions in range of MGAEntropy scores
    len_mga = len(mga_vec)
    good_codon_pos = [p for p in codon_pos if p < len_mga]

    # get MGAEntropy scores
    if good_codon_pos:
        mga_ent_scores = mga_vec[good_codon_pos]
    else:
        mga_ent_scores = None

    return mga_ent_scores
def fetch_mga_scores ( mga_vec , codon_pos , default_mga = None ) : len_mga = len ( mga_vec ) good_codon_pos = [ p for p in codon_pos if p < len_mga ] if good_codon_pos : mga_ent_scores = mga_vec [ good_codon_pos ] else : mga_ent_scores = None return mga_ent_scores
Get MGAEntropy scores from pre-computed scores in array.

    Parameters
    ----------
    mga_vec : np.array
        numpy vector containing MGA Entropy conservation scores for residues
    codon_pos: list of int
        position of codon in protein sequence
    default_mga: float or None, default=None
        value to use if MGA entropy score not available for a given mutation.
        Drop mutations if no default specified.

    Returns
    -------
    mga_ent_scores : np.array
        score results for MGA entropy conservation