changeset 241:049aa0f4844f draft default tip

Uploaded
author francesco_lapi
date Mon, 13 Jan 2025 15:16:18 +0000
parents 63f5078627a9
children
files COBRAxy/flux_to_map.py COBRAxy/local/svg metabolic maps/ENGRO2_map.svg COBRAxy/local/svg metabolic maps/ENGRO2_no_legend_map.svg
diffstat 3 files changed, 183 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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">
     <inkscape:grid
        id="grid1"
@@ -219,7 +219,8 @@
   </g>
   <g
      id="ENGRO2_2"
-     transform="translate(-4.4342642,-0.95335109)">
+     transform="translate(-4.4342642,-0.95335109)"
+     inkscape:label="ENGRO2_2">
     <g
        id="Legend"
        transform="translate(-32,60)">
@@ -20887,24 +20888,21 @@
          y="1211.9318"
          id="tspan1390-7"
          style="stroke-width:0.997137">Lact/Glc</tspan></text>
-    <g
-       id="G_LactGlc"
-       inkscape:label="G_LactGlc"
-       transform="translate(58.962448,78.145092)">
-      <path
-         id="R_LactGlc"
-         d="M -34.171748,1147.8658 H 44.878214"
-         stroke="#000000"
-         stroke-width="2.37931"
-         inkscape:label="R_LactGlc" />
-    </g>
+    <path
+       id="R_LactGlc"
+       d="M -34.171748,1147.8658 H 44.878214"
+       stroke="#000000"
+       stroke-width="2.37931"
+       inkscape:label="R_LactGlc"
+       transform="translate(58.962448,78.145092)" />
     <path
        id="F_LactGlc"
        fill-rule="evenodd"
        clip-rule="evenodd"
        d="m 25.385195,1223.309 -9.6123,2.9576 9.6123,2.9576 -2.400585,-2.9576 z"
        stroke="#000000"
-       stroke-width="2.31662" />
+       stroke-width="2.31662"
+       inkscape:label="F_LactGlc" />
     <path
        id="B_LactGlc"
        fill-rule="evenodd"
@@ -20929,17 +20927,13 @@
          y="1284.9663"
          id="tspan1390-7-7"
          style="stroke-width:0.997137">Lact/Gln</tspan></text>
-    <g
-       id="G_LactGln"
-       inkscape:label="G_LactGln"
-       transform="translate(60.358801,151.25589)">
-      <path
-         id="R_LactGln"
-         d="M -34.171748,1147.8658 H 44.878214"
-         stroke="#000000"
-         stroke-width="2.37931"
-         inkscape:label="R_LactGln" />
-    </g>
+    <path
+       id="R_LactGln"
+       d="M -34.171748,1147.8658 H 44.878214"
+       stroke="#000000"
+       stroke-width="2.37931"
+       inkscape:label="R_LactGln"
+       transform="translate(60.358801,151.25589)" />
     <path
        id="F_LactGln"
        fill-rule="evenodd"
@@ -20972,17 +20966,13 @@
          y="1350.5182"
          id="tspan1390-7-7-7"
          style="stroke-width:0.997137">Glu/Gln</tspan></text>
-    <g
-       id="G_GluGln"
-       inkscape:label="G_GluGln"
-       transform="translate(62.44494,216.87628)">
-      <path
-         id="R_GluGln"
-         d="M -34.171748,1147.8658 H 44.878214"
-         stroke="#000000"
-         stroke-width="2.37931"
-         inkscape:label="R_GluGln" />
-    </g>
+    <path
+       id="R_GluGln"
+       d="M -34.171748,1147.8658 H 44.878214"
+       stroke="#000000"
+       stroke-width="2.37931"
+       inkscape:label="R_GluGln"
+       transform="translate(62.44494,216.87628)" />
     <path
        id="F_GluGln"
        fill-rule="evenodd"
@@ -20999,5 +20989,46 @@
        stroke="#000000"
        stroke-width="2.31662"
        inkscape:label="B_GluGln" />
