Skip to content

Commit e50f8a1

Browse files
committed
add Deepcover MoA proteomics data
1 parent 4a4b7c3 commit e50f8a1

2 files changed

Lines changed: 170 additions & 13 deletions

File tree

appyters/Drug_Gene_Budger2/appyter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://raw.githubusercontent.com/MaayanLab/appyter-catalog/main/schema/appyter-validator.json",
33
"name": "Drug_Gene_Budger2",
44
"title": "Dr. Gene Budger (DGB) 2",
5-
"version": "0.0.6",
5+
"version": "0.0.7",
66
"description": "An appyter that retrieves drugs that up-regulate and down-regulate a single input gene across Connectivity Mapping datasets",
77
"image": "dgb_logo.png",
88
"authors": [

appyters/Drug_Gene_Budger2/drug_gene_budger2_appyter.ipynb

Lines changed: 169 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@
9595
"id": "7ea9d01d",
9696
"metadata": {},
9797
"source": [
98-
"This notebook takes a gene as input and identifies drugs that maximally up and down regulate the gene's expression in a collection of chemical perturbation datasets.\n",
98+
"This notebook takes a gene as input and identifies drugs that maximally up and down regulate the gene's mRNA expression in a collection of connectivity mapping resources that measure transcriptional response to chemical perturbations:\n",
9999
"\n",
100100
"- Ginkgo GDPx1 and GPDx2: Limma-Voom based differential gene expression results for 1,354 drugs.\n",
101101
"- Novartis DRUG-seq: Differential: Limma-Trend based differential gene expression results for 4,343 drugs. \n",
102102
"- LINCS L1000 Chemical Perturbations: Limma-Voom based differential gene expression results for a subset of 4,091 drugs from the LINCS L1000 Chemical Perturbation dataset. \n",
103103
"\n",
104-
"The Ginkgo dataset includes 4 primary cell types (epithelial melanocytes, smooth aortic muscle cells, skeletal muscle myoblasts and dermal fibroblasts) and one cell line (A549 lung carcinoma cell line). Previous analysis showed distinct transcriptional responses by cell type, so the drug rankings for the Ginkgo dataset are separated by cell type."
104+
"The Ginkgo dataset includes 4 primary cell types (epithelial melanocytes, smooth aortic muscle cells, skeletal muscle myoblasts and dermal fibroblasts) and one cell line (A549 lung carcinoma cell line). Previous analysis showed distinct transcriptional responses by cell type, so the drug rankings for the Ginkgo dataset are separated by cell type.\n",
105+
"\n",
106+
"The Deepcover MoA proteomics dataset is used to present protein-level regulation of the query gene. You can compare protein-level and mRNA-level regulation for compounds used in both the Deepcover MoA and connectivity mapping resources."
105107
]
106108
},
107109
{
@@ -142,10 +144,12 @@
142144
"metadata": {},
143145
"outputs": [],
144146
"source": [
145-
"# Storage url for Ginkgo and Novartis DE files\n",
147+
"# Storage URLs for DE gene files\n",
146148
"ginkgo_URL = 'https://appyters.maayanlab.cloud/storage/DrugRegulators_Appyter/ginkgo_de'\n",
147149
"novartis_URL = 'https://appyters.maayanlab.cloud/storage/DrugRegulators_Appyter/novartis_de'\n",
148150
"lincs_URL = 'https://appyters.maayanlab.cloud/storage/DrugRegulators_Appyter/lincs_de'\n",
151+
"deepcover_moa_URL = 'https://appyters.maayanlab.cloud/storage/DrugRegulators_Appyter/deepcoverMoa_de'\n",
152+
"\n",
149153
"# silence warnings\n",
150154
"warnings.filterwarnings('ignore')"
151155
]
@@ -263,6 +267,33 @@
263267
" raise Exception(\"Execution stopped, gene not found in any datasets\")"
264268
]
265269
},
270+
{
271+
"cell_type": "code",
272+
"execution_count": null,
273+
"id": "5ac47199",
274+
"metadata": {},
275+
"outputs": [],
276+
"source": [
277+
"# Get proteomics data\n",
278+
"in_deepcover = True\n",
279+
"try:\n",
280+
" protein_de = pd.read_feather(f'{deepcover_moa_URL}/{gene_file}').set_index('index')\n",
281+
"except:\n",
282+
" in_deepcover=False"
283+
]
284+
},
285+
{
286+
"cell_type": "code",
287+
"execution_count": null,
288+
"id": "cb86094c",
289+
"metadata": {},
290+
"outputs": [],
291+
"source": [
292+
"# Get pubchem ID dataframe\n",
293+
"pubchem_location = 'https://appyters.maayanlab.cloud/storage/DrugRegulators_Appyter/cmap_pubchem_ids.csv'\n",
294+
"pubchem_ids = pd.read_csv(pubchem_location, dtype = {'Drug':str, 'CID':str})"
295+
]
296+
},
266297
{
267298
"cell_type": "markdown",
268299
"id": "dd12adb9",
@@ -698,13 +729,16 @@
698729
" n_datasets = list()\n",
699730
" for _,row in overlapping_df.iterrows():\n",
700731
" n_datasets.extend([row['N Datasets']]*len(row['Overlap']))\n",
732+
" member_sets = row['Members']\n",
701733
" for d in row['Overlap']:\n",
702734
" n = 0\n",
703735
" runsum_rank = 0\n",
704736
" runsum_pctrank = 0\n",
705737
" runsum_logFC = 0\n",
706738
" runsum_pval = 0\n",
707-
" for _,df in data_dict.items():\n",
739+
" for source_name,df in data_dict.items():\n",
740+
" if not re.search(source_name, member_sets):\n",
741+
" continue\n",
708742
" subset = df[df['Drug'].str.lower() == d.lower()]\n",
709743
" n = n + subset.shape[0]\n",
710744
" runsum_rank = runsum_rank + subset.Rank.sum()\n",
@@ -730,7 +764,20 @@
730764
" else:\n",
731765
" # sort based on N datasets and average adjusted p-value\n",
732766
" res_df = res_df.sort_values(['N Datasets','Avg Adj.P.Val'], ascending=[False,True])\n",
733-
" return res_df"
767+
" return res_df\n",
768+
"\n",
769+
"\n",
770+
"def join_proteomics(ranking_table, protein_de):\n",
771+
" # join with PubChem ID table\n",
772+
" with_cids = ranking_table.merge(pubchem_ids, how='left', on='Drug')\n",
773+
" # Drop those drugs that did not have PubChem IDs\n",
774+
" with_cids = with_cids[with_cids['CID'].notna()]\n",
775+
" # join with proteomics data on PubChem IDs\n",
776+
" with_proteins = with_cids.merge(protein_de[['UniprotID','Pubchem','logFC']], how='inner', left_on='CID', right_on='Pubchem')\n",
777+
" # clean column names\n",
778+
" with_proteins.rename(columns = {'logFC':'Protein logFC', 'Pubchem' : 'PubChem CID'}, inplace=True)\n",
779+
" with_proteins.drop(columns='CID',inplace=True)\n",
780+
" return with_proteins"
734781
]
735782
},
736783
{
@@ -792,6 +839,69 @@
792839
" display(HTML(download_link(overlapping_down_TargetRank, f'overlapping_drugs_averages_{query_gene}_DnReg.tsv')))"
793840
]
794841
},
842+
{
843+
"cell_type": "markdown",
844+
"id": "2aaee19a",
845+
"metadata": {},
846+
"source": [
847+
"### Protein Regulation\n",
848+
"\n",
849+
"Query gene regulation at the protein level is dispalyed in the table below. Proteomics data is from the [Deepcover MoA dataset](https://wren.hms.harvard.edu/DeepCoverMOA/), which exposes cells from the HCT116 cancer cell line to 875 small molecule compounds. "
850+
]
851+
},
852+
{
853+
"cell_type": "code",
854+
"execution_count": null,
855+
"id": "53cc7efd",
856+
"metadata": {},
857+
"outputs": [],
858+
"source": [
859+
"if in_deepcover:\n",
860+
" up_protein = protein_de[protein_de['logFC'] > 0].loc[:,['UniprotID','Drug','Pubchem','logFC','Zscore','UpRank','PctUpRank']].sort_values('logFC',ascending=False).reset_index().drop(columns='index')\n",
861+
" up_protein.rename(columns={'Pubchem':'PubChem CID','Zscore':'Z-score','UpRank':'Up Rank', 'PctUpRank':'Normalized Up Rank'}, inplace=True)\n",
862+
" display_markdown(\"**Up-regulating drugs**\", raw=True)\n",
863+
" display(up_protein.head(top_n))\n",
864+
" display(HTML(download_link(up_protein, f'DeepcoverMoa_protein_{query_gene}_UpReg.tsv')))\n",
865+
"\n",
866+
" dn_protein = protein_de[protein_de['logFC'] < 0].loc[:,['UniprotID','Drug','Pubchem','logFC','Zscore','DnRank','PctDnRank']].sort_values('logFC', ascending=True).reset_index().drop(columns='index')\n",
867+
" dn_protein.rename(columns={'Pubchem':'PubChem CID','Zscore':'Z-score','UpRDnRankank':'Down Rank', 'PctDnRank':'Normalized Down Rank'}, inplace=True)\n",
868+
" display_markdown(\"**Down-regulating drugs**\", raw=True)\n",
869+
" display(dn_protein.head(top_n))\n",
870+
" display(HTML(download_link(dn_protein, f'DeepcoverMoa_protein_{query_gene}_DnReg.tsv')))\n",
871+
"else:\n",
872+
" display_markdown(f\"Protein of {query_gene} not in DeepCover MoA Dataset\", raw=True)"
873+
]
874+
},
875+
{
876+
"cell_type": "markdown",
877+
"id": "a0630a08",
878+
"metadata": {},
879+
"source": [
880+
"If the protein associated with the query gene was found in the Deepcover MoA proteomics dataset, the tables below show how the protein was up or down-regulated by the consensus drugs identified in the connectivity mapping resources. The table only includes compounds that were used in the connectivity mapping resources and the Deepcover MoA dataset. "
881+
]
882+
},
883+
{
884+
"cell_type": "code",
885+
"execution_count": null,
886+
"id": "6b46e327",
887+
"metadata": {},
888+
"outputs": [],
889+
"source": [
890+
"if in_deepcover:\n",
891+
" up_with_cid = join_proteomics(overlapping_up_TargetRank, protein_de)\n",
892+
" dn_with_cid = join_proteomics(overlapping_down_TargetRank, protein_de)\n",
893+
" \n",
894+
" display_markdown(\"**Up-regulating drugs with protein expression**\", raw=True)\n",
895+
" display(up_with_cid.head(n=top_n))\n",
896+
" display(HTML(download_link(up_with_cid, f'{query_gene}_mRNA_protein_UpReg.tsv')))\n",
897+
" \n",
898+
" display_markdown(\"**Down-regulating drugs with protein expression**\", raw=True)\n",
899+
" display(dn_with_cid.head(n=top_n))\n",
900+
" display(HTML(download_link(dn_with_cid, f'{query_gene}_mRNA_protein_DnReg.tsv')))\n",
901+
"else:\n",
902+
" display_markdown(f\"Protein of {query_gene} not in DeepCover MoA Dataset\", raw=True)"
903+
]
904+
},
795905
{
796906
"cell_type": "markdown",
797907
"id": "2e7c13dd",
@@ -954,22 +1064,43 @@
9541064
" df['Label'] = df['Perturbation'] + '_' + df['Drug']\n",
9551065
" elif source == 'L1000':\n",
9561066
" df['Label'] = df['Perturbation']\n",
1067+
" elif source == 'Deepcover MoA':\n",
1068+
" df['Label'] = df['Drug']\n",
1069+
" df['abs_Zscore'] = df['Zscore'].apply(abs)\n",
9571070
"\n",
9581071
" # set plot source\n",
959-
" plot_source = ColumnDataSource(df.loc[:,['Label','logFC','FC','log10adj.P.Val', 'Rank', 'PctRank']])\n",
960-
" x,y='logFC','log10adj.P.Val'\n",
961-
" hover = HoverTool(tooltips=[(\"Label\", \"@Label\"),\n",
1072+
" if source != 'Deepcover MoA':\n",
1073+
" plot_source = ColumnDataSource(df.loc[:,['Label','logFC','FC','log10adj.P.Val', 'Rank', 'PctRank']])\n",
1074+
" x,y='logFC','log10adj.P.Val'\n",
1075+
" xlabel,ylabel = 'Log2(Fold Change)','-Log10(Adj. p-value)'\n",
1076+
" title = f'{gene_id} Regulation in {source} {cell_type}'\n",
1077+
" hover = HoverTool(tooltips=[(\"Label\", \"@Label\"),\n",
9621078
" (\"Log2(FC)\", \"@logFC\"),\n",
9631079
" (\"Fold Change\", \"@FC\"),\n",
9641080
" ('-Log10(Adj. p-value)',\"@{log10adj.P.Val}{0.00e}\"),\n",
9651081
" (\"Raw Rank\", \"@Rank\"),\n",
9661082
" (\"Normalized Rank\", \"@PctRank\")])\n",
1083+
" else:\n",
1084+
" plot_source = ColumnDataSource(df.loc[:,['Label','logFC','FC','abs_Zscore','UpRank','DnRank','PctUpRank','PctDnRank']])\n",
1085+
" x,y = 'logFC','abs_Zscore'\n",
1086+
" xlabel,ylabel = 'Log2(Fold Change)','Abs(Z-score)'\n",
1087+
" title = f'{gene_id}: {df[\"UniprotID\"].iloc[0]} Regulation in {source} {cell_type}'\n",
1088+
" hover = HoverTool(tooltips=[(\"Label\", \"@Label\"),\n",
1089+
" (\"Log2(FC)\", \"@logFC\"),\n",
1090+
" (\"Fold Change\", \"@FC\"),\n",
1091+
" ('abs(z-score)',\"@{abs_Zscore}{0.00e}\"),\n",
1092+
" (\"Up Rank\", \"@UpRank\"),\n",
1093+
" (\"Normalized Up Rank\",\"@PctUpRank\"),\n",
1094+
" (\"Down Rank\", \"@DnRank\"),\n",
1095+
" (\"Normalized Down Rank\",\"@PctDnRank\")])\n",
1096+
"\n",
1097+
" \n",
9671098
" \n",
9681099
" # define figure\n",
9691100
" p = figure(\n",
970-
" title=f'{gene_id} Regulation in {source} {cell_type}',\n",
971-
" x_axis_label = 'Log2(Fold Change)',\n",
972-
" y_axis_label = '-Log10(Adj. p-value)',\n",
1101+
" title=title,\n",
1102+
" x_axis_label = xlabel,\n",
1103+
" y_axis_label = ylabel,\n",
9731104
" tools = 'pan,wheel_zoom,box_zoom,reset,save'\n",
9741105
" )\n",
9751106
"\n",
@@ -1053,6 +1184,30 @@
10531184
" display_markdown(f'**{query_gene}** not found in Novartis DRUG-seq dataset', raw=True)"
10541185
]
10551186
},
1187+
{
1188+
"cell_type": "markdown",
1189+
"id": "8c3df5f5",
1190+
"metadata": {},
1191+
"source": [
1192+
"### Deepcover MoA\n",
1193+
"\n",
1194+
"The Deepcover MoA proteomics dataset consists of proteome fingerprints for 875 chemical perturbations. This volcano plot of protein expression shows the logFC on the x-axis and the absolute difference in standard deviations between the protein's logFC for a given compound and the protein's mean logFC across all compounds on the y-axis. "
1195+
]
1196+
},
1197+
{
1198+
"cell_type": "code",
1199+
"execution_count": null,
1200+
"id": "213d50f5",
1201+
"metadata": {},
1202+
"outputs": [],
1203+
"source": [
1204+
"if in_deepcover:\n",
1205+
" # check for multiple proteins\n",
1206+
" uniprot_ids = list(protein_de['UniprotID'].unique())\n",
1207+
" for uid in uniprot_ids:\n",
1208+
" create_bokeh_volcano_plot(protein_de[protein_de['UniprotID']==uid], query_gene, '', 'Deepcover MoA')"
1209+
]
1210+
},
10561211
{
10571212
"cell_type": "markdown",
10581213
"id": "ba0c6439",
@@ -1070,7 +1225,9 @@
10701225
"\n",
10711226
"[5] “LINCS L1000 Reverse Search.” n.d. Accessed September 5, 2025. https://lincs-reverse-search-dashboard.dev.maayanlab.cloud/.\n",
10721227
"\n",
1073-
"[6] Wang, Zichen, Edward He, Kevin Sani, Kathleen M. Jagodnik, Moshe C. Silverstein, and Avi Ma’ayan. 2019. “Drug Gene Budger (DGB): An Application for Ranking Drugs to Modulate a Specific Gene Based on Transcriptomic Signatures.” Bioinformatics (Oxford, England) 35 (7): 1247–48."
1228+
"[6] Wang, Zichen, Edward He, Kevin Sani, Kathleen M. Jagodnik, Moshe C. Silverstein, and Avi Ma’ayan. 2019. “Drug Gene Budger (DGB): An Application for Ranking Drugs to Modulate a Specific Gene Based on Transcriptomic Signatures.” Bioinformatics (Oxford, England) 35 (7): 1247–48.\n",
1229+
"\n",
1230+
"[7] Mitchell, Dylan C., Miljan Kuljanin, Jiaming Li, Jonathan G. Van Vranken, Nathan Bulloch, Devin K. Schweppe, Edward L. Huttlin, and Steven P. Gygi. 2023. “A Proteome-Wide Atlas of Drug Mechanism of Action.” Nature Biotechnology 41 (6): 845–57."
10741231
]
10751232
}
10761233
],

0 commit comments

Comments
 (0)