-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_fba.r
38 lines (34 loc) · 1.08 KB
/
check_fba.r
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
##jmd
##3.7.11
##check_fba.r
source('fba.r')
##run fba
#fba grows on vogel's, dies when rm source of {c,n,s, or p}
#growth insensitive to ub=1000 or ub=10^9
check.fba <- function(a, ko.rxns.lst=NULL, sense='E'){
pred <- rep(NA, length(ko.rxns.lst))
for (ko.rxns.ind in 1:length(ko.rxns.lst)){
ko.rxns <- ko.rxns.lst[[ko.rxns.ind]]
if (sum(ko.rxns %in% colnames(a))>0){
pred[ko.rxns.ind] <- fba(a=a, ko.rxns=ko.rxns, sense=sense)$lp$obj
}
}
return(pred)
}
##run dual
#growth = fba, except when ko.rxns=sugar
check.dual <- function(a, ko.rxns.lst){
pred.dual <- rep(NA, length(ko.rxns.lst))
for (ko.rxns.ind in 1:length(ko.rxns.lst)){
ko.rxns <- ko.rxns.lst[[ko.rxns.ind]]
if (sum(ko.rxns %in% colnames(a))>0){
pred.dual[ko.rxns.ind] <- fba.dual(a=s.sp, ko.rxns=ko.rxns)$lp$obj
}
}
return(pred.dual)
}
###check#################################################################################################################
##check a met
#met <- 'POLYMER-INST-Peptidoglycans-C312-H512-N64-O152'
#in.rxns <- s.sp[met,]!=0
#(ss <- s.sp[s.sp[,in.rxns]!=0, in.rxns])