rankN=getRankLUSOL(arm.MRH.S(arm.MRH.metAtomMappedBool,arm.MRH.rxnAtomMappedBool));
Warning: There was an error loading the library "/home/rfleming/work/sbgCloud/code/fork-cobratoolbox/external/base/solvers/lusol/src/libclusol.so"
Unrecognized function or variable 'libclusol_proto_glnxa64'.
Caught error using lusol interface. Proceeding with matlab LU implementation (slower)
rankL=getRankLUSOL(arm.L);
Warning: There was an error loading the library "/home/rfleming/work/sbgCloud/code/fork-cobratoolbox/external/base/solvers/lusol/src/libclusol.so"
Unrecognized function or variable 'libclusol_proto_glnxa64'.
Caught error using lusol interface. Proceeding with matlab LU implementation (slower)
rankdATM=getRankLUSOL(incidence(arm.dATM));
Warning: There was an error loading the library "/home/rfleming/work/sbgCloud/code/fork-cobratoolbox/external/base/solvers/lusol/src/libclusol.so"
Unrecognized function or variable 'libclusol_proto_glnxa64'.
Caught error using lusol interface. Proceeding with matlab LU implementation (slower)
rankATG=getRankLUSOL(incidence(arm.ATG));
Warning: There was an error loading the library "/home/rfleming/work/sbgCloud/code/fork-cobratoolbox/external/base/solvers/lusol/src/libclusol.so"
Unrecognized function or variable 'libclusol_proto_glnxa64'.
Caught error using lusol interface. Proceeding with matlab LU implementation (slower)
rankMTG=getRankLUSOL(incidence(arm.MTG));
Warning: There was an error loading the library "/home/rfleming/work/sbgCloud/code/fork-cobratoolbox/external/base/solvers/lusol/src/libclusol.so"
Unrecognized function or variable 'libclusol_proto_glnxa64'.
Caught error using lusol interface. Proceeding with matlab LU implementation (slower)
TT={'Model', 'm+' , 'Metabolites', size(arm.MRH.S,1);
'' , 'm' , 'Mapped metabolites', nnz(arm.MRH.metAtomMappedBool);
'' , 'n+' , 'Reactions', size(arm.MRH.S,2);
'' , '' , 'Internal reactions', nnz(SConsistentRxnBool1);
'' , '' , 'External reactions', nnz(~SConsistentRxnBool1);
'' , 'n' , 'Mapped reactions', nnz(arm.MRH.rxnAtomMappedBool);
'Mapped model' , 'm' , 'size(model.S,1)', rankN;
'' , 'n+k' , 'size(model.S,2)', size(model.S,2);
'' , '' , 'Internal reactions', nnz(SConsistentRxnBool2);
'' , '' , 'External reactions', nnz(~SConsistentRxnBool2);
'' , 'r' , 'Rank(N)', rankN;
'' , 'm-r' , 'Row rank deficiency(N)', nnz(arm.MRH.metAtomMappedBool) - rankN;
'' , '' , 'Isomorphism classes', size(arm.L,1);
'' , '' , 'Independent isomorphism classes', rankL;
'MTG' , '' , 'Moieties', size(arm.I2M,2);
'' , '' , 'Moiety transitions', size(arm.M2I,1);
'' , '' , 'Rank(M)', rankMTG;
'ATG' , '' , 'Atoms', size(arm.I2A,2);
'' , '' , 'Atom transitions', size(arm.A2I,1);
'' , '' , 'Rank(A)', rankATG;
'' , '' , 'Row rank deficiency(A)', size(arm.I2A,2) - rankATG;
'' , '' , 'Components', size(arm.C2A,1);
'dATM' , '' , 'Atoms', size(arm.dATM.Nodes,1);
'' , '' , 'Directed atom transition instances', size(arm.dATM.Edges,1);
'' , '' , 'Rank(dATM)', rankdATM;
'' , '' , 'Row rank deficiency(dATM)', size(arm.dATM.Edges,1) - rankdATM;
disp(TT)
{'Model' } {'m+' } {'Metabolites' } {[ 11]}
{0×0 char } {'m' } {'Mapped metabolites' } {[ 11]}
{0×0 char } {'n+' } {'Reactions' } {[ 11]}
{0×0 char } {0×0 char} {'Internal reactions' } {[ 4]}
{0×0 char } {0×0 char} {'External reactions' } {[ 7]}
{0×0 char } {'n' } {'Mapped reactions' } {[ 4]}
{'Mapped model'} {'m' } {'size(model.S,1)' } {[ 4]}
{0×0 char } {'n+k' } {'size(model.S,2)' } {[ 11]}
{0×0 char } {0×0 char} {'Internal reactions' } {[ 4]}
{0×0 char } {0×0 char} {'External reactions' } {[ 7]}
{0×0 char } {'r' } {'Rank(N)' } {[ 4]}
{0×0 char } {'m-r' } {'Row rank deficiency(N)' } {[ 7]}
{0×0 char } {0×0 char} {'Isomorphism classes' } {[ 6]}
{0×0 char } {0×0 char} {'Independent isomorphism clas…'} {[ 6]}
{'MTG' } {0×0 char} {'Moieties' } {[ 26]}
{0×0 char } {0×0 char} {'Moiety transitions' } {[ 20]}
{0×0 char } {0×0 char} {'Rank(M)' } {[ 20]}
{'ATG' } {0×0 char} {'Atoms' } {[170]}
{0×0 char } {0×0 char} {'Atom transitions' } {[114]}
{0×0 char } {0×0 char} {'Rank(A)' } {[114]}
{0×0 char } {0×0 char} {'Row rank deficiency(A)' } {[ 56]}
{0×0 char } {0×0 char} {'Components' } {[ 56]}
{'dATM' } {0×0 char} {'Atoms' } {[170]}
{0×0 char } {0×0 char} {'Directed atom transition ins…'} {[176]}
{0×0 char } {0×0 char} {'Rank(dATM)' } {[114]}
{0×0 char } {0×0 char} {'Row rank deficiency(dATM)' } {[ 62]}
{0×0 char } {0×0 char} {0×0 char } {[NaN]}
approxMetMasses = arm.L'*moietyMasses;
plot(metMasses,approxMetMasses,'.')
xlabel('Metabolite mass')
ylabel('Mass weighted incidence of moieties in each metabolite')
massDifference = abs(approxMetMasses-metMasses)./metMasses;
bool=massDifference >0.1;
C(n,:)={i, massDifference(i),model.mets{i},model.metFormulas{i},metMasses(i),approxMetMasses(i)};
C=sortrows(C,5,'descend');
T.Properties.VariableNames={'index','massDifference','mets','metFormula','metMass','approxMetMass'};
massWeightedIncidence=diag(moietyMasses)*arm.L*ones(size(arm.L,2),1);
[massWeightedIncidenceSorted, xi] = sort(massWeightedIncidence,'descend');
bool=false(size(arm.L,1),1);
bool(xi(1:min(length(xi),30)))=1;
ind = find(strcmp(minimalMassMetabolite{i},model.mets));
C(n,1:9) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),minimalMassMetabolite{i},model.metNames{ind},model.metFormulas{ind},minimalMassFraction(i)};
C=sortrows(C,5,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Minimalmassmetabolite','Name','Formula','Massfraction'};
disp(T)
index metabolites rxns moietyformula mass Minimalmassmetabolite Name Formula Massfraction
_____ ___________ ____ _____________ ______ _____________________ _________ _____________ ____________
3 2 6 {'C9H13N5O3'} 239.1 {'dhbpt'} {'dhbpt'} {'C9H13N5O3'} 1
1 4 8 {'C8H11N' } 121.09 {'dopa' } {'dopa' } {'C8H12NO2' } 0.78585
2 5 11 {'CO2' } 43.99 {'co2' } {'co2' } {'CO2' } 1
6 5 12 {'O' } 15.995 {'h2o' } {'h2o' } {'H2O' } 0.88809
4 4 11 {'H' } 1.0078 {'h' } {'h' } {'H' } 1
5 3 8 {'H' } 1.0078 {'h2o' } {'h2o' } {'H2O' } 0.055957
bool=moietyIncidence>=100;
ind = find(strcmp(minimalMassMetabolite{i},model.mets));
C(n,1:9) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),minimalMassMetabolite{i},model.metNames{ind},model.metFormulas{ind},minimalMassFraction(i)};
C=sortrows(C,2,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Minimalmassmetabolite','Name','Formula','Massfraction'};
bool= moietyIncidence>=10 & moietyIncidence<=100;
ind = find(strcmp(minimalMassMetabolite{i},model.mets));
C(n,1:9) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),minimalMassMetabolite{i},model.metNames{ind},model.metFormulas{ind},minimalMassFraction(i)};
C=sortrows(C,9,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Minimalmassmetabolite','Name','Formula','Massfraction'};
bool= moietyIncidence>2 & moietyIncidence<=10;
ind = find(strcmp(minimalMassMetabolite{i},model.mets));
C(n,1:9) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),minimalMassMetabolite{i},model.metNames{ind},model.metFormulas{ind},minimalMassFraction(i)};
C=sortrows(C,5,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Minimalmassmetabolite','Name','Formula','Massfraction'};
disp(T)
index metabolites rxns moietyformula mass Minimalmassmetabolite Name Formula Massfraction
_____ ___________ ____ _____________ ______ _____________________ ________ ____________ ____________
1 4 8 {'C8H11N'} 121.09 {'dopa'} {'dopa'} {'C8H12NO2'} 0.78585
2 5 11 {'CO2' } 43.99 {'co2' } {'co2' } {'CO2' } 1
6 5 12 {'O' } 15.995 {'h2o' } {'h2o' } {'H2O' } 0.88809
4 4 11 {'H' } 1.0078 {'h' } {'h' } {'H' } 1
5 3 8 {'H' } 1.0078 {'h2o' } {'h2o' } {'H2O' } 0.055957
ind = find(arm.L(i,:)~=0);
C(n,1:11) = {i,moietyFormulae{i},moietyMasses(i),model.mets{ind(1)},model.metNames{ind(1)},model.metFormulas{ind(1)},model.mets{ind(2)},model.metNames{ind(2)},model.metFormulas{ind(2)},minimalMassMetabolite{i},minimalMassFraction(i)};
C=sortrows(C,3,'descend');
T.Properties.VariableNames={'index','moietyformula','mass','met1','name1','formula1','met2','name2','formula2','Minimalmassmetabolite','Massfraction'};
disp(T)
index moietyformula mass met1 name1 formula1 met2 name2 formula2 Minimalmassmetabolite Massfraction
_____ _____________ _____ _________ _________ _____________ _________ _________ _____________ _____________________ ____________
3 {'C9H13N5O3'} 239.1 {'thbpt'} {'thbpt'} {'C9H15N5O3'} {'dhbpt'} {'dhbpt'} {'C9H13N5O3'} {'dhbpt'} 1
isInternalMoiety = strcmp('Internal',moietyTypes);
ind = find(arm.L(i,:)~=0);
C(n,1:8) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),model.mets{ind(1)},model.metNames{ind(1)},model.metFormulas{ind(1)}};
C=sortrows(C,5,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Examplemet','Examplename','Exampleformula'};
disp(T)
index metabolites rxns moietyformula mass Examplemet Examplename Exampleformula
_____ ___________ ____ _____________ _____ __________ ___________ ______________
3 2 6 {'C9H13N5O3'} 239.1 {'thbpt'} {'thbpt'} {'C9H15N5O3'}
isTransititiveMoiety= strcmp('Transitive',moietyTypes);
bool = isTransititiveMoiety;
ind = find(strcmp(minimalMassMetabolite{i},model.mets));
C(n,1:9) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),minimalMassMetabolite{i},model.metNames{ind},model.metFormulas{ind},minimalMassFraction(i)};
C=sortrows(C,9,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Minimalmassmetabolite','Name','Formula','Massfraction'};
disp(T)
index metabolites rxns moietyformula mass Minimalmassmetabolite Name Formula Massfraction
_____ ___________ ____ _____________ ______ _____________________ ________ ____________ ____________
2 5 11 {'CO2' } 43.99 {'co2' } {'co2' } {'CO2' } 1
6 5 12 {'O' } 15.995 {'h2o' } {'h2o' } {'H2O' } 0.88809
1 4 8 {'C8H11N'} 121.09 {'dopa'} {'dopa'} {'C8H12NO2'} 0.78585
bool= strcmp('Integrative',moietyTypes);
ind = find(arm.L(i,:)~=0);
C(n,1:8) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),model.mets{ind(1)},model.metNames{ind(1)},model.metFormulas{ind(1)}};
C=sortrows(C,5,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Examplemet','Examplename','Exampleformula'};
disp(T)
index metabolites rxns moietyformula mass Examplemet Examplename Exampleformula
_____ ___________ ____ _____________ ______ __________ ___________ ______________
4 4 11 {'H'} 1.0078 {'thbpt'} {'thbpt'} {'C9H15N5O3'}
5 3 8 {'H'} 1.0078 {'thbpt'} {'thbpt'} {'C9H15N5O3'}
[compartments, uniqueCompartments] = getCompartment(model.mets);
isMitochondrial=strcmp('m',compartments);
isCompletelyMitochondrialMoiety = ~any(arm.L(:,~isMitochondrial),2);
nnz(isCompletelyMitochondrialMoiety)
mitochondrialMoietyFraction = sum(arm.L(:,isMitochondrial),2)./sum(arm.L,2);
title('Fraction of moiety incidence that is mitochondrial')
hist(mitochondrialMoietyFraction)
bool= mitochondrialMoietyFraction==1;
ind = find(arm.L(i,:)~=0);
C(n,1:8) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),model.mets{ind(1)},model.metNames{ind(1)},model.metFormulas{ind(1)}};
C=sortrows(C,5,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Examplemet','Examplename','Exampleformula'};
isTransititiveMoiety= strcmp('Transitive',moietyTypes);
isModerateIncidence = moietyIncidence>=7 & moietyIncidence<=100;
isSufficientMass = moietyMasses > 2;
isSufficientMinimalMassFraction = minimalMassFraction > 0.1;
bool = isTransititiveMoiety & isModerateIncidence & isSufficientMass & isSufficientMinimalMassFraction;
ind = find(strcmp(minimalMassMetabolite{i},model.mets));
C(n,1:9) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),minimalMassMetabolite{i},model.metNames{ind},model.metFormulas{ind},minimalMassFraction(i)};
C=sortrows(C,9,'descend');
T.Properties.VariableNames={'index','metabolites','rxns','moietyformula','mass','Minimalmassmetabolite','Name','Formula','Massfraction'};