Пример #1
0
    def test_get_shortest_paths_graph(self):
        """Test method to get shortest paths graph."""
        shortest_path_graph = self.mapped_network.copy()
        shortest_path_graph.delete_vertices([2, 6, 7, 8])
        shortest_path_graph.simplify(combine_edges=max)
        shortest_path_graph.delete_vertices(
            shortest_path_graph.vs.select(_degree_eq=0))
        eid = shortest_path_graph.get_eid("0", "3")
        shortest_path_graph.delete_edges(eid)
        weights = list(1 - np.array(shortest_path_graph.es['weight']))
        shortest_path_graph.es['weight'] = weights

        n = Network(
            self.interact_network,
            max_adj_p=0.05,
            max_l2fc=-1,
            min_l2fc=1,
        )
        n.set_up_network(self.protein_list)

        fn = FilteredNetwork(n)
        shortest_path_graph_to_test = fn.get_shortest_paths_graph()

        self.__check_for_graph_eq(shortest_path_graph,
                                  shortest_path_graph_to_test)
Пример #2
0
 def test_init(self):
     """Test the constructor and set_up methods."""
     n = Network(
         self.interact_network,
         max_adj_p=0.05,
         max_l2fc=-1,
         min_l2fc=1,
     )
     n.set_up_network(self.protein_list, gene_filter=True)
     self.__check_for_graph_eq(n.graph, self.mapped_network)
Пример #3
0
    def test_get_downregulated_genes_network(self):
        """Test the method to get downregulated genes network."""
        de_down = self.mapped_network.copy()
        de_down.delete_vertices([0, 1, 2, 3, 4, 6, 7, 8])
        de_down.delete_vertices(de_down.vs.select(_degree_eq=0))

        n = Network(
            self.interact_network,
            max_adj_p=0.05,
            max_l2fc=-1,
            min_l2fc=1,
        )
        n.set_up_network(self.protein_list)

        fn = FilteredNetwork(n)
        de_down_to_test = fn.get_downregulated_genes_network()
        self.__check_for_graph_eq(de_down, de_down_to_test)