def queries2alignments(cfg):
    """
    All the processes in alignannoted detection are here.
    
    :param cfg: Configuration settings provided in .yml file
    """
    from rohan.dandage.align import get_genomes
    get_genomes(cfg)
    
    cfg['datad']=cfg['prjd']
    cfg['plotd']=cfg['datad']
    dalignannotedp=f"{cfg['datad']}/dalignannoted.tsv"  
    
#     stepn='04_alignannoteds'
#     logging.info(stepn)
    
    cfg['datatmpd']=f"{cfg['datad']}/tmp"
    for dp in [cfg['datatmpd']]:
        if not exists(dp):
            makedirs(dp)
            
    step2doutp={
    1:'01_queries_queryl*.fa',
    2:'02_dalignbed.tsv',
    3:'03_annotations.bed',
    4:'04_dalignbedqueries.tsv',
    5:'05_dalignedfasta.tsv',
    6:'06_dalignbedqueriesseq.tsv',
    7:'07_dalignbedstats.tsv',
    8:'08_dannotsagg.tsv',
    9:'09_dalignbedannot.tsv',
    10:'10_daggbyquery.tsv',
    }
    cfg['dqueriesp']=cfg['dinp']
    cfg['alignmentbedp']=f"{cfg['datatmpd']}/02_alignment.bed"
    cfg['dalignbedp']=f"{cfg['datatmpd']}/02_dalignbed.tsv"
    cfg['dalignbedqueriesp']=f"{cfg['datatmpd']}/04_dalignbedqueries.tsv"
    cfg['dalignedfastap']=f"{cfg['datatmpd']}/05_dalignedfasta.tsv"
    cfg['dalignbedqueriesseqp']=f"{cfg['datatmpd']}/06_dalignbedqueriesseq.tsv"
    cfg['dalignbedstatsp']=f"{cfg['datatmpd']}/07_dalignbedstats.tsv"
    cfg['dannotsaggp']=f"{cfg['datatmpd']}/08_dannotsagg.tsv"
    cfg['dalignbedannotp']=f"{cfg['datatmpd']}/09_dalignbedannot.tsv"
    cfg['daggbyqueryp']=f"{cfg['datatmpd']}/10_daggbyquery.tsv"

    annotationsbedp=f"{cfg['datatmpd']}/03_annotations.bed"
    cfg['annotationsbedp']=annotationsbedp
    
    dqueries=read_table(cfg['dqueriesp'])
    print(dqueries.head())
    #check which step to process
    for step in range(2,10+1,1):
        if not exists(f"{cfg['datatmpd']}/{step2doutp[step]}"):
            if step==2:
                step=-1
            break
    logging.info(f'process from step:{step}')
    cfg['dalignannotedp']='{}/dalignannoted.tsv'.format(cfg['datad'])
    if not exists(cfg['dalignannotedp']) or cfg['force']:
        if step<=1:
            cfg=dqueries2queriessam(cfg,dqueries)
        if step<=2:
            cfg=queriessam2dalignbed(cfg)
        if step<=3:
            cfg=dalignbed2annotationsbed(cfg)
        if step<=4:
            cfg=dalignbed2dalignbedqueries(cfg)
        if step<=5:
            cfg=alignmentbed2dalignedfasta(cfg)
        if step<=6:
            cfg=dalignbed2dalignbedqueriesseq(cfg)
        if step<=7:
            cfg=dalignbedqueriesseq2dalignbedstats(cfg)
        if step<=8:
            cfg=dannots2dalignbed2dannotsagg(cfg)
        if step<=9:
            cfg=dannotsagg2dannots2dalignbedannot(cfg)
        if step<=10:
            cfg=dalignbedannot2daggbyquery(cfg)

        if cfg is None:        
            logging.warning(f"no alignment found")
            cfg['step']=4
            return saveemptytable(cfg,cfg['dalignannotedp'])
        import gc
        gc.collect()
All the processes in alignannoted detection are here.
    
    :param cfg: Configuration settings provided in .yml file