+    <text
+       id="text6041-8-3-9-2"
+       fill="#000000"
+       xml:space="preserve"
+       style="white-space:pre;stroke-width:0.997137"
+       font-family="Arial"
+       font-size="15.9542px"
+       font-weight="bold"
+       letter-spacing="0em"
+       x="-2417.4214"
+       y="761.58533"
+       transform="scale(0.99895309,1.001048)"><tspan
+         x="67.933342"
+         y="1416.2527"
+         id="tspan1390-7-7-7-9"
+         style="stroke-width:0.997137">Lact/O<tspan
+   style="font-size:65%;baseline-shift:sub"
+   id="tspan1">2</tspan></tspan></text>
+    <path
+       id="R_LactO2"
+       d="M -34.171748,1147.8658 H 44.878214"
+       stroke="#000000"
+       stroke-width="2.37931"
+       inkscape:label="R_LactO2"
+       transform="translate(62.148536,282.67969)" />
+    <path
+       id="F_LactO2"
+       fill-rule="evenodd"
+       clip-rule="evenodd"
+       d="m 28.571286,1427.8436 -9.6123,2.9576 9.6123,2.9576 -2.40058,-2.9576 z"
+       stroke="#000000"
+       stroke-width="2.31662"
+       inkscape:label="F_LactO2" />
+    <path
+       id="B_LactO2"
+       fill-rule="evenodd"
+       clip-rule="evenodd"
+       d="m 104.99934,1433.7939 9.6123,-2.9576 -9.6123,-2.9576 2.40058,2.9576 z"
+       stroke="#000000"
+       stroke-width="2.31662"
+       inkscape:label="B_LactO2" />
   </g>
 </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</tspan></text>
     </g>
     <text
-       id="text6041-8"
+       id="text6041-8-4"
        fill="#000000"
        xml:space="preserve"
        style="white-space:pre;stroke-width:0.997137"
@@ -20791,41 +20791,37 @@
        font-size="15.9542px"
        font-weight="bold"
        letter-spacing="0em"
-       x="-2420.0784"
-       y="526.66101"
+       x="-2415.866"
+       y="526.51935"
        transform="scale(0.99895309,1.001048)"><tspan
-         x="65.275986"
-         y="1181.329"
-         id="tspan1390-7"
+         x="69.488106"
+         y="1181.1871"
+         id="tspan1390-7-8"
          style="stroke-width:0.997137">Lact/Glc</tspan></text>
-    <g
-       id="G_LactGlc"
-       inkscape:label="G_LactGlc"
-       transform="translate(59.493893,47.510127)">
-      <path
-         id="R_LactGlc"
-         d="M -34.171748,1147.8658 H 44.878214"
-         stroke="#000000"
-         stroke-width="2.37931"
-         inkscape:label="R_LactGlc" />
-    </g>
+    <path
+       id="R_LactGlc"
+       d="M 29.529936,1195.2341 H 108.5799"
+       stroke="#000000"
+       stroke-width="2.37931"
+       inkscape:label="R_LactGlc" />
     <path
        id="F_LactGlc"
        fill-rule="evenodd"
        clip-rule="evenodd"
-       d="m 25.916693,1192.674 -9.6123,2.9576 9.6123,2.9576 -2.4006,-2.9576 z"
+       d="m 30.124426,1192.5322 -9.61229,2.9576 9.61229,2.9576 -2.40058,-2.9576 z"
        stroke="#000000"
-       stroke-width="2.31662" />
+       stroke-width="2.31662"
+       inkscape:label="F_LactGlc" />
     <path
        id="B_LactGlc"
        fill-rule="evenodd"
        clip-rule="evenodd"
-       d="m 102.34479,1198.6243 9.6123,-2.9576 -9.6123,-2.9576 2.4005,2.9576 z"
+       d="m 106.55248,1198.4825 9.6123,-2.9576 -9.6123,-2.9576 2.40058,2.9576 z"
        stroke="#000000"
        stroke-width="2.31662"
        inkscape:label="B_LactGlc" />
     <text
-       id="text6041-8-3"
+       id="text6041-8-3-8"
        fill="#000000"
        xml:space="preserve"
        style="white-space:pre;stroke-width:0.997137"
@@ -20833,29 +20829,24 @@
        font-size="15.9542px"
        font-weight="bold"
        letter-spacing="0em"
-       x="-2418.6807"
-       y="599.69604"
+       x="-2414.4683"
+       y="599.55438"
        transform="scale(0.99895309,1.001048)"><tspan
-         x="66.673813"
-         y="1254.3634"
-         id="tspan1390-7-7"
+         x="70.885933"
+         y="1254.2217"
+         id="tspan1390-7-7-8"
          style="stroke-width:0.997137">Lact/Gln</tspan></text>
