Skip to content

Commit 86c8845

Browse files
committed
drawPathway with labels
1 parent ffeb800 commit 86c8845

File tree

73 files changed

+20
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+20
-8
lines changed

Toolbox/UsageStrings.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(*Usage strings*)
55

66

7-
(* ::Subsection::Closed:: *)
7+
(* ::Subsection:: *)
88
(*Options*)
99

1010

@@ -34,6 +34,12 @@
3434

3535
Output::usage="Output is an option for many functions specifying the amount of detail that should be provided in the results.";
3636

37+
CompoundLabels::usage="Output is an option for specifying if compound labels should be included in a pathway visualizations."
38+
39+
TextLabels::usage="Output is an option for specifying if generic text labels should be included in a pathway visualizations."
40+
41+
ReactionLabels::usage="Output is an option for specifying if reaction labels should be included in a pathway visualizations."
42+
3743

3844
(* ::Subsection::Closed:: *)
3945
(*Species & Reactions*)
@@ -704,7 +710,7 @@
704710
filter::usage="filter[listOfRules, keys] behave like FilterRules with the exception that the filtered rules are returned in the order of keys.";
705711

706712

707-
(* ::Subsection::Closed:: *)
713+
(* ::Subsection:: *)
708714
(*Visualization*)
709715

710716

Toolbox/Visualization.m

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,19 +421,25 @@
421421

422422

