-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPanGenusModelReconstruction.m
96 lines (85 loc) · 3.26 KB
/
PanGenusModelReconstruction.m
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
function panModel = PanGenusModelReconstruction(modelPath,panPath,genusInfo,infoFilePath,dietApplied,dietFilePath)
% The function prepares the input to construct the Pan-Genus Metabolic Model (PGMM) from the
% existing GSMM for a genus
%
% INPUTS:
% modelPath : Path to GSMMs to include in PGMM
% panPath : Path tp save the PanModel
% genusInfo : Information about the genus that needs PGMM
%
% OPTIONAL INPUTS:
% infoFilePath : Path to the information file containing taxonomic information
% dietApplied : Binary value indicating whether to incorporate diet
% information to the model (default: )
% dietFilePath : If the diet needs to be applied, path to the diet
% file
%
% OUTPUT:
% panModel : A struct of the produced panModels
%
% Author: Indumathi Palanikumar, 2023
% Check for the genus name and file path for the species information
if ~exist(infoFilePath)
AGORAinfoFile = '/home/indumathi/Desktop/PhD/Research work/Resources/AGORA_infoFile.xlsx';
InfoFile = readtable(AGORAinfoFile);
else
InfoFile = readtable(infoFilePath);
end
if ~isempty(genusInfo)
genusNames = genusInfo;
else
genusNames = unique(InfoFile.Genus);
end
if ~(isempty(dir(panPath)))
dInfo = dir(panPath);
modelList={dInfo.name};
modelList=modelList';
modelList=strrep(modelList,{'.mat'},'');
modelList=strrep(modelList,{'pan'},'');
genusNames=setdiff(genusNames,modelList);
end
genusNames = intersect(genusNames,InfoFile.Genus);
for i = 1: length(genusNames)
genusName = genusNames{i};
% Information about the species in the genus
SpeciesInfo = InfoFile(strcmp(InfoFile.Genus,genusName),:);
% Loading the models from the genus
orgTable = table2cell(SpeciesInfo(:,1));
nameTags = regexprep(orgTable,'_',' ');
orgModels = {};
% Models need to be changed
for i =1: length(orgTable)
modelName = [modelPath,orgTable{i},'.mat'];
orgModels{i,1} = readCbModel(modelName);
% Change Reaction names to species specific
bioRxnInd(i,1) = find(orgModels{i,1}.c);
bioRxn(i,1) = orgModels{i,1}.rxns(bioRxnInd(i));
orgModels{i,1}.rxns(bioRxnInd(i,1)) = {[orgTable{i},'_',bioRxn{i,1}]};
% Change metabolite names to species specific
bioMetInd(i,1) = find(contains(orgModels{i,1}.mets,'biomass'));
bioMet(i,1) = orgModels{i,1}.mets(bioMetInd(i,1));
orgModels{i,1}.mets(bioMetInd(i,1)) = {[orgTable{i},'_',bioMet{i,1}]};
%orgRxns{i,1} = orgModels{i}.rxns;
end
if dietApplied == 1
if ~isempty(dietFilePath)
Diet = adaptVMHDietToAGORA(dietFilePath,'AGORA');
else
Diet = adaptVMHDietToAGORA('/home/indumathi/Desktop/PhD/Research work/Resources/Diet files/EUdiet','AGORA');
end
end
%% Growth analysis of individual species on specific diet condition
% default - EU diet
for i =1: length(orgTable)
modelSp = orgModels{i,1};
if dietApplied == 1
% Analyze the growth of the organisms
modelSp = useDiet(modelSp,Diet);
end
sol = optimizeCbModel(modelSp);
indFlux(i,1) = sol.f;
end
%% Creation of Pan genus model
[panModel] = createPanGenusModels(orgTable,orgModels,panPath,genusName,1);
end
end