Home > metabolic-economics > cba_feasible_cycle.m

cba_feasible_cycle

PURPOSE ^

CBA_FEASIBLE_CYCLE - Check economical flux distribution (non-beneficial cycle criterion)

SYNOPSIS ^

function [isFeasible, C_infeasible, C_cba, ind_non_orthogonal, n_wasteful] = cba_feasible_cycle(v, N, external, cba_constraints, network, flag_test_wasteful, flag_test_v_sign)

DESCRIPTION ^

 CBA_FEASIBLE_CYCLE - Check economical flux distribution (non-beneficial cycle criterion)

 [isFeasible,C_infeasible,C_cba,ind_non_orthogonal] = cba_feasible_cycle(v, N, external, cba_constraints, network, flag_test_wasteful, flag_test_v_sign)

 Calculation:
  - reduce problem to active subnetwork
  - check sign-orthogonality on futile cycles

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [isFeasible, C_infeasible, C_cba, ind_non_orthogonal, n_wasteful] = cba_feasible_cycle(v, N, external, cba_constraints, network, flag_test_wasteful, flag_test_v_sign)
0002 
0003 % CBA_FEASIBLE_CYCLE - Check economical flux distribution (non-beneficial cycle criterion)
0004 %
0005 % [isFeasible,C_infeasible,C_cba,ind_non_orthogonal] = cba_feasible_cycle(v, N, external, cba_constraints, network, flag_test_wasteful, flag_test_v_sign)
0006 %
0007 % Calculation:
0008 %  - reduce problem to active subnetwork
0009 %  - check sign-orthogonality on futile cycles
0010 
0011 
0012 eval(default('flag_test_wasteful','0','flag_test_v_sign','1'));
0013 
0014 cba_constraints = cba_update_constraints(cba_constraints,N(find(external),:));
0015 zv              = cba_constraints.zv;
0016 
0017 if zv'*v <10^-8, warning('Flux distribution is not beneficial'); end
0018 
0019 ind_int = find(external==0); 
0020 N_int   = N(ind_int,:);
0021 
0022 
0023 % -------------------------------------------------------------
0024 
0025 [v_act, N_int_act, Es, nn_act, cba_constraints_act, ind_act] = cba_reduce_to_active_subnetwork(v,N_int,[],network,cba_constraints);
0026 
0027 constraint_matrix = cba_constraints_act.zv;
0028 ii =  find(isfinite( cba_constraints_act.v_sign));
0029 nr = size(constraint_matrix,1);
0030 
0031 if length(ii),
0032   display('Treating flux bounds as dual variables like flux benefits');
0033   for it = 1:length(ii);
0034     constraint_matrix = [ constraint_matrix, zeros(nr,1)];
0035     constraint_matrix(ii(it),end) = cba_constraints_act.v_sign(ii(it));
0036   end
0037 end
0038 
0039 C = network_efmtool(nn_act, 'internal', [], constraint_matrix);
0040 
0041 ind_non_orthogonal = [];
0042 isFeasible         = 1; 
0043 
0044 if size(C), [isFeasible,ind_non_orthogonal] = EBA_orth(sign(v_act),C); end
0045 
0046 
0047 % -------------------------------------------------------------
0048 % put fluxes back into non-reduced network
0049 
0050 C_cba         = zeros(length(v),size(C,2));
0051 C_cba(ind_act,:) = C;
0052 
0053 C_infeasible = C_cba(:,ind_non_orthogonal);
0054 
0055 if flag_test_v_sign,
0056   vs = cba_constraints.v_sign;
0057   if size(C_infeasible,2),
0058     ind_correct_sign = find(sum(sign(diag(vs(find(isfinite(vs)))) * C_infeasible(find(isfinite(vs)),:) )==-1) ==0);
0059     C_infeasible = C_infeasible(:,ind_correct_sign);
0060     ind_non_orthogonal = ind_non_orthogonal(ind_correct_sign);
0061   else,      ind_correct_sign=[];
0062      ind_non_orthogonal = [];
0063   end
0064 end
0065 
0066 
0067 % -------------------------------------------------------------
0068 % sort infeasible cycles by size
0069 
0070 [dum,order]        = sort(sum(abs(sign(C_infeasible)),1));
0071 C_infeasible       = C_infeasible(:,order);
0072 ind_non_orthogonal = ind_non_orthogonal(order);
0073 
0074 
0075 % test if flux differs from elementary wasteful modes in at least on reaction sign
0076 
0077 if flag_test_wasteful,
0078   C = network_efmtool(nn_act, 'internal', []);
0079   C = C(:,find(cba_constraints_act.zv'*C<0));
0080   ind_wasteful = find(sum(diag(sign(v_act))*sign(C)==-1,1)==0);
0081   n_wasteful = length(ind_wasteful>0); 
0082 end
0083

Generated on Fri 12-Feb-2016 20:18:22 by m2html © 2003