\section{Introduction} \label{introduction}
Human genome contains about 20,000 genes, and those genes undergo diverse expression dynamics in different tissues throughout a life from its development to ageing. In a given cell of any tissue, tens of thousands of various gene products interact with one another, forming an incredibly complicated network, to support certain living processes. Such a network is often referred to as the gene regulatory network (GRN), and it has been a hot research topic for decades in the fields of genomics and system biology.   

Many computational approaches have been developed to model GRN, such as information theory models, boolean networks, differential equations models, Bayesian networks, Petri nets and so on \cite{DeJong2002a, Delgado2018, Steggles2007}. Among them, Petri nets present one of the most promising tools, as Petri nets not only excel in modelling concurrent dynamic systems, but also have a wide application community as well as a strong theoretical support \cite{Reisig1985, Murata1989, Steggles2007, Bordon2012}.

Standard Petri nets are able to specify clearly the structure and behaviour of a particular process. However, it's not convenient to compose larger nets from smaller ones as Petri nets suffer from a lack of compositionality and abstraction \cite{Ermel1996}. While complex systems such as GRN often need to abstract from internal transitions and focus on the communication behaviour between processes so that a holistic picture of the whole system could be captured. To address the question, putting Petri nets into the framework of category theory provides an optimal strategy. In fact, this line of research has been explored since 1990 and reached its climax in the recent years with the introduction and optimization of open Petri nets \cite{Meseguer1990, Ermel1996, BALDAN2005,Rathke2014, Baldan2015,Baez2017a, Baez2018}.

Standard Petri nets and their variants (except open Petri nets) have been employed to model GRN for a while \cite{Chaouiya2006, chaouiya2007petri, Chaouiya2008, Steggles2007, Ruths2008, Bordon2012, Liu2014, Liu2017, Hamed2018}. On the other hand, open Petri nets have been successfully applied in modelling electrical circuits \cite{Baez2015a}, Markov processes \cite{Baez2015}, chemical reaction networks \cite{Baez2017a}, etc. However, open Petri nets haven't been used for GRN so far. Therefore, in this work we attempt to explore the possibility and potential of an open Petri nets implementation for GRNs, with the motivation of bringing a better composability to GRN modelling.

\section{Gene regulatory networks} \label{grn}
  In order to support normal cellular functions of a living organism, genes interact with each other to carry out many crucial molecular processed. These interactions usually involve a regulation of the gene expression. If a change in the expression of gene X could induce a change in the expression of gene Y, we say that gene X regulates gene Y. This regulation can be either up-regulation or down-regulation, and we call it activation or inhibition, respectively. Together, those genes and their regulations form a complex network which is referred to as gene regulatory network (GRN) \cite{Chai2014}.
  
  GRN could be inferred from gene expression data through computational approaches such as ordinary differential equation, Boolean network, Bayesian network, etc. Each of those methods has its pro and con. Ordinary differential equation (ODE), as its name suggests, uses continuous variables to represent the concentrations of mRNA or protein molecules (the products of gene expression), and it uses differential equations to model the dynamics of concentration changes. Therefore, ODE suits best for an accurate analysis of non-linear features of GRN. However, it's relatively complex and the parameters for the equations are quite often unavailable in the biological reality. On the other hand, Boolean network uses boolean values to represent gene expression level as well as the relationships between genes. In a Boolean network, a gene is either on or off and the interaction between any pairs of genes is either active or inactive. Boolean network has the advantage of simplicity, while it suffers an inability to capture many important details of GRN. Probabilistic Boolean network is an extension of Boolean network which allows more than one transition Boolean functions and each of them is randomly selected during state transitions to update the target gene \cite{Chai2014}. 
  
  A more sophisticated probabilistic GRN model is Bayesian network. Bayesian network combines probability and graph theory to model the qualitative properties of GRN. It depicts the GRN as a directed acyclic graph (DAG) G=(X,A), X contains a set of nodes $\{x_1, ..., x_n\}$ which represent the gene variables, and A contains the directed edges which represents the probabilistic dependence interactions among genes. Bayesian network carries out the inference of network structure and parameters through belief propagation, which takes both the prior biological knowledge and the expression data into account. Bayesian network has been successfully applied to improve the quality of predicted GRN \cite{Chai2014}. 
  
    
