@@ -627,7 +627,7 @@ def printSpIdFromBt(self, bit):
627627 # Function that displays the reactions on the screen. It receives as
628628 # input a list p of integers corresponding to the reactions to be displayed.
629629 # If p is not entered, the complete network is displayed.
630- def printRp (self ,r_set = None ):
630+ def printRp (self ,r_set = None , string_out = False ):
631631
632632 # Checks if input is or not a bitarray, If is, it make the
633633 # transformation to an numpy array
@@ -645,7 +645,8 @@ def printRp(self,r_set=None):
645645 if i in self .MpDf .columns :
646646 r_i .append (i )
647647 # r=r_set
648-
648+
649+ str_out = str ()
649650 for i in r_i :
650651 p_text = "r" + str (i )+ ": "
651652 for j in np .where (self .MrDf .iloc [:,i ]!= 0 )[0 ]:
@@ -670,8 +671,14 @@ def printRp(self,r_set=None):
670671 p_text += "+ "
671672 if len (np .where (self .MpDf .iloc [:,i ]!= 0 )[0 ])> 0 :
672673 p_text = p_text [:- 2 ]
673- print (p_text )
674+ if not string_out :
675+ print (p_text )
676+ else :
677+ str_out += p_text + "\n "
674678
679+ if string_out :
680+ return str_out
681+
675682 # Function that displays the reactions on the screen. It receives as
676683 # input a list p of integers corresponding to the reactions to be displayed.
677684 # If p is not entered, the complete network is displayed.
@@ -1845,6 +1852,46 @@ def setExtraRandomgeneratedInflow(self,extra=0.1):
18451852 self .ReacListBt = reac
18461853 self .ProdListBt = prod
18471854
1855+ def addInflow (self ,sp_set ):
1856+ '''
1857+
1858+
1859+ Parameters
1860+ ----------
1861+ sp_set : TYPE
1862+ DESCRIPTION.
1863+
1864+ Returns
1865+ -------
1866+ None.
1867+
1868+ '''
1869+
1870+ # selection of species that will considere as inflow species
1871+ SpIds = sp_set .search (1 )
1872+ inflow_sp = self .getInflowFromSp (self .SpIdStrArray )
1873+
1874+ SpIds = list (set (SpIds )- set (inflow_sp ))
1875+
1876+
1877+
1878+ k = self .MpDf .shape [1 ]
1879+ for l in SpIds :
1880+ print (l )
1881+ self .MpDf [k ]= 0.0
1882+ self .MrDf [k ]= 0.0
1883+ self .MpDf .loc [self .SpIdStrArray [l ],k ]= 1.0
1884+
1885+ p_bt = bt (self .MpDf .shape [0 ])
1886+ p_bt .setall (0 )
1887+ r_bt = p_bt .copy ()
1888+
1889+ self .ReacListBt .append (r_bt )
1890+
1891+ p_bt [l ]= 1
1892+ self .ProdListBt .append (p_bt )
1893+ k += 1
1894+
18481895 # function that adds a percentage of additional (extra) inflow
18491896 # reactions to an existing network
18501897 def setExtraRandomgeneratedOutflow (self ,extra = 0.1 ):
@@ -1994,4 +2041,6 @@ def setRandomgeneratedBoolean(cls,init_Nr=10,add_Nr=10,bsp_N=10,bsp=None,bsp_wf=
19942041 out .IsSbmlBool = False
19952042
19962043 return out
1997-
2044+
2045+
2046+
0 commit comments