-
Notifications
You must be signed in to change notification settings - Fork 1
/
set_params.py
1252 lines (1162 loc) · 61.8 KB
/
set_params.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import re
from defs import *
from values import *
import time
# pick out compartment IDs. E.g. given label=Area_Lumen_Cell, it would return
# (0,1) for (lumen, cell)
def get_interface_id(label):
tmp = (label).split('_')
if len(tmp)==3: # only have two compartment IDs
ind1,ind2 = compart_id[tmp[1]],compart_id[tmp[2]]
return ind1, ind2
elif len(tmp)==4: # solute ID, followed by two compartment IDs
sid,ind1,ind2 = solute_id[tmp[1]],compart_id[tmp[2]],compart_id[tmp[3]]
return sid,ind1,ind2
# for coupled transpoters
# pick out solute IDs, compartment IDs, and coefficients
def get_coupled_id(label):
tmp = (label).split('_')
# print(tmp)
sid1,sid2 = solute_id[tmp[3]],solute_id[tmp[4]]
ind1,ind2 = compart_id[tmp[1]],compart_id[tmp[2]]
if len(tmp)==5: # only involves 2 solutes
return ind1,ind2,sid1,sid2
elif len(tmp)==6: # involves 3 solutes
sid3 = solute_id[tmp[5]]
return ind1,ind2,sid1,sid2,sid3
else:
print("Wrong label",tmp)
# is str_short at the beginning of str_long?
# case insensitive
def compare_string_prefix(str_long,str_short):
return (str_long.lower())[:len(str_short)] == str_short.lower()
def compare_sex(sex, cell):
if sex.lower() == 'male' or sex.lower() == 'female':
return cell.sex.lower() == sex.lower()
else:
return True
def set_torq_params(species,sex,preg):
if species == 'hum':
Radref = 0.0037/2.0e0 # Fortran:Change this to be half of the male diameter given in PTparams_M.dat.diam=0.0036 but this is changed to match Fortran code.
torqR = 0.0014 #Reference radius
torqL = 2.50e-4 #Microvillous length
torqd = 1.5e-05 #Height above the microvillous tip
torqvm = 0.02 #Compliance Fortran Code
PbloodPT = 20.0e0 #Reference pressure
elif species == 'rat':
if sex == 'male':
Radref = 0.00265/2.0 #0.0025/2.0
torqR = 0.00112
torqvm = 0.02 #0.030
PbloodPT = 9.0e0
elif sex == 'female':
if preg == 'non':
torqR = 0.00095
torqvm = 0.030
Radref = 0.002125/2.0 #female radius
PbloodPT = 8.0e0
elif preg == 'mid':
torqR = 0.00101
torqvm = 0.050
Radref = 0.00227375/2.0
PbloodPT = 8.0e0
elif preg == 'late':
torqR = 0.00101
torqvm = 0.050
Radref = 0.00227375/2.0
PbloodPT = 8.0e0
torqL = 2.50e-4
torqd = 1.50e-5
elif species == 'mou':
if sex == 'male':
Radref = 0.002/2.0
torqR = 0.001
torqvm = 0.0275
PbloodPT = 9.0e0
elif sex == 'female':
Radref = 0.0018/2.0 #0.002125/2.0 #female radius
torqR = 0.00095
torqvm = 0.030
PbloodPT = 8.0e0
torqL = 2.50e-4
torqd = 1.50e-5
else:
print('cell.species: ' + str(species))
raise Exception('what is species?')
return Radref,torqR,torqvm,PbloodPT,torqL,torqd
def read_params(cell,filename,j):
file = open(filename,'r')
cell.segment=filename[12:-16]
# error messages
if cell.preg != 'non':
print('cell.preg: ' + cell.preg)
raise Exception('cell.preg != non needs to use read_params_preg in set_params_preg')
line = file.readline()
while (line):
line = line.replace('\t',' ')
terms = line.split(' ')
if line[0][0]!='#':
id = terms[0] #re.findall(r'[A-Za-z_]+', line)
sex = id.split('_')[-1].lower()
if compare_sex(sex, cell):
id = id.replace('_male', '')
id = id.replace('_female', '')
else:
line = file.readline()
continue;
# Skip over the label, which may contain numbers like in HCO3
first_space_pos = line.index(' ')
num = re.findall(r'-?\d+\.?\d*[Ee]?[+-]?\d*', line[first_space_pos:len(line)])
if num: # if this line is numerical parameter
value = float(num[0])
if id.lower() == "Sex".lower():
find = re.findall("female".lower(), terms[-1].lower())
if find:
cell.sex = "female".lower()
# Diameter:
elif compare_string_prefix(id,"Diameter"):
# diabetic diameter
if cell.diabete == 'Non':
cell.diam = value
if cell.type != 'sup':
cell.diam = value*1.02 #slight increase in juxt diam size
elif cell.diabete == 'Moderate':
if cell.segment == 'PT' or cell.segment == 'S3':
cell.diam = value*1.1
elif cell.segment == 'SDL' or cell.segment == 'mTAL' or cell.segment == 'cTAL' or cell.segment == 'DCT' or cell.segment == 'CNT' or cell.segment == 'CCD' or cell.segment == 'OMCD':
cell.diam = value*1.18
else:
cell.diam = value
elif cell.diabete == 'Severe':
if cell.segment == 'PT' or cell.segment == 'S3':
cell.diam = value*1.28
elif cell.segment == 'SDL' or cell.segment == 'mTAL' or cell.segment == 'cTAL' or cell.segment == 'DCT' or cell.segment == 'CNT' or cell.segment == 'CCD' or cell.segment == 'OMCD':
cell.diam = value*1.42
else:
cell.diam = value
else:
print('What is the diabete status?')
if cell.inhib == 'NHE3-50':
if cell.sex == 'male':
if cell.segment == 'CCD' or cell.segment == 'OMCD' or cell.segment == 'IMCD':
cell.diam = value*1.05
if cell.sex == 'female':
if cell.segment == 'CCD' or cell.segment == 'OMCD' or cell.segment == 'IMCD':
cell.diam = value*0.95
if cell.inhib == 'NKCC2-100':
if cell.sex == 'male':
if cell.segment == 'CCD' or cell.segment == 'OMCD' or cell.segment == 'IMCD':
cell.diam = value*0.95
if cell.sex == 'female':
if cell.segment == 'CCD' or cell.segment == 'OMCD' or cell.segment == 'IMCD':
cell.diam = value*0.95
if cell.unx == 'Y':
if cell.sex == 'male':
if cell.segment == 'PT' or cell.segment == 'S3':
cell.diam = value*1.1
else:
cell.diam = value*1.1
elif cell.sex == 'female':
if cell.segment == 'PT' or cell.segment == 'S3':
cell.diam = value*1.085
else:
cell.diam = value*1.085
# Length:
elif compare_string_prefix(id,"Length"):
if cell.segment == 'LDL' or cell.segment == 'LAL':
if cell.type == 'jux1':
looplen = 0.2
elif cell.type == 'jux2':
looplen = 0.4
elif cell.type == 'jux3':
looplen = 0.6
elif cell.type == 'jux4':
looplen = 0.8
elif cell.type == 'jux5':
looplen = 1.0
cell.len = value*looplen
else:
cell.len = value
# parameter files specify superficial segmental lengths; for some segments, lengths are different for juxtamedullary nephrons, so we overwrite them here...
if cell.type != 'sup' and cell.species == 'rat':
if cell.segment == 'cTAL':
# cTAL is short in jux nephrons
if cell.sex == 'male':
cell.len = 0.05
elif cell.sex == 'female':
cell.len = 0.05*0.9
elif cell.segment == 'CNT':
# CNT is longer in jux nephrons
if cell.sex == 'male':
cell.len = 0.3
elif cell.sex == 'female':
cell.len = 0.3*0.9
if cell.type != 'sup' and cell.species == 'mou':
if cell.segment == 'PT':
if cell.sex == 'male':
cell.len = 0.6
elif cell.sex == 'female':
cell.len = 0.05*0.9 #0.05*0.85, updated female
#elif cell.segment == 'CNT':
# if cell.sex == 'male':
# cell.len = 0.12
# elif cell.sex == 'female':
# cell.len = 0.3*0.9 #0.3*0.85, updated female
if cell.type != 'sup' and cell.species == 'hum':
if cell.segment == 'cTAL':
if cell.sex == 'male':
cell.len = 0.125
elif cell.sex == 'female':
cell.len = 0.125
elif cell.segment == 'CNT':
if cell.sex == 'male':
cell.len = 0.6
elif cell.sex == 'female':
cell.len = 0.6
if cell.diabete == 'Non':
cell.len = cell.len
elif cell.diabete == 'Moderate':
if cell.segment == 'PT':
cell.len = value*1.1
elif cell.segment == 'SDL' or cell.segment == 'mTAL' or cell.segment == 'cTAL' or cell.segment == 'DCT' or cell.segment == 'CNT' or cell.segment == 'CCD' or cell.segment == 'OMCD':
cell.len = value*1.07
else:
cell.len = value
elif cell.diabete == 'Severe':
if cell.segment == 'PT':
cell.len = value*1.28
elif cell.segment == 'SDL' or cell.segment == 'mTAL' or cell.segment == 'cTAL' or cell.segment == 'DCT' or cell.segment == 'CNT' or cell.segment == 'CCD' or cell.segment == 'OMCD':
cell.len = value*1.07
else:
cell.len = value
else:
print('What is the diabete status?')
if cell.unx == 'Y':
if cell.sex == 'male':
if cell.segment == 'PT' or cell.segment == 'S3':
cell.len = value*1.1
else:
cell.len = value*1.1
elif cell.sex == 'female':
if cell.segment == 'PT' or cell.segment == 'S3':
cell.len = value*1.085
else:
cell.len = value*1.085
# Total number of cells:
elif compare_string_prefix(id,"Total"):
cell.total = value
# Luminal pressure:
elif compare_string_prefix(id,"Pressure"):
cell.pres[0] = value
# parameter files specify pressure (value) for superficial nephrons
if cell.type !='sup' and cell.segment == 'PT' and cell.species == 'rat':
if cell.sex == 'male':
cell.pres[0] = 14.0 #12.5
elif cell.sex == 'female':
cell.pres[0] = 14.0 #12.75 #12.5
if cell.type !='sup' and cell.segment == 'PT' and cell.species == 'mou':
if cell.sex == 'male':
cell.pres[0] = 12.5
elif cell.sex == 'female':
cell.pres[0] = 12.7
if cell.diabete != 'Non' and cell.species == 'hum':
if cell.type == 'sup' and cell.segment == 'PT':
if cell.sex == 'male':
cell.pres[0] = 25.0
elif cell.sex == 'female':
cell.pres[0] = 25.0
elif cell.type !='sup' and cell.segment == 'PT':
if cell.sex == 'male':
cell.pres[0] = 30.0
elif cell.sex == 'female':
cell.pres[0] = 30.0
if cell.unx == 'Y' and cell.species == 'hum':
if cell.type == 'sup' and cell.segment == 'PT':
if cell.sex == 'male':
cell.pres[0] = 25.0
elif cell.sex == 'female':
cell.pres[0] = 25.0
elif cell.type !='sup' and cell.segment == 'PT':
if cell.sex == 'male':
cell.pres[0] = 25.0
elif cell.sex == 'female':
cell.pres[0] = 25.0
# pH:
elif compare_string_prefix(id,"pH"):
for i in range(6):
cell.pH[i] = num[i]
# Surface area multiplication factor:
elif compare_string_prefix(id,"Area"):
ind1,ind2 = get_interface_id(id)
cell.area[ind1][ind2] = value
cell.area[ind2][ind1] = value # symmetry
cell.area_init[ind1][ind2] = value
cell.area_init[ind2][ind1] = value
if cell.type != 'sup' and (cell.species == 'rat'):
if cell.segment == 'PT' or cell.segment == 'S3':
cell.area[ind1][ind2] = 1.75*cell.area[ind1][ind2]
cell.area[ind2][ind1] = cell.area[ind1][ind2]
# Water permeabilities:
elif compare_string_prefix(id,"Pf"):
ind1,ind2 = get_interface_id(id)
# Units of dimensional water flux (in 'value'): cm3/s/cm2 epith
# Non-dimensional factor for water flux: (Pfref)*Vwbar*Cref
# Calculate non-dimensional dLPV = Pf*Vwbar*Cref / (Pfref*Vwbar*Cref)
# dLPV = Pf/Pfref
cell.dLPV[ind1][ind2] = value/Pfref
# symmetry
cell.dLPV[ind2][ind1] = value/Pfref
if cell.diabete != 'Non':
if cell.segment == 'CCD':
cell.dLPV[0,1] = cell.dLPV[0,1]*1.55
cell.dLPV[1,5] = cell.dLPV[1,5]*1.55
elif cell.segment == 'IMCD':
cell.dLPV[0,1] = cell.dLPV[0,1]*1.4
cell.dLPV[1,5] = cell.dLPV[1,5]*1.4
if cell.HT != 'N':
# AQP2 changed
HT_rat = 1.0
# AQP2 on the apical interface
if ind1 == 0 and ind2 == 1:
if cell.segment == 'CCD':
HT_rat = 1.3
elif cell.segment == 'OMCD':
HT_rat = 1.3
elif cell.segment == 'IMCD':
HT_rat = 1.3
# basolateral interface
elif ind1 == 1:
if ind2 == 4 or ind2 == 5:
if cell.segment == 'CCD':
HT_rat = 1.3
elif cell.segment == 'OMCD':
HT_rat = 1.3
elif cell.segment == 'IMCD':
HT_rat = 1.3
cell.dLPV[ind1][ind2] = value/Pfref*HT_rat
if cell.obese != 'N':
# Pf (transcellular)
OB_rat = 1.0
if ind1 == 0 and ind2 == 1:
# AQP1
if cell.segment == 'PT' or cell.segment == 'S3':
if cell.sex == 'male':
OB_rat = 0.77 #change below also!
elif cell.sex == 'female':
OB_rat = 1.13 #change below also!
elif cell.segment == 'SDL':
if cell.sex == 'male':
OB_rat = 0.77 #change below also!
elif cell.sex == 'female':
OB_rat = 1.13 #change below also!
# AQP2
elif cell.segment == 'CCD' or cell.segment == 'OMCD' or cell.segment == 'IMCD':
if cell.sex == 'male':
OB_rat = 1.20 #change below also!
elif cell.sex == 'female':
OB_rat = 1.15 #change below also!
elif ind1 == 1:
if ind2 == 4 or ind2 == 5:
# AQP1
if cell.segment == 'PT' or cell.segment == 'S3':
if cell.sex == 'male':
OB_rat = 0.77
elif cell.sex == 'female':
OB_rat = 1.13
elif cell.segment == 'SDL':
if cell.sex == 'male':
OB_rat = 0.77
elif cell.sex == 'female':
OB_rat = 1.13
# AQP2
elif cell.segment == 'CCD' or cell.segment == 'OMCD' or cell.segment == 'IMCD':
if cell.sex == 'male':
OB_rat = 1.20
elif cell.sex == 'female':
OB_rat = 1.15
cell.dLPV[ind1][ind2] = value/Pfref*OB_rat
#symmetry
cell.dLPV[ind2][ind1] = value/Pfref*OB_rat
if cell.segment == 'SDL' and cell.type == 'sup':
if j>=0.46*cell.total:
cell.dLPV[0,1]=0.00*cell.dLPV[0,1]
cell.dLPV[0,4]=0.00*cell.dLPV[0,4]
elif cell.segment == 'LDL':
if cell.sex == 'male':
if j>=0.4*cell.total:
cell.dLPV[0,1]=0.00*cell.dLPV[0,1]
cell.dLPV[0,4]=0.00*cell.dLPV[0,4]
elif cell.sex == 'female':
if j>=0.5*cell.total:
cell.dLPV[0,1]=0.00*cell.dLPV[0,1]
cell.dLPV[0,4]=0.00*cell.dLPV[0,4]
if cell.segment == 'CNT' and cell.type !='sup':
if cell.sex == 'female':
cell.dLPV = cell.dLPV*4/3
# Reflection coefficients:
elif compare_string_prefix(id,"sig"):
sid,ind1,ind2 = get_interface_id(id)
cell.sig[sid][ind1][ind2] = value
# symmetry
cell.sig[sid][ind2][ind1] = value
cell.sig[sid][4][5] = 0.0
cell.sig[sid][5][4] = 0.0
# Membrane solute permeabilities:
elif compare_string_prefix(id,"perm"):
sid,ind1,ind2 = get_interface_id(id)
cell.h[sid][ind1][ind2] = value*1.0e-5/href
# Symmetry:
cell.h[sid][ind2][ind1] = value*1.0e-5/href
# Same permeability on basolateral membrane (around bath or LIS):
if ind1==1 and ind2==5:
cell.h[sid][ind1][4] = value*1.0e-5/href
cell.h[sid][4][ind1] = value*1.0e-5/href
elif ind1==1 and ind2==4:
cell.h[sid][ind1][5] = value*1.0e-5/href
cell.h[sid][5][ind1] = value*1.0e-5/href
elif ind1==2 and ind2==4:
cell.h[sid][ind1][5] = value*1.0e-5/href
elif ind1==3 and ind2==4:
cell.h[sid][ind1][5] = value*1.0e-5/href
if cell.segment == 'OMCD':
cell.h[sid][0][3] = 0.0
cell.h[sid][3][4] = 0.0
cell.h[sid][3][5] = 0.0
if cell.segment == 'IMCD':
if cell.sex == 'male':
if j>3*cell.total/4-1:
cell.h[8,0,1] = 300.0*1.0e-5/href
elif cell.sex == 'female':
if j>2*cell.total/3-1:
cell.h[8,0,1] = 300.0*1.0e-5/href
if cell.segment == 'LDL':
if cell.sex == 'male':
if j>=0.4*cell.total:
cell.h[0,0,1]=80.0
cell.h[0,0,4]=80.0
cell.h[1,0,1]=100.0
cell.h[1,0,4]=100.0
cell.h[2,0,1]=80.0
cell.h[2,0,4]=80.0
cell.h[3,0,1]=20.0
cell.h[3,0,4]=20.0
cell.h[10,0,1]=20.0
cell.h[10,0,4]=20.0
cell.h[8,0,1]=80.0 #80
cell.h[8,0,4]=80.0 #80
elif cell.sex == 'female':
if j>=0.5*cell.total:
cell.h[0,0,1]=40.0
cell.h[0,0,4]=80.0
cell.h[1,0,1]=100.0
cell.h[1,0,4]=100.0
cell.h[2,0,1]=40.0
cell.h[2,0,4]=80.0
cell.h[3,0,1]=20.0
cell.h[3,0,4]=20.0
cell.h[10,0,1]=20.0
cell.h[10,0,4]=20.0
cell.h[8,0,1]=80.0
cell.h[8,0,4]=80.0
if cell.inhib == 'ACE' and cell.segment == 'DCT':
cell.h[1,0,1] = 0.5*value*1.0e-5/href
# ROMK2 (K secretion) change in HT rat
if cell.HT != 'N':
if sid == 1 and (ind1 == 0 and ind2 == 1):
temp = cell.h[1,0,1]
if cell.segment == 'DCT':
if j>0.66*cell.total:
# DCT2
HT_rat = 0.3 #0.175
cell.h[1,0,1] = HT_rat*temp
elif cell.segment == 'CNT':
HT_rat = 0.3 #0.2
cell.h[1,0,1] = HT_rat*temp
if cell.obese != 'N':
if cell.segment == 'PT' or cell.segment == 'S3':
# PNa, PCl
if (sid == 0 or sid == 2) and (ind1 == 0 and ind2 == 4):
temp = cell.h[sid, 0, 4]
# PNa, PCl
if cell.sex == 'male':
OB_rat = 0.66
cell.h[sid,0,4] = OB_rat*temp
cell.h[sid,4,0] = OB_rat*temp
elif cell.sex == 'female':
OB_rat = 0.66
cell.h[sid,0,4] = OB_rat*temp
cell.h[sid,4,0] = OB_rat*temp
elif cell.segment == 'SDL':
# PNa, PCl
if (sid == 0 or sid == 2) and (ind1 == 0 and ind2 == 1):
temp = cell.h[sid,0,1]
if cell.sex == 'male':
OB_rat = 0.66
cell.h[sid,0,1] = OB_rat*temp
cell.h[sid,1,0] = OB_rat*temp
elif cell.sex == 'female':
OB_rat = 0.66
cell.h[sid,0,1] = OB_rat*temp
cell.h[sid,1,0] = OB_rat*temp
elif cell.segment == 'DCT':
if j>0.66*cell.total:
if sid == 1 and (ind1 == 0 and ind2 == 1):
temp = cell.h[1,0,1]
# DCT2
# ROMK
if cell.sex == 'male':
OB_rat = 0.72
cell.h[1,0,1] = OB_rat*temp
elif cell.sex == 'female':
OB_rat = 0.85
cell.h[1,0,1] = OB_rat*temp
elif cell.segment == 'CNT':
if sid == 1 and (ind1 ==0 and ind2 == 1):
temp = cell.h[1,0,1]
# ROMK
if cell.sex == 'male':
OB_rat = 0.72
cell.h[1,0,1] = OB_rat*temp
elif cell.sex == 'female':
OB_rat = 0.85
cell.h[1,0,1] = OB_rat*temp
# Coupled transporters:
elif compare_string_prefix(id,"coupled"):
# retrieve interface and solute id
vals = get_coupled_id(id)
newdLA = coupled_transport()
newdLA.perm = value / (href*Cref)
newdLA.membrane_id = [vals[0],vals[1]]
coef = [] # retrieve coupling coefficients
for i in range(1,len(num)):
coef.append(int(num[i]))
newdLA.coef = coef
newdLA.solute_id = vals[2:len(vals)]
# HTN
if cell.HT != 'N':
# NaPi2
if newdLA.solute_id == (0,7):
if cell.segment == 'PT' or cell.segment == 'S3':
HT_rat = 0.85
newdLA.perm = HT_rat*newdLA.perm
# obesity
if cell.obese != 'N':
# NaPi2
if newdLA.solute_id == (0,7):
OB_rat = 1.0
if cell.segment == 'PT' or cell.segment == 'S3':
if cell.sex == 'male':
OB_rat = 1.0
elif cell.sex == 'female':
OB_rat = 1.23
newdLA.perm = OB_rat*newdLA.perm
cell.dLA.append(newdLA)
# Specific transporters:
elif compare_string_prefix(id,"transport"):
tmp = (id).split('_')
ind1,ind2 = compart_id[tmp[1]],compart_id[tmp[2]]
newTransp = transporter()
newTransp.membrane_id = [ind1,ind2]
newTransp.type = tmp[3]
newTransp.act = value/(href*Cref)
#print('transporter')
#print(newTransp.membrane_id,newTransp.type,newTransp.act)
if cell.type != 'sup' and cell.sex == 'female' and (cell.species == 'rat' or cell.species == 'mou'):
if cell.segment == 'mTAL' or cell.segment == 'cTAL':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F' or newTransp.type == 'NaKATPase':
newTransp.act = 1.5*value/(href*Cref)
elif newTransp.type == 'KCC4':
newTransp.act = 2.0*value/(href*Cref)
if cell.diabete == 'Moderate':
if cell.segment == 'PT' or cell.segment == 'S3':
if newTransp.type == 'SGLT2':
if cell.sex == 'male':
newTransp.act = (1+0.38)*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = (1+0.38)*value/(href*Cref)
# elif newTransp.type == 'GLUT2': # optional
# if cell.sex == 'male':
# newTransp.act = (1+0.5)*value/(href*Cref)
# if cell.sex == 'female':
# newTransp.act = (1+0.3)*value/(href*Cref)
elif newTransp.type == 'SGLT1':
newTransp.act = (1-0.33)*value/(href*Cref)*3.5
# elif newTransp.type == 'GLUT1': # optional
# if cell.sex == 'male':
# newTransp.act = 0.5*value/(href*Cref)
elif newTransp.type == 'NaKATPase':
newTransp.act = 1.1*value/(href*Cref)
elif cell.segment == 'mTAL':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2F':
if cell.sex =='male':
newTransp.act = 1.1*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.1*value/(href*Cref)
elif newTransp.type == 'NaKATPase':
if cell.sex == 'male':
newTransp.act = 1.2*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.2*value/(href*Cref)
elif cell.segment == 'cTAL' or cell.segment == 'DCT' or cell.segment == 'CNT' or cell.segment == 'CCD':
if newTransp.type == 'NaKATPase':
if cell.sex == 'male':
newTransp.act = 1.1*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.1*value/(href*Cref)
elif cell.segment == 'OMCD':
if newTransp.type == 'NaKATPase':
if cell.sex == 'male':
newTransp.act = 1.1*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.1*value/(href*Cref)
elif cell.segment == 'IMCD':
if newTransp.type == 'NaKATPase':
if cell.sex == 'male':
if j<2/3*cell.total:
newTransp.act = 1.5*value/(href*Cref)
else:
newTransp.act = 2.5*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 2.5*value/(href*Cref)
elif newTransp.type == 'HKATPase' and cell.inhib == 'SGLT2':
if cell.sex == 'male':
newTransp.act = 5*value/(href*Cref)
elif cell.diabete == 'Severe':
if cell.segment == 'PT' or cell.segment == 'S3':
if newTransp.type == 'SGLT2':
if cell.sex == 'male':
newTransp.act = (1+0.38)*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = (1+0.28)*value/(href*Cref)
elif newTransp.type == 'GLUT2':
if cell.sex == 'male':
newTransp.act = (1+0.5)*value/(href*Cref)
if cell.sex == 'female':
newTransp.act = (1+0.3)*value/(href*Cref)
elif newTransp.type == 'SGLT1':
newTransp.act = (1-0.33)*value/(href*Cref)*3.5
elif newTransp.type == 'NaKATPase':
newTransp.act = 1.1*value/(href*Cref)
elif cell.segment == 'mTAL':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2F':
if cell.sex =='male':
newTransp.act = 1.1*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.05*value/(href*Cref)
elif newTransp.type == 'NaKATPase':
if cell.sex == 'male':
newTransp.act = 1.2*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.1*value/(href*Cref)
elif cell.segment == 'cTAL' or cell.segment == 'DCT' or cell.segment == 'CNT' or cell.segment == 'CCD':
if newTransp.type == 'NaKATPase':
if cell.sex == 'male':
newTransp.act = 1.1*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.05*value/(href*Cref)
elif cell.segment == 'OMCD':
if newTransp.type == 'NaKATPase':
if cell.sex == 'male':
newTransp.act = 1.1*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.05*value/(href*Cref)
elif cell.segment == 'IMCD':
if newTransp.type == 'NaKATPase':
if cell.sex == 'male':
newTransp.act = 2.5*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.5*value/(href*Cref)
if cell.inhib == 'NHE3-50':
if cell.segment == 'PT':
if newTransp.type == 'NHE3':
newTransp.act = (1-0.5)*value/(href*Cref)
elif cell.segment == 'mTAL' or cell.segment == 'cTAL':
if newTransp.type == 'NHE3':
newTransp.act = (1-0.5*0.5)*value/(href*Cref)
if cell.segment == 'mTAL':
if newTransp.type == 'NaKATPase':
newTransp.act = (1+0.5*0.5)*value/(href*Cref)
if cell.segment == 'cTAL':
if newTransp.type == 'NaKATPase':
newTransp.act = (1-0.5*0.5)*value/(href*Cref)
elif cell.segment == 'DCT':
if newTransp.type == 'NHE3':
newTransp.act = (1-0.5)*value/(href*Cref)
elif cell.inhib == 'NHE3-80':
if cell.segment == 'PT':
if newTransp.type == 'NHE3':
newTransp.act = (1-0.8)*value/(href*Cref)
elif cell.segment == 'mTAL' or cell.segment == 'cTAL':
if newTransp.type == 'NHE3':
newTransp.act = (1-0.8*0.5)*value/(href*Cref)
if cell.segment == 'mTAL':
if newTransp.type == 'NaKATPase':
newTransp.act = (1+0.8*0.5)*value/(href*Cref)
if cell.segment == 'cTAL':
if newTransp.type == 'NaKATPase':
newTransp.act = (1-0.8*0.5)*value/(href*Cref)
elif cell.segment == 'DCT':
if newTransp.type == 'NHE3':
newTransp.act = (1-0.8)*value/(href*Cref)
elif cell.inhib == 'NKCC2-70':
if cell.segment == 'mTAL' or cell.segment == 'cTAL':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F':
newTransp.act = (1-0.7)*value/(href*Cref)
elif cell.inhib == 'NKCC2-100':
if cell.segment == 'mTAL' or cell.segment == 'cTAL':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F':
newTransp.act = (1-1)*value/(href*Cref)
elif cell.inhib == 'NCC-70':
if cell.segment == 'DCT':
if newTransp.type == 'NCC':
newTransp.act = (1-0.7)*value/(href*Cref)
elif cell.inhib == 'NCC-100':
if cell.segment == 'DCT':
if newTransp.type == 'NCC':
newTransp.act = (1-1)*value/(href*Cref)
elif cell.inhib == 'ENaC-70':
if newTransp.type == 'ENaC':
newTransp.act = (1-0.7)*value/(href*Cref)
elif cell.inhib == 'ENaC-100':
if newTransp.type == 'ENaC':
newTransp.act = (1-1)*value/(href*Cref)
elif cell.inhib == 'HKA-100':
if newTransp.type == 'HKATPase':
newTransp.act = (1-1)*value/(href*Cref)
elif cell.inhib == 'SNB-70':
if cell.segment == 'mTAL' or cell.segment == 'cTAL':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F':
newTransp.act = (1-0.7)*value/(href*Cref)
if cell.segment == 'DCT':
if newTransp.type == 'NCC':
newTransp.act = (1-0.7)*value/(href*Cref)
if newTransp.type == 'ENaC':
newTransp.act = (1-0.7)*value/(href*Cref)
elif cell.inhib == 'SNB-100':
if cell.segment == 'mTAL' or cell.segment == 'cTAL':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F':
newTransp.act = (1-1)*value/(href*Cref)
if cell.segment == 'DCT':
if newTransp.type == 'NCC':
newTransp.act = (1-1)*value/(href*Cref)
if newTransp.type == 'ENaC':
newTransp.act = (1-1)*value/(href*Cref)
if cell.inhib == 'ACE':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F':
newTransp.act = 0.5*value/(href*Cref)
if cell.segment == 'DCT':
if newTransp.type == 'NCC' or newTransp.type == 'NaKATPase' or newTransp.type == 'ENaC':
newTransp.act == 0.5*value/(href*Cref)
if cell.inhib == 'SGLT2':
if newTransp.type == 'SGLT2':
newTransp.act = value/(href*Cref)*0.2
if newTransp.type == 'SGLT1':
newTransp.act = value/(href*Cref)*3.5
if cell.unx == 'Y':
if newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F':
newTransp.act = 1.05*value/(href*Cref)
elif newTransp.type == 'NCC':
newTransp.act = 1.1*value/(href*Cref)
elif newTransp.type == 'ENaC':
if cell.sex == 'male':
newTransp.act = 1.3*value/(href*Cref)
elif cell.sex == 'female':
newTransp.act = 1.2*value/(href*Cref)
if cell.HT != 'N':
if newTransp.type == 'NCC':
HT_rat = 1.95
newTransp.act = HT_rat*value/(href*Cref)
elif newTransp.type == 'NHE3':
if cell.segment == 'PT' or cell.segment == 'S3' or cell.segment == 'mTAL':
HT_rat = 0.82
elif cell.segment == 'cTAL' or cell.segment == 'DCT':
HT_rat = 1.0
else:
print('segment: ' + cell.segment)
raise Exception('NHE3 activity not done for this segment in HT rat model')
newTransp.act = HT_rat*value/(href*Cref)
elif newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F':
if cell.segment == 'mTAL':
HT_rat = 0.7
elif cell.segment == 'cTAL':
HT_rat = 1.74
else:
print('segment: ' + cell.segment)
raise Exception('NKCC2 activity not done for this segment in HT rat model')
newTransp.act = HT_rat*value/(href*Cref)
elif newTransp.type == 'NaKATPase':
if cell.segment == 'mTAL':
HT_rat = 0.70
else:
HT_rat = 1.0
newTransp.act = HT_rat*value/(href*Cref)
elif newTransp.type == 'ENaC':
HT_rat = 1.45
newTransp.act = HT_rat*value/(href*Cref)
# obesity impact
if cell.obese != 'N':
OB_rat = 1.0
if newTransp.type == 'NHE3':
if cell.segment == 'PT' or cell.segment == 'S3' or cell.segment == 'cTAL' or cell.segment == 'DCT':
if cell.sex == 'male':
OB_rat = 0.7 #1.0 #0.51
elif cell.sex == 'female':
OB_rat = 0.8 #1.0 #0.64
elif cell.segment == 'mTAL':
if cell.sex == 'male':
OB_rat = 0.6 #1.0 #0.45
elif cell.sex == 'female':
OB_rat = 0.7 #1.0 #0.50
else:
print('segment: ' + cell.segment)
raise Exception('NHE3 activity not done for obesity in this segment')
elif newTransp.type == 'SGLT2':
if cell.sex == 'male':
OB_rat = 1.0
elif cell.sex == 'female':
OB_rat = 1.1
elif newTransp.type == 'SGLT1':
if cell.sex == 'male':
OB_rat = 2.0
elif cell.sex == 'female':
OB_rat = 1.84
elif newTransp.type == 'NaKATPase':
if cell.segment == 'PT' or cell.segment == 'S3' or cell.segment == 'cTAL' or cell.segment == 'DCT' or cell.segment == 'CNT' or cell.segment == 'CCD':
if cell.sex == 'male':
OB_rat = 1.0 #0.95
elif cell.sex == 'female':
OB_rat = 1.0 #0.90
elif cell.segment == 'mTAL' or cell.segment == 'OMCD' or cell.segment == 'IMCD':
if cell.sex == 'male':
OB_rat = 1.0
elif cell.sex == 'female':
OB_rat = 1.0
else:
print('segment: ' + cell.segment)
raise Exception('NKATPase activity not done for this segment')
elif newTransp.type == 'NKCC2A' or newTransp.type == 'NKCC2B' or newTransp.type == 'NKCC2F':
if cell.segment == 'mTAL':
if cell.sex == 'male':
OB_rat = 0.6 #0.45
elif cell.sex == 'female':
OB_rat == 0.75 #0.62
elif cell.segment == 'cTAL':
if cell.sex == 'male':
OB_rat = 0.6 #0.46
elif cell.sex == 'female':
OB_rat = 0.75 #0.65
else:
print('segment: ' + cell.segment)
raise Exception('NKCC2 activity not done for obesity in this segment')
elif newTransp.type == 'NCC':
if cell.sex == 'male':
OB_rat = 1.0
elif cell.sex == 'female':
OB_rat = 0.72
elif newTransp.type == 'ENaC':
if cell.sex == 'male':
OB_rat = 1.44
elif cell.sex == 'female':
OB_rat = 0.92
newTransp.act = OB_rat*newTransp.act
cell.trans.append(newTransp)
# Solute concentrations:
elif compare_string_prefix(id,"conc"):
tmp = (id).split('_')
cell.conc[solute_id[tmp[1]]][0] = float(num[0])
cell.conc[solute_id[tmp[1]]][1] = float(num[1])
cell.conc[solute_id[tmp[1]]][4] = float(num[2])
cell.conc[solute_id[tmp[1]]][5] = float(num[3])
if len(num) > 4:
cell.conc[solute_id[tmp[1]]][2] = float(num[4])
if len(num) > 5:
cell.conc[solute_id[tmp[1]]][3] = float(num[5])
if cell.diabete == 'Moderate':
if cell.segment == 'PT':
cell.conc[14,0] = 8.6
elif cell.diabete == 'Severe':
if cell.segment == 'PT' and cell.species == 'hum':
cell.conc[14,0] = 20.0
elif cell.segment == 'PT' and cell.species == 'rat':
cell.conc[14,0] = 25.0
elif cell.segment == 'PT' and cell.species == 'mou':
cell.conc[14,0] = 25.0
# Reference impermeat concentration (for cell)
# or oncotic pressure for lumen/LIS/bath
elif compare_string_prefix(id,"cimpref"):
tmp = (id).split('_')
cell.cimpref[compart_id[tmp[1]]] = float(num[0])
# Impermeant properties
elif compare_string_prefix(id,"zimp"):
tmp = (id).split('_')
cell.zimp[compart_id[tmp[1]]] = float(num[0])
# Reference buffer concentrations (for cell):
elif compare_string_prefix(id,"cbuftot"):
tmp = (id).split('_')
cell.cbuftot[compart_id[tmp[1]]] = float(num[0])
# Rates used in HCO3/H2CO3 reaction:
elif compare_string_prefix(id,"dkd"):
tmp = (id).split('_')
cell.dkd[compart_id[tmp[1]]] = float(num[0])
elif compare_string_prefix(id,"dkh"):
tmp = (id).split('_')
cell.dkh[compart_id[tmp[1]]] = float(num[0])
# Reference volume flows:
elif compare_string_prefix(id,"volref"):
tmp = (id).split('_')
cell.volref[compart_id[tmp[1]]] = float(num[0])
# Actual volume flows:
elif compare_string_prefix(id,"vol"):
tmp = (id).split('_')
# data files specify values for superficial nephrons, juxmedullary nephron values are hardcoded here
if cell.segment == 'PT' and cell.type != 'sup' and cell.species == 'rat':
if compart_id[tmp[1]] == 0:
if cell.type == 'jux1':
if cell.sex == 'male':
cell.vol[0] = 0.0075
elif cell.sex == 'female':
cell.vol[0] = 0.0056
cell.vol_init[0] = cell.vol[0]
elif cell.type == 'jux2':
if cell.sex == 'male':
cell.vol[0] = 0.0075
elif cell.sex == 'female':
cell.vol[0] = 0.0056