Skip to content

Commit

Permalink
Merge branch 'feat/updateDataCode' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
haowang-bioinfo committed Jun 23, 2021
2 parents d60954e + 25177a7 commit c5ce633
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 94 deletions.
79 changes: 23 additions & 56 deletions code/masterScriptFruitflyGEM.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,44 @@
% pathways/reactions.
%
%
% Annotation files in tsv format are also generated by
% integrating human and fruitfly-specific annotation information.
%


%% Load Human-GEM as template
load('Human-GEM.mat');


% convert gene identifiers from Ensembl ids to gene symbols
[grRules,genes,rxnGeneMat] = translateGrRules(ihuman.grRules,'Name','ENSG');
ihuman.grRules = grRules;
ihuman.genes = genes;
ihuman.rxnGeneMat = rxnGeneMat;



%% Use MA reactions identifiers

% load reaction annotaiton files
rxnAssoc = jsondecode(fileread('humanGEMRxnAssoc.JSON'));

%replace reaction identifiers with MA ids if available
ind = getNonEmptyList(rxnAssoc.rxnMAID);
ihuman.rxns(ind) = rxnAssoc.rxnMAID(ind);

%% Add path
addpath(genpath('../../Fruitfly-GEM/'));


%% Generate Fruitfly-GEM by using Human-GEM as template
%% Prepare Fruitfly ortholog pairs and species-specific network

% get ortholog pairs from human to worm
% get ortholog pairs from human to fruitfly
fruitflyOrthologPairs = extractAllianceGenomeOrthologs('human2FruitflyOrthologs.json');
fruitflyGEM = getModelFromOrthology(ihuman, fruitflyOrthologPairs);



%% Incorporate species-specific reactions

% get metabolic networks based on the KEGG annoation using RAVEN function
KEGG_human=getKEGGModelForOrganism('hsa');
KEGG_fruitfly=getKEGGModelForOrganism('dme');

% remove reactions shared with human
FruitflySpecificRxns=setdiff(KEGG_fruitfly.rxns,KEGG_human.rxns);

% remove reactions included in Human-GEM
FruitflySpecificRxns=setdiff(FruitflySpecificRxns,rxnAssoc.rxnKEGGID);


% get species-specific network for manual inspection and then
% organize species-specific pathways into two tsv files:
fruitflySpecificNetwork=removeReactions(KEGG_fruitfly,...
setdiff(KEGG_fruitfly.rxns,FruitflySpecificRxns), true, true, true);

% "fruitflySpecificMets.tsv" contains species-specific metabolites
% load species-specific rxns and mets
rxnsToAdd = importTsvFile('fruitflySpecificRxns.tsv');
metsToAdd = importTsvFile('fruitflySpecificMets.tsv');

% "fruitflySpecificRxns.tsv" contains species-specific reactions
rxnsToAdd = importTsvFile('fruitflySpecificRxns.tsv');
rxnsToAdd.subSystems = cellfun(@(s) {{s}}, rxnsToAdd.subSystems);

% integrate fruitfly-specific metabolic network
[fruitflyGEM, modelChanges] = addMetabolicNetwork(fruitflyGEM, rxnsToAdd, metsToAdd);
%% Generate Fruitfly-GEM
[fruitflyGEM, speciesSpecNetwork, gapfillNetwork]=updateAnimalGEM(...
fruitflyOrthologPairs,rxnsToAdd,metsToAdd,'Fruitfly-GEM');


%% Update annotations
[rxnAssoc, metAssoc] = updateAnimalAnnotations(fruitflyGEM,rxnsToAdd,metsToAdd);

%% Gap-filling for biomass formation
[fruitflyGEM, gapfillNetwork]=gapfill4EssentialTasks(fruitflyGEM,ihuman);
% Added 39 reactions for gap-filling

%% Save annotation into tsv files, and the model into mat, yml, and xml

%% Save the model into mat, yml, and xml
% sanity check
if isequal(rxnAssoc.rxns, fruitflyGEM.rxns) && isequal(metAssoc.mets, fruitflyGEM.mets)
fprintf('sanity check passed.\n');
exportTsvFile(rxnAssoc,'../model/reactions.tsv');
exportTsvFile(metAssoc,'../model/metabolites.tsv');
end

