docs: def dannots2dalignbed2dannotsagg(cfg):
      """
      Aggregate annotations per query
      step#8
  
      :param cfg: configuration dict
      """
      datatmpd=cfg['datatmpd']
      
      daannotp=f'{datatmpd}/08_dannot.tsv'
      cfg['daannotp']=daannotp
      dannotsaggp=cfg['dannotsaggp']
      logging.info(basename(daannotp))
      if ((not exists(daannotp)) and (not exists(dannotsaggp))) or cfg['force']:
          gff_renamed_cols=[c+' annotation' if c in set(bed_colns).intersection(gff_colns) else c for c in gff_colns]
          dannots=pd.read_csv(cfg['annotationsbedp'],sep='\t',
                     names=bed_colns+gff_renamed_cols,
                             low_memory=False)
          dannots=del_Unnamed(dannots)
  
          dannots=dannots.set_index('id')
          dannots['annotations count']=1
          # separate ids from attribute columns
          dannots=lambda2cols(dannots,lambdaf=gffatributes2ids,
                      in_coln='attributes',
                  to_colns=['gene name','gene id','transcript id','protein id','exon id'])
          dannots=dannots.drop(['attributes']+[c for c in gff_renamed_cols if 'annotation' in c],axis=1)
          logging.debug('or this step takes more time?')
          to_table(dannots,daannotp)
  #         to_table_pqt(dannots,daannotp)
      else:
  #         dannots=read_table_pqt(daannotp)
          dannots=read_table(daannotp)
          dannots=del_Unnamed(dannots)
          
      logging.info(basename(dannotsaggp))
      if not exists(dannotsaggp) or cfg['force']:
          if not 'dannots' in locals():
  #             dannots=read_table_pqt(daannotp)
              dannots=pd.read_table(daannotp,low_memory=False)
          dannots=del_Unnamed(dannots)
          dannots=dannots.reset_index()
          logging.debug('aggregating the annotations')
          from rohan.dandage.io_sets import unique 
          cols2aggf={'annotations count':np.sum,
                    'type': unique,
                    'gene name': unique,
                    'gene id': unique,
                    'transcript id': unique,
                    'protein id': unique,
                    'exon id': unique}
          dannotsagg=dannots.groupby('id').agg(cols2aggf)
          dannotsagg['annotations count']=dannotsagg['annotations count']-1
          dannotsagg.loc[dannotsagg['annotations count']==0,'region']='intergenic'
          dannotsagg.loc[dannotsagg['annotations count']!=0,'region']='genic'
          logging.debug('end of the slowest step')            
          del dannots    
          dannotsagg=dannotsagg.reset_index()
  #         to_table_pqt(dannotsagg,dannotsaggp)
          dannotsagg.to_csv(dannotsaggp,sep='\t')        
      return cfg