Load selected astrocytes signalling data estimated using Liana-py and Rank Aggregation method (including CellPhoneDB, CellChat, ICELLNET, connectomeDB2020, and CellTalkDB) for CellChatDB only
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(`Astro_LXN+==>POMC neurons`, `Astro_LXN-==>POMC neurons`), names_to ="pairs", values_to ="lr_probs") %>%full_join(df_specificity, by =c("pairs", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>POMC neurons", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>POMC neurons", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>POMC neurons", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>POMC neurons", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN+==>POMC neurons"& diff_rank >=0) | (!is.na(lr_probs) & pairs =="Astro_LXN+==>POMC neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN-==>POMC neurons"& diff_rank <=0) | (!is.na(lr_probs) & pairs =="Astro_LXN-==>POMC neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(`Astro_LXN+==>POMC neurons`, `Astro_LXN-==>POMC neurons`), names_to ="pairs", values_to ="lr_probs") %>%full_join(df_specificity, by =c("pairs", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>POMC neurons", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>POMC neurons", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>POMC neurons", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>POMC neurons", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN+==>POMC neurons"& diff_rank >=0) | (!is.na(lr_probs) & pairs =="Astro_LXN+==>POMC neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN-==>POMC neurons"& diff_rank <=0) | (!is.na(lr_probs) & pairs =="Astro_LXN-==>POMC neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)
How do latexin positive or negative astrocytes coupled with AGRP/NPY neurons?
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(`Astro_LXN+==>AGRP/NPY neurons`, `Astro_LXN-==>AGRP/NPY neurons`), names_to ="pairs", values_to ="lr_probs") %>%full_join(df_specificity, by =c("pairs", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>AGRP/NPY neurons", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>AGRP/NPY neurons", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>AGRP/NPY neurons", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>AGRP/NPY neurons", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN+==>AGRP/NPY neurons"& diff_rank >=0) | (!is.na(lr_probs) & pairs =="Astro_LXN+==>AGRP/NPY neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN-==>AGRP/NPY neurons"& diff_rank <=0) | (!is.na(lr_probs) & pairs =="Astro_LXN-==>AGRP/NPY neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(`Astro_LXN+==>AGRP/NPY neurons`, `Astro_LXN-==>AGRP/NPY neurons`), names_to ="pairs", values_to ="lr_probs") %>%full_join(df_specificity, by =c("pairs", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>AGRP/NPY neurons", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>AGRP/NPY neurons", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>AGRP/NPY neurons", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>AGRP/NPY neurons", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN+==>AGRP/NPY neurons"& diff_rank >=0) | (!is.na(lr_probs) & pairs =="Astro_LXN+==>AGRP/NPY neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN-==>AGRP/NPY neurons"& diff_rank <=0) | (!is.na(lr_probs) & pairs =="Astro_LXN-==>AGRP/NPY neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)
Lutomska 2022
Signalling pairs
How do latexin positive or negative astrocytes coupled with POMC neurons?
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(`Astro_LXN+==>POMC neurons`, `Astro_LXN-==>POMC neurons`), names_to ="pairs", values_to ="lr_probs") %>%full_join(df_specificity, by =c("pairs", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>POMC neurons", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>POMC neurons", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>POMC neurons", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>POMC neurons", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN+==>POMC neurons"& diff_rank >=0) | (!is.na(lr_probs) & pairs =="Astro_LXN+==>POMC neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN-==>POMC neurons"& diff_rank <=0) | (!is.na(lr_probs) & pairs =="Astro_LXN-==>POMC neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(`Astro_LXN+==>POMC neurons`, `Astro_LXN-==>POMC neurons`), names_to ="pairs", values_to ="lr_probs") %>%full_join(df_specificity, by =c("pairs", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>POMC neurons", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>POMC neurons", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>POMC neurons", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>POMC neurons", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN+==>POMC neurons"& diff_rank >=0) | (!is.na(lr_probs) & pairs =="Astro_LXN+==>POMC neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN-==>POMC neurons"& diff_rank <=0) | (!is.na(lr_probs) & pairs =="Astro_LXN-==>POMC neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)
How do latexin positive or negative astrocytes coupled with AGRP/NPY neurons?
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(`Astro_LXN+==>AGRP/NPY neurons`, `Astro_LXN-==>AGRP/NPY neurons`), names_to ="pairs", values_to ="lr_probs") %>%full_join(df_specificity, by =c("pairs", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>AGRP/NPY neurons", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>AGRP/NPY neurons", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>AGRP/NPY neurons", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>AGRP/NPY neurons", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN+==>AGRP/NPY neurons"& diff_rank >=0) | (!is.na(lr_probs) & pairs =="Astro_LXN+==>AGRP/NPY neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN-==>AGRP/NPY neurons"& diff_rank <=0) | (!is.na(lr_probs) & pairs =="Astro_LXN-==>AGRP/NPY neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(`Astro_LXN+==>AGRP/NPY neurons`, `Astro_LXN-==>AGRP/NPY neurons`), names_to ="pairs", values_to ="lr_probs") %>%full_join(df_specificity, by =c("pairs", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>AGRP/NPY neurons", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>AGRP/NPY neurons", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN+==>AGRP/NPY neurons", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( pairs =="Astro_LXN-==>AGRP/NPY neurons", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = pairs, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN+==>AGRP/NPY neurons"& diff_rank >=0) | (!is.na(lr_probs) & pairs =="Astro_LXN+==>AGRP/NPY neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (pairs =="Astro_LXN-==>AGRP/NPY neurons"& diff_rank <=0) | (!is.na(lr_probs) & pairs =="Astro_LXN-==>AGRP/NPY neurons"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)
ARC vs PVN (Lopez)
Signalling pairs
How do latexin positive or negative astrocytes coupled with POMC neurons?
df_specificity <- df_complex_conditions %>%filter( pairs =="Astro_LXN+==>POMC neurons", condition %in%c("CSDS", "HFHSD"), control ==TRUE ) %>%mutate(neg_log10_specificity_rank =-log10(specificity_rank),lr_complex =str_c(ligand_complex, receptor_complex, sep ="–>") ) %>%select(region, lr_complex, ligand_complex, receptor_complex, neg_log10_specificity_rank, control)# Reshape the dataframe to a wider formatdf_wide <- df %>%pivot_wider(names_from = region, values_from = lr_probs)# Calculate the difference and categorize itdf_wide <- df_wide %>%mutate(diff_rank =`PVN`-`ARC`) %>%mutate(diff_category =ifelse(abs(diff_rank) >0.002|is.na(abs(diff_rank)), "big difference", "small difference"))df_wide
Code
skim(df_wide)
Data summary
Name
df_wide
Number of rows
103
Number of columns
8
_______________________
Column type frequency:
character
4
logical
1
numeric
3
________________________
Group variables
None
Variable type: character
skim_variable
n_missing
complete_rate
min
max
empty
n_unique
whitespace
lr_complex
0
1
8
27
0
103
0
ligand_complex
0
1
3
7
0
31
0
receptor_complex
0
1
3
19
0
60
0
diff_category
0
1
14
16
0
2
0
Variable type: logical
skim_variable
n_missing
complete_rate
mean
count
control
0
1
1
TRU: 103
Variable type: numeric
skim_variable
n_missing
complete_rate
mean
sd
p0
p25
p50
p75
p100
hist
PVN
38
0.63
0.02
0.04
0.00
0.00
0.01
0.02
0.26
▇▁▁▁▁
ARC
19
0.82
0.02
0.05
0.00
0.00
0.01
0.02
0.29
▇▁▁▁▁
diff_rank
57
0.45
-0.01
0.02
-0.09
-0.02
-0.01
0.00
0.02
▁▁▁▇▁
Code
# Reshape the dataframe back to a long formatdf_long <- df_wide %>%pivot_longer(cols =c(ARC, PVN), names_to ="region", values_to ="lr_probs") %>%full_join(df_specificity, by =c("region", "lr_complex", "ligand_complex", "receptor_complex", "control"))df_long
# Generate the plotpr <-ggplot(df_long, aes(x = region, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpr <- pr +geom_text_repel(data = top_bot_10 %>%filter( region =="PVN", diff_rank >=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( region =="ARC", diff_rank <=0 ),aes(label = receptor_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pr)
Code
pl <-ggplot(df_long, aes(x = region, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelpl <- pl +geom_text_repel(data = top_bot_10 %>%filter( region =="PVN", diff_rank >=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( region =="ARC", diff_rank <=0 ),aes(label = ligand_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(pl)
Code
plr <-ggplot(df_long, aes(x = region, y = lr_probs, color =as.factor(diff_category), size = neg_log10_specificity_rank)) +geom_jitter(width =0.05) +geom_line(aes(group = lr_complex), linetype ="solid", alpha =0.2) +theme_minimal() +theme(axis.text.x =element_text(angle =90, vjust =0.5, hjust =1)) +facet_wrap(~diff_category)# Add text labels for min and max 5 values within each group using ggrepelplr <- plr +geom_text_repel(data = top_bot_10 %>%filter( (region =="PVN"& diff_rank >=0) | (!is.na(lr_probs) & region =="PVN"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =0.2, direction ="y", hjust ="left",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +geom_text_repel(data = top_bot_10 %>%filter( (region =="ARC"& diff_rank <=0) | (!is.na(lr_probs) & region =="ARC"&is.na(diff_rank)) ),aes(label = lr_complex,point.size = neg_log10_specificity_rank ), # data point sizenudge_x =-.2, direction ="y", hjust ="right",size =6, # font size in the text labelspoint.padding =0.2, # additional padding around each pointmin.segment.length =0, # draw all line segmentsmax.time =5, max.iter =1e6, # stop after 1 second, or after 100,000 iterationsseed = reseed,max.overlaps =Inf,box.padding =0.5) +scale_x_discrete(expand =expansion(add =2))print(plr)