From b9c39a40c9ba28083e2479e1275660bec05835a8 Mon Sep 17 00:00:00 2001 From: August <30163079+augeorge@users.noreply.github.com> Date: Tue, 7 May 2024 19:55:26 -0700 Subject: [PATCH] replace np float and int --- .DS_Store | Bin 14340 -> 14340 bytes SERGIO/.DS_Store | Bin 6148 -> 6148 bytes SERGIO/sergio.py | 54 +++++++++++++++++++++++------------------------ 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.DS_Store b/.DS_Store index 1d935807f114f6b5ed025a30474443b5c80e9fb7..686196c64704b68b50a2ab1be1217e45f41e0563 100644 GIT binary patch delta 125 zcmZoEXepTBaFU^hRb;3N^1%?1MU9Goe|$vH{+`8kY}?ImQH86Vkfj+YQ+6-dg- zPhwzT;AoW3mr?qB)NyiytO%yy0$EumCWX!WWwn_Yg(veU6i*h^5Z+v*7{a^xsH`H> PW_E*bESvADvNHn!DSjm? delta 346 zcmZoEXepTBÄU^hRbz$6is%?1MU9FsF7c$pclKiOO%A{B!eDT#)4_AC#44Vief?KvtV+;sZrS@yR?2#q~lAdJLHi1q_u8 zc??Mm@eIif84RgFG8-tC50uGcC}AkhNjD5m&d)6XTf!jR1Eh)4mz(bbcLKzP==x%@ qTZrs->>9D_E66~0sKR7jb@9!U6he46UUFpI%x>_FWwWdbJ2L>w-cpbN diff --git a/SERGIO/.DS_Store b/SERGIO/.DS_Store index 3b55eed608d39576a44aad25b4aa69b650f60934..c043effb833ad581ad5825f163cd1ca16a5115cb 100644 GIT binary patch delta 213 zcmZoMXfc=&$(_uQ$dJsC!H~)jKlvl$@_H5q1_o}1cpxlbs07NuWf|gg(hY-?^K%P; zDi|0TIlkjonVaw8l9ZF51XRIMbwFF$;`32Qe5zC6stpM%FUUZ4hQa2KjACpP8_YJd IbNuB80MNfO-~a#s delta 258 zcmZoMXfc=&$(_fL#1PMr%#gv5I{6^u@_H5q1_mJpJ%&t%0)|QkBw3)EY@k>^P$rL| zgrPVm-7q*gKeqs=9t0);F;V(*^Icq0N=uR%7;c8eFoX3X=}Sa72i?Nl{1iMIaqBC{ TKz69Y=7WqfY@69R{_+C=fK51- diff --git a/SERGIO/sergio.py b/SERGIO/sergio.py index 4587d43..3353f00 100644 --- a/SERGIO/sergio.py +++ b/SERGIO/sergio.py @@ -155,7 +155,7 @@ def build_graph (self, input_file_taregts, input_file_regs, shared_coop_state = reader = csv.reader(f, delimiter=',') if (shared_coop_state <= 0): for row in reader: - nRegs = np.int(row[1]) + nRegs = int(float(row[1])) ##################### Raise Error ########################## if nRegs == 0: print ("Error: a master regulator (#Regs = 0) appeared in input") @@ -165,22 +165,22 @@ def build_graph (self, input_file_taregts, input_file_regs, shared_coop_state = currInteraction = [] currParents = [] for regId, K, C_state in zip(row[2: 2 + nRegs], row[2+nRegs : 2+2*nRegs], row[2+2*nRegs : 2+3*nRegs]): - currInteraction.append((np.int(regId), np.float(K), np.float(C_state), 0)) # last zero shows half-response, it is modified in another method - allRegs.append(np.int(regId)) - currParents.append(np.int(regId)) - self.graph_[np.int(regId)]['targets'].append(np.int(row[0])) + currInteraction.append((int(float(regId)), float(K), float(C_state), 0)) # last zero shows half-response, it is modified in another method + allRegs.append(int(float(regId))) + currParents.append(int(float(regId))) + self.graph_[int(float(regId))]['targets'].append(int(float(row[0]))) - self.graph_[np.int(row[0])]['params'] = currInteraction - self.graph_[np.int(row[0])]['regs'] = currParents - self.graph_[np.int(row[0])]['level'] = -1 # will be modified later - allTargets.append(np.int(row[0])) + self.graph_[int(float(row[0]))]['params'] = currInteraction + self.graph_[int(float(row[0]))]['regs'] = currParents + self.graph_[int(float(row[0]))]['level'] = -1 # will be modified later + allTargets.append(int(float(row[0]))) #if self.dyn_: # for b in range(self.nBins_): - # binDict[b].append(gene(np.int(row[0]),'T', b)) + # binDict[b].append(gene(int(float(row[0]),'T', b)) else: for indRow, row in enumerate(reader): - nRegs = np.int(np.float(row[1])) + nRegs = int(float((row[1]))) ##################### Raise Error ########################## if nRegs == 0: print ("Error: a master regulator (#Regs = 0) appeared in input") @@ -190,19 +190,19 @@ def build_graph (self, input_file_taregts, input_file_regs, shared_coop_state = currInteraction = [] currParents = [] for regId, K, in zip(row[2: 2 + nRegs], row[2+nRegs : 2+2*nRegs]): - currInteraction.append((np.int(np.float(regId)), np.float(K), shared_coop_state, 0)) # last zero shows half-response, it is modified in another method - allRegs.append(np.int(np.float(regId))) - currParents.append(np.int(np.float(regId))) - self.graph_[np.int(np.float(regId))]['targets'].append(np.int(np.float(row[0]))) + currInteraction.append((int(float((regId))), float(K), shared_coop_state, 0)) # last zero shows half-response, it is modified in another method + allRegs.append(int(float((regId)))) + currParents.append(int(float((regId)))) + self.graph_[int(float((regId)))]['targets'].append(int(float((row[0])))) - self.graph_[np.int(np.float(row[0]))]['params'] = currInteraction - self.graph_[np.int(np.float(row[0]))]['regs'] = currParents - self.graph_[np.int(np.float(row[0]))]['level'] = -1 # will be modified later - allTargets.append(np.int(np.float(row[0]))) + self.graph_[int(float((row[0])))]['params'] = currInteraction + self.graph_[int(float((row[0])))]['regs'] = currParents + self.graph_[int(float((row[0])))]['level'] = -1 # will be modified later + allTargets.append(int(float((row[0])))) #if self.dyn_: # for b in range(self.nBins_): - # binDict[b].append(gene(np.int(row[0]),'T', b)) + # binDict[b].append(gene(int(float(row[0]),'T', b)) #self.master_regulators_idx_ = set(np.setdiff1d(allRegs, allTargets)) @@ -214,14 +214,14 @@ def build_graph (self, input_file_taregts, input_file_regs, shared_coop_state = print ("Error: Inconsistent number of bins") sys.exit() - masterRegs.append(int(float(row[0]))) - self.graph_[int(float(row[0]))]['rates'] = [np.float(i) for i in row[1:]] - self.graph_[int(float(row[0]))]['regs'] = [] - self.graph_[int(float(row[0]))]['level'] = -1 + masterRegs.append(int(float(float(row[0])))) + self.graph_[int(float(float(row[0])))]['rates'] = [float(i) for i in row[1:]] + self.graph_[int(float(float(row[0])))]['regs'] = [] + self.graph_[int(float(float(row[0])))]['level'] = -1 #if self.dyn_: # for b in range(self.nBins_): - # binDict[b].append(gene(np.int(row[0]),'MR', b)) + # binDict[b].append(gene(int(float(row[0]),'MR', b)) self.master_regulators_idx_ = set(masterRegs) @@ -614,7 +614,7 @@ def populate_with_parentCells_(self, binID): elif np.count_nonzero(parentBins) == 1: parentBinID = np.nonzero(parentBins)[0][0] - nPopulation = int(round(self.bifurcationMat_[parentBinID, binID] * self.nSC_)) + nPopulation = int(float(round(self.bifurcationMat_[parentBinID, binID] * self.nSC_))) #self.nInitCells_[binID] = nPopulation #Bifurcation rates of <1/nSC are set to 1/nSC @@ -622,7 +622,7 @@ def populate_with_parentCells_(self, binID): nPopulation = 1 else: parentBinID = binID - nPopulation = int(max(1, np.random.normal(20,5))) + nPopulation = int(float(max(1, np.random.normal(20,5)))) #self.nInitCells_[binID] = nPopulation for g in self.binDict[binID]: