import csv


def get_genes_with_summaries(alliance_gs_file: str):
    """
    Read in the Alliance gene summaries aka gene descriptions TSV file and
    return a Set with all FlyBase IDs that have a description.

    File may be obtained from https://www.alliancegenome.org/downloads

    :param alliance_gs_file: Path to file containing the Alliance gene summaries/descriptions.
    :return: set containing all FlyBase (FBgn) IDs with descriptions.
    """
    summaries = set()
    with open(alliance_gs_file, 'r') as alliance_fh:
        # Read in the Alliance
        reader = csv.DictReader(filter(lambda r: r[0] != '#', alliance_fh),
                                fieldnames=['fbgn', 'symbol', 'summary'], delimiter='\t')
        for row in reader:
            fbgn = row['fbgn'].replace('FB:', '', 1)
            if row['summary'].lower() != 'no description available':
                summaries.add(fbgn)
    return summaries