Drug-induced changes in connectivity to midbrain dopamine cells revealed by rabies monosynaptic tracing.
The 11 matches
- [1] § Materials and methods › Dimensionality reduction of RABV input data ↔ 10-gene-expression-analysis-cocaine.ipynb, lines 375–384 · score 0.74 · anterior cortex, DStr, LDT, PVH, LHb, VP
- [2] § Materials and methods › Experimental procedures › Stereotaxic surgery ↔ 2-DAT-Cre vs GAD2-Cre and vGluT2-Cre-euclidean.ipynb, lines 263–277 · score 0.71 · vGluT2, GAD2 Cre, DAT Cre, mPFC, cTRIO, Amygdala
- [3] § Materials and methods › Experimental procedures › Stereotaxic surgery ↔ 0-data-exploration-master-euclidean.ipynb, lines 2482–2537 · score 0.62 · vGluT2, mPFC, cTRIO, GAD2 Cre, DAT Cre, NAcLat
- [4] § Results › A single injection of an addictive drug changes brain-wide input patterns to VTADA cells ↔ 2-DAT-Cre vs GAD2-Cre and vGluT2-Cre-euclidean.ipynb, lines 263–277 · score 0.61 · vGluT2, GAD2 Cre, DAT Cre, isoflurane anesthetized, cocaine, cell
- [5] § Results › Exploring gene expression patterns that predict changes in RABV input labeling ↔ 11-gene-expression-analysis-comparison-controls.ipynb, lines 911–914 · score 0.57 · ligand gated ion, voltage gated ion, ion channel, gene expression
- [6] § Results › A single injection of an addictive drug changes brain-wide input patterns to VTADA cells ↔ 10-gene-expression-analysis-cocaine.ipynb, lines 375–384 · score 0.55 · DStr, PVH, LHb, VP, CeA, PO
- [7] § Results › Exploring gene expression patterns that predict changes in RABV input labeling ↔ 11-gene-expression-analysis-comparison-controls.ipynb, lines 1145–1186 · score 0.55 · exocytosis genes, linear regressions, endo, gene expression, ratios, drug
- [8] § Results › Dimensionality reduction methods identify differences in inputs of VTA cell populations ↔ 2-DAT-Cre vs GAD2-Cre and vGluT2-Cre-euclidean.ipynb, lines 540–550 · score 0.55 · Euclidean distance, GAD2 Cre, DAT Cre, PCA
- [9] § Results › Dimensionality reduction methods identify differences in inputs of VTA cell populations ↔ 2-DAT-Cre vs GAD2-Cre and vGluT2-Cre-euclidean.ipynb, lines 299–351 · score 0.54 · standard deviation, GAD2 Cre, DAT Cre, error, Dimensionality
- [10] § Results › Exploring gene expression patterns that predict changes in RABV input labeling ↔ 11-gene-expression-analysis-comparison-controls.ipynb, lines 911–914 · score 0.51 · ligand gated ion, voltage gated ion, ion channel, Gene Expression
- [11] § Results › Dimensionality reduction methods identify differences in inputs of VTA cell populations ↔ 10-gene-expression-analysis-cocaine.ipynb, lines 400–438 · score 0.50 · anterior cortex, LHb, VP, CeA, PO, EP
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 · 687 lines · 27 KB · MIT · 4 matches
- # %%
- #import things we need
- import pandas as pd
- import numpy as np
- import matplotlib.pyplot as plt
- from sklearn.preprocessing import StandardScaler
- from sklearn.decomposition import PCA
- import umap
- import seaborn as sns
- from scipy.stats import zscore
- from matplotlib.patches import Ellipse
- import matplotlib.transforms as transforms
- # %% [markdown]
- # # Load data, rotate as needed, join dataframes together for ease of processing later
- # %%
- set_metric='euclidean'
- set_stdevs=1
- # %%
- #import data DAT-cre
- DATcre66T = pd.read_excel(r'data/8dat-crebrains.xlsx')
- #and import dat cre and gad2 also from 76 brain set
- DATcre66T_gad2 = pd.read_excel(r'data/12datcre-and-gad2.xlsx')
- # %%
- DATcre66T_gad2
- # %%
- VGlut2_cre = pd.read_excel(r'data/vGluT2-Cre.xlsx')
- # %%
- #import data (all DA cells)
- all_DA_cells = ['Cocaine','Control ketamine anesthesia','Control isoflurane anesthesia','Amphetamine',
- 'Nicotine','Morphine','Fluoxetine','MDMA group','MDMA isolated','Ethanol','Stress',
- 'GAD2-Cre isoflurane','GAD2-Cre Cocaine','GAD2-Cre isoflurane (lateral)']
- all_DA_cells_df = {} #empty dictionary
- num_drugs=len(all_DA_cells) #get number of drugs/conditions
- for drug in range(num_drugs):
- #read in the sheet with that drug name
- tempdf = pd.read_excel(r'data/organized drug and experience data for Bartas et al.xlsx',sheet_name=all_DA_cells[drug])
- #add id column with drug name and condition
- tempdf['condition']=all_DA_cells[drug]
- list1=list(tempdf['condition'])
- length=len(tempdf['condition'])
- list2=list(range(1,length+1))
- tempdf['condition_num']=[str(s) +'-'+ str(num) for s,num in zip(list1,list2)]
- tempdf.dropna(inplace=True)
- all_DA_cells_df[drug]=tempdf #put into dictionary at index
- # %%
- # #import NAcMed data
- NAcMeds = ['cTRIO NAcMed cocaine 1 inj','NAcMed controls','cTRIO NAcMed C 5 inj',
- 'cTRIO NAcMed FC','cTRIO NAcMed ketamine anesthesi']
- NAcMeds_df = {} #empty dictionary
- num_drugs=len(NAcMeds) #get number of drugs/conditions
- for drug in range(num_drugs):
- #read in the sheet with that drug name
- tempdf = pd.read_excel(r'data/organized drug and experience data for Bartas et al.xlsx',sheet_name=NAcMeds[drug])
- #add id column with drug name and condition
- tempdf['condition']=NAcMeds[drug]
- list1=list(tempdf['condition'])
- length=len(tempdf['condition'])
- list2=list(range(1,length+1))
- tempdf['condition_num']=[str(s) +'-'+ str(num) for s,num in zip(list1,list2)]
- tempdf.dropna(inplace=True)
- NAcMeds_df[drug]=tempdf #put into dictionary at index
- # %%
- NAcMed_data=pd.concat(
- NAcMeds_df,
- axis=0,
- join="outer",
- ignore_index=False,
- keys=None,
- levels=None,
- names=None,
- verify_integrity=False,
- copy=True,
- )
- # %%
- # #import NAcLat data
- NAcLats = ['cTRIO NAcLat cocaine','NAcLat iso saline controls','cTRIO NAcLat C 5 inj',
- 'cTRIO NAcLat FC','cTRIO NAcLat ketamine anesthesi']
- NAcLats_df = {} #empty dictionary
- num_drugs=len(NAcLats) #get number of drugs/conditions
- for drug in range(num_drugs):
- #read in the sheet with that drug name
- tempdf = pd.read_excel(r'data/organized drug and experience data for Bartas et al.xlsx',sheet_name=NAcLats[drug])
- #add id column with drug name and condition
- tempdf['condition']=NAcLats[drug]
- list1=list(tempdf['condition'])
- length=len(tempdf['condition'])
- list2=list(range(1,length+1))
- tempdf['condition_num']=[str(s) +'-'+ str(num) for s,num in zip(list1,list2)]
- tempdf.dropna(inplace=True)
- NAcLats_df[drug]=tempdf #put into dictionary at index
- # %%
- #combine NAcLat data
- NAcLat_data=pd.concat(
- NAcLats_df,
- axis=0,
- join="outer",
- ignore_index=False,
- keys=None,
- levels=None,
- names=None,
- verify_integrity=False,
- copy=True,
- )
- # %%
- # #import DLS data
- DLSs = ['DLS_sal','DLS_coc1x','DLS_FC']
- DLSs_df = {} #empty dictionary
- num_drugs=len(DLSs) #get number of drugs/conditions
- for drug in range(num_drugs):
- #read in the sheet with that drug name
- tempdf = pd.read_excel(r'data/organized drug and experience data for Bartas et al.xlsx',
- sheet_name=DLSs[drug],skiprows=1)
- tempdf=tempdf.transpose()
- tempdf.columns = tempdf.iloc[0]
- tempdf = tempdf.iloc[1: , :]
- #add id column with drug name and condition
- tempdf['condition']=DLSs[drug]
- list1=list(tempdf['condition'])
- length=len(tempdf['condition'])
- list2=list(range(1,length+1))
- tempdf['condition_num']=[str(s) +'-'+ str(num) for s,num in zip(list1,list2)]
- tempdf.dropna(inplace=True)
- DLSs_df[drug]=tempdf #put into dictionary at index
- # %%
- #combine DLS data
- DLS_data=pd.concat(
- DLSs_df,
- axis=0,
- join="outer",
- ignore_index=False,
- keys=None,
- levels=None,
- names=None,
- verify_integrity=False,
- copy=True,
- )
- # %%
- # #import amygdala data
- Amygs = ['cTRIO Amygdala cocaine 1 dose','cTRIO Amygdala isoflurane anest','cTRIO Amygdala AFC']
- Amygs2= ['cTRIO Amygdala ketamine anesthe']
- Amygs_df = {} #empty dictionary
- num_drugs=len(Amygs) #get number of drugs/conditions
- for drug in range(num_drugs):
- #read in the sheet with that drug name
- tempdf = pd.read_excel(r'data/organized drug and experience data for Bartas et al.xlsx',
- sheet_name=Amygs[drug],skiprows=1)
- tempdf=tempdf.transpose()
- tempdf.columns = tempdf.iloc[0]
- tempdf = tempdf.iloc[1: , :]
- #add id column with drug name and condition
- tempdf['condition']=Amygs[drug]
- list1=list(tempdf['condition'])
- length=len(tempdf['condition'])
- list2=list(range(1,length+1))
- tempdf['condition_num']=[str(s) +'-'+ str(num) for s,num in zip(list1,list2)]
- tempdf.dropna(inplace=True)
- Amygs_df[drug]=tempdf #put into dictionary at index
- for drug in range(1):
- #read in the sheet with that drug name
- tempdf = pd.read_excel(r'data/organized drug and experience data for Bartas et al.xlsx',sheet_name=Amygs2[drug])
- #add id column with drug name and condition
- tempdf['condition']=Amygs2[drug]
- list1=list(tempdf['condition'])
- length=len(tempdf['condition'])
- list2=list(range(1,length+1))
- tempdf['condition_num']=[str(s) +'-'+ str(num) for s,num in zip(list1,list2)]
- tempdf.dropna(inplace=True)
- Amygs_df[3]=tempdf #put into dictionary at index
- # %%
- #combine Amyg data
- Amyg_data=pd.concat(
- Amygs_df,
- axis=0,
- join="outer",
- ignore_index=False,
- keys=None,
- levels=None,
- names=None,
- verify_integrity=False,
- copy=True,
- )
- # %%
- Amyg_data.dropna(inplace=True,axis=1)
- # %%
- #import mPFC data
- mPFCs = ['cTRIO mPFC isoflurane anesthesi','cTRIO mPFC cocaine 1 dose','cTRIO mPFC AFC']
- mPFCs2= ['cTRIO mPFC ketamine anesthesia']
- mPFCs_df = {} #empty dictionary
- num_drugs=len(mPFCs) #get number of drugs/conditions
- for drug in range(num_drugs):
- #read in the sheet with that drug name
- tempdf = pd.read_excel(r'data/organized drug and experience data for Bartas et al.xlsx',
- sheet_name=mPFCs[drug],skiprows=1)
- tempdf=tempdf.transpose()
- tempdf.columns = tempdf.iloc[0]
- tempdf = tempdf.iloc[1: , :]
- #add id column with drug name and condition
- tempdf['condition']=mPFCs[drug]
- list1=list(tempdf['condition'])
- length=len(tempdf['condition'])
- list2=list(range(1,length+1))
- tempdf['condition_num']=[str(s) +'-'+ str(num) for s,num in zip(list1,list2)]
- tempdf.dropna(inplace=True)
- mPFCs_df[drug]=tempdf #put into dictionary at index
- for drug in range(1):
- #read in the sheet with that drug name
- tempdf = pd.read_excel(r'data/organized drug and experience data for Bartas et al.xlsx',sheet_name=mPFCs2[drug])
- #add id column with drug name and condition
- tempdf['condition']=mPFCs2[drug]
- list1=list(tempdf['condition'])
- length=len(tempdf['condition'])
- list2=list(range(1,length+1))
- tempdf['condition_num']=[str(s) +'-'+ str(num) for s,num in zip(list1,list2)]
- tempdf.dropna(inplace=True)
- mPFCs_df[3]=tempdf #put into dictionary at index
- # %%
- # combine mPFC data
- mPFC_data=pd.concat(
- mPFCs_df,
- axis=0,
- join="outer",
- ignore_index=False,
- keys=None,
- levels=None,
- names=None,
- verify_integrity=False,
- copy=True,
- )
- # %%
- mPFC_data.dropna(inplace=True,axis=1)
- # %%
- all_data=pd.concat(
- all_DA_cells_df,
- axis=0,
- join="outer",
- ignore_index=False,
- keys=None,
- levels=None,
- names=None,
- verify_integrity=False,
- copy=True,
- )
- # %%
- categories= pd.DataFrame({'group_name':['Psychostimulants','Controls','Controls',
- 'Psychostimulants','Other','Other','Controls','MDMA','MDMA','Other',
- 'Other','GAD2-Cre','GAD2-Cre','GAD2-Cre'],'condition5':all_DA_cells})
- categories2= pd.DataFrame({'group_name':['Cocaine','Controls','Cocaine',
- 'FC','Controls'],'condition5':NAcMeds})
- categories3= pd.DataFrame({'group_name':['Cocaine','Controls','Cocaine',
- 'FC','Controls'],'condition5':NAcLats})
- categories4= pd.DataFrame({'group_name':['Cocaine','Controls','AFC',
- 'Controls'],'condition5':['cTRIO Amygdala cocaine 1 dose','cTRIO Amygdala isoflurane anest','cTRIO Amygdala AFC','cTRIO Amygdala ketamine anesthe']})
- categories5= pd.DataFrame({'group_name':['Controls','Cocaine',
- 'AFC','Controls'],'condition5':['cTRIO mPFC isoflurane anesthesi','cTRIO mPFC cocaine 1 dose','cTRIO mPFC AFC','cTRIO mPFC ketamine anesthesia']})
- categories6= pd.DataFrame({'group_name':['DAT-Cre','DAT-Cre','GAD2-Cre'],'condition5':['DAT-Cre', 'DAT-Cre 66T','Gad2-Cre']})
- categories7= pd.DataFrame({'group_name':['vGluT2-Cre'],'condition5':['vGluT2-Cre']})
- categories=pd.concat([categories,categories2,categories3,categories4,categories5,categories6,categories7])
- # %%
- all_data.replace({'GAD2-Cre isoflurane': 'Gad2-Cre', 'GAD2-Cre isoflurane (lateral)': 'Gad2-Cre'},inplace=True)
- # %% [markdown]
- # # Define some functions, variables, and other things we will use
- # %%
- uniq_colors=['mediumorchid','gray','royalblue','darkred','red','hotpink',
- 'khaki','palegreen','seagreen','orange','lavender',
- 'steelblue','navy','dodgerblue','thistle','violet',
- 'deeppink','pink','slateblue','peru','darkorange',
- 'magenta','cyan','lightcoral','lawngreen',
- 'burlywood'] # to use later
- uniq_colors2=['mediumorchid','gray','royalblue','darkred','hotpink',
- 'khaki','palegreen','seagreen','orange','lavender',
- 'steelblue','navy','dodgerblue','thistle','violet',
- 'deeppink','pink','slateblue','peru','darkorange',
- 'magenta','cyan','lightcoral','lawngreen',
- 'burlywood','red'] # to use later
- # %%
- #from https://matplotlib.org/devdocs/gallery/statistics/confidence_ellipse.html
- def confidence_ellipse(x, y, ax, n_std=set_stdevs, facecolor='none', **kwargs):
- """
- Create a plot of the covariance confidence ellipse of *x* and *y*.
- Parameters
- ----------
- x, y : array-like, shape (n, )
- Input data.
- ax : matplotlib.axes.Axes
- The axes object to draw the ellipse into.
- n_std : float
- The number of standard deviations to determine the ellipse's radiuses.
- **kwargs
- Forwarded to `~matplotlib.patches.Ellipse`
- Returns
- -------
- matplotlib.patches.Ellipse
- """
- if x.size != y.size:
- raise ValueError("x and y must be the same size")
- cov = np.cov(x, y)
- pearson = cov[0, 1]/np.sqrt(cov[0, 0] * cov[1, 1])
- # Using a special case to obtain the eigenvalues of this
- # two-dimensionl dataset.
- ell_radius_x = np.sqrt(1 + pearson)
- ell_radius_y = np.sqrt(1 - pearson)
- ellipse = Ellipse((0, 0), width=ell_radius_x * 2, height=ell_radius_y * 2,
- facecolor=facecolor, **kwargs)
- # Calculating the stdandard deviation of x from
- # the squareroot of the variance and multiplying
- # with the given number of standard deviations.
- scale_x = np.sqrt(cov[0, 0]) * n_std
- mean_x = np.mean(x)
- # calculating the stdandard deviation of y ...
- scale_y = np.sqrt(cov[1, 1]) * n_std
- mean_y = np.mean(y)
- transf = transforms.Affine2D() \
- .rotate_deg(45) \
- .scale(scale_x, scale_y) \
- .translate(mean_x, mean_y)
- ellipse.set_transform(transf + ax.transData)
- return ax.add_patch(ellipse)
- # %%
- def signif(x, p): #get p significant digits of all of a numpy array (why does base numpy not have this...)
- x = np.asarray(x)
- x_positive = np.where(np.isfinite(x) & (x != 0), np.abs(x), 10**(p-1))
- mags = 10 ** (p - 1 - np.floor(np.log10(x_positive)))
- return np.round(x * mags) / mags
- # %%
- def plot_components(components_df): #plot feature importance of the PCA components 1-5
- #code adapted from
- #https://matplotlib.org/stable/gallery/images_contours_and_fields/image_annotated_heatmap.html
- fig, ax = plt.subplots(figsize=(6, 13))
- comptemp0=components_df.transpose()
- comptemp1=comptemp0.to_numpy()
- comptemp=signif(comptemp1,3)
- im = ax.imshow(comptemp)
- pca5=['PC 1', 'PC 2', 'PC 3', 'PC 4', 'PC 5']
- regions=components_df.columns
- # We want to show all ticks...
- ax.set_xticks(np.arange(len(pca5)))
- ax.set_yticks(np.arange(len(regions)))
- # ... and label them with the respective list entries
- ax.set_xticklabels(pca5)
- ax.set_yticklabels(regions)
- # Rotate the tick labels and set their alignment.
- plt.setp(ax.get_xticklabels(), rotation=45, ha="right",
- rotation_mode="anchor")
- fig.colorbar(im)
- # Loop over data dimensions and create text annotations.
- for i in range(len(regions)):
- for j in range(len(pca5)):
- text = ax.text(j, i, comptemp[i, j],
- ha="center", va="center", color="w")
- ax.set_title("Components and Feature Importance")
- fig.tight_layout()
- plt.show()
- # %%
- def make_pca_plots_label(pc1,pc2,pc3,group,labels): #makes plots of pc1v2, 1v3, and 2v3
- align_embed= pd.DataFrame({'pc1': pc1.values,'pc2': pc2.values,'pc3': pc3.values},index=labels)
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc1'],drug1['pc2'],c=uniq_colors[i],label=r)
- ax.set_xlabel('PC 1')
- ax.set_ylabel('PC 2')
- for i, txt in enumerate(group):
- ax.annotate(txt, (pc1[i], pc2[i]))
- ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5)) #make legend not on the plot
- plt.show()
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc1'],drug1['pc3'],c=uniq_colors[i],label=r)
- ax.set_xlabel('PC 1')
- ax.set_ylabel('PC 3')
- for i, txt in enumerate(group):
- ax.annotate(txt, (pc1[i], pc3[i]))
- ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5)) #make legend not on the plot
- plt.show()
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc2'],drug1['pc3'],c=uniq_colors[i],label=r)
- ax.set_xlabel('PC 2')
- ax.set_ylabel('PC 3')
- for i, txt in enumerate(group):
- ax.annotate(txt, (pc2[i], pc3[i]))
- ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5)) #make legend not on the plot
- plt.show()
- # %%
- def make_pca_plots_ellipse(pc1,pc2,pc3,group,labels,grouped_elipse='no'): #makes plots of pc1v2, 1v3, and 2v3
- align_embed= pd.DataFrame({'pc1': pc1.values,'pc2': pc2.values,'pc3': pc3.values},index=labels)
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- if grouped_elipse=='no':
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc1'],drug1['pc2'],c=uniq_colors[i],label=r)
- confidence_ellipse(drug1['pc1'],drug1['pc2'], ax, alpha=0.5, n_std=set_stdevs, facecolor=uniq_colors2[i], edgecolor=uniq_colors2[i], zorder=0)
- ax.set_xlabel('PC 1')
- ax.set_ylabel('PC 2')
- ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5)) #make legend not on the plot
- plt.show()
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc1'],drug1['pc3'],c=uniq_colors[i],label=r)
- confidence_ellipse(drug1['pc1'],drug1['pc3'], ax, alpha=0.5, n_std=set_stdevs, facecolor=uniq_colors2[i], edgecolor=uniq_colors2[i], zorder=0)
- ax.set_xlabel('PC 1')
- ax.set_ylabel('PC 3')
- ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5)) #make legend not on the plot
- plt.show()
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc2'],drug1['pc3'],c=uniq_colors[i],label=r)
- confidence_ellipse(drug1['pc2'],drug1['pc3'], ax, alpha=0.5, n_std=set_stdevs, facecolor=uniq_colors2[i], edgecolor=uniq_colors2[i], zorder=0)
- ax.set_xlabel('PC 2')
- ax.set_ylabel('PC 3')
- else:
- align_embed['condition5']=labels #categories
- category_df=align_embed.merge(categories,on='condition5',copy=True).dropna()
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc1'],drug1['pc2'],c=uniq_colors[i],label=r)
- ax.set_xlabel('PC 1')
- ax.set_ylabel('PC 2')
- for i,r in enumerate(np.unique(category_df['group_name'])):
- drug1=category_df[category_df['group_name']== r]
- confidence_ellipse(drug1['pc1'],drug1['pc2'], ax, alpha=0.5, n_std=set_stdevs, facecolor=uniq_colors2[i], edgecolor=uniq_colors2[i], zorder=0,label=r)
- ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5)) #make legend not on the plot
- plt.show()
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc1'],drug1['pc3'],c=uniq_colors[i],label=r)
- ax.set_xlabel('PC 1')
- ax.set_ylabel('PC 3')
- for i,r in enumerate(np.unique(category_df['group_name'])):
- drug1=category_df[category_df['group_name']== r]
- confidence_ellipse(drug1['pc1'],drug1['pc3'], ax, alpha=0.5, n_std=set_stdevs, facecolor=uniq_colors2[i], edgecolor=uniq_colors2[i], zorder=0,label=r)
- ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5)) #make legend not on the plot
- plt.show()
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['pc2'],drug1['pc3'],c=uniq_colors[i],label=r)
- ax.set_xlabel('PC 2')
- ax.set_ylabel('PC 3')
- for i,r in enumerate(np.unique(category_df['group_name'])):
- drug1=category_df[category_df['group_name']== r]
- confidence_ellipse(drug1['pc2'],drug1['pc3'], ax, alpha=0.5, n_std=set_stdevs, facecolor=uniq_colors2[i], edgecolor=uniq_colors2[i], zorder=0,label=r)
- ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5)) #make legend not on the plot
- plt.show()
- # %%
- def get_feats_and_labels(dataframe): #gets features and conditions (drugs) and brain regions
- labels=dataframe['condition'].values
- condition_nums=dataframe['condition_num'].values
- features=dataframe.iloc[: , 2:24]
- regions=features.columns
- return features, labels, condition_nums, regions
- # %%
- gad2only2=all_data[(all_data["condition"] == 'Gad2-Cre')]
- features4, labels4, condition_nums4, regions4 = get_feats_and_labels(gad2only2)
- # %%
- #modularized pieter's code
- def umap_n_times(X_scaled,labels,N = 20,n_neighbors=15,metric='euclidean'):
- umap_distances = np.zeros((len(labels),len(labels),N,))
- for n in range(0,N):
- embedding=umap.UMAP(n_neighbors=n_neighbors,metric=metric).fit_transform(X_scaled)
- for r1 in range(0,len(labels)):
- for r2 in range(0,len(labels)):
- d = np.sum((embedding[r1]-embedding[r2])**2)**(0.5)
- umap_distances[r1,r2,n]=d
- max_distance = np.max(umap_distances[:,:,n])
- umap_distances[:,:,n] = umap_distances[:,:,n]/max_distance
- umap_distances_means = np.mean(umap_distances,axis=2)
- return umap_distances_means
- # %%
- #modularized pieter's code
- def umap_dist_heatmap(t1,indexed='no'):
- if indexed=='yes':
- labs=labels.values
- uniq=list(range(len(labels)))
- uniq_labels = [str(i) +'_'+ str(j) for i, j in zip(labs, uniq)]
- else:
- labs=labels.values
- uniq=[x[1] for x in labels.index.values]
- uniq_labels = [str(i) +'_'+ str(j) for i, j in zip(labs, uniq)]
- fig,ax =plt.subplots(figsize=(10,4))
- plt.pcolor(t1, cmap="RdYlBu_r")
- plt.yticks(np.arange(0.5, len(uniq_labels), 1),uniq_labels)
- plt.xticks(np.arange(0.5, len(uniq_labels), 1),uniq_labels)
- plt.colorbar()
- plt.setp(ax.get_xticklabels(), rotation=45, ha="right",
- rotation_mode="anchor")
- plt.show()
- # %%
- #modularized pieter's code
- def pca_distance(pc1,pc2,pc3,labels):
- pca_distances = np.zeros((len(labels),len(labels)))
- for r1 in range(0,len(labels)):
- for r2 in range(0,len(labels)):
- d = ((pc1[r1]-pc1[r2])**2 +(pc2[r1]-pc2[r2])**2+(pc3[r1]-pc3[r2])**2)**(0.5)
- pca_distances[r1,r2]=d #euclidean distance
- max_distance = np.max(pca_distances[:,:])
- pca_distances[:,:] = pca_distances[:,:]/max_distance #normalized
- return pca_distances
- # %%
- def distance_to_other_points(to_heatmap,labels,condition_nums,umap_or_pca):
- means_df2 = pd.DataFrame(to_heatmap,index=labels,columns=condition_nums)
- labels2=[str(s) +'_average' for s in labels]
- means_df2['condition2']=labels2
- means_df2=means_df2.groupby(['condition2']).mean().transpose()
- cm = sns.clustermap(means_df2,yticklabels=True,xticklabels=True)
- cm.fig.suptitle("point distance - average by condition 1 axis"+umap_or_pca)
- cm.fig.set_size_inches(18, 18)
- plt.show()
- means_df2['condition3']=labels2
- means_df2=means_df2.groupby(['condition3']).mean().transpose()
- cm = sns.clustermap(means_df2,yticklabels=True,xticklabels=True)
- cm.fig.suptitle("point distance - average by condition both axis"+umap_or_pca)
- cm.fig.set_size_inches(18, 18)
- plt.show()
- # %%
- def umap_and_heatmap(X_scaled,labels,condition_nums,grouped_elipse='no'):
- neighbors=int(len(labels)/3)
- metrics=set_metric
- reducer = umap.UMAP(metric=metrics,n_neighbors=neighbors)
- embedding = reducer.fit_transform(X_scaled)
- align_embed= pd.DataFrame(embedding,index=labels,columns=['umap1','umap2'])
- # fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- # for i,r in enumerate(np.unique(align_embed.index.values)):
- # drug1=align_embed[align_embed.index == r]
- # ax.scatter(drug1['umap1'],drug1['umap2'],c=uniq_colors[i],label=r)
- # for i, txt in enumerate(condition_nums):
- # ax.annotate(txt, (embedding[i,0], embedding[i,1]))
- # ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5))
- # ax.set_xlabel('UMAP 1')
- # ax.set_ylabel('UMAP 2')
- # plt.show()
- fig, ax = plt.subplots(figsize=(12, 10)) #init fig
- if grouped_elipse=='no':
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['umap1'],drug1['umap2'],c=uniq_colors[i],label=r)
- confidence_ellipse(drug1['umap1'],drug1['umap2'], ax, alpha=0.5, n_std=set_stdevs, facecolor=uniq_colors2[i], edgecolor=uniq_colors2[i], zorder=0)
- else:
- align_embed['condition5']=labels #categories
- category_df=align_embed.merge(categories,on='condition5',copy=True).dropna()
- for i,r in enumerate(np.unique(align_embed.index.values)):
- drug1=align_embed[align_embed.index == r]
- ax.scatter(drug1['umap1'],drug1['umap2'],c=uniq_colors[i],label=r)
- for i,r in enumerate(np.unique(category_df['group_name'])):
- drug1=category_df[category_df['group_name']== r]
- confidence_ellipse(drug1['umap1'],drug1['umap2'], ax, alpha=0.5, n_std=set_stdevs, facecolor=uniq_colors2[i], edgecolor=uniq_colors2[i], zorder=0,label=r)
- leg2 = ax.legend(loc="right",bbox_to_anchor=(1.6, 0.5))
- ax.set_xlabel('UMAP 1')
- ax.set_ylabel('UMAP 2')
- plt.show()
- #distance heatmap
- to_heatmap=umap_n_times(X_scaled,labels,metric=metrics,n_neighbors=neighbors)
- means_df = pd.DataFrame(to_heatmap,index=condition_nums,columns=condition_nums)
- cm = sns.clustermap(means_df,yticklabels=True,xticklabels=True)
- cm.fig.suptitle("average umap relative distance")
- cm.fig.set_size_inches(18, 18)
- plt.show()
- distance_to_other_points(to_heatmap,labels,condition_nums,' - UMAP') # umap
- # %%
- def get_feats_and_labels(dataframe):
- labels=dataframe['Experimental condition']
- condition_nums=dataframe['condition_nums']
- features=dataframe.iloc[: , 1:23]
- regions=features.columns
- return features, labels, condition_nums, regions
- # %% [markdown]
- # # Get features from DAT-cre and 66T data
- # %% [markdown]
- # # DAT-cre and 66T and Gad2Cre (no drugs)
- # %%
- features2, labels2, condition_nums2, regions2 = get_feats_and_labels(DATcre66T_gad2)
- features3, labels3, condition_nums3, regions3 = get_feats_and_labels(VGlut2_cre)
- labels=list(labels2)+list(labels4)+list(labels3)
- condition_nums=list(condition_nums2)+list(condition_nums4)+list(condition_nums3)
- #scale X
- X2=features2.to_numpy().astype(float)
- X3=features3.to_numpy().astype(float)
- X4=features4.to_numpy().astype(float)
- #features4, labels4, condition_nums4, regions4
- X=np.vstack((X2, X4))
- X=np.vstack((X, X3))
- #get rid of NAs before scaling
- X_scaled=zscore(X,axis=1)
- X_scaled=zscore(X_scaled,axis=0)
- # %%
- #can change n_components to more if you want to visualize in 3D
- pca = PCA(n_components=5)
- #PCA using the scaled drug data array made earlier
- principalComponents = pca.fit_transform(X_scaled)
- #make into dataframe if you want to view with labels
- principalDf = pd.DataFrame(data = principalComponents
- , columns = ['principal component 1', 'principal component 2', 'principal component 3', 'principal component 4', 'principal component 5'])
- region_components=pd.DataFrame(data = pca.components_ , columns = regions2)
- #view df
- print('Explained variance for each PC: 1, 2, 3')
- print(pca.explained_variance_)
- principalDf
- # %% [markdown]
- # ### PCA Plots
- # %%
- pc1=principalDf['principal component 1']
- pc2=principalDf['principal component 2']
- pc3=principalDf['principal component 3']
- #make_pca_plots_label(pc1,pc2,pc3,condition_nums,labels)
- make_pca_plots_ellipse(pc1,pc2,pc3,condition_nums,labels,grouped_elipse='yes')
- plot_components(region_components)
- # %%
- pca_dist=pca_distance(pc1,pc2,pc3,labels)
- heatmapdf = pd.DataFrame(pca_dist,index=condition_nums,columns=condition_nums)
- cm = sns.clustermap(heatmapdf,yticklabels=True)
- cm.fig.suptitle("PCA relative distance")
- cm.fig.set_size_inches(18, 18)
- plt.show()
- distance_to_other_points(pca_dist,labels,condition_nums,' - PCA') # pca
- # %% [markdown]
- # ### UMAP
- # %%
- umap_and_heatmap(X_scaled,labels,condition_nums,grouped_elipse='yea')
2-DAT-Cre vs GAD2-Cre and vGluT2-Cre-euclidean.ipynb at commit 4868c4c, under MIT · at the source
Overview
- Program in Mathematical, Computational, and Systems Biology, University of California, Irvine Irvine United States
- Department of Physiology and Biophysics, University of California, Irvine Irvine United States
- Department of Biomedical Engineering, University of California, Irvine Irvine United States
- Department of Neurobiology and Behavior, University of California, Irvine Irvine United States
- Department of Pharmaceutical Sciences, University of California, Irvine Irvine United States
Abstract
Addictive drugs cause long-lasting changes in connectivity from inputs onto ventral tegmental area dopamine cells (VTADA) that contribute to drug-induced behavioral adaptations. However, it is not known which inputs are altered. Here, we used a rabies virus (RABV)-based mapping strategy to quantify RABV-labeled inputs to VTA cells after a single exposure to one of a variety of misused drugs – cocaine, amphetamine, methamphetamine, morphine, and nicotine – and compared the relative global input labeling across conditions. We observed that all tested addictive drugs elicited similar input changes onto VTADA cells, in particular onto DA cells projecting to the lateral shell of the nucleus accumbens and amygdala. In addition, repeated administration of ketamine/
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 11 matches between paragraphs and lines of code.
ejcorn/mouse_abi_tool
5efe587ddbe223518503b28065435da95bfaf7ff, 16 July 2021Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
13 files
- code/
aba/ , R, 81 linesaba_fxns.R - code/
aba/ , R, 62 linesdownload_gene_expression .R - code/
aba/ , R, 46 linesprobenormalization_selec tion.R - code/
aba/ , R, 69 linesprobenormalization_selec tion_v2.R - code/
aba/ , R, 45 linesprobeselection_normaliza tion.R - code/
aba/ , R, 51 linesprocess_ontology.R - code/
misc/ , R, 6 linesdirectories.R - code/
misc/ , R, 47 linesmiscfxns.R - code/
misc/ , R, 6 linespackages.R - code/
process/ , R, 49 linesprocess.R - pipeline.R, R, 30 lines
- LICENSE, License, 21 lines
- README.md, Text, 14 lines
ktbartas/Bartas_et_al_eLife_2024
4868c4c1df5cea4574c924df6042999362407284, 2 May 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
8 files
- 0-data-exploration-maste
r-euclidean.ipynb , Jupyter, 2,620 lines, 1 match - 1-z-scored-data-explorat
ion-master-euclidean.ipy , Jupyter, 1,857 linesnb - 10-gene-expression-analy
sis-cocaine.ipynb , Jupyter, 501 lines, 3 matches - 11-gene-expression-analy
sis-comparison-controls. , Jupyter, 1,360 lines, 3 matchesipynb - 12-gene-expression-analy
sis-comparison-regions.i , Jupyter, 223 linespynb - 13-gene-expression-vs-ra
bies_allen.ipynb , Jupyter, 236 lines - 2-DAT-Cre vs GAD2-Cre and vGluT2-Cre-euclidean.ipy
nb , Jupyter, 687 lines, 4 matches - 3-Region-centers.ipynb, Jupyter, 1,009 lines
- repository limit reached (2,000 files or 30 MB): the rest is at the source (8 files)
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:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 19 scripts, each with its path and the digest of its content;
- 11 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
Datasets cited
- doi:10.5061/
dryad.gxd25481q , at Dryad; found in “Data availability”
Data availability
The current manuscript is largely a computational study, so no data have been generated for most of this manuscript, except for Figure 10; raw data are available for Figure 10 on Dryad at https://
The following dataset was generated:
BartasK DerdeynP BeierKT 2026Drug-induced changes in connectivity to midbrain dopamine cells revealed by rabies monosynaptic tracingDryad Digital Repository10.5061/
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, 28 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 8 authors, 7 keywords, 7 MeSH terms, 8 funders, 84 references, 8 RRIDs.
Cite
This paper
Bartas, K., Derdeyn, P., Tian, G., Vasquez, J. J., Azouz, G., Yamamoto, C. M., Hui, M., & Beier, K. T. (2026). Drug-induced changes in connectivity to midbrain dopamine cells revealed by rabies monosynaptic tracing. eLife, 13, RP93664. https://
BibTeX
@article{bartas2026drug,
author = {Bartas, Katrina and Derdeyn, Pieter and Tian, Guilian and Vasquez, Jose J and Azouz, Ghalia and Yamamoto, Cindy M and Hui, May and Beier, Kevin T},
title = {{Drug-induced changes in connectivity to midbrain dopamine cells revealed by rabies monosynaptic tracing}},
journal = {eLife},
year = {2026},
month = may,
volume = {13},
pages = {RP93664},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/
url = {https://
pmid = {42138352},
pmcid = {PMC13179063}
}
RIS
TY - JOUR
AU - Bartas, Katrina
AU - Derdeyn, Pieter
AU - Tian, Guilian
AU - Vasquez, Jose J
AU - Azouz, Ghalia
AU - Yamamoto, Cindy M
AU - Hui, May
AU - Beier, Kevin T
TI - Drug-induced changes in connectivity to midbrain dopamine cells revealed by rabies monosynaptic tracing
T2 - eLife
J2 - Elife
PY - 2026
DA - 2026/
VL - 13
SP - RP93664
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.7554/
"type": "article-journal",
"title": "Drug-induced changes in connectivity to midbrain dopamine cells revealed by rabies monosynaptic tracing",
"container-title": "eLife",
"author": [
{
"family": "Bartas",
"given": "Katrina"
},
{
"family": "Derdeyn",
"given": "Pieter"
},
{
"family": "Tian",
"given": "Guilian"
},
{
"family": "Vasquez",
"given": "Jose J"
},
{
"family": "Azouz",
"given": "Ghalia"
},
{
"family": "Yamamoto",
"given": "Cindy M"
},
{
"family": "Hui",
"given": "May"
},
{
"family": "Beier",
"given": "Kevin T"
}
],
"container-title-short":
"volume": "13",
"page": "RP93664",
"DOI": "10.7554/
"PMID": "42138352",
"PMCID": "PMC13179063",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
15
]
]
}
}
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.1038/s41467-026-76939-w [code]
- HIPPIE: a generative model for electrophysiological analysis across species, technologies, and modalities.Journal: Nature communicationsIn common: AllenSDK, UMAP, cowplot, 10 other tools, mouse
- [2] doi:10.1002/advs.202521254 [code]
- Persistently Increased Expression of PKMzeta and Unbiased Gene Expression Profiles Identify Hippocampal Molecular Traces of a Long-Term Active Place Avoidance Memory and "Shadow" Proteins.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: UMAP, cowplot, statsmodels, 8 other tools, cellular / molecular, 2 references
- [3] doi:10.1016/j.xcrm.2026.102766 [code]
- A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.Journal: Cell reports. MedicineIn common: tifffile, UMAP, cowplot, 9 other tools, other condition, cellular / molecular
- [4] doi:10.1038/s41467-026-71357-4 [code]
- Social reward outcompetes drug seeking dopaminergic ensembles to prevent relapse.Journal: Nature communicationsIn common: SciPy, Matplotlib, NumPy, other condition, 7 references
- [5] doi:10.1186/s13059-026-04177-w [code]
- Genomic sequence evolution underlying human neocortical interareal diversification.Journal: Genome biologyIn common: AllenSDK, UMAP, Pillow, 8 other tools, mouse, cellular / molecular
- [6] doi:10.1038/s42003-026-10957-8 [code]
- Brain defence by the extracellular matrix protein Cochlin.Journal: Communications biologyIn common: UMAP, Pillow, statsmodels, 8 other tools, mouse, cellular / molecular, 1 reference
- [7] doi:10.1038/s41467-026-75723-0 [code]
- Spatial transcriptomics reveals distinct cell type dynamics following opioid dependence in female mice with the common human μ-opioid receptor variant Oprm1 A118G.Journal: Nature communicationsIn common: AllenSDK, ggplot2, tidyverse, 5 other tools, other condition, mouse, cellular / molecular, 2 references
- [8] doi:10.1038/s41586-026-10629-x [code]
- Whole-genome duplication shaped cell-type evolution in the vertebrate brain.Journal: NatureIn common: UMAP, cowplot, statsmodels, 8 other tools, mouse, cellular / molecular
- [9] doi:10.1038/s41593-026-02253-9 [code]
- Genoarchitecture and input-output organization of the mouse basal ganglia and thalamic parafascicular nucleus.Journal: Nature neuroscienceIn common: AllenSDK, seaborn, scikit-learn, 4 other tools, mouse, 3 references
- [10] doi:10.1038/s41586-026-10444-4 [code]
- A brain reward circuit inhibited by next-generation weight-loss drugs in mice.Journal: NatureIn common: ggplot2, seaborn, tidyverse, 4 other tools, mouse, author Kevin T Beier
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: 2 repositories of the authors' code, each at its verified commit and with its license, 19 scripts, and 11 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:f9d1536b0a291e4a…
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.
