## 2 Materials and Methods  
### Reactor Operation and Sampling  
An acrylic sequencing batch reactor (SBR) with a working volume of 2 L was inoculated with wastewater sludge from the aerobic tank of a WWTP located in Lisbon (Beirolas, Portugal). The SBR was fed with synthetic domestic wastewater and operated for 128 days in 8 h cycles, comprising subsequent periods of anaerobic (dark), aerobic (light) and anoxic phases for 7 h, followed by 1 h for settling and withdrawal. The synthetic medium, fed at the beginning of each cycle, was composed of 75% (\(v/v\)) of a phosphate solution (253 mg/L of K\({}_{2}\)HPO\({}_{4}\) and 154 mg/L of KH\({}_{2}\)PO\({}_{4}\)) and 25% (\(v/v\)) of carbon and nitrogen medium with a concentration per liter of: 0.64 g C\({}_{2}\)H\({}_{3}\)O\({}_{2}\)Na\(\cdot\)3H\({}_{2}\)O; 68 uL C\({}_{3}\)H\({}_{6}\)O\({}_{2}\); 0.59 g NH\({}_{4}\)Cl; 0.95 g MgSO\({}_{4}\);7H\({}_{2}\)O; 0.44 g CaCl\({}_{2}\)\(\cdot\)2H\({}_{2}\)O; 11.7 mg allyl-N thiourea (ATU, only added during PAO enrichment to prevent nitrification); 31.7 mg ethylene-diaminetetraacetic (EDTA) to prevent salts precipitation and 3.17 mL of a micronutrients solution, with a concentration per liter of: 1.5 g FeCl\({}_{3}\)\(\cdot\)6H\({}_{2}\)O; 0.15 g H\({}_{3}\)BO\({}_{3}\); 0.03 g CuSO\({}_{4}\).5H\({}_{2}\)O; 0.18 g KI; 0.12 g MnCl\({}_{2}\)\(\cdot\)4H\({}_{2}\)O; 0.06 g Na\({}_{2}\)MoO\(\cdot\)2H\({}_{2}\)O; 0.12 g ZnSO\({}_{4}\)\(\cdot\)7H\({}_{2}\)O and 0.15 g CoCl\({}_{2}\)\(\cdot\)6H\({}_{2}\)O. The carbon media contained volatile fatty acids (VFAs) at a ratio of 75% acetate and 25% propionate, to promote PAO enrichment [30]. The temperature of the reactor was set to 20 \({}^{\circ}\)C while the pH was controlled at 7.5 through the addition of 0.1 M HCl. Anaerobic, aerobic, anoxic and idle periods were stirred with a magnetic stirrer at a constant rate of 700 rpm. At the end of the anoxic period, the culture was settled and decanted, with 1 L of supernatant being removed. During the following idle period, argon was bubbled to ensure anaerobic conditions before the next cycle. The anoxic phase was introduced at the end of day 73, upon the suspension of ATU addition for nitrification inhibition. The HRT and sludge retention time were 16 h and 18 days, respectively. Illumination was supplied by external Osram halogen lamps (two lamps of 40 W and one of 60 W), providing an intensity of 99 W/m\({}^{2}\) on the reactor surface, which corresponds to 4.5 W/L. This light intensity was chosen to simulate the sun irradiance levels that occur during a summer day in Portugal [31]. For more information about reactor operation details, please see [14].  
Mixed liquor samples were harvested from the SBR during 7 h of each reactor cycle (Figure S1 in Supplementary Materials), along the selected treatment cycles (13 samples per cycle) [14] and used for both at-line Raman spectra acquisition and offline quantification of TOC, VFAs, CO\({}_{2}\), NH\({}_{3}\), NO\({}_{3}\), PO\({}_{4}\), total P, PHAs, glycogen, TSSs and VSSs through reference analytical methods. Total P, TSSs and VSSs were only determined on samples collected at specific timepoints. Four SBR cycles were selected for this study, corresponding to the SBR operation days 73 (cycle A; samples 1-13); 79 (cycle B; samples 14-26); 85 (cycle C; samples 27-39); and 101 (cycle D; samples 40-52). Specifically, the duration of the anaerobic/aerobic/anoxic phases were 3 h/4 h/0 h on cycle A, 1.5 h/2.5 h/3 h on cycles B and C, and 1.5 h/3.5 h/2 h on cycle D. The quantification of all parameters was performed in the four selected cycles, except for TOC, which was only measured on cycle A.