Last updated: 2022-10-26

Checks: 7 0

Knit directory: Williams_Retina_scRNA_IMPG2_workflowr/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20221026) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 9ed74d3. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Unstaged changes:
    Modified:   README.md
    Deleted:    code/README.md
    Deleted:    data/README.md
    Deleted:    output/README.md

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/Peng_macaque_retina_summarized_IMPG1-2_expression_boxplots.Rmd) and HTML (docs/Peng_macaque_retina_summarized_IMPG1-2_expression_boxplots.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 9ed74d3 jeremymsimon 2022-10-26 Initial commit
html 146a845 jeremymsimon 2022-10-26 Build site.
Rmd 69977d1 jeremymsimon 2022-10-26 Initial commit

Data acquisition

Single-cell RNA-seq data from the 3-9yo macaque retina corresponding to Peng et al 2019 were retrieved from the Broad single-cell portal. Below we additionally annotate the cluster numbers into named cell types based on the information provided in the supplied metadata file

Data were downloaded as follows

curl "https://singlecell.broadinstitute.org/single_cell/api/v1/bulk_download/generate_curl_config?accessions=SCP212&auth_code=Z2Yow3ap&directory=all&context=study"  -o cfg.txt; curl -K cfg.txt && rm cfg.$

Analysis of IMPG1 and IMPG2 expression in retinal cell types

Filter expression matrices for IMPG1 and IMPG2 expression

grep -E 'GENE|IMPG1|IMPG2' Macaque_fov_AC_expression2.txt > Macaque_fov_AC_expression2_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_fov_BC_expression.txt > Macaque_fov_BC_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_fov_EpiImmune_expression.txt > Macaque_fov_EpiImmune_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_fov_HC_expression.txt > Macaque_fov_HC_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_fov_PR_expression.txt > Macaque_fov_PR_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_fov_RGC_expression.txt > Macaque_fov_RGC_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_per_AC_expression.txt > Macaque_per_AC_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_per_BC_expression2.txt > Macaque_per_BC_expression2_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_per_EpiImmune_expression.txt > Macaque_per_EpiImmune_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_per_HC_expression.txt > Macaque_per_HC_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_per_PR_expression.txt > Macaque_per_PR_expression_IMPG1_IMPG2.txt
grep -E 'GENE|IMPG1|IMPG2' Macaque_per_RGC_expression.txt > Macaque_per_RGC_expression_IMPG1_IMPG2.txt

Load libraries

suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(cowplot))

Import metadata

Categories are modeled after Fig. 1C in the paper, where clusters are summarized by broader categories

meta <- read_csv("Macaque_NN_RGC_AC_BC_HC_PR_metadata_3.txt", col_names=c("CellID","Cluster","Subcluster"), skip=2) %>%
    mutate(CellID = str_replace_all(CellID,"-","."))

Import expression data

