LPS-induced inflammation differentially affects endogenous Ca<sup>2</sup>⁺ activity in mouse and human iPSC-derived astrocytes.
The 1 match
- [1] § Methods › LDA, component analysis and weight matrix generation ↔ 2026-06-05_LPS_Paper_Figs_GS_AZ_KL.ipynb, lines 119–263 · score 0.57 · MaxSize, Negative Matrix Factorization, weights, distance, components, NMF
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 640 lines · 23 KB · GPL-3.0 · 1 match
- # %% [markdown]
- # ## LPS-induced inflammation differentially affects endogenous Ca2⁺ activity in mouse and human iPSC-derived astrocytes
- # ### Franziska E. Müller, Flavian Ivanov, Anne-Catharine Studt, Ida Nitzsche, Frauke S. Bahr, Anna-Lena Krüger, Josephine Labus, Ghanendra Singh, Evgeni G. Ponimaskin, Kerstin Lenk* & Andre Zeug*
- # \* authors contributed equally
- # Mol Med 32, 52 (2026). https://doi.org/10.1186/s10020-026-01450-3
- #
- # **Contribution to code:** Ghanendra Singh, Andre Zeug, Kerstin Lenk
- # %% [markdown]
- # **Install libraries if needed:**
- # pip install seaborn, used version seaborn-0.13.2
- # pip install scikit-learn, used version scikit-learn-1.9.0
- # pip install openpyxl, used version openpyxl-3.1.5
- # %%
- # Import Library
- import pandas as pd
- import numpy as np
- import matplotlib.pyplot as plt
- from matplotlib import cm, ticker
- import matplotlib.colors as colors
- %matplotlib inline
- import seaborn as sns
- import os
- from matplotlib.backends.backend_pdf import PdfPages
- from datetime import datetime
- from matplotlib.colors import Normalize
- # ML Methods
- from sklearn.manifold import TSNE
- from sklearn.decomposition import PCA, FastICA, NMF
- # Importing different scalars
- from sklearn.preprocessing import StandardScaler,MinMaxScaler
- # Handy to ignore warnings
- import warnings
- warnings.filterwarnings("ignore")
- # %% [markdown]
- # ### Load data from Excel file
- # #### Note:
- # * Place your excel file in the same folder as jupyter notebook or use custom path
- # * Ignores the first header row for simplicity
- # * Index starts from zero
- # %%
- # Load data from the excel file into a dataframe using pandas pd
- path = 'MLData_comp_LPS_Treatment_Ch2_updated_file.xlsx'
- xl = pd.ExcelFile(path)
- # Check multipe sheets in the excel file #xl.sheet_names
- df_b18_g_5 = xl.parse(1,header=1) # pass sheet index as 1 for 18bin with gamma 0.5 excel data
- # %%
- # Visualize first five observations
- df_b18_g_5.head()
- # %% [markdown]
- # ### Dataframe with multi Index
- # * Data columm contains (first five sub columns)
- # * Here it is fixed (metadata size = 5)
- # %%
- # Function to load data with proper columns names
- # Default binsize in the function is 18
- def load_data(df,bs=18): # bs is bin size in short
- md = 5 #md = 5 as metadata size
- df_xl = pd.concat([df.iloc[:,0:md],
- df.iloc[:,md:1*bs*6+md],
- df.iloc[:,1*bs*6+md:2*bs*6+md],
- df.iloc[:,2*bs*6+md:3*bs*6+md],
- df.iloc[:,3*bs*6+md:4*bs*6+md]],
- axis=1,
- keys=['Data','maxArea','duration','maxDist','slopeCa'])
- return df_xl
- # %% [markdown]
- # ### Load the whole data file (HIP, PFC + iPSCs)
- # * Add the path to iPSCs data
- # %%
- path2 = 'MLData_hiPSC-Astros-AAV-V5-basal_Ch2.xlsx'
- xl2 = pd.ExcelFile(path2)
- df_b18_g_5_iPSC = xl2.parse(0,header=1)
- df = load_data(df_b18_g_5_iPSC, binsize)
- df.head()
- # %% [markdown]
- # #### Data representation can also be further simplified as
- # * Metadata (First five columns) or more for later datasets
- # * Main data (More no. of features can be considered)
- # * Generally a single name is used to just modify binsize and run whole cells at once.
- # * Dataframes are named with bin sizes to ensure to choose right binsize and dataframe.
- # %% [markdown]
- # ### Main dataframe
- # %%
- # Always use this bin size
- binsize = 18 #default binsize
- # change dataframe and binsize for different data
- df = load_data(df_b18_g_5, binsize)
- # %% [markdown]
- # ### Plotting different x-axis for bin size 18 for flame plots
- # %%
- bins = 18 # binsize
- bins_area = np.logspace(np.log10(0.44), np.log10(4000), num=bins, base=10)
- bins_duration = np.logspace(np.log10(0.6), np.log10(300), num=bins, base=10)
- bins_distance = np.logspace(np.log10(0.5), np.log10(100), num=bins, base=10)
- bins_slope = np.logspace(np.log10(0.001), np.log10(8), num=bins, base=10)
- x_axis_bins = [bins_area,bins_duration,bins_distance,bins_slope]
- y_axis_thresholds = [.5,1,2,5,10,20]
- # %% [markdown]
- # ## NMF (Non-Negative Matrix Factorization)
- # %% [markdown]
- # ### On entire dataset
- # %%
- # Load data
- from matplotlib.backends.backend_pdf import PdfPages
- from datetime import datetime
- def nmf_whole(nmf_Comp=6, plot_contour_flag=True, region="Whole_data"):
- # df = load_data(df_b18_g_5)
- df = load_data(df_b18_g_5, 18)
- features = ["maxArea", "duration", "maxDist", "slopeCa"]
- legend_names = ["Ctrl.", "3 h LPS", "24 h LPS"]
- if region == "HIP":
- dfc = df[df["Data"]["Condition"] <= 3]
- elif region == "PFC":
- dfc = df[df["Data"]["Condition"] > 3]
- elif region == "iPSC":
- dfc = load_data(df_b18_g_5_iPSC, 18)
- print("iPSC data loaded")
- else:
- dfc = df
- X = dfc.iloc[:, 5:] # data (ignore first five columns)
- y = dfc.iloc[:, 0] # labels
- nmfC = nmf_Comp # of NMF components
- nF = 4 # no. of features
- nmf = NMF(n_components=nmfC, init="random", random_state=0, tol=1e-3)
- W = nmf.fit_transform(X)
- H = nmf.components_
- # Normalize H to have a maximum value of 1 and adjust W accordingly
- W = W * H.max(axis=1)
- H = H / H.max(axis=1, keepdims=True)
- # Manually reorganize matrices to fit color sceme
- if region == "HIP":
- if nmf_Comp == 2:
- H = H[[1, 0], :]
- W = W[:, [1, 0]]
- # elif nmf_Comp == 3:
- # H = H[[0, 2, 1], :]
- # W = W[:, [0, 2, 1]]
- elif region == "iPSC":
- # if nmf_Comp == 2:
- # H = H[[1, 0], :]
- # W = W[:, [1, 0]]
- if nmf_Comp == 3:
- H = H[[0, 2, 1], :]
- W = W[:, [0, 2, 1]]
- # print(H[:5, :5])
- # print(H_reorganized[:5, :5])
- H = H.reshape(nmfC, 4, 6, 18)
- vmin = 0
- vmax = 1 # H.max()
- levels = np.linspace(vmin, vmax, 11) # Define levels for contourf
- levelsC = np.linspace(0.2, vmax, 6) # Define levels for contour
- norm = colors.Normalize(vmin=vmin, vmax=vmax)
- # Generate a timestamp
- timestamp = datetime.now().strftime("%Y-%m-%d_%H.%M.%S")
- # Create a PdfPages object with a timestamped file name
- file_name = f'tmp/NMF_{region}_{nmf_Comp}_{timestamp}.pdf'
- file_name_W = f'tmp/NMF_{region}_{nmf_Comp}_{timestamp}_W.csv'
- # Convert W to a DataFrame
- W_df = pd.DataFrame(W)
- # Save the DataFrame to a CSV file
- W_df.to_csv(file_name_W, index=False)
- #print("W matrix saved as:", file_name_W)
- # Set the default font size
- plt.rcParams.update({'font.size': 16}) # Change 16 to your desired font size
- feature_labels = [r"MaxSize [$\mu$m$^2$]",
- "Duration [s]",
- r"Distance [$\mu$m]",
- r"Ca$^{2+}$ change [a.u.]"
- ]
- legend_names = ["Ctrl.", "3 h LPS", "24 h LPS"]
- with PdfPages(file_name) as pdf:
- ## Contours overlayed on top of each other
- cmap = ["Greys", "Greens", "Reds", "Blues", "Purples", "Oranges"]
- res = plt.subplots(1, nF+1, figsize=(18, 4),facecolor='none')
- axes : list[plt.Axes] = res[1] # Initialize axes list
- fig2 = res[0]
- for f in range(nF):
- sax = plt.subplot(1, nF+1, f + 1)
- for nmf_i in range(nmfC):
- contour = plt.contour(x_axis_bins[f], range(0, 6, 1), H[nmf_i, f], levels=levelsC,
- vmin=vmin, vmax=vmax, extend="neither", cmap=cmap[nmf_i],
- alpha=0.7, linewidths=3, norm=norm)
- # fp.cmap.set_over('black')
- # fp.cmap.set_under('white')
- plt.xscale("log") # Set x-axis to logarithmic scale
- plt.yticks(range(0, 6, 1), y_axis_thresholds)
- plt.xlim(x_axis_bins[f].min(), x_axis_bins[f].max()) # Set x-axis limits
- # plt.autoscale(enable=True, axis='x', tight=True)
- # contour.set_clim(vmin, vmax) # Set colorbar limits explicitly
- contour.cmap.set_under("white")
- # plt.title(features[f], pad=20)
- plt.ylabel("Threshold (NMF Comp. %d)" % (nmf_i + 1),fontsize=15)
- plt.xlabel(feature_labels[f],fontsize=15)
- sax.patch.set_alpha(0) # Make the axes background transparent
- plt.tight_layout()
- sax.set_aspect(aspect="auto") # Options: 'equal', 'auto', or a numeric value
- # plt.show()
- # Weight distribution
- cmap=["grey","green","red","blue","purple","orange"]
- clabel = dfc["Data"]["Cond.Label"].unique()
- cond_u = dfc["Data"]["Condition"].unique()
- cond_u_int = list(map(int, cond_u))
- WW = np.zeros((cond_u.shape[0], nmfC))
- list_cond = []
- for i,cond_i in enumerate(cond_u):
- W_i = W[dfc["Data"]["Condition"] == cond_i, :]
- list_cond.append(W_i)
- W_i = np.mean(W_i, axis=0)
- WW[i, :] = W_i
- # list_cond[0][:,0]
- # plt.figure(figsize=(12, 6))
- plt.subplot(1, nF+1, nF + 1)
- for i in range(WW.shape[1]): # Loop over the number of NMF components
- plt.plot(cond_u,WW[:,i],ls="--",marker="s",
- label=f"NMF Comp{i+1}", color=cmap[i % len(cmap)]) # Use colors from cmap
- # plt.legend()
- plt.title("Weight Distribution", pad=20)
- plt.xticks(cond_u,legend_names)
- plt.xlabel("Condition Index")
- plt.ylabel("Weight")
- plt.ylim(bottom=0)
- plt.gca().patch.set_alpha(0) # Make the axes background transparent#
- plt.savefig("tmp/NMF_Weight_Distribution_%d.svg"%nmfC, dpi=300, bbox_inches='tight', transparent=True)
- plt.show()
- #pdf.savefig(fig2, transparent=True) # Save the current figure to the PDF
- # %%
- from datetime import datetime
- def nmf_whole(nmf_Comp=6, plot_contour_flag=True, region="Whole_data",suptext="", suptextcolor=""):
- # Load data
- df = load_data(df_b18_g_5, 18)
- if region == "HIP":
- dfc = df[df["Data"]["Condition"] <= 3]
- elif region == "PFC":
- dfc = df[df["Data"]["Condition"] > 3]
- elif region == "iPSC":
- dfc = load_data(df_b18_g_5_iPSC, 18)
- #print("iPSC data loaded")
- else:
- dfc = df
- # Labels
- feature_labels = [r"MaxSize [$\mu$m$^2$]","Duration [s]",r"Distance [$\mu$m]",r"Ca$^{2+}$ change [a.u.]",]
- legend_names = ["Ctrl.", "3 h LPS", "24 h LPS"]
- # NMF
- X = dfc.iloc[:, 5:]
- nmf = NMF(n_components=nmf_Comp,init="random",random_state=0,tol=1e-3,)
- W = nmf.fit_transform(X)
- H = nmf.components_
- # Normalize
- W = W * H.max(axis=1)
- H = H / H.max(axis=1, keepdims=True)
- # Optional component reordering
- if region == "HIP" and nmf_Comp == 2:
- H = H[[1, 0], :]
- W = W[:, [1, 0]]
- elif region == "iPSC" and nmf_Comp == 3:
- H = H[[0, 2, 1], :]
- W = W[:, [0, 2, 1]]
- # Save W matrix
- timestamp = datetime.now().strftime("%Y-%m-%d_%H.%M.%S")
- pd.DataFrame(W).to_csv(f"tmp/NMF_{region}_{nmf_Comp}_{timestamp}_W.csv",index=False,)
- # Reshape H
- H = H.reshape(nmf_Comp, 4, 6, 18)
- vmin, vmax = 0, 1
- levelsC = np.linspace(0.2, vmax, 6)
- norm = colors.Normalize(vmin=vmin, vmax=vmax)
- # Figure layout
- plt.rcParams.update({"font.size": 14})
- fig, axes = plt.subplots(1,5,figsize=(16, 4),constrained_layout=True,)
- contour_cmaps = ["Greys","Greens","Reds","Blues","Purples","Oranges",]
- # Contour plots (first 4 columns)
- y_axis_thresholds = [0.5, 1, 2, 5, 10, 20]
- for f in range(4):
- ax = axes[f]
- for nmf_i in range(nmf_Comp):
- contour = ax.contour(x_axis_bins[f],range(6),H[nmf_i, f],levels=levelsC,cmap=contour_cmaps[nmf_i],
- alpha=0.7,linewidths=3,norm=norm,)
- contour.cmap.set_under("white")
- ax.set_xscale("log")
- ax.set_xlim(x_axis_bins[f].min(),x_axis_bins[f].max(),)
- ax.set_xlabel(feature_labels[f])
- ax.set_yticks(range(6))
- if f == 0:
- ax.set_yticks(range(6))
- ax.set_yticklabels(y_axis_thresholds)
- ax.tick_params(axis="y", labelleft=True)
- ax.set_ylabel(r"$Ca^{2+}$ threshold")
- # Force x ticks to show on log scale
- ax.tick_params(axis="x", which="both", labelbottom=True)
- ax.set_aspect("auto")
- fig.supylabel(suptext, color=suptextcolor,fontsize=16, fontweight="bold")
- # Weight distribution (last column)
- ax_w = axes[4]
- cmap_weights = ["grey","green","red","blue","purple","orange",]
- cond_u = dfc["Data"]["Condition"].unique()
- WW = np.zeros((len(cond_u), nmf_Comp))
- for i, cond_i in enumerate(cond_u):
- W_i = W[dfc["Data"]["Condition"] == cond_i]
- WW[i] = np.mean(W_i, axis=0)
- for i in range(nmf_Comp):
- ax_w.plot(cond_u,WW[:, i],ls="--",marker="s",color=cmap_weights[i % len(cmap_weights)],label=f"NMF {i + 1}",)
- ax_w.set_xticks(cond_u)
- ax_w.set_xticklabels(legend_names)
- ax_w.set_xlabel("Condition")
- ax_w.set_ylabel("Weight")
- ax_w.set_ylim(bottom=0)
- ax_w.tick_params(axis="x", which="both", labelbottom=True)
- ax_w.tick_params(axis="y", which="both", labelleft=True)
- ax_w.legend(frameon=False)
- # Export
- #plt.savefig(f"tmp/NMF_{region}_{nmf_Comp}.svg",dpi=300,bbox_inches="tight",transparent=True)
- plt.show()
- # %%
- os.makedirs("tmp", exist_ok=True)
- nmf_whole(nmf_Comp=3, plot_contour_flag=True, region="HIP", suptext="HC", suptextcolor="#2F4F8F")
- nmf_whole(nmf_Comp=3, plot_contour_flag=True, region="PFC", suptext="PFC",suptextcolor="#A01B8E")
- nmf_whole(nmf_Comp=3, plot_contour_flag=True, region="iPSC", suptext="PFC",suptextcolor="#18C7A0")
- # %% [markdown]
- # ## PCA, NMF and LDA
- # %%
- from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
- def lda_compare(region="Whole_data"):
- # df = load_data(df_b18_g_5)
- features = ["maxArea", "duration", "maxDist", "slopeCa"]
- legend_names = ["Ctrl.", "3 h LPS", "24 h LPS"]
- if region == "HIP":
- df = load_data(df_b18_g_5, 18)
- dfc = df[df["Data"]["Condition"] <= 3]
- colors_rgb = [(144, 191, 249), (139, 144, 206), (0, 0, 192)] # RGB colors
- elif region == "PFC":
- df = load_data(df_b18_g_5, 18)
- dfc = df[df["Data"]["Condition"] > 3]
- colors_rgb = [(255, 160, 160), (193, 139, 183), (128, 0, 128)] # RGB colors
- elif region == "iPSC":
- dfc = load_data(df_b18_g_5_iPSC, 18)
- print("iPSC data loaded")
- colors_rgb = [(169, 254, 169), (15, 153, 178), (3, 78, 97)] # RGB colors
- else:
- df = load_data(df_b18_g_5, 18)
- dfc = df
- colors_rgb = np.array(colors_rgb) / 255.0 # Normalize RGB values to [0, 1]
- X = dfc.iloc[:, 5:] # data (ignore first five columns)
- y = dfc.iloc[:, 0] # labels
- noC = 2 # no. of components
- lda = LDA(n_components=noC) #,shrinkage='Auto',solver='lsqr',priors=None,store_covariance=False, tol=0.0001
- pca = PCA(n_components=noC,random_state=22)
- #nmf = NMF(n_components=noC)
- nmf = NMF(n_components=noC, init='random', random_state=22)
- Xs = StandardScaler().fit_transform(X)
- Xs = MinMaxScaler().fit_transform(X)
- X_lda = lda.fit_transform(X,y)
- X_pca = pca.fit_transform(X)
- X_nmf = nmf.fit_transform(X)
- # Define RGB colors for each condition
- unique_conditions = np.unique(y)
- color_map = {condition: colors_rgb[i % len(colors_rgb)] for i, condition in enumerate(unique_conditions)}
- condition_colors = [color_map[condition] for condition in y]
- # Generate a timestamp
- timestamp = datetime.now().strftime("%Y-%m-%d_%H.%M.%S")
- # Create a PdfPages object with a timestamped file name
- file_name = f'tmp/LDA_{region}.pdf' #_{timestamp}
- with PdfPages(file_name) as pdf:
- res = plt.subplots(1, 3, figsize=(16, 4), constrained_layout=False)
- axes : list[plt.Axes] = res[1] # Initialize axes list
- fig = res[0]
- print("Default font size:", plt.rcParams['font.size'])
- adjusted_font_size = plt.rcParams['font.size']-2 # Adjust font size for legends
- # PCA scatter plot
- for i, condition in enumerate(unique_conditions):
- mask = y == condition
- axes[0].scatter(X_pca[mask, 0], X_pca[mask, 1], color=color_map[condition], label=legend_names[i])
- axes[0].set_title('PCA')
- axes[0].set_xlabel('PCA 1')
- axes[0].set_ylabel('PCA 2')
- axes[0].set_aspect('equal') # Set equal scaling
- axes[0].legend(fontsize=adjusted_font_size)
- # NMF scatter plot
- for i, condition in enumerate(unique_conditions):
- mask = y == condition
- axes[1].scatter(X_nmf[mask, 0], X_nmf[mask, 1], color=color_map[condition], label=legend_names[i])
- axes[1].set_title('NMF')
- axes[1].set_xlabel('NMF 1')
- axes[1].set_ylabel('NMF 2')
- axes[1].set_aspect('equal') # Set equal scaling
- axes[1].legend(fontsize=adjusted_font_size)
- # LDA scatter plot
- for i, condition in enumerate(unique_conditions):
- mask = y == condition
- axes[2].scatter(X_lda[mask, 0], X_lda[mask, 1], color=color_map[condition], label=legend_names[i])
- axes[2].set_title('LDA')
- axes[2].set_xlabel('LDA 1')
- axes[2].set_ylabel('LDA 2')
- axes[2].set_aspect('equal') # Set equal scaling , adjustable='box'
- axes[2].legend(fontsize=adjusted_font_size)
- # Add legend
- axes[2].legend(loc='best', fontsize='small', framealpha=0.5, borderaxespad=0.2,handletextpad=0.2) #, edgecolor='black'
- #axes[2].legend(loc='center left', bbox_to_anchor=(1.05, 0.5), fontsize='small', framealpha=0.5, borderaxespad=0.2) #, edgecolor='black'
- # Adjust layout for better spacing
- plt.tight_layout()
- plt.show()
- pdf.savefig(fig)
- # %%
- lda_compare('HIP')
- # %%
- lda_compare('PFC')
- # %% [markdown]
- # ## Supplementary Figure 8
- # %%
- # load data
- from matplotlib.backends.backend_pdf import PdfPages
- from datetime import datetime
- from matplotlib.colors import Normalize
- def nmf_whole_modified(nmf_Comp=6, plot_contour_flag=True, region="Whole_data"):
- # df = load_data(df_b18_g_5)
- df = load_data(df_b18_g_5, 18)
- features = ["maxArea", "duration", "maxDist", "slopeCa"]
- legend_names = ["Ctrl.", "3 h LPS", "24 h LPS"]
- if region == "HIP":
- dfc = df[df["Data"]["Condition"] <= 3]
- elif region == "PFC":
- dfc = df[df["Data"]["Condition"] > 3]
- elif region == "iPSC":
- dfc = load_data(df_b18_g_5_iPSC, 18)
- print("iPSC data loaded")
- else:
- dfc = df
- X = dfc.iloc[:, 5:] # data (ignore first five columns)
- y = dfc.iloc[:, 0] # labels
- nmfC = nmf_Comp # of NMF components
- nF = 4 # no. of features
- nmf = NMF(n_components=nmfC, init="random", random_state=0, tol=1e-3)
- W = nmf.fit_transform(X)
- H = nmf.components_
- # Normalize H to have a maximum value of 1 and adjust W accordingly
- W = W * H.max(axis=1)
- H = H / H.max(axis=1, keepdims=True)
- # Manually reorganize matrices to fit color sceme
- if region == "HIP":
- if nmf_Comp == 2:
- H = H[[1, 0], :]
- W = W[:, [1, 0]]
- # elif nmf_Comp == 3:
- # H = H[[0, 2, 1], :]
- # W = W[:, [0, 2, 1]]
- elif region == "iPSC":
- # if nmf_Comp == 2:
- # H = H[[1, 0], :]
- # W = W[:, [1, 0]]
- if nmf_Comp == 3:
- H = H[[0, 2, 1], :]
- W = W[:, [0, 2, 1]]
- # print(H[:5, :5])
- # print(H_reorganized[:5, :5])
- H = H.reshape(nmfC, 4, 6, 18)
- vmin = 0
- vmax = 1 # H.max()
- levels = np.linspace(vmin, vmax, 11) # Define levels for contourf
- levelsC = np.linspace(0.2, vmax, 6) # Define levels for contour
- norm = colors.Normalize(vmin=vmin, vmax=vmax)
- # Generate a timestamp
- timestamp = datetime.now().strftime("%Y-%m-%d_%H.%M.%S")
- # Create a PdfPages object with a timestamped file name
- file_name = f'tmp/NMF_{region}_{nmf_Comp}_{timestamp}.pdf'
- file_name_W = f'tmp/NMF_{region}_{nmf_Comp}_{timestamp}_W.csv'
- # Convert W to a DataFrame
- W_df = pd.DataFrame(W)
- # Save the DataFrame to a CSV file
- #W_df.to_csv(file_name_W, index=False)
- #print("W matrix saved as:", file_name_W)
- # Set the default font size
- plt.rcParams.update({'font.size': 12}) # Change 16 to your desired font size
- plt.rcParams['xtick.labelsize']=12
- plt.rcParams['xtick.bottom'] = True
- plt.rcParams['xtick.labelbottom'] = False
- plt.rcParams['ytick.left'] = True
- plt.rcParams['ytick.labelleft'] = False
- plt.rcParams['ytick.labelsize']=12
- with PdfPages(file_name) as pdf:
- #fig1 = plt.figure(figsize=(18,12))
- res = plt.subplots(nmfC,nF, figsize=(18,nmfC*4),sharex=False, sharey=True)
- axes1 : list[plt.Axes] = res[1] # Initialize axes list
- fig1 = res[0]
- plt.suptitle("# NMF components: %d"%nmfC, y=0.92) # Adjust the y parameter for more space
- #plt.subplots_adjust(top=0.95) # Adjust the top spacing for more gap
- for nmf_i in range(nmfC):
- for f in range(nF):
- plt.subplot(nmfC,nF,nF*nmf_i +f+1)
- if plot_contour_flag:
- contour = plt.contourf(x_axis_bins[f],range(0,6,1),H[nmf_i,f],cmap='jet',levels=levels,
- vmin=vmin,vmax=vmax, extend='neither')
- else:
- contour = plt.imshow(H[nmf_i,f], interpolation='bicubic',aspect='auto',
- origin='lower',cmap='jet',vmin=0)
- contour.set_clim(vmin, vmax) # Set colorbar limits explicitly
- if f==0:
- plt.tick_params(left=True,labelleft=True)
- plt.ylabel(r'$Ca^{2+}$ Threshold')
- if nmf_i == nmfC-1:
- plt.tick_params(bottom=True,labelbottom=True)
- plt.xlabel(features[f])
- #fp.cmap.set_over('black')
- #fp.cmap.set_under('white')
- plt.xscale('log') # Set x-axis to logarithmic scale
- plt.yticks(range(0,6,1),y_axis_thresholds,fontsize=15)
- #plt.xlim(x_axis_bins[f].min(), x_axis_bins[f].max()) # Set x-axis limits
- plt.xticks(fontsize=12)
- plt.yticks(fontsize=12)
- plt.autoscale(enable=True, axis='x', tight=True)
- plt.subplots_adjust(hspace=0.04,wspace=0.04)
- cbar = fig1.colorbar(contour,ax=axes1.ravel().tolist(),shrink=0.5,pad=0.02) # ,fontsize=15
- cbar.mappable.set_clim(vmin, vmax) # Set colorbar limits explicitly
- #fig1.tight_layout()
- plt.gca().patch.set_alpha(0) # Make the axes background transparent#
- pdf.savefig(fig1) # Save the current figure to the PDF
- #plt.savefig("NMF_Components_%d.pdf"%nmfC, dpi=300, bbox_inches='tight')
- plt.savefig('NMF_Components_%d_iPSC.svg'%nmfC,format="svg", dpi=600, bbox_inches='tight',transparent=True)
- plt.show()
- n_nmfc=3
- nmf_whole_modified(n_nmfc,plot_contour_flag=True,region = "HIP")
2026-06-05_LPS_Paper_Figs_GS_AZ_KL.ipynb at commit 1e9979f, under GPL-3.0 · at the source
Overview
- Cellular Neurophysiology, Institute of Neurophysiology, Hannover Medical School, Hannover, Germany
- Institute of Neural Engineering, Graz University of Technology, Graz, Austria
Abstract
Background: Mouse and human astrocytes exhibit substantial species-specific differences in both morphology and function. Their response to inflammatory stimuli, however, remains underexplored despite being crucial for understanding bidirectional astrocyte-neuron signaling dynamics and for translating preclinical findings to human-relevant applications. Induced pluripotent stem cell-based models thus offer a powerful platform to investigate these mechanisms in the context of the human neural connectome.
Methods: We apply two well-established in vitro protocols by exposing cultured astrocytes to lipopolysaccharide (LPS) for either 3 or 24 h to trigger an inflammatory response. We investigated how LPS-induced inflammation affects the endogenous Ca2+ activity in astrocytes derived from the mouse hippocampus (HC) and prefrontal cortex (PFC), as well as human induced pluripotent stem cell (hiPSC)-derived astrocytes. Both, morphological changes and Ca2+ activity were analyzed using the volume fraction (VF) approach and our previously developed multi-threshold event detection (MTED) combined with machine learning-driven non-negative matrix factorization (NMF).
Results: The comprehensive assessment of Ca2+ activity patterns and their relation to cell morphology revealed significant alterations in response to LPS treatment, and further between mouse and human hiPSC-derived astrocytes. While both mouse and human astrocytes show increased Ca2+ event frequency after short-term LPS exposure, after 24 h of LPS treatment Ca2+ activity is severely restricted in PFC astrocytes but substantially increased in human astrocytes.
Conclusions: Our findings highlight the unique properties of human iPSC-derived astrocytes and provide detailed insights into how Ca2+ signaling becomes dysregulated under neuroinflammatory conditions. Understanding the species-specific responses is essential for advancing stem cell-based models of human astrocyte-neuron signaling circuits and for developing targeted therapeutic strategies to alleviate neuroinflammation and Ca2+-related dysregulation in neurological diseases.
Supplementary Information: The online version contains supplementary material available at 10.1186/
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.
kerstinlenk/QuantifyCalciumDynamics
1e9979fdbc30fc6f47736777ae562e15338a2aa6, 7 June 2026Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
3 files
- 2026-06-05_LPS_Paper_Fig
s_GS_AZ_KL.ipynb , Jupyter, 640 lines, 1 match - LICENSE, License, 674 lines
- README.md, Text, 9 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 1 script, each with its path and the digest of its content;
- 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- figshare:31976500, at figshare; found in DataCite
Data availability
The data and MATLAB code developed in this study are available from the corresponding author upon request. The Python code is available on GitHub using the following link: https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 11 authors, 5 keywords, 10 MeSH terms, 1 funder, 57 references.
Cite
This paper
Müller, F. E., Ivanov, F., Studt, A.-C., Nitzsche, I., Bahr, F. S., Krüger, A.-L., Labus, J., Singh, G., Ponimaskin, E. G., Lenk, K., & Zeug, A. (2026). LPS-induced inflammation differentially affects endogenous Ca&
BibTeX
@article{muller2026lps,
author = {Müller, Franziska E and Ivanov, Flavian and Studt, Anne-Catharine and Nitzsche, Ida and Bahr, Frauke S and Krüger, Anna-Lena and Labus, Josephine and Singh, Ghanendra and Ponimaskin, Evgeni G and Lenk, Kerstin and Zeug, Andre},
title = {{LPS-induced inflammation differentially affects endogenous Ca\&
journal = {Molecular medicine (Cambridge, Mass.)},
year = {2026},
month = mar,
volume = {32},
number = {1},
pages = {52},
publisher = {The Feinstein Institute for Medical Research},
issn = {1076-1551},
doi = {10.1186/
url = {https://
pmid = {41787269},
pmcid = {PMC13064076}
}
RIS
TY - JOUR
AU - Müller, Franziska E
AU - Ivanov, Flavian
AU - Studt, Anne-Catharine
AU - Nitzsche, Ida
AU - Bahr, Frauke S
AU - Krüger, Anna-Lena
AU - Labus, Josephine
AU - Singh, Ghanendra
AU - Ponimaskin, Evgeni G
AU - Lenk, Kerstin
AU - Zeug, Andre
TI - LPS-induced inflammation differentially affects endogenous Ca&
T2 - Molecular medicine (Cambridge, Mass.)
J2 - Mol Med
PY - 2026
DA - 2026/
VL - 32
IS - 1
SP - 52
SN - 1076-1551
PB - The Feinstein Institute for Medical Research
DO - 10.1186/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1186/
"type": "article-journal",
"title": "LPS-induced inflammation differentially affects endogenous Ca&
"container-title": "Molecular medicine (Cambridge, Mass.)",
"author": [
{
"family": "Müller",
"given": "Franziska E"
},
{
"family": "Ivanov",
"given": "Flavian"
},
{
"family": "Studt",
"given": "Anne-Catharine"
},
{
"family": "Nitzsche",
"given": "Ida"
},
{
"family": "Bahr",
"given": "Frauke S"
},
{
"family": "Krüger",
"given": "Anna-Lena"
},
{
"family": "Labus",
"given": "Josephine"
},
{
"family": "Singh",
"given": "Ghanendra"
},
{
"family": "Ponimaskin",
"given": "Evgeni G"
},
{
"family": "Lenk",
"given": "Kerstin"
},
{
"family": "Zeug",
"given": "Andre"
}
],
"container-title-short":
"volume": "32",
"issue": "1",
"page": "52",
"DOI": "10.1186/
"PMID": "41787269",
"PMCID": "PMC13064076",
"ISSN": "1076-1551",
"publisher": "The Feinstein Institute for Medical Research",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
5
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1111/jnc.70470 [code]
- Calcium Buffering in Astrocytes and Its Relevance for Experimental Data Interpretation and Computational Modeling.Journal: Journal of neurochemistryIn common: cellular / molecular, 5 references, 2 authors
- [2] doi:10.1186/s12974-026-03837-9
- PTP1B in astrocytes drives pathogen-induced neurodegeneration.Journal: Journal of neuroinflammationIn common: mouse, cellular / molecular, 6 references
- [3] doi:10.1038/s41467-026-73435-z [code]
- Cellular and subcellular heterogeneity of astrocytic Na⁺ homeostasis tuning astrocytes into functionally distinct subgroups in the mouse brain.Journal: Nature communicationsIn common: seaborn, pandas, Matplotlib, 1 other tool, mouse, cellular / molecular, 3 references
- [4] doi:10.3390/ijms27135902
- Functional Expression of Nicotinic Receptors on iPSC-Derived Astrocytes and Signalling Disturbances by a Panel of Neonicotinoid Pesticides and Their Metabolites.Journal: International journal of molecular sciencesIn common: cellular / molecular, 5 references
- [5] doi:10.1167/iovs.67.5.73 [code]
- Identification of a Small-Molecule Modulator of Astrocyte Reactivity for Optic Nerve Protection.Journal: Investigative ophthalmology & visual scienceIn common: scikit-learn, pandas, Matplotlib, 1 other tool, mouse, cellular / molecular, 3 references
- [6] doi:10.1002/alz.71745 [code]
- Regional astrocyte dysregulation and altered glymphatic-related markers in Alzheimer's disease frontal cortex.Journal: Alzheimer's & dementia : the journal of the Alzheimer's AssociationIn common: seaborn, pandas, Matplotlib, 1 other tool, cellular / molecular, 3 references
- [7] doi:10.1111/ejn.70480 [code]
- Astrocyte Proximity Protects Synapses From Human Amyloid-Beta Induced Degeneration in a Mouse Ex Vivo Model of Early Alzheimer's Disease.Journal: The European journal of neuroscienceIn common: seaborn, scikit-learn, pandas, 2 other tools, mouse, cellular / molecular, 2 references
- [8] doi:10.1016/j.celrep.2026.117803
- APOE3 and APOE4 human astrocytes differentially modulate Alzheimer's disease pathology and microglial responses in chimeric mice.Journal: Cell reportsIn common: mouse, cellular / molecular, 4 references
- [9] doi:10.1038/s41514-026-00391-9 [code]
- Region-specific transcriptional signatures of brain aging in the absence of neuropathology at the single-cell level.Journal: npj agingIn common: seaborn, scikit-learn, pandas, 2 other tools, cellular / molecular, 2 references
- [10] doi:10.1038/s41467-026-76837-1 [code]
- Drug screen and machine learning predict neuroprotective agents in a preclinical human model of childhood dementia.Journal: Nature communicationsIn common: seaborn, scikit-learn, pandas, 2 other tools, 2 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 1 script, and 1 match between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:96e9cc8749c36be7…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
