def get_highweight_LV_coverage(dict_genes, LV_matrix, quantile=0.9):
    """
    This function count the number of LVs that each
    gene contributes a lot to (i.e. has a high negative or positive
    weight contribution).
    This function returns a dictionary [gene id]: number of LVs

    Note: Using the quantile means that each LV has the same number
    of high weight values. Also here we are using a quantile cutoff
    since our distribution is not normal (exponential PDF)

    Arguments
    ---------
    dict_genes: dict
        Dictionary mapping gene ids to label="generic", "other"

    LV_matrix: df
        Dataframe containing contribution of gene to LV (gene x LV matrix)

    quantile: float(0,1)
        Quantile to use to threshold weights. Default set to 90th quantile.
    """
    thresholds_per_LV = LV_matrix.quantile(quantile)

    # Manually checked that genes selected as high weight
    # are above threshold using below print statements
    # print(thresholds_per_LV)
    # print(LV_matrix)
    # print(
    #    LV_matrix.loc[
    #        (LV_matrix.abs() > thresholds_per_LV)["Node2"].values, "Node2"
    #    ]
    # )
    dict_highweight_coverage = {}
    for gene_label, ls_genes in dict_genes.items():

        LV_series = (LV_matrix.abs() > thresholds_per_LV).sum(axis=1)[ls_genes]

        dict_highweight_coverage[gene_label] = LV_series

    return dict_highweight_coverage