refgen/cli/run.py
def choose_refgen(extr, term):
    """retrieve qualified reference genomes candidates, and allow users to
    choose one to download, return the option provided by the user"""

    chosen_ftp_url = None

    while True:
        refgen_list = extr.find_refgen(term)

        if len(refgen_list) == 0: # if no refgen, re-enter a term
            print("No referece genome detected for your organisms.")
            print("Re-enter: ", end = '')
            term = input()
            continue
        else:
            print("{} reference genome detected.".format(len(refgen_list)))
            print("{:<2s} {:20s} {:100s}".format('Id', 'Assembly', 'Name'))
            for i in range(len(refgen_list)):
                print("{:<2d} {:20s} {:100s}".format(i + 1, refgen_list[i][0],
                    refgen_list[i][1]))

            if len(refgen_list) == 1: # if only one refgen, return ftp_url
                chosen_ftp_url = refgen_list[0][2]
            else: # if more than one, allow users to choose one
                while True:
                    print("Choose an id: ", end = '')
                    choice = input()

                    if not choice.isdigit() or int(choice) < 1 or \
                            int(choice) > len(refgen_list):
                        print("Invalid input. ", end = '')
                        continue
                    else:
                        chosen_ftp_url = refgen_list[int(choice) - 1][2]
                        break
            break
    return chosen_ftp_url
retrieve qualified reference genomes candidates, and allow users to
    choose one to download, return the option provided by the user
retrieve qualified reference genomes candidates, and allow users to
choose one to download, return the option provided by the user
retrieve qualified reference genomes candidates and allow users to choose one to download return the option provided by the user
def choose_refgen(extr, term):
    chosen_ftp_url = None
    while True:
        refgen_list = extr.find_refgen(term)
        if len(refgen_list) == 0: 
            print("No referece genome detected for your organisms.")
            print("Re-enter: ", end = '')
            term = input()
            continue
        else:
            print("{} reference genome detected.".format(len(refgen_list)))
            print("{:<2s} {:20s} {:100s}".format('Id', 'Assembly', 'Name'))
            for i in range(len(refgen_list)):
                print("{:<2d} {:20s} {:100s}".format(i + 1, refgen_list[i][0],
                    refgen_list[i][1]))
            if len(refgen_list) == 1: 
                chosen_ftp_url = refgen_list[0][2]
            else: 
                while True:
                    print("Choose an id: ", end = '')
                    choice = input()
                    if not choice.isdigit() or int(choice) < 1 or \
                            int(choice) > len(refgen_list):
                        print("Invalid input. ", end = '')
                        continue
                    else:
                        chosen_ftp_url = refgen_list[int(choice) - 1][2]
                        break
            break
    return chosen_ftp_url
def choose_refgen ( extr , term ) : chosen_ftp_url = None while True : refgen_list = extr . find_refgen ( term ) if len ( refgen_list ) == 0 : print ( "No referece genome detected for your organisms." ) print ( "Re-enter: " , end = '' ) term = input ( ) continue else : print ( "{} reference genome detected." . format ( len ( refgen_list ) ) ) print ( "{:<2s} {:20s} {:100s}" . format ( 'Id' , 'Assembly' , 'Name' ) ) for i in range ( len ( refgen_list ) ) : print ( "{:<2d} {:20s} {:100s}" . format ( i + 1 , refgen_list [ i ] [ 0 ] , refgen_list [ i ] [ 1 ] ) ) if len ( refgen_list ) == 1 : chosen_ftp_url = refgen_list [ 0 ] [ 2 ] else : while True : print ( "Choose an id: " , end = '' ) choice = input ( ) if not choice . isdigit ( ) or int ( choice ) < 1 or int ( choice ) > len ( refgen_list ) : print ( "Invalid input. " , end = '' ) continue else : chosen_ftp_url = refgen_list [ int ( choice ) - 1 ] [ 2 ] break break return chosen_ftp_url
retrieve qualified reference genomes candidates, and allow users to
choose one to download, return the option provided by the user
retrieve qualified reference genomes candidates and allow users to choose one to download return the option provided by the user
"""retrieve qualified reference genomes candidates, and allow users to
    choose one to download, return the option provided by the user""" # if no refgen, re-enter a term # if only one refgen, return ftp_url # if more than one, allow users to choose one
extr
term