\section{Petri net modelling of gene regulatory networks} \label{pnGrn}
Petri nets provide a complementary network modelling to the above mentioned traditional methods. Petri nets were introduced by C.A. Petri in 1962 to model distributed and concurrent systems \cite{petri1962kommunikation}. Petri nets combine a well defined mathematical theory with a graphical representation; the former allows a precise analysis of the system behaviour, while the latter provides an intuitive visualization of the structure and state changes of the system. Due to these advantages, Petri nets have been successfully applied in modelling many kinds of dynamic systems such as computer networks, communication systems, logistic networks, etc. \cite{Liu2014}

By definition, a Petri net is a bipartite directed graph containing places and transitions connected by directed arcs; arcs can only connect place to transition and vice versa. Figure \ref{pn_1} shows a simple Petri net with 2 places (P1, P2) and one transition (T1).

\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.4]{"pn_1"}
	\caption{A simple Petri net}
	\label{pn_1}
\end{figure}
\noindent

A place can hold tokens (in Figure \ref{pn_1}, P1 holds one token as denoted by a red dot inside the circle), and an arc has its capacity (1 by default, otherwise the capacity is marked on the arc), and transitions have neither capacity, nor tokens. The marking (or state) of a Petri net is its token assignments of places. When the number of tokens in each input place is equal or larger than the arc weight (capacity), a transition is able to fire. When a transition fires, the tokens in input places are transferred to the output places, resulting in a new marking of the net. Figure \ref{pn_2} illustrates the firing of a transition, which reveals that the firing of a transition removes tokens from its input places and add tokens to its output places according to the capacity of the corresponding arcs. Note that tokens may disappear or appear going through a transition \cite{petri1966communication}. 
\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.4]{"pn_2"}
	\caption{Firing of a transition}
	\label{pn_2}
\end{figure}

\noindent
As the theory and methodology of Petri nets have been developed for more than 50 years, using Petri nets to model GRN will enrich our ability to analyse the dynamic properties of GRN. Several attempts have been made to model GRN using Petri nets \cite{Chaouiya2004, Chaouiya2006, chaouiya2007petri, Chaouiya2008, Liu2014, Liu2017, Liu2017a, Liu2017b, Liu2017c, Liu2018, Liu2018a, Liu2018b}. Here we adopt a simple model based on \cite{Chaouiya2004, DraganBosnacki2004} and \cite{Ruths2008}. In this model we draw an arrow from gene g2 to gene g1 to represent that g2 activates g1 (Figure \ref{pn_3}a), and a blunt-end line from g2 to g1 will represent the inhibition of g1 by g2 (Figure \ref{pn_4}a). For these two elementary GRNs we may construct the corresponding Petri nets, where genes are modelled as places, and the interaction between two genes is modelled by a transition together with directed arcs that connect the places and transitions. 

\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.4]{"pn_3"}
	\caption{Activation of gene g1 by g2}
	\label{pn_3}
\end{figure}

\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.4]{"pn_4"}
	\caption{Inhibition of gene g1 by g2}
	\label{pn_4}
\end{figure}


In both activation and inhibition cases, g2 may or may not be consumed. We use double sided arrow to indicate that g2 activates g1 without itself being consumed (Figure \ref{pn_3}c and \ref{pn_4}c), and one sided arrow otherwise (Figure \ref{pn_3}b and \ref{pn_4}b). For activation, we draw an arrow pointing towards g1 from transition ${T_{g1, g2}}$, while for inhibition, we draw the arrow the other way round. Figure \ref{pn_3} and Figure \ref{pn_4} also describe what happens when ${T_{g1, g2}}$ fires. For example, in Figure \ref{pn_3}b, before firing there is a token in g2 but none in g1, while after firing the token in g2 is consumed and g1 is activated as indicated by having a token in it.

Once we have these basic building blocks, we are able to convert a normal GRN into its corresponding Petri net. For example, if we have a GRN as shown in Figure \ref{pn_5}a, then the Petri net for it will look like that in Figure \ref{pn_5}b.
\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.4]{"pn_5"}
	\caption{A simple GRN and its Petri net representation}
	\label{pn_5}
\end{figure}