fruitflyGEM.id = 'Fruitfly-GEM';
save('../model/Fruitfly-GEM.mat', 'fruitflyGEM');
writeHumanYaml(fruitflyGEM, '../model/Fruitfly-GEM.mat');
exportYaml(fruitflyGEM, '../model/Fruitfly-GEM.yml');
exportModel(fruitflyGEM, '../model/Fruitfly-GEM.xml');

76 changes: 38 additions & 38 deletions data/fruitflySpecificMets.tsv
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
mets metNames metFormulas metCharges compartments metKEGGID metPubChemID metChEBIID metMetaCycID metMetaNetXID
"MAM20003c" "L-Allothreonine" "C4H9NO3" 0 "c" "C05519" "99289" "CHEBI:28718" "L-ALLO-THREONINE" "MNXM2125"
"MAM01104p" "5-hydroxyisourate" "C5H4N4O4" 0 "p" "C11821" "250388" "CHEBI:250388" "5-HYDROXYISOURATE" "MNXM1137"
"MAM10018p" "5-Hydroxy-2-oxo-4-ureido-2,5-dihydro-1H-imidazole-5-carboxylate" "C5H5N4O5" -1 "p" "C12248" "443736" "CHEBI:58639" "CPD-5821" "MNXM1805"
"MAM10018c" "5-Hydroxy-2-oxo-4-ureido-2,5-dihydro-1H-imidazole-5-carboxylate" "C5H5N4O5" -1 "c" "C12248" "443736" "CHEBI:58639" "CPD-5821" "MNXM1805"
"MAM20005p" "1,3,7-Trimethyluric acid" "C8H10N4O3" 0 "p" "C16361" "47205669" "CHEBI:691622" "CPD-12480" "MNXM2761"
"MAM20006p" "3,6,8-Trimethylallantoin" "C7H12N4O3" 0 "p" "C16362" "47205670" "CHEBI:80471" "CPD-12485" "MNXM6778"
"MAM20010c" "pseudouridine" "C9H12N2O6" 0 "c" "C02067" "15047" "CHEBI:17802" "CPD-497" "MNXM1094063;MNXM4794"
"MAM02807c" "pseudouridine-5-phosphate" "C9H11N2O9P" -2 "c" "C01168" "25245232" "CHEBI:18116" "PSEUDOURIDINE-5-P" "MNXM2276"
"MAM20027c" "L-arginine-phosphate" "C6H14N4O5P" -1 "c" "C05945" "92150" "CHEBI:58477" "L-ARGININE-P" "MNXM3663"
"MAM20028r" "2-2-N-linked-Glycan" "C54H88N6O37" 0 "r" "" "25200901" "CHEBI:60651" "2-2-N-linked-Glycan" "MNXM146421"
"MAM20029r" "N4-N-ACETYL-BETA-D-GLUCOSAMINYL-F" "C60H98N6O41" 0 "r" "" "25203205" "CHEBI:137182" "N4-N-ACETYL-BETA-D-GLUCOSAMINYL-F" "MNXM148917"
"MAM01948r" "GDP" "C10H12N5O11P2" -3 "r" "C00035" "" "CHEBI:17552" "" "MNXM30"
"MAM01950r" "GDP-L-fucose" "C16H23N5O15P2" -2 "r" "C00325" "" "CHEBI:17009" "" "MNXM193"
"MAM20030c" "ecdysone" "C27H44O6" 0 "c" "C00477" "19212" "CHEBI:16688" "ECDYSONE" "MNXM727021;MNXM727022"
"MAM20031c" "3-dehydroecdysone" "C27H42O6" 0 "c" "C02513" "5460083" "CHEBI:17058" "CPD-331" "MNXM819815;MNXM2610"
"MAM20032c" "20-hydroxyecdysone" "C27H44O7" 0 "c" "C02633" "5459840" "CHEBI:16587" "CPD-276" "MNXM733384"
"MAM20033c" "2,22,25-trideoxyecdysone" "C27H44O3" 0 "c" "C16493" "15942885" "CHEBI:19290" "CPD-15499" "MNXM6663"
"MAM20034c" "2,22-dideoxyecdysone" "C27H44O4" 0 "c" "C16494" "14017685" "CHEBI:80530" "CPD-15498" "MNXM6852"
"MAM20035c" "2,22-dideoxyecdysone" "C27H44O4" 0 "c" "C16494" "14017685" "CHEBI:80530" "CPD-15498" "MNXM6852"
"MAM20036c" "2-deoxyecdysone" "C27H44O5" 0 "c" "C16495" "13939876" "CHEBI:19566" "CPD-15497" "MNXM739340;MNXM739339"
"MAM20037c" "3-dehydro-2,22,25-deoxyecdysone" "C27H42O3" 0 "c" "C16509" "15081546" "CHEBI:80541" "" "MNXM5425"
"MAM20038c" "3-dehydro-2,22-dideoxyecdysone" "C27H42O4" 0 "c" "C16498" "23724770" "CHEBI:80533" "" "MNXM6664"
"MAM20039c" "3-dehydro-2-deoxyecdysone" "C27H42O5" 0 "c" "C16497" "15251159" "CHEBI:80532" "CPD-15506" "MNXM6790"
"MAM20040c" "3-dehydroecdysone" "C27H42O6" 0 "c" "C02513" "5460083" "CHEBI:17058" "CPD-331" "MNXM819815;MNXM2610"
"MAM20041c" "20,26-dihydroxyecdysone" "C27H44O8" 0 "c" "C16500" "21123946" "CHEBI:19793" "CPD-15601" "MNXM741791;MNXM741792"
"MAM20042c" "trans-trans-farnesyl-phosphate" "C15H25O4P" -2 "c" "C20121" "46926298" "CHEBI:88226" "CPD-12587" "MNXM4974"
"MAM20043c" "2-trans-S-6-trans-farnesol" "C15H26O" 0 "c" "C01126" "445070" "CHEBI:16619" "2-TRANS6-TRANS-FARNESOL" "MNXM727075"
"MAM20044c" "2-trans-6-trans-farnesal" "C15H24O" 0 "c" "C03461" "5280598" "CHEBI:15894" "2-TRANS6-TRANS-FARNESAL" "MNXM1959"
"MAM20045c" "alpha-D-glucose 6-phosphate" "C6H11O9P" -2 "c" "C00668" "439284" "CHEBI:17665" "ALPHA-GLC-6-P" "MNXM729990"
"MAM20046c" "alpha-alpha-trehalose-6-phosphate" "C12H21O14P" -2 "c" "C00689" "122336" "CHEBI:18283" "TREHALOSE-6P" "MNXM448"
"MAM20047c" "secologanin" "C17H24O10" 0 "c" "C01852" "161276" "CHEBI:18002" "SECOLOGANIN-CPD" "MNXM823"
"MAM20048c" "3-alphaS-strictosidine" "C27H35N2O9" 1 "c" "C03470" "44123291" "CHEBI:17559" "STRICTOSIDINE" "MNXM728173"
"MAM20049c" "pyrimidodiazepine" "C9H11N5O2" 0 "c" "C02587" "135887869" "CHEBI:27114" "A-PYRIMIDODIAZEPINE" "MNXM732507"
"MAM20050c" "Juvenile hormone III" "C16H26O3" 0 "c" "C09694" "5281523" "CHEBI:27493" "CPD-8838" "MNXM2685"
"MAM20051c" "Juvenile hormone III acid" "C15H23O3" -1 "c" "C16504" "23724771" "CHEBI:83274" "CPD-12750" "MNXM3627"
"MAM20052c" "farnesoic acid" "C15H24O2" 0 "c" "C16502" "21895630" "CHEBI:83276" "CPD-12585" "MNXM735428"
"MAM20053c" "methyl farnesoate" "C16H26O2" 0 "c" "C16503" "5275508" "CHEBI:80535" "CPD-12586" "MNXM5369"
mets metNames metFormulas metCharges compartments metKEGGID metPubChemID metChEBIID metMetaCycID metMetaNetXID metsNoComp
"MAM20003c" "L-Allothreonine" "C4H9NO3" 0 "c" "C05519" "99289" "CHEBI:28718" "L-ALLO-THREONINE" "MNXM2125" "MAM20003"
"MAM01104p" "5-hydroxyisourate" "C5H4N4O4" 0 "p" "C11821" "250388" "CHEBI:250388" "5-HYDROXYISOURATE" "MNXM1137" "MAM01104"
"MAM10018p" "5-Hydroxy-2-oxo-4-ureido-2,5-dihydro-1H-imidazole-5-carboxylate" "C5H5N4O5" -1 "p" "C12248" "443736" "CHEBI:58639" "CPD-5821" "MNXM1805" "MAM10018"
"MAM10018c" "5-Hydroxy-2-oxo-4-ureido-2,5-dihydro-1H-imidazole-5-carboxylate" "C5H5N4O5" -1 "c" "C12248" "443736" "CHEBI:58639" "CPD-5821" "MNXM1805" "MAM10018"
"MAM20005p" "1,3,7-Trimethyluric acid" "C8H10N4O3" 0 "p" "C16361" "47205669" "CHEBI:691622" "CPD-12480" "MNXM2761" "MAM20005"
"MAM20006p" "3,6,8-Trimethylallantoin" "C7H12N4O3" 0 "p" "C16362" "47205670" "CHEBI:80471" "CPD-12485" "MNXM6778" "MAM20006"
"MAM20010c" "pseudouridine" "C9H12N2O6" 0 "c" "C02067" "15047" "CHEBI:17802" "CPD-497" "MNXM1094063;MNXM4794" "MAM20010"
"MAM02807c" "pseudouridine-5-phosphate" "C9H11N2O9P" -2 "c" "C01168" "25245232" "CHEBI:18116" "PSEUDOURIDINE-5-P" "MNXM2276" "MAM02807"
"MAM20027c" "L-arginine-phosphate" "C6H14N4O5P" -1 "c" "C05945" "92150" "CHEBI:58477" "L-ARGININE-P" "MNXM3663" "MAM20027"
"MAM20028r" "2-2-N-linked-Glycan" "C54H88N6O37" 0 "r" "" "25200901" "CHEBI:60651" "2-2-N-linked-Glycan" "MNXM146421" "MAM20028"
"MAM20029r" "N4-N-ACETYL-BETA-D-GLUCOSAMINYL-F" "C60H98N6O41" 0 "r" "" "25203205" "CHEBI:137182" "N4-N-ACETYL-BETA-D-GLUCOSAMINYL-F" "MNXM148917" "MAM20029"
"MAM01948r" "GDP" "C10H12N5O11P2" -3 "r" "C00035" "" "CHEBI:17552" "" "MNXM30" "MAM01948"
"MAM01950r" "GDP-L-fucose" "C16H23N5O15P2" -2 "r" "C00325" "" "CHEBI:17009" "" "MNXM193" "MAM01950"
"MAM20030c" "ecdysone" "C27H44O6" 0 "c" "C00477" "19212" "CHEBI:16688" "ECDYSONE" "MNXM727021;MNXM727022" "MAM20030"
"MAM20031c" "3-dehydroecdysone" "C27H42O6" 0 "c" "C02513" "5460083" "CHEBI:17058" "CPD-331" "MNXM819815;MNXM2610" "MAM20031"
"MAM20032c" "20-hydroxyecdysone" "C27H44O7" 0 "c" "C02633" "5459840" "CHEBI:16587" "CPD-276" "MNXM733384" "MAM20032"
"MAM20033c" "2,22,25-trideoxyecdysone" "C27H44O3" 0 "c" "C16493" "15942885" "CHEBI:19290" "CPD-15499" "MNXM6663" "MAM20033"
"MAM20034c" "2,22-dideoxyecdysone" "C27H44O4" 0 "c" "C16494" "14017685" "CHEBI:80530" "CPD-15498" "MNXM6852" "MAM20034"
"MAM20035c" "2,22-dideoxyecdysone" "C27H44O4" 0 "c" "C16494" "14017685" "CHEBI:80530" "CPD-15498" "MNXM6852" "MAM20035"
"MAM20036c" "2-deoxyecdysone" "C27H44O5" 0 "c" "C16495" "13939876" "CHEBI:19566" "CPD-15497" "MNXM739340;MNXM739339" "MAM20036"
"MAM20037c" "3-dehydro-2,22,25-deoxyecdysone" "C27H42O3" 0 "c" "C16509" "15081546" "CHEBI:80541" "" "MNXM5425" "MAM20037"
"MAM20038c" "3-dehydro-2,22-dideoxyecdysone" "C27H42O4" 0 "c" "C16498" "23724770" "CHEBI:80533" "" "MNXM6664" "MAM20038"
"MAM20039c" "3-dehydro-2-deoxyecdysone" "C27H42O5" 0 "c" "C16497" "15251159" "CHEBI:80532" "CPD-15506" "MNXM6790" "MAM20039"
"MAM20040c" "3-dehydroecdysone" "C27H42O6" 0 "c" "C02513" "5460083" "CHEBI:17058" "CPD-331" "MNXM819815;MNXM2610" "MAM20040"
"MAM20041c" "20,26-dihydroxyecdysone" "C27H44O8" 0 "c" "C16500" "21123946" "CHEBI:19793" "CPD-15601" "MNXM741791;MNXM741792" "MAM20041"
"MAM20042c" "trans-trans-farnesyl-phosphate" "C15H25O4P" -2 "c" "C20121" "46926298" "CHEBI:88226" "CPD-12587" "MNXM4974" "MAM20042"
"MAM20043c" "2-trans-S-6-trans-farnesol" "C15H26O" 0 "c" "C01126" "445070" "CHEBI:16619" "2-TRANS6-TRANS-FARNESOL" "MNXM727075" "MAM20043"
"MAM20044c" "2-trans-6-trans-farnesal" "C15H24O" 0 "c" "C03461" "5280598" "CHEBI:15894" "2-TRANS6-TRANS-FARNESAL" "MNXM1959" "MAM20044"
"MAM20045c" "alpha-D-glucose 6-phosphate" "C6H11O9P" -2 "c" "C00668" "439284" "CHEBI:17665" "ALPHA-GLC-6-P" "MNXM729990" "MAM20045"
"MAM20046c" "alpha-alpha-trehalose-6-phosphate" "C12H21O14P" -2 "c" "C00689" "122336" "CHEBI:18283" "TREHALOSE-6P" "MNXM448" "MAM20046"
"MAM20047c" "secologanin" "C17H24O10" 0 "c" "C01852" "161276" "CHEBI:18002" "SECOLOGANIN-CPD" "MNXM823" "MAM20047"
"MAM20048c" "3-alphaS-strictosidine" "C27H35N2O9" 1 "c" "C03470" "44123291" "CHEBI:17559" "STRICTOSIDINE" "MNXM728173" "MAM20048"
"MAM20049c" "pyrimidodiazepine" "C9H11N5O2" 0 "c" "C02587" "135887869" "CHEBI:27114" "A-PYRIMIDODIAZEPINE" "MNXM732507" "MAM20049"
"MAM20050c" "Juvenile hormone III" "C16H26O3" 0 "c" "C09694" "5281523" "CHEBI:27493" "CPD-8838" "MNXM2685" "MAM20050"
"MAM20051c" "Juvenile hormone III acid" "C15H23O3" -1 "c" "C16504" "23724771" "CHEBI:83274" "CPD-12750" "MNXM3627" "MAM20051"
"MAM20052c" "farnesoic acid" "C15H24O2" 0 "c" "C16502" "21895630" "CHEBI:83276" "CPD-12585" "MNXM735428" "MAM20052"
"MAM20053c" "methyl farnesoate" "C16H26O2" 0 "c" "C16503" "5275508" "CHEBI:80535" "CPD-12586" "MNXM5369" "MAM20053"

0 comments on commit c5ce633

Please sign in to comment.