def merge_glycan_substructure_dict_to_substructure_dict(
    glycan_substructure_dict, glycan_dict, combine_original=True):
    """
    merge glycan_substructure_dict to substructure_dict
    :param glycan_substructure_dict: dict_ID_dict_degree_list
    :param combine_original: Check if you need add the original glycan to the substructure-vec
    :return:
    """
    print('Start merge_glycan_substructure_to_substructure_dict')
    _substructure_dic = {}
    for i in sorted(list(glycan_substructure_dict.keys()), reverse=True):
        for j in glycan_substructure_dict[i].keys():
            if j not in _substructure_dic.keys():
                _substructure_dic[j] = glycan_substructure_dict[i][j][:]
            else:
                _substructure_dic[j].extend(glycan_substructure_dict[i][j][:])
    if combine_original:
        print('combine original')
        for i in glycan_dict.keys():
            if str(len(glycan_dict[i])) not in _substructure_dic.keys():
                print('add new glycan degree')
                _substructure_dic[str(len(glycan_dict[i]))] = [glycan_dict[i]]
            else:
                _substructure_dic[str(len(glycan_dict[i]))].append(glycan_dict
                    [i])
    return _substructure_dic