\noindent
Note that in this GRN gene A activates gene B and C, gene B activates gene D, and gene C inhibits gene D while activates gene E. Except in the case of C activating E, where C is consumed, all other transitions don't consume the source gene.

Now that we obtain the Petri net modelling of a GRN, we shall be able to simulate and analyse the dynamics of the GRN \cite{Ruths2008}. 

\section{A Categorical Treatment of Petri nets}
Unfortunately, standard Petri net lacks proper mechanisms for composition and abstraction, which makes it inadequate to model large or multi-scale GRN. The problem can be solved by viewing Petri net from the category theory perspective, i.e., treating Petri nets as monoids (\cite{Meseguer1990, Ermel1996}). In order to do that, we need to introduce two definitions, following Meseguer and Montanari's work:

(1) A standard Petri net is a triple $<S, T, F>$, where S is a set of places, T is a set of transitions, and $F: (S \times T)+(T \times S) \rightarrow \mathbb{N}$ is a multiset which describes the connections between places and transitions. Here $\mathbb{N}$ represents natural numbers, $\times$ is the Cartesian product of sets, and + denotes the disjoint union of sets. 

(2) A graph G is a set T of arcs, a set V of nodes and two functions $\partial_0$ and $\partial_1$ from T to V ($\partial_0, \partial_1: T \rightarrow V $), called source and target, respectively. A graph morphism from G to G' is a pair of functions $<f, g>, f: T \rightarrow T', g: V \rightarrow V'$ such that:
$g \circ \partial_0 = \partial_0' \circ f$ and $g \circ \partial_1 = \partial_1' \circ f$.

In support of their motto "Petri Nets Are Monoids", Meseguer and Montanani argued that Petri nets can be viewed as ordinary, directed graphs equipped with parallel and sequential composition of transitions \cite{Meseguer1990}. Accordingly, they provided a new definition of Petri net:

A Petri net is a graph where the arcs in set are called transitions and where the set of nodes is the free commutative monoid $S^\oplus$ generated by the set of places S. The elements of $S^\oplus$ has the form $n_1a_1 \oplus n_2a_2 \oplus ...n_ma_m$, where $a_i \in S, n_i \in \mathbb{N}, i \in 1..m$, and m is the number of elements in S. The source and target functions go from T to $S^\oplus$ ($\partial_0, \partial_1: T \rightarrow S^\oplus $). And a Petri net morphism $<f, g>$ is similar to a graph morphism, except that g is now a monoid homomorphism, which respects the monoid structure of $S^\oplus$.

This definition allows a different representation of the same standard Petri net. For example, if we have a Petri net $<S, T, F>$ as shown in Figure \ref{pn_6} where $S = \lbrace g_1, g_2, g_3 \rbrace$, $T = \lbrace t \rbrace $, $F(g_1,t)=1, F(g_2,t) = 1, F(t, g_1)=1, F(t, g_3)=1$, then we can represent it as $S^\oplus = \lbrace g_1, g_2, g_3 \rbrace ^\oplus$, $T = \lbrace t \rbrace $ and  $\partial_0(t) = g_1+g_2$, $\partial_1(t) = g_1+g_3$.

\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.4]{"pn_6"}
	\caption{A simple GRN modelled in Petri net}
	\label{pn_6}
\end{figure}

Under such a representation, sequential and parallel compositions of Petri nets based on transitions could be obtained in a straightforward way. For example, a sequential composition of two Petri nets is illustrated in Figure \ref{pn_7}, where the Petri net in Figure \ref{pn_7}c is a composition of the Petri net in Figure \ref{pn_7}b after that in Figure \ref{pn_7}a.

\begin{figure}[h!]
\centering
\includegraphics[scale=0.4]{"pn_7"}
\caption{Sequential composition of Petri nets}
\label{pn_7}
\end{figure}

On the other hand, a parallel composition of two Petri nets is shown in Figure \ref{pn_8}, in which we calculate the products of places and transitions from Figure \ref{pn_8}a and Figure \ref{pn_8}b, and got the result Petri net in Figure \ref{pn_8}c.

\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.4]{"pn_8"}
	\caption{Parallel composition of Petri nets}
	\label{pn_8}
\end{figure}

\noindent
With these two compositions at hands, we will be able to combine small Petri nets into large ones for the modelling of large GRNs.

