diff --git a/src/db_utils/frequency_scripts/frequency_function.py b/src/db_utils/frequency_scripts/frequency_function.py index b8b6075f59ac5cfce6f405636ed1c2e3a5b7da52..4e8c0caca92f83a5a9a20549e707b613dab54c5a 100644 --- a/src/db_utils/frequency_scripts/frequency_function.py +++ b/src/db_utils/frequency_scripts/frequency_function.py @@ -22,7 +22,7 @@ def frequencies(sequence: str, nt_list: Iterable[str]) -> Dict[str, float]: :param nt_list: (a list of nt) :return: (dic) contains the frequence of every nucleotide """ - if not full_defined(sequence): + if not full_defined(sequence) or len(sequence) < 3: return {nt: np.nan for nt in nt_list} dic = {nt: 0. for nt in nt_list} seql = len(sequence) @@ -60,29 +60,6 @@ def compute_dic(dic_seq: Dict[str, Seq], coord: List[str], return frequencies(sequence, nt_list) -def concat_dic(main_dic: Dict[str, List], sub_dic: Dict[str, float], - region: str, name_col: str) -> Dict[str, List]: - """ - Add the data in sub_dic into main_dic. - - :param main_dic: The dictionary that will contains the - :param sub_dic: The dictionary containing nucleotide frequency of region \ - `region` - :param region: The region with the nucleotide frequencies indicated by \ - sub_dic. - :param name_col: The name of the column where the name of the regions \ - are stored in main_dic - :return: main_dic with the frequency data of region `region` - """ - main_dic[name_col].append(region) - for k in sub_dic.keys(): - if k not in main_dic.keys(): - main_dic[k] = [sub_dic[k]] - else: - main_dic[k].append(sub_dic[k]) - return main_dic - - def get_ft_type(ft: str) -> str: """ From a feature get the feature type of interest.