423423
$SimphenyInternalIDsToNames={"252134"->"iMM904_COMBINED","294177"->"iJR904_Alternate_Carbon_Sources","133267"->"iJR904_Amino_Acid_Metabolism","225959"->"iJR904_Cell_Membrane_Constituents","224016"->"iJR904_Central_Metabolism","303020"->"iJR904_Cofactor_Biosynthesis","305120"->"iJR904_Nucleotide_Metabolism","234509"->"iJR904_COMBINED","1226614"->"iAF1260_Alternate_Carbon_Sources","1230565"->"iAF1260_Amino_Acid_Metabolism","1555394"->"iAF1260_Central_Metabolism","1240422"->"iAF1260_Cofactor_Biosynthesis","1233958"->"iAF1260_Fatty_Acid_Biosynthesis","861115"->"iAF1260_Inorganic_Ion_Transport_(Inner_Membrane)","1243392"->"iAF1260_Lipopolysaccharide_(LPS)_Biosynthesis","651224"->"iAF1260_Murein_Biosynthesis_and_Recycling","1237864"->"iAF1260_Nucleotide_Metabolism","1225142"->"iAF1260_tRNA_Charging","1276939"->"iAF1260_COMBINED","745364"->"Recon1_AMINO_ACID_METABOLISM","607474"->"Recon1_CARBOHYDRATE_METABOLISM","854888"->"Recon1_ENERGY_METABOLISM","681892"->"Recon1_GLYCAN_METABOLISM","1103958"->"Recon1_LIPID_METABOLISM","700994"->"Recon1_NUCLEOTIDE_METABOLISM","821108"->"Recon1_SECONDARY_METABOLITES","851235"->"Recon1_VITAMIN_&_COFACTOR_METABOLISM","1014133"->"Recon1_COMBINED","22199"->"iND750_Amino_Acid_Metabolism","35089"->"iND750_Cofactor_and_Vitamin_Biosynthesis","38537"->"iND750_Lipid_Metabolism","20179"->"iND750_Nucleotide_Metabolism","666364"->"iND750_COMBINED","382379"->"iAF692_Vitamin_and_Cofactor_Biosynthesis","441083"->"iAF692_Nucleotide_Metabolism","447592"->"iAF692_COMBINED","549"->"iIT341_Central_Metabolism","503671"->"iIT341_Co-set_Order","387841"->"iIT341_COMBINED","340794"->"iSB619_Amino_Acid_Metabolism","340815"->"iSB619_Biomass","340795"->"iSB619_Central_Metabolism","340806"->"iSB619_Cofactor_Biosynthesis","385801"->"iSB619_Heme_Biosynthesis","340797"->"iSB619_Oxidative_Phosphorylation","340798"->"iSB619_Pentose_Phosphate","340800"->"iSB619_Purine/Pyrimidine_Metabolism","390808"->"iSB619_COMBINED","1576807"->"EcoliCore_coreMap","1148996"->"iNJ661_COMBINED"};
424-
$AVAILABLEMAPS=StringSplit[FileNameSplit[#][[-1]],"_"][[1]]->#&/@FileNames["*.gz",{FileNameJoin[{$ToolboxPath,"maps","bigg_maps"}]}];
425-
$AVAILABLEMAPS=$AVAILABLEMAPS/.$SimphenyInternalIDsToNames;
424+
$AVAILABLEMAPS=StringReplace[FileNameSplit[#][[-1]],"_toolbox.json.gz"->""]->#&/@FileNames["*.gz",{FileNameJoin[{$ToolboxPath,"maps","bigg_maps"}]}];
425+
$AVAILABLEMAPS=Select[$AVAILABLEMAPS,!StringMatchQ[#[[1]],RegularExpression["^\\d+"]]&];
426426

427427

428428
Unprotect[drawPathway];
429-
Options[drawPathway]={"MinMaxHack"->False,"PlotLegends"->None,"Tooltips"->True,"ColorFunctionScaling"->True,"Boundary"->False,"ReactionData"->{},"MetaboliteData"->{},ColorFunction->ColorData["Rainbow"],"MinSize"->0.005,"MaxSize"->0.01,"MinThickness"->0.001,"MaxThickness"->0.003,"TextStyle"->{FontFamily->"Arial",FontSize->Scaled[.008]},"MetaboliteStyle"->Options[drawMetaboliteMap],"ReactionStyle"->Options[drawReactionMap],ImageSize->350};
430-
drawPathway::unknowmap="Map `1` is not available. Try drawPathway[] to see a list of available maps";
429+
Options[drawPathway]={"CompoundLabels"->True,"ReactionLabels"->True,"TextLabels"->False,"MinMaxHack"->False,"PlotLegends"->None,"Tooltips"->True,"ColorFunctionScaling"->True,"Boundary"->False,"ReactionData"->{},"MetaboliteData"->{},ColorFunction->ColorData["Rainbow"],"MinSize"->0.005,"MaxSize"->0.01,"MinThickness"->0.001,"MaxThickness"->0.003,"TextStyle"->{FontFamily->"Arial",FontSize->Scaled[.008]},"MetaboliteStyle"->Options[drawMetaboliteMap],"ReactionStyle"->Options[drawReactionMap],ImageSize->350};
430+
drawPathway::unknownmap="Map `1` is not available. Try drawPathway[] to see a list of available maps";
431431
drawPathway[]:=Sort[$AVAILABLEMAPS[[All,1]]]
432-
drawPathway[mapID_String,opts:OptionsPattern[{drawPathway,drawReactionMap,drawMetaboliteMap}]]:=Module[{cmpdPos,rxnPos,finalLabels,mapData},
433-
If[MemberQ[$AVAILABLEMAPS[[All,1]],mapID], mapData=Import[mapID/.$AVAILABLEMAPS], Message[drawPathway,mapID];Abort[];];
432+
drawPathway[mapID_String,opts:OptionsPattern[{drawPathway,drawReactionMap,drawMetaboliteMap}]]:=Module[{cmpdPos,rxnPos,finalLabels,mapData,cmpdLabels,rxnLabels,textLabels},
433+
If[MemberQ[$AVAILABLEMAPS[[All,1]],mapID], mapData=Import[mapID/.$AVAILABLEMAPS], Message[drawPathway::unknownmap,mapID];Abort[];];
434434
cmpdPos=Flatten[query["cmpd_pos",mapData,{}]];
435435
rxnPos=query["rxn_pos",mapData];
436+
cmpdLabels = Text[#[[1]], #[[2,2]]]&/@Flatten[query["cmpd_label_pos", mapData, {}]];
437+
rxnLabels = Text@@@query["rxn_label_pos", mapData, {}];
438+
textLabels = Text@@@query["text_label_pos", mapData, {}];
436439
finalLabels={};
440+
If[OptionValue["CompoundLabels"]==True, finalLabels=Join[cmpdLabels,finalLabels];];
441+
If[OptionValue["TextLabels"]==True, finalLabels=Join[textLabels,finalLabels];];
442+
If[OptionValue["ReactionLabels"]==True, finalLabels=Join[rxnLabels,finalLabels];];
437443
drawPathway[cmpdPos,DeleteCases[rxnPos,{"NaN","NaN"},\[Infinity]](*TODO: fix this in the maps*),finalLabels,opts]
438444
];
439445
drawPathway[metPos:{_Rule..},rxnPos:{_Rule..},textPos:({(_Text|_Rule|_Style)..}|{}),opts:OptionsPattern[{drawPathway,drawReactionMap,drawMetaboliteMap}]]:=Module[{refMin,refMax,helperFunc,min,max,directedQ,map,fluxStyle,metStyle,cellMembrane,corners,aspectRatio,cleanRxnData,scalingFunction,cleanMetaboliteData},
-507 KB
Binary file not shown.
-4.43 KB
Binary file not shown.
-58.2 KB
Binary file not shown.
-15.1 KB
Binary file not shown.
-373 KB
Binary file not shown.
-38.7 KB
Binary file not shown.
-16 KB
Binary file not shown.
-19.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)