Alternatively, we could construct the "open" Petri net following Baez and Master's recent work (\cite{Baez2018}).

The basic idea underlies an Open Petri net is that certain places in the Petri net are designated as inputs or outputs via a cospan of sets, which allows tokens to flow in or out of the Petri net and therefore make it open. From the categorical theory point of view, the input and output sets are objects and the open Petri net is the morphism between them, together they form a symmetric monoidal category (\cite{Baez2017a, Baez2018}). Further, in order to better describe vertical composition between sets and horizontal composition between open Petri nets, a symmetric monoidal double category $\mathbb{O}pen(Petri)$ was introduced. $\mathbb{O}pen(Petri)$ has the following components:\\
\hspace*{1em}(1) objects: sets X, Y, Z, ... \\
\hspace*{1em}(2) vertical 1-morphisms: functions from set X to Y $(f:X \rightarrow Y)$ \\
\hspace*{1em}(3) horizontal 1-cells: open Petri nets $(P:X \nrightarrow Y)$, which are cospans in Petri of the form: \\

\[
\begin{tikzpicture}[commutative diagrams/every diagram]
\node (P0) at (90:2.3cm) {$P$};
\node (P1) at (90+72:2cm) {$LX$} ;
\node (P4) at (90+4*72:2cm) {$LY$};

\path[commutative diagrams/.cd, every arrow, every label]
(P1) edge node {$i$} (P0)
(P4) edge node[swap] {$o$} (P0);
\end{tikzpicture}
\]
here L is a functor from Set to Petri.

\hspace*{1em}(4) 2-morphisms: morphisms between open Petri nets. A 2-morphism in $\mathbb{O}pen(Petri)$ has the following form:
 
\[ \begin{tikzcd}
LX_1 \arrow{r}{i_1} \arrow[swap]{d}{Lf} &P_1 \arrow[swap]{d}{\alpha}  &LY_1 \arrow[swap]{l}{o_1} \arrow{d}{Lg}\\%
LX_2 \arrow{r}{i_2}& P_2 &LY_2 \arrow[swap]{l}{o_2} 
\end{tikzcd}
\]

We can compose 2-morphisms vertically by usual composition of functions as well as horizontally via the pushout of cospans. In addition, we can also obtain the tensor products of two 2-morphisms \cite{Baez2018}. For example, if we have two 2-morphisms as follows:

\[ \begin{tikzcd}
LX_1 \arrow{r}{i_1} \arrow[swap]{d}{Lf} &P_1 \arrow[swap]{d}{\alpha}  &LY_1 \arrow[swap]{l}{o_1} \arrow{d}{Lg}\\%
LX_2 \arrow{r}{i_2}& P_2 &LY_2 \arrow[swap]{l}{o_2} 
\end{tikzcd}
\]

\vspace*{1em}


\[ \begin{tikzcd}
LX_2 \arrow{r}{i_2} \arrow[swap]{d}{Lf'} &P_1 \arrow[swap]{d}{\beta}  &LY_2 \arrow[swap]{l}{o_2} \arrow{d}{Lg'}\\%
LX_3 \arrow{r}{i_3}& P_3 &LY_3 \arrow[swap]{l}{o_3} 
\end{tikzcd}
\]

\noindent
we can compose them vertically to get the 2-morphism:
\[ \begin{tikzcd}
LX_1 \arrow{r}{i_1} \arrow[swap]{d}{L(f' \circ f)} &P_1 \arrow[swap]{d}{\beta \circ \alpha}  &LY_1 \arrow[swap]{l}{o_1} \arrow{d}{L(g' \circ g)}\\%
LX_3 \arrow{r}{i_3}& P_3 &LY_3 \arrow[swap]{l}{o_3} 
\end{tikzcd}
\]

\noindent
And, for the following two 2-morphisms:\\