Macaque_fov_AC <- read_csv("Macaque_fov_AC_expression2_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    add_column(Category = "Amacrine cells")

Macaque_fov_BC <- read_csv("Macaque_fov_BC_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    add_column(Category = "Bipolar cells")
    
Macaque_fov_EpiImmune <- read_csv("Macaque_fov_EpiImmune_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%    
    mutate(Category = str_replace_all(Cluster, c("MG"="Muller glia", "Mic"="Microglia", "Endo"="Endothelial")))

Macaque_fov_HC <- read_csv("Macaque_fov_HC_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    add_column(Category = "Horizontal cells")

Macaque_fov_PR <- read_csv("Macaque_fov_PR_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    mutate(Category = str_replace_all(Cluster,"M/L Cones|S Cones", "Cones"))

Macaque_fov_RGC <- read_csv("Macaque_fov_RGC_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    add_column(Category = "Retinal ganglion cells")


Macaque_per_AC <- read_csv("Macaque_per_AC_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    add_column(Category = "Amacrine cells")

Macaque_per_BC <- read_csv("Macaque_per_BC_expression2_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    add_column(Category = "Bipolar cells")
    
Macaque_per_EpiImmune <- read_csv("Macaque_per_EpiImmune_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%    
    mutate(Category = str_replace_all(Cluster, c("MG"="Muller glia", "Mic"="Microglia", "Endo"="Endothelial")))

Macaque_per_HC <- read_csv("Macaque_per_HC_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    add_column(Category = "Horizontal cells")

Macaque_per_PR <- read_csv("Macaque_per_PR_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    mutate(Category = str_replace_all(Cluster,"M/L Cones|S Cones", "Cones"))

Macaque_per_RGC <- read_csv("Macaque_per_RGC_expression_IMPG1_IMPG2.txt", name_repair="minimal") %>%
    pivot_longer(cols=!GENE,names_to="CellID",values_to="Expression") %>%
    pivot_wider(names_from=GENE,values_from=Expression) %>%
    mutate(CellID = str_replace_all(CellID,"-",".")) %>%
    inner_join(meta,by="CellID") %>%
    add_column(Category = "Retinal ganglion cells")
macaque_all <- bind_rows(Macaque_fov_AC,Macaque_fov_BC,Macaque_fov_EpiImmune,Macaque_fov_HC,Macaque_fov_PR,Macaque_fov_RGC,Macaque_per_AC,Macaque_per_BC,Macaque_per_EpiImmune,Macaque_per_HC,Macaque_per_PR,Macaque_per_RGC)

Plot boxplots of IMPG1 and IMPG2 expression

Split and color fovea and periphery separately

p1 <- macaque_all %>%
    group_by(Category) %>%
    ggplot(aes(x=reorder(Category,-IMPG2),y=IMPG1,fill=Subcluster)) +
    geom_boxplot(outlier.shape = NA) +
    theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5),legend.position = c(0.7, 0.8)) +
    xlab("Macaque retina cell types") +
    ylab("IMPG1 expression")

p2 <- macaque_all %>%
    group_by(Category) %>%
    ggplot(aes(x=reorder(Category,-IMPG2),y=IMPG2,fill=Subcluster)) +
    geom_boxplot(outlier.shape = NA) +
    theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5),legend.position = c(0.7, 0.8)) +
    xlab("Macaque retina cell types") +
    ylab("IMPG2 expression")

plot_grid(p1,p2)


sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux 8.5 (Ootpa)

Matrix products: default
BLAS/LAPACK: /nas/longleaf/rhel8/apps/r/4.1.0/lib/libopenblas_haswellp-r0.3.5.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] cowplot_1.1.1   forcats_0.5.1   stringr_1.4.0   dplyr_1.0.9    
 [5] purrr_0.3.4     readr_2.1.2     tidyr_1.2.0     tibble_3.1.8   
 [9] ggplot2_3.3.6   tidyverse_1.3.1 workflowr_1.7.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3     lubridate_1.8.0  getPass_0.2-2    ps_1.6.0        
 [5] assertthat_0.2.1 rprojroot_2.0.2  digest_0.6.29    utf8_1.2.2      
 [9] R6_2.5.1         cellranger_1.1.0 backports_1.4.1  reprex_2.0.1    
[13] evaluate_0.15    highr_0.9        httr_1.4.2       pillar_1.7.0    
[17] rlang_1.0.4      readxl_1.3.1     rstudioapi_0.13  whisker_0.4     
[21] callr_3.7.0      jquerylib_0.1.4  rmarkdown_2.12   labeling_0.4.2  
[25] bit_4.0.4        munsell_0.5.0    broom_1.0.0      compiler_4.1.0  
[29] httpuv_1.6.5     modelr_0.1.8     xfun_0.30        pkgconfig_2.0.3 
[33] htmltools_0.5.2  tidyselect_1.1.2 fansi_1.0.3      withr_2.5.0     
[37] crayon_1.5.1     tzdb_0.2.0       dbplyr_2.1.1     later_1.3.0     
[41] grid_4.1.0       jsonlite_1.8.0   gtable_0.3.0     lifecycle_1.0.1 
[45] DBI_1.1.2        git2r_0.30.1     magrittr_2.0.2   scales_1.2.0    
[49] vroom_1.5.7      cli_3.3.0        stringi_1.7.6    farver_2.1.0    
[53] fs_1.5.2         promises_1.2.0.1 xml2_1.3.3       bslib_0.3.1     
[57] ellipsis_0.3.2   generics_0.1.2   vctrs_0.4.1      tools_4.1.0     
[61] bit64_4.0.5      glue_1.6.2       hms_1.1.1        parallel_4.1.0  
[65] processx_3.5.2   fastmap_1.1.0    yaml_2.3.5       colorspace_2.0-3
[69] rvest_1.0.2      knitr_1.37       haven_2.4.3      sass_0.4.0