def add_edges_GRNdb(dir_graph, w):
    """
    Given a directed graph and w matrix, adds a directed edge from gene j to gene i representing the interaction at
    w[i,j], if it exists. Edges are weighted based on confidence values in GRNdb; 0 marks no interaction, 1 marks a low
    confidence interaction, 2 marks a high confidence interaction. Returns the graph.

    :param dir_graph: A directed graph of gene interactions
    :type dir_graph: DiGraph
    :param w: A matrix representing perturbation interactions with genes as columns and gene names as indices
    :type w: DataFrame
    :output dir_graph: A directed graph of gene interactions with edges to represent interactions between genes
    :type dir_graph: DiGraph
    """
    w = w.to_numpy()
    for i in range(w.shape[1]):
        for j in range(w.shape[1]):
            if w[i, j] == 1:  # low confidence interaction
                dir_graph.add_edge(j, i, color="green", weight=w[i, j])
            if w[i, j] == 2:  # high confidence interaction
                dir_graph.add_edge(j, i, color="green", weight=w[i, j])
    return dir_graph