def dannotsagg2dannots2dalignbedannot(cfg):
    """
    Map aggregated annotations to queries
    step#9

    :param cfg: configuration dict
    """
    datatmpd=cfg['datatmpd']
    
    dannotsagg=del_Unnamed(pd.read_csv(cfg['dannotsaggp'],sep='\t'))
    dalignbedstats=del_Unnamed(pd.read_csv(cfg['dalignbedstatsp'],sep='\t'))
    dalignbedannotp=cfg['dalignbedannotp']
    logging.info(basename(dalignbedannotp))
    if not exists(dalignbedannotp) or cfg['force']:
        # df2info(dalignbed)
        # df2info(dannotsagg)
        dalignbedannot=dalignbedstats.set_index('id').join(set_index(dannotsagg,'id'),
                                              rsuffix=' annotation')
        dalignbedannot['NM']=dalignbedannot['NM'].apply(int)
#         from rohan.dandage.get_scores import get_beditorscore_per_alignment,get_cfdscore
#         dalignbedannot['beditor score']=dalignbedannot.apply(lambda x : get_beditorscore_per_alignment(NM=x['NM'],
#                                genic=True if x['region']=='genic' else False,
#                                alignment=x['alignment'],
#                                pam_length=len(x['PAM']),
#                                pam_position=x['original position'],
#                                # test=cfg['test'],
#                                 ),axis=1) 
#         dalignbedannot['CFD score']=dalignbedannot.apply(lambda x : get_cfdscore(x['query sequence'].upper(), x['aligned sequence'].upper()), axis=1)            
        dalignbedannot.to_csv(dalignbedannotp,sep='\t')
    return cfg