\hspace*{3em}
\begin{tikzcd}
LX_1 \arrow{r}{i_1} \arrow[swap]{d}{Lf} &P_1 \arrow[swap]{d}{\alpha}  &LY_1 \arrow[swap]{l}{o_1} \arrow{d}{Lg}  &LY_1 \arrow{r}{i_1'} \arrow[swap]{d}{Lg} &P_1' \arrow[swap]{d}{\alpha'}  &LZ_1 \arrow[swap]{l}{o_1'} \arrow{d}{Lh} \\%
LX_2 \arrow{r}{i_2}& P_2 &LY_2 \arrow[swap]{l}{o_2} &LY_2 \arrow{r}{i_2'}& P_2' &LZ_2 \arrow[swap]{l}{o_2'}
\end{tikzcd}\\

\noindent
we can compose them horizontally to get the following 2-morphism:
\[ \begin{tikzcd}
LX_1 \arrow{r}{i_1' \circ i_1} \arrow[swap]{d}{Lf} &{P_1+_{LY_1}P_1'} \arrow[swap]{d}{\alpha +_{Lg} \alpha'}  &LZ_1 \arrow[swap]{l}{o_1' \circ o_1} \arrow{d}{Lh}\\%
LX_2 \arrow{r}{i_2' \circ i_2} &{P_2+_{LY_2}P_2'} &LZ_2 \arrow[swap]{l}{o_2' \circ o_2} 
\end{tikzcd}
\]

\noindent
Moreover, for the two 2-morphism like these:\\


\hspace*{3em}
\begin{tikzcd}
	LX_1 \arrow{r}{i_1} \arrow[swap]{d}{Lf} &P_1 \arrow[swap]{d}{\alpha}  &LY_1 \arrow[swap]{l}{o_1} \arrow{d}{Lg}  &LX_1' \arrow{r}{i_1'} \arrow[swap]{d}{Lf'} &P_1' \arrow[swap]{d}{\alpha'}  &LY_1' \arrow[swap]{l}{o_1'} \arrow{d}{Lg'} \\%
	LX_2 \arrow{r}{i_2}& P_2 &LY_2 \arrow[swap]{l}{o_2} &LY_2' \arrow{r}{i_2'}& P_2' &LY_2' \arrow[swap]{l}{o_2'}
\end{tikzcd}\\

\noindent
we can calculate their tensor product to get the following 2-morphism:
\[ \begin{tikzcd}
L(X_1+X_1') \arrow{r}{i_1+i_1'} \arrow[swap]{d}{L(f+f')} &{P_1 +P_1'} \arrow[swap]{d}{\alpha + \alpha'}  &L(Y_1+Y_1') \arrow[swap]{l}{o_1+o_1'} \arrow{d}{L(g+g')}\\%
L(X_2+X_2') \arrow{r}{i_2+i_2'}&{P_2+P_2'} &L(Y_2+Y_2') \arrow[swap]{l}{o_2+o_2'} 
\end{tikzcd}
\]

\section{Open Petri nets for gene regulatory networks} \label{opnGrn}
Finally, we will illustrate with an example on how to compose two GRNs (in the form of open Petri nets). The example presented here is based on that created in \cite{Baez2018}. Suppose we have the following two GRNs:\\
\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.6]{"pn_9"}

	\label{pn_9}
\end{figure}

\noindent
To compose them horizontal via pushout, we could first stick them side by side through the set Y and get the following intermediate network: \\
\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.6]{"pn_10"}

	\label{pn_10}
\end{figure}

\noindent Then, we identify those places that are images of the same point in Y, group them together, and randomly choose one place to represent the group, removing set Y meanwhile \cite{Baez2018}. For example, point 2 in Y has images g3 and g6, so g3 and g6 are grouped together. Similarly, g4 and g6 are grouped together, and therefore we have g3, g4 and g6 all in the same group. Now we could merge those 3 places together, and we use g6 to represent this group. Also we merge g5 and g7 using g7 as representative place for them. We no longer need set Y and will obtain the composed open Petri net:
\\
\begin{figure}[h!]
	\centering
	\includegraphics[scale=0.6]{"pn_11"}

	\label{pn_10}
\end{figure}

\section{Conclusion and future work}
In this preliminary work we attempt to model the gene regulatory networks (GRNs) with open Petri nets (OPNs) \cite{Baez2018}. OPN incorporates the power of both category theory and Petri nets, therefore it holds the great potential to become an ideal framework for systematic representation of GRNs. At this stage we only provide an example of how to compose two hypothetical GRNs written in the forms of OPNs. In the future we need to formalize on how to convert real GRNs into composable OPNs and further demonstrate that these OPN models facilitate the construction of large GRNs from smaller parts.

\bibliographystyle{apalike}

