# HG changeset patch # User francesco_lapi # Date 1736781378 0 # Node ID 049aa0f4844f121610fc7b9995297089053136ae # Parent 63f5078627a9b5fa2963cef87f31fea5107c3c25 Uploaded diff -r 63f5078627a9 -r 049aa0f4844f COBRAxy/flux_to_map.py --- a/COBRAxy/flux_to_map.py Mon Jan 13 10:01:40 2025 +0000 +++ b/COBRAxy/flux_to_map.py Mon Jan 13 15:16:18 2025 +0000 @@ -842,24 +842,37 @@ if missing_reactions: sys.exit(f'Execution aborted: Missing required reactions {missing_reactions} in {datasetName}\n') + # Calculate new rows using safe division lact_glc = np.divide( - dataset.loc['EX_lac__L_e'], -dataset.loc['EX_glc__D_e'], - out=np.zeros_like(dataset.loc['EX_lac__L_e']), where=dataset.loc['EX_glc__D_e'] != 0 + np.clip(dataset.loc['EX_lac__L_e'].to_numpy(), a_min=0, a_max=None), + np.clip(dataset.loc['EX_glc__D_e'].to_numpy(), a_min=None, a_max=0), + out=np.full_like(dataset.loc['EX_lac__L_e'].to_numpy(), np.nan), # Prepara un array con NaN come output di default + where=dataset.loc['EX_glc__D_e'].to_numpy() != 0 # Condizione per evitare la divisione per zero ) lact_gln = np.divide( - dataset.loc['EX_lac__L_e'], -dataset.loc['EX_gln__L_e'], - out=np.zeros_like(dataset.loc['EX_lac__L_e']), where=dataset.loc['EX_gln__L_e'] != 0 + np.clip(dataset.loc['EX_lac__L_e'].to_numpy(), a_min=0, a_max=None), + np.clip(dataset.loc['EX_gln__L_e'].to_numpy(), a_min=None, a_max=0), + out=np.full_like(dataset.loc['EX_lac__L_e'].to_numpy(), np.nan), + where=dataset.loc['EX_gln__L_e'].to_numpy() != 0 + ) + lact_o2 = np.divide( + np.clip(dataset.loc['EX_lac__L_e'].to_numpy(), a_min=0, a_max=None), + np.clip(dataset.loc['EX_o2_e'].to_numpy(), a_min=None, a_max=0), + out=np.full_like(dataset.loc['EX_lac__L_e'].to_numpy(), np.nan), + where=dataset.loc['EX_o2_e'].to_numpy() != 0 ) glu_gln = np.divide( - dataset.loc['EX_glu__L_e'], -dataset.loc['EX_gln__L_e'], - out=np.zeros_like(dataset.loc['EX_glu__L_e']), where=dataset.loc['EX_gln__L_e'] != 0 + dataset.loc['EX_glu__L_e'].to_numpy(), + np.clip(dataset.loc['EX_gln__L_e'].to_numpy(), a_min=None, a_max=0), + out=np.full_like(dataset.loc['EX_lac__L_e'].to_numpy(), np.nan), + where=dataset.loc['EX_gln__L_e'].to_numpy() != 0 ) # Create a DataFrame for the new rows new_rows = pd.DataFrame({ - dataset.index.name: ['LactGlc', 'LactGln', 'GluGln'], - **{col: [lact_glc[i], lact_gln[i], glu_gln[i]] for i, col in enumerate(dataset.columns)} + dataset.index.name: ['LactGlc', 'LactGln','LactO2', 'GluGln'], + **{col: [lact_glc[i], lact_gln[i],lact_o2[i], glu_gln[i]] for i, col in enumerate(dataset.columns)} }) # Reset the index of the original dataset and append new rows diff -r 63f5078627a9 -r 049aa0f4844f COBRAxy/local/svg metabolic maps/ENGRO2_map.svg --- a/COBRAxy/local/svg metabolic maps/ENGRO2_map.svg Mon Jan 13 10:01:40 2025 +0000 +++ b/COBRAxy/local/svg metabolic maps/ENGRO2_map.svg Mon Jan 13 15:16:18 2025 +0000 @@ -7,7 +7,7 @@ version="1.1" id="svg5792" sodipodi:docname="ENGRO2_map.svg" - inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)" + inkscape:version="1.3 (0e150ed6c4, 2023-07-21)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" @@ -107,15 +107,15 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" showgrid="true" - inkscape:zoom="1.0470149" - inkscape:cx="1956.0371" - inkscape:cy="797.50536" - inkscape:window-width="1850" - inkscape:window-height="1016" - inkscape:window-x="70" - inkscape:window-y="27" + inkscape:zoom="2.0940298" + inkscape:cx="65.662868" + inkscape:cy="1326.3899" + inkscape:window-width="1920" + inkscape:window-height="1009" + inkscape:window-x="-8" + inkscape:window-y="-8" inkscape:window-maximized="1" - inkscape:current-layer="g35" + inkscape:current-layer="ENGRO2_2" showguides="true"> + transform="translate(-4.4342642,-0.95335109)" + inkscape:label="ENGRO2_2"> @@ -20887,24 +20888,21 @@ y="1211.9318" id="tspan1390-7" style="stroke-width:0.997137">Lact/Glc - - - + + stroke-width="2.31662" + inkscape:label="F_LactGlc" /> Lact/Gln - - - + Glu/Gln - - - + + Lact/O2 + + + diff -r 63f5078627a9 -r 049aa0f4844f COBRAxy/local/svg metabolic maps/ENGRO2_no_legend_map.svg --- a/COBRAxy/local/svg metabolic maps/ENGRO2_no_legend_map.svg Mon Jan 13 10:01:40 2025 +0000 +++ b/COBRAxy/local/svg metabolic maps/ENGRO2_no_legend_map.svg Mon Jan 13 15:16:18 2025 +0000 @@ -101,9 +101,9 @@ inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" - inkscape:zoom="0.26824698" - inkscape:cx="795.90832" - inkscape:cy="1504.2108" + inkscape:zoom="4.2919517" + inkscape:cx="125.70039" + inkscape:cy="1327.9506" inkscape:window-width="1920" inkscape:window-height="1009" inkscape:window-x="-8" @@ -20783,7 +20783,7 @@ id="tspan353">4abut Lact/Glc - - - + + stroke-width="2.31662" + inkscape:label="F_LactGlc" /> Lact/Gln - - - + @@ -20863,12 +20854,12 @@ id="B_LactGln" fill-rule="evenodd" clip-rule="evenodd" - d="m 103.74109,1271.7351 9.6123,-2.9576 -9.6123,-2.9576 2.4006,2.9576 z" + d="m 107.94884,1271.5933 9.6123,-2.9576 -9.6123,-2.9576 2.40058,2.9576 z" stroke="#000000" stroke-width="2.31662" inkscape:label="B_LactGln" /> Glu/Gln - - - + @@ -20906,9 +20892,49 @@ id="B_GluGln" fill-rule="evenodd" clip-rule="evenodd" - d="m 105.82729,1337.3555 9.6123,-2.9576 -9.6123,-2.9576 2.4005,2.9576 z" + d="m 110.03498,1337.2137 9.6123,-2.9576 -9.6123,-2.9576 2.40058,2.9576 z" stroke="#000000" stroke-width="2.31662" inkscape:label="B_GluGln" /> + Lact/O2 + + +