-    <g
-       id="G_LactGln"
-       inkscape:label="G_LactGln"
-       transform="translate(60.890293,120.62093)">
-      <path
-         id="R_LactGln"
-         d="M -34.171748,1147.8658 H 44.878214"
-         stroke="#000000"
-         stroke-width="2.37931"
-         inkscape:label="R_LactGln" />
-    </g>
+    <path
+       id="R_LactGln"
+       d="M 30.926286,1268.3449 H 109.97625"
+       stroke="#000000"
+       stroke-width="2.37931"
+       inkscape:label="R_LactGln" />
     <path
        id="F_LactGln"
        fill-rule="evenodd"
        clip-rule="evenodd"
-       d="m 27.313093,1265.7848 -9.6123,2.9576 9.6123,2.9576 -2.4006,-2.9576 z"
+       d="m 31.520786,1265.643 -9.6123,2.9576 9.6123,2.9576 -2.40058,-2.9576 z"
        stroke="#000000"
        stroke-width="2.31662"
        inkscape:label="F_LactGln" />
@@ -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" />
     <text
-       id="text6041-8-3-9"
+       id="text6041-8-3-9-0"
        fill="#000000"
        xml:space="preserve"
        style="white-space:pre;stroke-width:0.997137"
@@ -20876,29 +20867,24 @@
        font-size="15.9542px"
        font-weight="bold"
        letter-spacing="0em"
-       x="-2416.5923"
-       y="665.24805"
+       x="-2412.3799"
+       y="665.10626"
        transform="scale(0.99895309,1.001048)"><tspan
-         x="68.76207"
-         y="1319.9154"
-         id="tspan1390-7-7-7"
+         x="72.974266"
+         y="1319.7736"
+         id="tspan1390-7-7-7-6"
          style="stroke-width:0.997137">Glu/Gln</tspan></text>
-    <g
-       id="G_GluGln"
-       inkscape:label="G_GluGln"
-       transform="translate(62.976393,186.24133)">
-      <path
-         id="R_GluGln"
-         d="M -34.171748,1147.8658 H 44.878214"
-         stroke="#000000"
-         stroke-width="2.37931"
-         inkscape:label="R_GluGln" />
-    </g>
+    <path
+       id="R_GluGln"
+       d="M 33.012426,1333.9653 H 112.06239"
+       stroke="#000000"
+       stroke-width="2.37931"
+       inkscape:label="R_GluGln" />
     <path
        id="F_GluGln"
        fill-rule="evenodd"
        clip-rule="evenodd"
-       d="m 29.399193,1331.4052 -9.6123,2.9576 9.6123,2.9576 -2.4006,-2.9576 z"
+       d="m 33.606926,1331.2634 -9.6123,2.9576 9.6123,2.9576 -2.40058,-2.9576 z"
        stroke="#000000"
        stroke-width="2.31662"
        inkscape:label="F_GluGln" />
@@ -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" />
+    <text
+       id="text6041-8-3-9-2"
+       fill="#000000"
+       xml:space="preserve"
+       style="white-space:pre;stroke-width:0.997137"
+       font-family="Arial"
+       font-size="15.9542px"
+       font-weight="bold"
+       letter-spacing="0em"
+       x="-2412.6768"
+       y="730.84076"
+       transform="scale(0.99895309,1.001048)"><tspan
+         x="72.677551"
+         y="1385.5081"
+         id="tspan1390-7-7-7-9"
+         style="stroke-width:0.997137">Lact/O<tspan
+   style="font-size:65%;baseline-shift:sub"
+   id="tspan1-6">2</tspan></tspan></text>
+    <path
+       id="R_LactO2"
+       d="M 32.716026,1399.7687 H 111.76598"
+       stroke="#000000"
+       stroke-width="2.37931"
+       inkscape:label="R_LactO2" />
+    <path
+       id="F_LactO2"
+       fill-rule="evenodd"
+       clip-rule="evenodd"
+       d="m 33.310526,1397.0668 -9.6123,2.9576 9.6123,2.9576 -2.40058,-2.9576 z"
+       stroke="#000000"
+       stroke-width="2.31662"
+       inkscape:label="F_LactO2" />
+    <path
+       id="B_LactO2"
+       fill-rule="evenodd"
+       clip-rule="evenodd"
+       d="m 109.73857,1403.0171 9.6123,-2.9576 -9.6123,-2.9576 2.40058,2.9576 z"
+       stroke="#000000"
+       stroke-width="2.31662"
+       inkscape:label="B_LactO2" />
   </g>
 </svg>