practicing python#
%run receptor_tools.ipynb
mydoc(myfun, method='both')
Display the signature of myfun followed by the docstring of myfun.
Set method ='signature' or 'method = 'docstring' or 'method = 'both'
print_graph(G)
Prints the vertices and edges of the graph G.
generator(A, rowsum=True)
Creates the generator matrix ‘Q’ from the adjacency matrix ‘A’. By default the sum along each row of ‘Q’ is zero (‘rowsum=True’). For the sum along each column of ‘Q’ to be zero, set ‘rowsum=False’.
hill_diagramatic_method(Q)
Returns the spanning tree polynomials rooted in each vertex.
add_vertex_monomials(G=Graph on 0 vertices, method='integer', ring=False)
Add monomials to vertices of a graph.
The add_vertex_monomials function takes a graph G, as well as optional parameters method and ring. The function creates a new graph H with vertices labeled by monomials. The monomials are chosen based on the number of vertices in G. If the method parameter is set to ‘alpha’ and the number of vertices in G is less than or equal to 10, the monomials are chosen as alphabetical letters (‘a’ to ‘k’). Otherwise, the monomials are chosen as strings of the form ‘a0’, ‘a1’, …, ‘an-1’, where n is the number of vertices in G. The function then adds the vertices from G to H using the monomials as labels, and adds the edges from G to H using the monomials as endpoints. If the ring parameter is set to True, the function also creates a polynomial ring V with the chosen monomials and ‘invlex’ order, and returns both H and V. Otherwise, it returns only H.
INPUT:
G– graph object (default:Graph());method– integer (default:integer);
OUTPUT:
The graph with monomials as vertices
add_edge_monomials(G0, method='integer', edge_vars=['b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], ring=False, short_name=False)
Add monomials to edges of a graph.
The add_edge_monomials function takes a graph G, as well as optional parameters method, edge_vars, ring, and short_name. If method is set to ‘integer’, the function creates a polynomial ring using the given edge variables and assigns variables to the edges of the graph. The edge variables can be represented either as ‘e’ followed by the first vertex label or the first and second vertex labels concatenated. If the vertex labels are integers and the short_name parameter is set to True, the edge variables are created using only the first vertex label. If method is set to ‘alpha’, the function creates a polynomial ring using the given edge variables and assigns variables to the edges of the graph in reverse order. The number of edge variables used is determined by the size of the graph. The ring parameter, if set to True, injects the polynomial variables into the global namespace and returns the graph and the polynomial ring. Otherwise, it simply returns the graph.
INPUT:
G– graph object (default:Graph());method– integer (default:integer);
OUTPUT:
The graph with monomials as edges
add_edge_monomials_ver2(G, edge_labels='default', prefix='')
Add monomials to edges of a graph.
[NEED TO WRITE DESCRIPTION]
enumerate_allosteric_parameters(G=House Graph: Graph on 5 vertices, **kwargs)
Enumerate allosteric parameters of a receptor model.
[NEED TO WRITE DESCRIPTION]
INPUT:
G– graph object (default:Graph());method– integer (default:integer);
OUTPUT:
The graph with monomials as vertices
cartesian_power(G, k=2, edge_labels='cannonical')
Construct Cartesian power of a graph.
[NEED TO WRITE DESCRIPTION]
reduced_cartesian_power(G, k=2, edge_labels='cannonical', prefix='', independent=False)
Construct reduced Cartesian power of a graph.
[NEED TO WRITE DESCRIPTION]
reduced_cartesian_power_ver2(G, k, contexts=True, edge_labels=True)
<IPython.core.display.Markdown object>
combinatorial_laplacian(G, combinatorial_coefficients=False)
Construct the combinatorial Laplacian of a graph.
[NEED TO WRITE DESCRIPTION]
tree_polynomial(G, combinatorial_coefficients=False)
Construct the tree polynomial of a graph.
[NEED TO WRITE DESCRIPTION]
def my_function(*args, **kwargs):
print(args)
print(*args)
print(kwargs)
print(kwargs.keys())
print(*kwargs)
#print([key for key in *kwargs])
pass
my_function(1, b=3, c=4)
(1,)
1
{'b': 3, 'c': 4}
dict_keys(['b', 'c'])
b c
zeros(5,8)
[[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0]]