Motor priming is associated with widespread recruitment into neural ensembles and more rapid ensemble transitions.
The 15 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
- [1] § STAR★Methods › Method details › Identification of nerve projections ↔ axonal_projections_pipeline.py, lines 355–400 · score 0.85 · Granger causality, optimal lag, co occurrences, Cross correlation, pipeline, peak
- [2] § STAR★Methods › Quantification and statistical analysis ↔ figure_neuron_factors.py, lines 134–157 · score 0.79 · Holm Sidak, Kruskal Wallis, post hoc, neuron factor, Dunn, animals
- [3] § STAR★Methods › Quantification and statistical analysis ↔ figure_neuron_factors_fractional.py, lines 85–105 · score 0.79 · Holm Sidak, Kruskal Wallis, post hoc, neuron factor, Dunn, animals
- [4] § STAR★Methods › Method details › Analysis of VSD imaging data ↔ Intan_gui.m, lines 2250–2344 · score 0.75 · 5–80 Hz, passband ripple, attenuation, lowpass, stopband, bandpass
- [5] § STAR★Methods › Method details › Transition analysis ↔ figure_neuron_factors.py, lines 478–506 · score 0.72 · JS divergence, Monte Carlo, neuron factors, matrices, transition
- [6] § STAR★Methods › Method details › Tensor component analysis ↔ tca_run_concatenated.py, the whole file · a weak match · score 0.69 · fitting TCA, factor matrices, neuron factor, rank, tensor, components
- [7] § STAR★Methods › Method details › Tensor component analysis ↔ tca_run_egestive_priming.py, the whole file · a weak match · score 0.69 · fitting TCA, factor matrices, neuron factor, rank, tensor, components
- [8] § Results › TCA reveals three distinct neuronal ensembles associated with phases of feeding behavior ↔ plot_identified_neurons.py, lines 1–87 · score 0.69 · B10, B43, B62, B67, neurons contributed, B47
- [9] § Results › Priming leads to more rapid ensemble transitions and increases neuronal contributions to all three ensembles ↔ figure_neuron_factors.py, lines 134–157 · score 0.63 · Post hoc Dunn, Kruskal Wallis, Neuron factor, EP
- [10] § Results › Priming leads to more rapid ensemble transitions and increases neuronal contributions to all three ensembles ↔ figure_neuron_factors_fractional.py, lines 85–105 · score 0.63 · Post hoc Dunn, Kruskal Wallis, Neuron factor, EP
- [11] § Results › TCA reveals three distinct neuronal ensembles associated with phases of feeding behavior ↔ plot_rasters_identified.ipynb, lines 12–84 · score 0.61 · B10, B43, B62, B67, B47, B44
- [12] § STAR★Methods › Method details › Analysis of extracellular nerve activity ↔ Intan_gui.m, lines 2250–2344 · score 0.59 · passband ripple, attenuation, stopband, notch, Intan, filtered
- [13] § STAR★Methods › Method details › Analysis of VSD imaging data ↔ fVSD/detect_spikes_vsd.m, lines 1–27 · score 0.54 · standard deviation, cell, amplitude, VSD, traces, peak
- [14] § STAR★Methods › Method details › Analysis of extracellular nerve activity ↔ read_Intan_RHS2000_file.m, lines 1–51 · score 0.53 · notch filter, amplified, Stimulus, Intan, Stimulation, MATLAB
- [15] § STAR★Methods › Method details › Concatenated analysis ↔ helper_functions_image.py, lines 190–274 · score 0.50 · vertically flipped, linear, rotated, maps, Neuron
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
Python · 615 lines · 24 KB · no license · 3 matches
- from cv2 import exp
- from matplotlib.pylab import nan
- import numpy as np
- import matplotlib.pyplot as plt
- import pandas as pd
- from matplotlib_venn import venn3
- from collections import defaultdict
- import pingouin as pg
- import networkx as nx
- import matplotlib.colors as mcolors
- import matplotlib as mpl
- from scipy.io import savemat
- import seaborn as sns
- import matplotlib.patches as patches
- from scipy.spatial.distance import jensenshannon
- from scipy.stats import kruskal
- import scikit_posthocs as sp
- pd.set_option("display.max_rows", None)
- pd.set_option("display.max_columns", None)
- pd.set_option("display.width", None)
- pd.set_option("display.max_colwidth", None)
- num_components = 3
- joint = False # joint or conditional probability?
- pre_path = f"figures_pre_test_{num_components}/neuron_contributions"
- ep_path = f"figures_egestive_priming_{num_components}/neuron_contributions"
- post_path = f"figures_post_test_{num_components}/neuron_contributions"
- pre_path_pkl = f"figures_pre_test_{num_components}/pkl_files"
- ep_path_pkl = f"figures_egestive_priming_{num_components}/pkl_files"
- post_path_pkl = f"figures_post_test_{num_components}/pkl_files"
- df_mapping = pd.read_csv("data_folder/identified_neurons.csv", header=None)
- df_mapping.columns = ["experiment", "vsd_mapping", "neuron_name"]
- contribution_array = []
- for animal in range(1, 13):
- if animal in [5, 6, 9]:
- continue
- exp_pre = pd.read_csv(f'{pre_path}/animal_{animal}_contributions.csv')
- exp_ep = pd.read_csv(f'{ep_path}/animal_{animal}_contributions.csv')
- exp_post = pd.read_csv(f'{post_path}/animal_{animal}_contributions.csv')
- pre_vals = exp_pre.drop(columns=['Neuron']).values.flatten()
- ep_vals = exp_ep.drop(columns=['Neuron']).values.flatten()
- post_vals = exp_post.drop(columns=['Neuron']).values.flatten()
- contribution_array.extend(pre_vals)
- contribution_array.extend(ep_vals)
- contribution_array.extend(post_vals)
- contribution_array = np.array(contribution_array)
- thr = np.percentile(contribution_array, 75)
- print("Threshold:", thr)
- print('\n')
- if num_components == 2:
- required_cols = ['Neuron', 'Group_1', 'Group_2']
- elif num_components == 3:
- required_cols = ['Neuron', 'Group_1', 'Group_2', 'Group_3']
- elif num_components == 4:
- required_cols = ['Neuron', 'Group_1', 'Group_2', 'Group_3', 'Group_4']
- elif num_components == 5:
- required_cols = ['Neuron', 'Group_1', 'Group_2', 'Group_3', 'Group_4', 'Group_5']
- # Figure 1: Change in neuron contribution across conditions, per group
- print('\n Change in neuron contribution across conditions')
- all_group_dfs = {}
- for animal in range(1, 13):
- if animal in [5, 6, 9]:
- continue
- exp_pre = pd.read_csv(f'{pre_path}/animal_{animal}_contributions.csv')
- exp_ep = pd.read_csv(f'{ep_path}/animal_{animal}_contributions.csv')
- exp_post = pd.read_csv(f'{post_path}/animal_{animal}_contributions.csv')
- assert(set(exp_pre['Neuron']) == set(exp_ep['Neuron']) == set(exp_post['Neuron'])), f"Neuron mismatch in animal {animal}"
- group_cols = [col for col in exp_pre.columns if col != 'Neuron' and col in exp_ep.columns and col in exp_post.columns]
- print(f"\n Animal {animal}, group_cols: {group_cols}")
- all_neurons = set(exp_pre['Neuron'])
- print(f" Total neurons: {len(all_neurons)}")
- for group in group_cols: # for each group that exists in all three conditions
- rows = []
- for neuron in all_neurons: # for each neuron
- pre_val = exp_pre.loc[exp_pre['Neuron'] == neuron, group].values[0]
- ep_val = exp_ep.loc[exp_ep['Neuron'] == neuron, group].values[0]
- post_val = exp_post.loc[exp_post['Neuron'] == neuron, group].values[0]
- values = [pre_val, ep_val, post_val]
- if pre_val == 0 and ep_val == 0 and post_val == 0: # alternatiely, filter using threshold thr
- continue
- # print(f"{group}, Neuron {neuron}, Pre: {pre_val:.2f}, EP: {ep_val:.2f}, Post: {post_val:.2f}")
- rows.append({
- 'Neuron': f"{neuron}_{animal}", # make neuron unique per animal
- 'Pre': pre_val,
- 'EP': ep_val,
- 'Post': post_val
- })
- df_group = pd.DataFrame(rows, columns=['Neuron', 'Pre', 'EP', 'Post'])
- if group not in all_group_dfs:
- all_group_dfs[group] = {}
- all_group_dfs[group][animal] = df_group
- # print(all_group_dfs['Group_1'][1])
- # Statistics: repeated measures ANOVA
- conditions = ['Pre', 'EP', 'Post']
- for group, animals in all_group_dfs.items():
- df_all = pd.concat(animals.values(), ignore_index=True)
- df_melt = pd.melt(df_all.reset_index(), id_vars=['Neuron'], value_vars=conditions, var_name='Stage', value_name='Contribution')
- n_neurons = df_melt['Neuron'].nunique()
- anova_results = pg.rm_anova(data=df_melt, dv='Contribution', within='Stage', subject='Neuron', detailed=True)
- print(f"\nGroup: {group}")
- print(f"n = {n_neurons} neurons")
- print(anova_results)
- if anova_results['p-unc'].iloc[0] < 0.05:
- posthoc = pg.pairwise_tests(data=df_melt, dv='Contribution', within='Stage', subject='Neuron', padjust='holm') # parametric = True by default
- print("\nPost-hoc pairwise comparisons:")
- print(posthoc)
- # Statistics: Kruskal-Wallis test (non-parametric)
- conditions = ['Pre', 'EP', 'Post']
- for group, animals in all_group_dfs.items():
- df_all = pd.concat(animals.values(), ignore_index=True)
- df_melt = pd.melt(df_all.reset_index(), id_vars=['Neuron'], value_vars=conditions, var_name='Stage', value_name='Contribution')
- n_neurons = df_melt['Neuron'].nunique()
- n_animals = len(animals)
- print(f"n = {n_neurons} neurons across {n_animals} experiments")
- print(f"\nGroup: {group}")
- print(f"n = {n_neurons} neurons")
- pre_vals = df_all['Pre'].values
- ep_vals = df_all['EP'].values
- post_vals = df_all['Post'].values
- stat, p_val = kruskal(pre_vals, ep_vals, post_vals)
- print(f"Kruskal-Wallis: H = {stat:.4f}, p = {p_val:.6f}")
- if p_val < 0.05:
- posthoc = sp.posthoc_dunn(df_melt, val_col='Contribution', group_col='Stage', p_adjust='holm-sidak')
- print("\nPost-hoc Dunn's test:")
- print(posthoc)
- # Sanity check means
- """
- # part 1 (post filtering)
- for group, animals in all_group_dfs.items():
- df_all = pd.concat(animals.values(), ignore_index=True)
- print(f"{group}: Pre={df_all['Pre'].mean():.4f}, EP={df_all['EP'].mean():.4f}, Post={df_all['Post'].mean():.4f}")
- # part 2 (original)
- group_vals = defaultdict(lambda: {'Pre': [], 'EP': [], 'Post': []})
- for animal in range(1, 13):
- if animal in [5, 6, 9]:
- continue
- exp_pre = pd.read_csv(f'{pre_path}/animal_{animal}_contributions.csv')
- exp_ep = pd.read_csv(f'{ep_path}/animal_{animal}_contributions.csv')
- exp_post = pd.read_csv(f'{post_path}/animal_{animal}_contributions.csv')
- group_cols = [col for col in exp_pre.columns if col != 'Neuron' and col in exp_ep.columns and col in exp_post.columns]
- for g in group_cols:
- group_vals[g]['Pre'].extend(exp_pre[g].values)
- group_vals[g]['EP'].extend(exp_ep[g].values)
- group_vals[g]['Post'].extend(exp_post[g].values)
- for g, vals in group_vals.items():
- print(f"{g}: Pre={np.mean(vals['Pre']):.4f}, EP={np.mean(vals['EP']):.4f}, Post={np.mean(vals['Post']):.4f}")
- """
- # Plotting
- fig, axes = plt.subplots(1, num_components, figsize=(15, 5), sharey=False)
- for ax, (group, animals) in zip(axes, all_group_dfs.items()):
- df_all = pd.concat(animals.values(), ignore_index=True)
- df_melt = df_all.melt(id_vars='Neuron', value_vars=conditions, var_name='Stage', value_name='Contribution')
- df_melt['Stage'] = pd.Categorical(df_melt['Stage'], categories=conditions, ordered=True)
- sns.boxplot(data=df_melt, x='Stage', y='Contribution', ax=ax, showfliers=False, color='lightgray', width=0.5, showmeans=True, meanprops=dict(marker='D', markerfacecolor='red', markeredgecolor='red', markersize=5))
- ax.set_title(group)
- ax.set_xlabel('')
- ax.set_ylabel('Contribution')
- ax.spines['top'].set_visible(False)
- ax.spines['right'].set_visible(False)
- if group == 'Group_1':
- ax.set_ylim(0, 1)
- ax.set_yticks([0, 0.5, 1])
- if group == 'Group_2':
- ax.set_ylim(0, 4)
- ax.set_yticks([0, 2, 4])
- if group == 'Group_3':
- ax.set_ylim(0, 1.5)
- ax.set_yticks([0, 0.75, 1.5])
- fig.tight_layout()
- plt.savefig('figures_paper/neuronal_delta.pdf', dpi=300, bbox_inches='tight')
- plt.show()
- # Figure 2: Transition probabilities of neurons between groups across conditions
- transition_pre_ep = defaultdict(int)
- transition_ep_post = defaultdict(int)
- from_counts_pre = defaultdict(int)
- from_counts_ep = defaultdict(int)
- to_counts_ep = defaultdict(int)
- to_counts_post = defaultdict(int)
- total_neurons = 0
- for animal in range(1, 13):
- if animal in [5, 6, 9]:
- continue
- exp_pre = pd.read_csv(f'{pre_path}/animal_{animal}_contributions.csv')
- exp_ep = pd.read_csv(f'{ep_path}/animal_{animal}_contributions.csv')
- exp_post = pd.read_csv(f'{post_path}/animal_{animal}_contributions.csv')
- all_neurons = set(exp_pre['Neuron']) # same neurons across all three conditions
- pre_cols = [c for c in exp_pre.columns if c != 'Neuron']
- ep_cols = [c for c in exp_ep.columns if c != 'Neuron']
- post_cols = [c for c in exp_post.columns if c != 'Neuron']
- # group_cols = [col for col in exp_pre.columns if col != 'Neuron' and col in exp_ep.columns and col in exp_post.columns]
- for neuron in all_neurons:
- total_neurons += 1
- pre_val = exp_pre.loc[exp_pre['Neuron'] == neuron, pre_cols].values[0]
- if np.nanmax(pre_val) < thr:
- g_pre = 'Group_0'
- else:
- g_pre = pre_cols[np.nanargmax(pre_val)]
- ep_val = exp_ep.loc[exp_ep['Neuron'] == neuron, ep_cols].values[0]
- if np.nanmax(ep_val) < thr:
- g_ep = 'Group_0'
- else:
- g_ep = ep_cols[np.nanargmax(ep_val)]
- post_val = exp_post.loc[exp_post['Neuron'] == neuron, post_cols].values[0]
- if np.nanmax(post_val) < thr:
- g_post = 'Group_0'
- else:
- g_post = post_cols[np.nanargmax(post_val)]
- # Count FROM occurrences
- from_counts_pre[g_pre] += 1
- from_counts_ep[g_ep] += 1
- transition_pre_ep[(g_pre, g_ep)] += 1 # Pre → EP (only one edge per neuron)
- transition_ep_post[(g_ep, g_post)] += 1 # EP → Post (only one edge per neuron)
- to_counts_ep[g_ep] += 1
- to_counts_post[g_post] += 1
- print(total_neurons)
- # Build probability DataFrames
- pre_ep_df = pd.DataFrame([(k[0], k[1], v / from_counts_pre[k[0]]) for k, v in transition_pre_ep.items()], columns=["From", "To", "Prob"])
- ep_post_df = pd.DataFrame([(k[0], k[1], v / from_counts_ep[k[0]]) for k, v in transition_ep_post.items()], columns=["From", "To", "Prob"])
- # joint probability distribution
- total_pre = sum(transition_pre_ep.values())
- pre_ep_joint_df = pd.DataFrame([(k[0], k[1], v / total_pre) for k, v in transition_pre_ep.items()], columns=["From", "To", "Prob"])
- total_ep = sum(transition_ep_post.values())
- ep_post_joint_df = pd.DataFrame([(k[0], k[1], v / total_ep) for k, v in transition_ep_post.items()], columns=["From", "To", "Prob"])
- if joint == True:
- pre_ep_df = pre_ep_joint_df
- ep_post_df = ep_post_joint_df
- print("\nPre → EP transition probabilities:")
- print(pre_ep_df.sort_values("Prob", ascending=False))
- print("\nEP → Post transition probabilities:")
- print(ep_post_df.sort_values("Prob", ascending=False))
- # Build figure
- if num_components == 2:
- groups = ["Group_0", "Group_1", "Group_2"]
- elif num_components == 3:
- groups = ["Group_0", "Group_1", "Group_2", "Group_3"]
- elif num_components == 4:
- groups = ["Group_0", "Group_1", "Group_2", "Group_3", "Group_4"]
- elif num_components == 5:
- groups = ["Group_0", "Group_1", "Group_2", "Group_3", "Group_4", "Group_5"]
- G = nx.DiGraph()
- for stage in conditions:
- for g in groups:
- G.add_node(f"{stage}_{g}", stage=stage, group=g)
- for _, row in pre_ep_df.iterrows():
- G.add_edge(f"Pre_{row['From']}", f"EP_{row['To']}", weight=row["Prob"])
- for _, row in ep_post_df.iterrows():
- G.add_edge(f"EP_{row['From']}", f"Post_{row['To']}", weight=row["Prob"])
- pos = {}
- for j, stage in enumerate(conditions): # x-axis: stage
- for i, g in enumerate(groups): # y-axis: group
- pos[f"{stage}_{g}"] = (j, -i) # flip y for nicer layout
- node_colors = ['#FFC0C0'] * len(G.nodes())
- # node_labels = {node: ("Not\nRecruited" if data.get("group") == "Group_0" else data.get("group", node)) for node, data in G.nodes(data=True)}
- fig, ax = plt.subplots(figsize=(10, 8))
- """# compute node sizes
- scale_factor = 20
- node_sizes = {}
- if joint:
- for g in groups:
- # to_counts_ep = from_counts_ep
- node_sizes[f"Pre_{g}"] = from_counts_pre[g] * scale_factor
- node_sizes[f"EP_{g}"] = from_counts_ep[g] * scale_factor
- node_sizes[f"Post_{g}"] = to_counts_post[g] * scale_factor
- else:
- for n in G.nodes():
- node_sizes[n] = 2200
- """
- # compute node sizes
- scale_factor = 20
- node_sizes = {}
- node_counts = {}
- if joint:
- for g in groups:
- node_counts[f"Pre_{g}"] = from_counts_pre[g]
- node_counts[f"EP_{g}"] = from_counts_ep[g]
- node_counts[f"Post_{g}"] = to_counts_post[g]
- node_sizes[f"Pre_{g}"] = from_counts_pre[g] * scale_factor
- node_sizes[f"EP_{g}"] = from_counts_ep[g] * scale_factor
- node_sizes[f"Post_{g}"] = to_counts_post[g] * scale_factor
- else:
- for n in G.nodes():
- node_sizes[n] = 2200
- node_labels = {
- node: (
- ("Not\nRecruited" if data.get("group") == "Group_0" else data.get("group", node))
- + (f"\nn={node_counts[node]}" if node in node_counts else "")
- )
- for node, data in G.nodes(data=True)
- }
- group0_nodes = [n for n, d in G.nodes(data=True) if d.get("group") == "Group_0"] # Non-Group_0 nodes (filled pink)
- other_nodes = [n for n, d in G.nodes(data=True) if d.get("group") != "Group_0"]
- nx.draw_networkx_nodes(G, pos, nodelist=other_nodes, node_size=[node_sizes[n] for n in other_nodes], node_color="#FFC0C0", edgecolors="#FFC0C0", ax=ax)
- nx.draw_networkx_nodes(G, pos, nodelist=group0_nodes, node_size=[node_sizes[n] for n in group0_nodes], node_color="white", edgecolors="#FFC0C0", linewidths=2.5, ax=ax)
- nx.draw_networkx_labels(G, pos, labels=node_labels, font_size=10, font_weight="bold")
- edges = G.edges()
- # scale weight and color based on prob
- if not joint:
- norm = mcolors.Normalize(vmin=0, vmax=1)
- if joint:
- norm = mcolors.Normalize(vmin=0, vmax=0.3)
- cmap = mpl.colormaps["Reds"]
- edges = list(G.edges(data=True)) # get edges with data
- edges_sorted = sorted(edges, key=lambda x: x[2]['weight']) # sort edges from lightest to heaviest
- edge_list = [(u, v) for u, v, d in edges_sorted] # extract edge list, widths, and colors in sorted order
- scale = 50 if joint else 10
- weights = [d['weight'] * scale for u, v, d in edges_sorted] # 10 for conditional
- colors = [cmap(norm(d['weight'])) for u, v, d in edges_sorted]
- nx.draw_networkx_edges(G, pos, edgelist=edge_list, width=weights, edge_color=colors, arrows=False, ax=ax)
- # colorbar
- sm = mpl.cm.ScalarMappable(cmap=cmap, norm=norm)
- sm.set_array([])
- cbar = fig.colorbar(sm, ax=ax, fraction=0.03, pad=0.04)
- cbar.set_label("Transition Probability", fontsize=12)
- if not joint:
- cbar.set_ticks([0, 0.25, 0.5, 0.75, 1])
- cbar.set_ticklabels([0, 0.25, 0.5, 0.75, 1])
- if joint:
- cbar.set_ticks([0, 0.15, 0.3])
- cbar.set_ticklabels([0, 0.15, 0.3])
- ax.margins(0.2)
- ax.set_title("Neuron Transition Probabilities", fontsize=14, weight="bold")
- ax.axis("off")
- if joint:
- plt.savefig('figures_paper/neuronal_transitions_joint.pdf', dpi=300, bbox_inches='tight')
- else:
- plt.savefig('figures_paper/neuronal_transitions_conditional.pdf', dpi=300, bbox_inches='tight')
- plt.show()
- # Figure 3: Transitions of identified neurons
- total_neurons = 0
- records = []
- for animal in range(1, 13):
- if animal in [5, 6, 9]:
- continue
- exp_pre = pd.read_csv(f'{pre_path}/animal_{animal}_contributions.csv')
- exp_ep = pd.read_csv(f'{ep_path}/animal_{animal}_contributions.csv')
- exp_post = pd.read_csv(f'{post_path}/animal_{animal}_contributions.csv')
- df_mapping_exp = df_mapping[df_mapping['experiment'] == animal]
- pre_cols = [c for c in exp_pre.columns if c != 'Neuron']
- ep_cols = [c for c in exp_ep.columns if c != 'Neuron']
- post_cols = [c for c in exp_post.columns if c != 'Neuron']
- all_neurons = set(exp_pre['Neuron']) # same neurons across all three conditions
- for neuron in all_neurons:
- if neuron not in df_mapping_exp['vsd_mapping'].values:
- continue
- neuron_name = df_mapping_exp.loc[df_mapping_exp['vsd_mapping'] == neuron, 'neuron_name'].values[0]
- total_neurons += 1
- pre_val = exp_pre.loc[exp_pre['Neuron'] == neuron, pre_cols].values[0]
- if np.nanmax(pre_val) < thr:
- g_pre = "Group_0"
- else:
- g_pre = pre_cols[np.nanargmax(pre_val)]
- ep_val = exp_ep.loc[exp_ep['Neuron'] == neuron, ep_cols].values[0]
- if np.nanmax(ep_val) < thr:
- g_ep = "Group_0"
- else:
- g_ep = ep_cols[np.nanargmax(ep_val)]
- post_val = exp_post.loc[exp_post['Neuron'] == neuron, post_cols].values[0]
- if np.nanmax(post_val) < thr:
- g_post = "Group_0"
- else:
- g_post = post_cols[np.nanargmax(post_val)]
- first_transition = f"{g_pre}-{g_ep}"
- second_transition = f"{g_ep}-{g_post}"
- records.append({"animal": animal, "neuron_name": neuron_name, "neuron": neuron, "Pre": g_pre, "EP": g_ep, "Post": g_post, "first_transition": first_transition, "second_transition": second_transition})
- df_transitions = pd.DataFrame(records)
- print("Total neurons:", total_neurons)
- print(df_transitions.head())
- # group by first transition
- first_transition_counts = (df_transitions.groupby(["neuron_name", "first_transition"]).size().reset_index(name="count"))
- print('\n First transition')
- print(first_transition_counts)
- # group by second transition
- second_transition_counts = (df_transitions.groupby(["neuron_name", "second_transition"]).size().reset_index(name="count"))
- print('\n Second transition')
- print(second_transition_counts)
- def to_matrix(df, groups):
- mat = pd.DataFrame(0, index=groups, columns=groups, dtype=float)
- for _, row in df.iterrows():
- mat.loc[row['From'], row['To']] = row['Prob']
- return mat
- def neuron_p_value(pop_df, neuron_df, total_transitions, n_sim=10000):
- np.random.seed(111) # for reproducibility
- groups = sorted(set(pop_df['From']).union(pop_df['To']).union(neuron_df['From']).union(neuron_df['To']))
- pop_mat = to_matrix(pop_df, groups).values.flatten()
- neuron_mat = to_matrix(neuron_df, groups).values.flatten()
- n_obs = total_transitions
- # print(n_obs)
- # print(f"pop_mat sum: {pop_mat.sum():.6f}")
- # print(f"neuron_mat sum: {neuron_mat.sum():.6f}")
- # print(f"neuron_df Prob sum: {neuron_df['Prob'].sum():.6f}")
- # print(f"Expected neuron_dist sum should be: {neuron_df['Prob'].sum():.6f}")
- # print("-" * 40)
- assert np.isclose(pop_mat.sum(), 1.0), f"pop_mat sums to {pop_mat.sum()}"
- obs_js = jensenshannon(neuron_mat, pop_mat) # Test statistic: JS divergence
- # print(neuron_mat)
- # print(pop_mat)
- # Monte Carlo null distribution
- sim_js = []
- for _ in range(n_sim):
- sample = np.random.multinomial(n_obs, pop_mat)
- sample_dist = sample / n_obs
- sim_js.append(jensenshannon(sample_dist, pop_mat))
- p_val = np.mean(np.array(sim_js) >= obs_js)
- return obs_js, p_val
- def plot_neuron_transition_graph(df_transitions, neuron, num_components, ax=None):
- df_neuron = df_transitions[df_transitions["neuron_name"] == neuron]
- print("\n", neuron)
- # Count transitions
- transition_pre_ep = {}
- transition_ep_post = {}
- for _, row in df_neuron.iterrows():
- if pd.notna(row["first_transition"]):
- src, dst = row["first_transition"].split("-")
- transition_pre_ep[(src, dst)] = transition_pre_ep.get((src, dst), 0) + 1
- if pd.notna(row["second_transition"]):
- src, dst = row["second_transition"].split("-")
- transition_ep_post[(src, dst)] = transition_ep_post.get((src, dst), 0) + 1
- total_pre_ep = sum(transition_pre_ep.values())
- total_ep_post = sum(transition_ep_post.values())
- # Probabilities
- pre_ep_df_neuron = pd.DataFrame([(k[0], k[1], v / total_pre_ep) for k, v in transition_pre_ep.items()], columns=["From", "To", "Prob"])
- ep_post_df_neuron = pd.DataFrame([(k[0], k[1], v / total_ep_post) for k, v in transition_ep_post.items()], columns=["From", "To", "Prob"])
- num_comparison = 28 # 14 neurons, 2 transitions
- obs_js, p_val = neuron_p_value(pre_ep_joint_df, pre_ep_df_neuron, total_pre_ep)
- p_val_adj = min(p_val*num_comparison, 1.0)
- print(f"Pre -> EP, Observed JS: {obs_js}, p-value: {p_val_adj}")
- obs_js, p_val = neuron_p_value(ep_post_joint_df, ep_post_df_neuron, total_ep_post)
- p_val_adj = min(p_val*num_comparison, 1.0)
- print(f"EP -> Post, Observed JS: {obs_js}, p-value: {p_val_adj}")
- # Define groups/stages
- groups = [f"Group_{i}" for i in range(0, num_components+1)]
- stages = ["Pre", "EP", "Post"]
- # Build graph
- G = nx.DiGraph()
- for stage in stages:
- for g in groups:
- G.add_node(f"{stage}_{g}", stage=stage, group=g)
- for _, row in pre_ep_df_neuron.iterrows():
- G.add_edge(f"Pre_{row['From']}", f"EP_{row['To']}", weight=row["Prob"])
- for _, row in ep_post_df_neuron.iterrows():
- G.add_edge(f"EP_{row['From']}", f"Post_{row['To']}", weight=row["Prob"])
- # Fixed layout
- pos = {}
- for j, stage in enumerate(stages): # x-axis
- for i, g in enumerate(groups): # y-axis
- pos[f"{stage}_{g}"] = (j * 0.25, -i * 0.25)
- # Determine node colors based on connectivity
- node_colors = []
- for node in G.nodes():
- if G.in_edges(node) or G.out_edges(node):
- node_colors.append("#FFC0C0")
- else:
- node_colors.append("#A9A9A9")
- node_labels = {node: ("Not\nRecruited" if data.get("group") == "Group_0" else data.get("group", node)) for node, data in G.nodes(data=True)}
- if ax is None:
- fig, ax = plt.subplots(figsize=(6, 4))
- # nx.draw_networkx_nodes(G, pos, node_size=1500, node_color=node_colors, ax=ax)
- other_nodes = [n for n, d in G.nodes(data=True) if d.get("group") != "Group_0"]
- nx.draw_networkx_nodes(G, pos, nodelist=other_nodes, node_size=1000, node_color=[node_colors[list(G.nodes()).index(n)] for n in other_nodes], ax=ax)
- group0_nodes = [n for n, d in G.nodes(data=True) if d.get("group") == "Group_0"]
- nx.draw_networkx_nodes(G, pos, nodelist=group0_nodes, node_size=1000, node_color="white", edgecolors=[node_colors[list(G.nodes()).index(n)] for n in group0_nodes], linewidths=2.5, ax=ax)
- nx.draw_networkx_labels(G, pos, labels=node_labels, font_size=6, font_weight="bold", ax=ax)
- # Edge weights/colors
- norm = mcolors.Normalize(vmin=0, vmax=1)
- cmap = mpl.colormaps["Reds"]
- edges_sorted = sorted(G.edges(data=True), key=lambda x: x[2]['weight'])
- edge_list = [(u, v) for u, v, d in edges_sorted]
- weights = [d['weight'] * 5 for u, v, d in edges_sorted]
- colors = [cmap(norm(d['weight'])) for u, v, d in edges_sorted]
- nx.draw_networkx_edges(G, pos, edgelist=edge_list, width=weights, edge_color=colors, arrows=False, ax=ax)
- ax.set_title(f"Neuron {neuron}", fontsize=10, weight="bold")
- ax.axis("off")
- ax.set_xlim(-0.1, 0.7)
- ax.set_ylim(-1.2, 0.1)
- ax.set_aspect("equal")
- ax.margins(0)
- ax.autoscale(False)
- return ax
- unique_neurons = df_transitions["neuron_name"].unique()
- nrows = (len(unique_neurons) + 2) // 3
- fig, axes = plt.subplots(nrows=nrows, ncols=3, figsize=(8, 5*nrows))
- axes = axes.flatten()
- for ax, neuron in zip(axes, unique_neurons):
- ax = plot_neuron_transition_graph(df_transitions, neuron, num_components, ax=ax)
- for ax in axes[len(unique_neurons):]:
- ax.axis("off")
- plt.tight_layout()
- plt.savefig('figures_paper/neuronal_transitions_identified.pdf', dpi=300, bbox_inches='tight')
- plt.show()
figure_neuron_factors.py at commit 7086df8, no license · at the source
Overview
- Department of Neurobiology and Anatomy, W. M. Keck Center for the Neurobiology of Learning and Memory, McGovern Medical School at The University of Texas Health Science Center at Houston, Houston, TX 77030, USA
- The University of Texas MD Anderson UTHealth Houston Graduate School of Biomedical Sciences, Houston, TX 77030, USA
- Department of Neuroscience and Friedman Brain Institute, Mount Sinai School of Medicine, New York, NY 10029, USA
Abstract
Repetition priming is a ubiquitous form of implicit learning in which repetition leads to increased performance. We investigated egestive priming of feeding behavior in Aplysia californica using an isolated cerebral and buccal ganglia preparation and recorded the activities of numerous neurons by using voltage-sensitive dye (VSD) imaging. The high-dimensional VSD data were subjected to tensor component analysis, which characterized three neuronal ensembles with distinct spatial and temporal domains. The activities of these ensembles corresponded to three motor phases: radula protraction, early retraction, and late retraction. Priming resulted in repetition enhancement characterized by increased neural activity during early retraction (i.e., gain modulation), as well as a more rapid transition into the late retraction ensemble. In addition, priming recruited previously inactive neurons into the protraction and early retraction ensembles. These results indicate that priming-induced neural plasticity is multifaceted, operating across multiple axes of plasticity, and each axis modifies specific subsets of ensembles.
Reproduced under the paper's license (CC BY-NC), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 15 matches between paragraphs and lines of code.
Zenodo 21875573
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
29 files
- axonal_projections_pipel
ine.py , Python, 559 lines - figure_behavior.py, Python, 244 lines
- figure_multifunctionalit
y.py , Python, 374 lines - figure_neuron_factors.py
, Python, 615 lines - figure_neuron_factors_fr
actional.py , Python, 207 lines - figure_temporal_factors.
py , Python, 869 lines - helper_functions_concate
nated.py , Python, 450 lines - helper_functions_egestiv
e_priming.py , Python, 388 lines - helper_functions_image.p
y , Python, 439 lines - helper_functions_post_te
st.py , Python, 414 lines - helper_functions_pre_tes
t.py , Python, 408 lines - image_alignment.py, Python, 219 lines
- plot_factors.py, Python, 156 lines
- plot_identified_neurons.
py , Python, 246 lines - plot_rasters.ipynb, Jupyter, 372 lines
- plot_rasters_identified.
ipynb , Jupyter, 250 lines - process_data.m, MATLAB, 220 lines
- process_data_visualizati
on.m , MATLAB, 262 lines - tca_analysis_concatenate
d.py , Python, 193 lines - tca_analysis_egestive_pr
iming.py , Python, 258 lines - tca_analysis_post_test.p
y , Python, 191 lines - tca_analysis_pre_test.py
, Python, 191 lines - tca_performance.py, Python, 145 lines
- tca_performance_analysis
.py , Python, 97 lines - tca_run_concatenated.py, Python, 74 lines
- tca_run_egestive_priming
.py , Python, 75 lines - tca_run_post_test.py, Python, 75 lines
- tca_run_pre_test.py, Python, 75 lines
- README.md, Text, 147 lines
Byrne-Lab/tca_egestive_priming_2025
7086df89cf190032630f282d4ab9d9d36b5c46eb, 4 August 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
29 files
- axonal_projections_pipel
ine.py , Python, 559 lines, 1 match - figure_behavior.py, Python, 244 lines
- figure_multifunctionalit
y.py , Python, 374 lines - figure_neuron_factors.py
, Python, 615 lines, 3 matches - figure_neuron_factors_fr
actional.py , Python, 207 lines, 2 matches - figure_temporal_factors.
py , Python, 869 lines - helper_functions_concate
nated.py , Python, 450 lines - helper_functions_egestiv
e_priming.py , Python, 388 lines - helper_functions_image.p
y , Python, 439 lines, 1 match - helper_functions_post_te
st.py , Python, 414 lines - helper_functions_pre_tes
t.py , Python, 408 lines - image_alignment.py, Python, 219 lines
- plot_factors.py, Python, 156 lines
- plot_identified_neurons.
py , Python, 246 lines, 1 match - plot_rasters.ipynb, Jupyter, 372 lines
- plot_rasters_identified.
ipynb , Jupyter, 250 lines, 1 match - process_data.m, MATLAB, 220 lines
- process_data_visualizati
on.m , MATLAB, 262 lines - tca_analysis_concatenate
d.py , Python, 193 lines - tca_analysis_egestive_pr
iming.py , Python, 258 lines - tca_analysis_post_test.p
y , Python, 191 lines - tca_analysis_pre_test.py
, Python, 191 lines - tca_performance.py, Python, 145 lines
- tca_performance_analysis
.py , Python, 97 lines - tca_run_concatenated.py, Python, 74 lines, 1 match
- tca_run_egestive_priming
.py , Python, 75 lines, 1 match - tca_run_post_test.py, Python, 75 lines
- tca_run_pre_test.py, Python, 75 lines
- README.md, Text, 147 lines
Byrne-Lab/VSD_CFE_analysis
208d3fc4cfa99c10be4e91c8c336a2911a493a80, 25 September 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
30 files
- Intan_gui.m, MATLAB, 4,749 lines, 2 matches
- all_kframe.m, MATLAB, 29 lines
- compareim.m, MATLAB, 35 lines
- extractTSM.m, MATLAB, 283 lines
- fVSD/
PCA Denoising/ , MATLAB, 86 linespca_denoise.m - fVSD/
PCA Denoising/ , MATLAB, 372 linespca_denoise_UI.m - fVSD/
Specific Plotters/ , MATLAB, 42 linesvsd_spec_plotter_tsm.m - fVSD/
Specific Plotters/ , MATLAB, 243 linesvsd_stacked_plotter_tsm. m - fVSD/
averageFrameTSM.m , MATLAB, 74 lines - fVSD/
detect_spikes_vsd.m , MATLAB, 81 lines, 1 match - fVSD/
extractTBN.m , MATLAB, 53 lines - fVSD/
registerim.m , MATLAB, 116 lines - fVSD/
trimRHS.m , MATLAB, 27 lines - fVSD/
vsd_all_plotter_tsm.m , MATLAB, 50 lines - fVSD/
vsd_ellipTSM.m , MATLAB, 15 lines - fVSD/
vsd_pipeline_example.m , MATLAB, 73 lines - fVSD/
vsd_pipeline_tsm.m , MATLAB, 110 lines - find_kframe.m, MATLAB, 188 lines
- get_imhist.m, MATLAB, 21 lines
- makecolor.m, MATLAB, 45 lines
- quickplot.m, MATLAB, 27 lines
- readTSM.m, MATLAB, 66 lines
- read_Intan_RHS2000_file.
m , MATLAB, 622 lines, 1 match - readdet.m, MATLAB, 38 lines
- rearrange_intan.m, MATLAB, 5 lines
- rmbaseline.m, MATLAB, 156 lines
- spikedetection.m, MATLAB, 1,434 lines
- spikedetection_algorithm
.m , MATLAB, 124 lines - stim_avg.m, MATLAB, 85 lines
- stim_avg_all.m, MATLAB, 19 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:
- 3 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 86 scripts, each with its path and the digest of its content;
- 15 matches 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
No dataset and no data link were found in the paper.
Data and code availability
Data and original code has been deposited at GitHub and is publicly available at Zenodo: https://
Reproduced under the paper's license (CC BY-NC), 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 2, 28 September 2026
- Authors: added Archit Gupta (0009-0001-5152-3421); John H Byrne (0000-0001-7947-5890); removed Archit Gupta; John H Byrne
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 3 keywords, 1 funder, 80 references.
Cite
This paper
Gupta, A., Neveu, C. L., Cropper, E. C., & Byrne, J. H. (2026). Motor priming is associated with widespread recruitment into neural ensembles and more rapid ensemble transitions. iScience, 29(9), 117375. https://
BibTeX
@article{gupta2026motor,
author = {Gupta, Archit and Neveu, Curtis L and Cropper, Elizabeth C and Byrne, John H},
title = {{Motor priming is associated with widespread recruitment into neural ensembles and more rapid ensemble transitions}},
journal = {iScience},
year = {2026},
month = aug,
volume = {29},
number = {9},
pages = {117375},
publisher = {Elsevier},
issn = {2589-0042},
doi = {10.1016/
url = {https://
pmid = {42713042},
pmcid = {PMC13551948}
}
RIS
TY - JOUR
AU - Gupta, Archit
AU - Neveu, Curtis L
AU - Cropper, Elizabeth C
AU - Byrne, John H
TI - Motor priming is associated with widespread recruitment into neural ensembles and more rapid ensemble transitions
T2 - iScience
J2 - iScience
PY - 2026
DA - 2026/
VL - 29
IS - 9
SP - 117375
SN - 2589-0042
PB - Elsevier
DO - 10.1016/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1016/
"type": "article-journal",
"title": "Motor priming is associated with widespread recruitment into neural ensembles and more rapid ensemble transitions",
"container-title": "iScience",
"author": [
{
"family": "Gupta",
"given": "Archit"
},
{
"family": "Neveu",
"given": "Curtis L"
},
{
"family": "Cropper",
"given": "Elizabeth C"
},
{
"family": "Byrne",
"given": "John H"
}
],
"container-title-short":
"volume": "29",
"issue": "9",
"page": "117375",
"DOI": "10.1016/
"PMID": "42713042",
"PMCID": "PMC13551948",
"ISSN": "2589-0042",
"publisher": "Elsevier",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
29
]
]
}
}
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.3389/fncom.2026.1771884 [code]
- NEURONpyxl: fast, flexible, Python-integrated simulation of biophysical neural networks with complex plastic synapses.Journal: Frontiers in computational neuroscienceIn common: pandas, SciPy, Matplotlib, 1 other tool, other, 11 references
- [2] doi:10.1038/s41593-026-02232-0 [code]
- Entorhinal cortex represents task-relevant remote locations independently of CA1.Journal: Nature neuroscienceIn common: Pingouin, Optimization Toolbox, NetworkX, 13 other tools, systems
- [3] doi:10.1016/j.neuron.2026.03.034 [code]
- Dentate gyrus interneurons modulate winner-take-all network dynamics in freely behaving mice.Journal: NeuronIn common: Optimization Toolbox, NetworkX, h5py, 10 other tools, systems
- [4] doi:10.1038/s42003-026-10957-8 [code]
- Brain defence by the extracellular matrix protein Cochlin.Journal: Communications biologyIn common: Optimization Toolbox, NetworkX, OpenCV, 10 other tools
- [5] doi:10.1038/s41593-026-02362-5 [code]
- Replay of procedural memory is independent of the hippocampus.Journal: Nature neuroscienceIn common: scikit-posthocs, Pingouin, h5py, 9 other tools
- [6] doi:10.1016/j.isci.2026.116825 [code]
- Social hierarchy shapes behavioral and transcriptional responses to chronic stress and ketamine in male mice.Journal: iScienceIn common: Pingouin, NetworkX, OpenCV, 9 other tools, systems
- [7] doi:10.1038/s42003-026-10276-y [code]
- The cellular correlates and adolescent reorganisation of cortical myelination networks in the common marmoset.Journal: Communications biologyIn common: Pingouin, Optimization Toolbox, Image Processing Toolbox, 9 other tools
- [8] doi:10.1371/journal.pbio.3003831 [code]
- Disinhibitory signaling enables flexible coding of top-down information in cortical networks.Journal: PLoS biologyIn common: scikit-posthocs, NetworkX, h5py, 8 other tools, systems
- [9] doi:10.1016/j.nicl.2026.104012 [code]
- Structural-functional multilayer brain network properties and outcome of combined repetitive transcranial magnetic stimulation and psychotherapy for obsessive-compulsive disorder.Journal: NeuroImage. ClinicalIn common: Pingouin, NetworkX, Image Processing Toolbox, 9 other tools
- [10] doi:10.1038/s41467-026-74823-1 [code]
- Cerebellar activity is triggered by reach endpoint during learning of a complex locomotor task.Journal: Nature communicationsIn common: scikit-posthocs, Pingouin, OpenCV, 8 other tools
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: 3 repositories of the authors' code, each at its verified commit and with its license, 86 scripts, and 15 matches 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:ee4713b57f081912…
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.
