Last updated: 2022-01-06

Checks: 4 3

Knit directory: MS_lesions/

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


The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

The global environment had objects present when the code in the R Markdown file was run. These objects 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. Use wflow_publish or wflow_build to ensure that the code is always run in an empty environment.

The following objects were defined in the global environment when these results were created:

Name Class Size
q function 1008 bytes

The command set.seed(20210118) 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.

The following chunks had caches available:
  • calc_ancom_bootstraps
  • calc_ancom_neuron_nagm
  • calc_ancom_neuron_subspaces
  • calc_ancom_standard
  • calc_gm_layer_pcs
  • calc_gm_wide_pcs
  • calc_lrts_pcs
  • calc_lrts_std
  • calc_pcs_coefs
  • calc_wide_dt
  • combine_results
  • load_ancom_bootstraps
  • load_ancom_neuron_subspaces
  • load_ancom_standard
  • load_conos
  • plot_barplots_oligos
  • plot_bootstrap_vs_standard
  • plot_bootstraps_all_coefs
  • plot_bootstraps_lesions
  • plot_bootstraps_lesions_signif
  • plot_clr_pca_neurons
  • plot_effect_of_pcs_lesions
  • plot_effect_of_pcs_neurons
  • plot_effect_of_pcs_rest
  • plot_heatmaps_clr
  • plot_heatmaps_log_p_neurons
  • plot_layer_var_exp
  • plot_lrt_results
  • plot_no_gpr17_cells
  • plot_patients_over_pcs
  • plot_propns_layers
  • plot_sample_splits_clrs_oligos
  • plot_standard_all_coefs
  • plot_standard_lesions
  • plot_wm_vs_gm
  • remove_weird_samples
  • save_pseudobulk_w_pcs
  • session_info
  • session-info-chunk-inserted-by-workflowr
  • setup_input
  • setup_outputs

To ensure reproducibility of the results, delete the cache directory ms09_ancombc_mixed_cache and re-run the analysis. To have workflowr automatically delete the cache directory prior to building the file, set delete_cache = TRUE when running wflow_build() or wflow_publish().

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 388261f. 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:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rprofile
    Ignored:    .Rproj.user/
    Ignored:    ._MS_lesions.sublime-project
    Ignored:    ._test_heatmap.png
    Ignored:    .log/
    Ignored:    MS_lesions.sublime-project
    Ignored:    MS_lesions.sublime-workspace
    Ignored:    analysis/.__site.yml
    Ignored:    analysis/fig_muscat_cache/
    Ignored:    analysis/ms00_manuscript_figures_cache/
    Ignored:    analysis/ms02_doublet_id_cache/
    Ignored:    analysis/ms03_SampleQC_cache/
    Ignored:    analysis/ms04_conos_cache/
    Ignored:    analysis/ms05_splitting_cache/
    Ignored:    analysis/ms06_sccaf_cache/
    Ignored:    analysis/ms07_soup_cache/
    Ignored:    analysis/ms08_modules_cache/
    Ignored:    analysis/ms08_modules_pseudobulk_cache/
    Ignored:    analysis/ms09_ancombc_cache/
    Ignored:    analysis/ms09_ancombc_clean_1e3_cache/
    Ignored:    analysis/ms09_ancombc_clean_2e3_cache/
    Ignored:    analysis/ms09_ancombc_mixed_cache/
    Ignored:    analysis/ms10_muscat_run01_cache/
    Ignored:    analysis/ms10_muscat_run02_cache/
    Ignored:    analysis/ms10_muscat_template_broad_slim_cache/
    Ignored:    analysis/ms10_muscat_template_fine_slim_cache/
    Ignored:    analysis/ms11_paga_cache/
    Ignored:    analysis/ms11_paga_superclean_cache/
    Ignored:    analysis/ms12_markers_cache/
    Ignored:    analysis/ms13_labelling_cache/
    Ignored:    analysis/ms14_lesions_cache/
    Ignored:    analysis/ms15_mofa_sample_gm_cache/
    Ignored:    analysis/ms15_mofa_sample_gm_final_meta_cache/
    Ignored:    analysis/ms15_mofa_sample_gm_superclean_cache/
    Ignored:    analysis/ms15_mofa_sample_gm_w_layers_final_meta_cache/
    Ignored:    analysis/ms15_mofa_sample_wm_cache/
    Ignored:    analysis/ms15_mofa_sample_wm_final_meta_cache/
    Ignored:    analysis/ms15_mofa_sample_wm_new_meta_cache/
    Ignored:    analysis/ms15_mofa_sample_wm_superclean_cache/
    Ignored:    analysis/ms15_patients_cache/
    Ignored:    analysis/ms15_patients_gm_cache/
    Ignored:    analysis/ms15_patients_sample_level_cache/
    Ignored:    analysis/ms15_patients_w_ms_cache/
    Ignored:    analysis/supp06_sccaf_cache/
    Ignored:    analysis/supp07_superclean_check_cache/
    Ignored:    analysis/supp09_ancombc_cache/
    Ignored:    analysis/supp09_ancombc_mixed_cache/
    Ignored:    analysis/supp09_ancombc_rowitch_cache/
    Ignored:    analysis/supp09_ancombc_superclean_cache/
    Ignored:    analysis/supp10_muscat_cache/
    Ignored:    analysis/supp10_muscat_ctrl_gm_vs_wm_cache/
    Ignored:    analysis/supp10_muscat_gm_layers_effects_cache/
    Ignored:    analysis/supp10_muscat_gsea_cache/
    Ignored:    analysis/supp10_muscat_heatmaps_cache/
    Ignored:    analysis/supp10_muscat_olg_pc1_cache/
    Ignored:    analysis/supp10_muscat_olg_pc2_cache/
    Ignored:    analysis/supp10_muscat_olg_pc_cache/
    Ignored:    analysis/supp10_muscat_regression_cache/
    Ignored:    analysis/supp10_muscat_soup_cache/
    Ignored:    analysis/supp10_muscat_soup_mito_cache/
    Ignored:    code/._ms10_muscat_fns_recover.R
    Ignored:    code/.recovery/
    Ignored:    code/jobs/._muscat_run09_2021-10-11.slurm
    Ignored:    code/muscat_plan.txt
    Ignored:    data/
    Ignored:    figures/
    Ignored:    output/
    Ignored:    tmp/

Untracked files:
    Untracked:  analysis/ms11_paga_recalc.Rmd
    Untracked:  analysis/supp09_ancombc_superclean.Rmd
    Untracked:  code/dev_dheeraj_oligo_dotplots_2021-12-08.R
    Untracked:  code/dev_magma_de_heatmaps_2021-12-03.R
    Untracked:  code/dev_plot_dotplot_sel_genes_2021-12-21.R
    Untracked:  code/dev_plot_fcs_selected_genes_2021-12-09.R
    Untracked:  code/jobs/muscat_run20_2021-12-07.slurm
    Untracked:  test_heatmap.png

Unstaged changes:
    Modified:   analysis/fig_muscat.Rmd
    Modified:   analysis/ms09_ancombc_mixed.Rmd
    Modified:   analysis/ms13_labelling.Rmd
    Modified:   analysis/ms14_lesions.Rmd
    Modified:   analysis/ms15_mofa_sample_wm_superclean.Rmd
    Modified:   analysis/supp07_superclean_check.Rmd
    Modified:   code/dev_de_w_contamation_2021-10-25.R
    Modified:   code/dev_edger_on_mofa_20210804.R
    Modified:   code/fig_muscat.R
    Modified:   code/ms04_conos.R
    Modified:   code/ms09_ancombc_mixed.R
    Modified:   code/ms14_lesions.R
    Modified:   code/supp07_superclean.R
    Modified:   code/supp10_muscat.R

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/ms09_ancombc_mixed.Rmd) and HTML (public/ms09_ancombc_mixed.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 afba18d wmacnair 2021-12-20 Add more plots to ms00_manuscript_figures
html afba18d wmacnair 2021-12-20 Add more plots to ms00_manuscript_figures
Rmd 8364a6f wmacnair 2021-12-13 Regress out layer PCs in GM CLR plots
html 8364a6f wmacnair 2021-12-13 Regress out layer PCs in GM CLR plots
Rmd 54bd2e9 wmacnair 2021-12-08 Add sex to CLR heatmaps in ms09_ancombc_mixed
html 54bd2e9 wmacnair 2021-12-08 Add sex to CLR heatmaps in ms09_ancombc_mixed
Rmd 97aa6f8 wmacnair 2021-12-08 Tweak oligo barplots to include patient IDs
html 97aa6f8 wmacnair 2021-12-08 Tweak oligo barplots to include patient IDs
Rmd 9ee5eee wmacnair 2021-12-08 Add oligo groupings to ms09_ancombc_mixed CLR plots
html 9ee5eee wmacnair 2021-12-08 Add oligo groupings to ms09_ancombc_mixed CLR plots
Rmd 315cf3b wmacnair 2021-12-08 Tidy up ms09_ancombc_mixed.Rmd
html 315cf3b wmacnair 2021-12-08 Tidy up ms09_ancombc_mixed.Rmd
Rmd 47a3ec8 wmacnair 2021-12-08 Add oligo barplots to ms09_ancombc_mixed.Rmd
html 47a3ec8 wmacnair 2021-12-08 Add oligo barplots to ms09_ancombc_mixed.Rmd
Rmd 1f4bea5 wmacnair 2021-11-29 Fix plot bug in ms09_ancombc_mixed
html 1f4bea5 wmacnair 2021-11-29 Fix plot bug in ms09_ancombc_mixed
Rmd 270e5fc wmacnair 2021-11-26 Add signif_only option to ANCOM-BC plots
html 270e5fc wmacnair 2021-11-26 Add signif_only option to ANCOM-BC plots
html 7fb1b95 wmacnair 2021-11-25 Host with GitLab.
Rmd 8b7ce6e Macnair 2021-11-24 Final update to ANCOM-BC analysis, including layer PCs
Rmd afe32c6 Macnair 2021-11-16 Final version of ANCOM-BC analysis
Rmd 8d1ece6 Macnair 2021-10-28 Update ms09_ancombc_mixed with paired analysis
Rmd a73a2fa Macnair 2021-10-23 Update ANCOM bootstrapping analysis

Setup / definitions

Libraries

Helper functions

source('code/ms00_utils.R')
source('code/ms04_conos.R')
source('code/ms07_soup.R')
source('code/ms09_ancombc_mixed.R')

Inputs

# define run
labels_f    = 'data/byhand_markers/validation_markers_2021-05-31.csv'
labelled_f  = 'output/ms13_labelling/conos_labelled_2021-05-31.txt.gz'
meta_f      = "data/metadata/metadata_checked_assumptions_2021-10-08.xlsx"

# define pseudobulk data
soup_dir    = 'output/ms07_soup'
pb_broad_f  = file.path(soup_dir, 'pb_sum_broad_2021-10-11.rds')
pb_fine_f   = file.path(soup_dir, 'pb_sum_fine_2021-10-11.rds')
pb_f_ls     = c(broad = pb_broad_f, fine = pb_fine_f)

# celltype proportions data
prop_fine_f = file.path(soup_dir, 'pb_prop_fine_2021-10-11.rds')

Outputs

# where to save?
save_dir    = 'output/ms09_ancombc'
date_tag    = '2021-11-12'
if (!dir.exists(save_dir))
    dir.create(save_dir)

# sample variables
sample_vars = c('sample_id', 'matter', 'lesion_type', 
  'neuro_ok', 'neuro_prop', 'sample_source', 'subject_id', 
  'sex', 'age_scale', 'pmi_cat', 'pmi_cat2')

# identifying strange samples
neuro_mad_cut = 2
log_n_mad_cut = 3

# define how to select PCs
cut_var_exp   = 0.01
cut_layer_cor = 0.2

# define WM data
wm_spec     = list(
  name        = 'lesions_WM',
  subset      = list(matter = 'WM', neuro_ok = TRUE),
  size        = list(min_count = 10, min_prop = 0.1),
  exc_regex   = '^(Ex_|Inh_|Neuro_oligo)',
  formula     = '~ lesion_type + sex + age_scale + pmi_cat',
  fixef_test  = 'lesion_type',
  fixef_covar = c('sex', 'age_scale', 'pmi_cat'),
  ranef_var   = 'subject_id'
)
gm_spec     = list(
  name        = 'lesions_GM',
  subset      = list(matter = 'GM', neuro_ok = TRUE),
  size        = list(min_count = 10, min_prop = 0.1),
  exc_regex   = NULL,
  formula     = '~ lesion_type + sex + age_scale + pmi_cat2',
  fixef_test  = 'lesion_type',
  fixef_covar = c('sex', 'age_scale', 'pmi_cat2'),
  ranef_var   = 'subject_id'
)

# define multiple different ways to do subspaces
gm_pc_spec  = list(
  name_str    = 'lesions_GM_',
  subset      = list(matter = 'GM', neuro_ok = TRUE),
  size        = list(min_count = 10, min_prop = 0.1),
  exc_regex   = NULL,
  formula_pat = '~ lesion_type + %s + sex + age_scale + pmi_cat2',
  fixef_test  = 'lesion_type',
  fixef_covar = c('sex', 'age_scale', 'pmi_cat2'),
  ranef_var   = 'subject_id',
  broad_sel   = c("Excitatory neurons", "Inhibitory neurons"),
  lesion_ctrl = "GM",
  n_pcs       = NA
)

# define multiple different ways to do subspaces
nagm_pc_spec  = list(
  name_str    = 'lesions_NAGM_',
  subset      = list(matter = 'GM', neuro_ok = TRUE),
  size        = list(min_count = 10, min_prop = 0.1),
  exc_regex   = NULL,
  formula_pat = '~ lesion_type + %s + sex + age_scale + pmi_cat2',
  fixef_test  = 'lesion_type',
  fixef_covar = c('sex', 'age_scale', 'pmi_cat2'),
  ranef_var   = 'subject_id',
  broad_sel   = c("Excitatory neurons", "Inhibitory neurons"),
  lesion_ctrl = "GM",
  n_pcs       = NA
)

# gather things
spec_list         = list(wm_spec, gm_spec)
names(spec_list)  = sapply(spec_list, function(l) l$name)

# bootstrapping parameters
n_boots     = 2e4
n_cores     = 24

# define files for saving outputs
lrt_pat     = file.path(save_dir, 'abundance_nb_lrt_model_%s_%s.rds')
clr_pat     = file.path(save_dir, 'clr_clustering_%s_%s.txt')
ancom_pat   = file.path(save_dir, 'ancombc_standard_%s_%s.rds')
boots_pat   = file.path(save_dir, 'ancombc_bootstrap_%s_%s.txt.gz')

# define files for saving outputs
pb_pcs_ls   = c(
  broad = sprintf('%s/pb_gm_w_pcs_sum_broad_%s.rds', soup_dir, date_tag),
  fine  = sprintf('%s/pb_gm_w_pcs_sum_fine_%s.rds', soup_dir, date_tag)
  )

# define parameters for CLR plots
sel_types   = c('OPCs / COPs', 'Oligodendrocytes')
min_cells   = 50
olg_grps_f  = 'data/metadata/oligo_groupings.txt'

# params for plotting GPR17 cell abundances
sel_g       = "GPR17"

Load inputs

meta_dt     = load_meta_dt_from_xls(meta_f)
labels_dt   = load_names_dt(labels_f) %>%
  .[, cluster_id := type_fine]
conos_dt    = load_labelled_dt(labelled_f, labels_f) %>%
  merge(meta_dt, by = 'sample_id') %>%
  add_neuro_props(mad_cut = neuro_mad_cut)
# check for any outliers
size_chks   = calc_size_outliers(conos_dt, mad_cut = log_n_mad_cut)
message("these samples excluded to outlier sample sizes:")
these samples excluded to outlier sample sizes:
print(size_chks[ size_ok == FALSE ])
   matter sample_id   N med_log_N mad_log_N size_ok
1:     GM     EU034 911  8.519391  0.423111   FALSE
2:     GM     EU043 687  8.519391  0.423111   FALSE
# exclude them from conos
ok_samples  = size_chks[ size_ok == TRUE]$sample_id
conos_dt    = conos_dt[ (sample_id %in% ok_samples) & (neuro_ok == TRUE) ]
props_dt    = calc_props_dt(conos_dt, sample_vars)
wide_dt     = calc_counts_wide(props_dt, sample_vars)
# get neuronal proportions for all samples
props_neu   = conos_dt %>%
  .[ (type_broad %in% gm_pc_spec$broad_sel) ] %>% 
  calc_props_dt(sample_vars)

# calc PCAs
ctrl_pcs_dt = props_neu %>% 
  .[ lesion_type == gm_pc_spec$lesion_ctrl ] %>%
  calc_ctrl_pcs_dt(layers_dt)
# apply pcs
all_pcs_dt  = apply_ctrl_pcs(props_neu[ matter == "GM" ], ctrl_pcs_dt, 
  cut_var_exp, cut_layer_cor)
wide_neu    = merge(all_pcs_dt, wide_dt, 'sample_id')
pc_vars     = str_subset(names(wide_neu), "ctrl_PC")

Processing / calculations

# negative-binomial model on unadjusted counts, WM
nb_wm_f     = sprintf(lrt_pat, wm_spec$name, date_tag)
if (file.exists(nb_wm_f)) {
  nb_wm_ls    = readRDS(nb_wm_f)
} else {
  nb_wm_ls    = calc_celltype_mixed_models(wide_dt, sample_vars,
    wm_spec$subset, wm_spec$size, wm_spec$exc_regex, wm_spec$inc_regex,
    wm_spec$fixef_test, wm_spec$fixef_covar, wm_spec$ranef_var, 
    n_cores = n_cores, offset_var = NULL)
  saveRDS(nb_wm_ls, file = nb_wm_f)  
}

# negative-binomial model on unadjusted counts, GM
nb_gm_f     = sprintf(lrt_pat, gm_spec$name, date_tag)
if (file.exists(nb_gm_f)) {
  nb_gm_ls    = readRDS(nb_gm_f)
} else {
  nb_gm_ls    = calc_celltype_mixed_models(wide_dt, sample_vars,
    gm_spec$subset, gm_spec$size, gm_spec$exc_regex, gm_spec$inc_regex,
    gm_spec$fixef_test, gm_spec$fixef_covar, gm_spec$ranef_var, 
    n_cores = n_cores, offset_var = NULL)
  saveRDS(nb_gm_ls, file = nb_gm_f)  
}
# make spec
for (n_pcs in seq_along(pc_vars)) {
  # which PCs?
  layer_spec  = make_layer_pc_spec(gm_pc_spec, pc_vars, n_pcs = n_pcs)


  # negative-binomial model on unadjusted counts, GM, w layers
  nb_layers_f = sprintf(lrt_pat, layer_spec$name, date_tag)
  if (!file.exists(nb_layers_f)) {
    nb_layers_ls  = calc_celltype_mixed_models(wide_neu, c(sample_vars, pc_vars),
      layer_spec$subset, layer_spec$size, layer_spec$exc_regex, layer_spec$inc_regex,
      layer_spec$fixef_test, layer_spec$fixef_covar, layer_spec$ranef_var, 
      n_cores = n_cores, offset_var = NULL)
    saveRDS(nb_layers_ls, file = nb_layers_f)  
  }
}

# load them
nb_pcs_ls   = lapply(seq_along(pc_vars), function(n_pcs) {
  # make file
  layer_spec  = make_layer_pc_spec(gm_pc_spec, pc_vars, n_pcs = n_pcs)
  nb_gm_ls    = sprintf(lrt_pat, layer_spec$name, date_tag) %>%
    readRDS
  
  return(nb_gm_ls)
  }) %>% setNames(paste0(gm_pc_spec$name_str, seq_along(pc_vars), 'pcs'))

# make list of models
lrt_ls      = list(WM = nb_wm_ls, GM = nb_gm_ls) %>%
  c(nb_pcs_ls)
# loop through specified models
for (nn in names(spec_list)) {
  # make file
  ancom_f   = sprintf(ancom_pat, spec_list[[nn]]$name, date_tag)
  
  # if necessary, run thing
  if (!file.exists(ancom_f)) {
    message('running standard ANCOM-BC for ', nn)
    # define things we need
    spec      = spec_list[[nn]]

    # do standard ANCOM, save results
    ancom_obj = calc_ancom_standard(wide_dt, sample_vars,
      spec$subset, spec$size, spec$exc_regex, spec$inc_regex, spec$ref_type,
      spec$fixef_test, spec$fixef_covar)
    saveRDS(ancom_obj, file = ancom_f)
  }
}
# loop through specified models
for (nn in names(spec_list)) {
  # make file
  boots_f   = sprintf(boots_pat, spec_list[[nn]]$name, date_tag)
  
  # if necessary, run thing
  if (!file.exists(boots_f)) {
    message('running bootstrapped ANCOM-BC for ', nn)
    # define things we need
    spec      = spec_list[[nn]]

    # do bootstrapping, save resulst
    boots_dt  = calc_ancom_bootstrap(wide_dt, sample_vars,
      spec$subset, spec$size, spec$exc_regex, spec$inc_regex, spec$ref_type,
      spec$fixef_test, spec$fixef_covar, spec$ranef_var, 
      seed = 1, n_boots, n_cores)
    fwrite(boots_dt, file = boots_f)
  }
}
# set up this run
for (n_pcs in seq_along(pc_vars)) {
  # which PCs?
  layer_spec  = make_layer_pc_spec(gm_pc_spec, pc_vars, n_pcs = n_pcs)

  # make file
  ancom_f   = sprintf(ancom_pat, layer_spec$name, date_tag)

  # if necessary, run thing
  if (file.exists(ancom_f)) {
    message('standard ANCOM-BC for ', layer_spec$name, ' already done')
  } else {
    # do bootstrapping, save results
    message('running standard ANCOM-BC for ', layer_spec$name)
    ancom_neu = calc_ancom_standard(wide_neu, c(sample_vars, pc_vars),
      layer_spec$subset, layer_spec$size, layer_spec$exc_regex, 
      layer_spec$inc_regex, layer_spec$ref_type,
      layer_spec$fixef_test, layer_spec$fixef_covar)
    saveRDS(ancom_neu, file = ancom_f)
  }

  # do bootstrapping
  boots_f   = sprintf(boots_pat, layer_spec$name, date_tag)

  # if necessary, run thing
  if (file.exists(boots_f)) {
    message('bootstrapped ANCOM-BC for ', layer_spec$name, ' already done')
  } else {
    # do bootstrapping, save resulst
    message('running bootstrapped ANCOM-BC for ', layer_spec$name)
    t_start    = Sys.time()
    boots_neu = calc_ancom_bootstrap(wide_neu, c(sample_vars, pc_vars),
      layer_spec$subset, layer_spec$size, layer_spec$exc_regex, 
      layer_spec$inc_regex, layer_spec$ref_type,
      layer_spec$fixef_test, layer_spec$fixef_covar, layer_spec$ranef_var, 
      seed = 1, n_boots, n_cores)
    t_stop    = Sys.time()
    fwrite(boots_neu, file = boots_f)

    # report how long it took
    t_elapsed = difftime(t_stop, t_start, units = 'mins') %>% unclass
    message(sprintf(
      paste0('  (bootstrapping %d boots with %d cores took %.1f minutes;',
        ' %.1f boots / min / core)'), 
      n_boots, n_cores, t_elapsed, n_boots / t_elapsed / n_cores))
  }
}
standard ANCOM-BC for lesions_GM_1pcs already done
bootstrapped ANCOM-BC for lesions_GM_1pcs already done
standard ANCOM-BC for lesions_GM_2pcs already done
bootstrapped ANCOM-BC for lesions_GM_2pcs already done
standard ANCOM-BC for lesions_GM_3pcs already done
bootstrapped ANCOM-BC for lesions_GM_3pcs already done
standard ANCOM-BC for lesions_GM_4pcs already done
bootstrapped ANCOM-BC for lesions_GM_4pcs already done
standard ANCOM-BC for lesions_GM_5pcs already done
bootstrapped ANCOM-BC for lesions_GM_5pcs already done
standard ANCOM-BC for lesions_GM_6pcs already done
bootstrapped ANCOM-BC for lesions_GM_6pcs already done
standard ANCOM-BC for lesions_GM_7pcs already done
bootstrapped ANCOM-BC for lesions_GM_7pcs already done
# set up this run
nagm_pcs    = 4
layer_spec  = make_layer_pc_spec(nagm_pc_spec, pc_vars, n_pcs = nagm_pcs)
wide_nagm   = wide_neu %>% copy %>% 
  .[, lesion_type := lesion_type %>% fct_relevel("NAGM") %>% fct_drop ]

# make file
ancom_f     = sprintf(ancom_pat, layer_spec$name, date_tag)


# if necessary, run thing
if (file.exists(ancom_f)) {
  message('standard ANCOM-BC for ', layer_spec$name, ' already done')
  ancom_nagm  = ancom_f %>% readRDS
} else {
  # do bootstrapping, save results
  message('running standard ANCOM-BC for ', layer_spec$name)
  ancom_nagm  = calc_ancom_standard(wide_nagm, c(sample_vars, pc_vars),
    layer_spec$subset, layer_spec$size, layer_spec$exc_regex, 
    layer_spec$inc_regex, layer_spec$ref_type,
    layer_spec$fixef_test, layer_spec$fixef_covar)
  saveRDS(ancom_nagm, file = ancom_f)
}
standard ANCOM-BC for lesions_NAGM_4pcs already done
# do bootstrapping
boots_f   = sprintf(boots_pat, layer_spec$name, date_tag)

# if necessary, run thing
if (file.exists(boots_f)) {
  message('bootstrapped ANCOM-BC for ', layer_spec$name, ' already done')
  boots_nagm  = boots_f %>% fread
} else {
  # do bootstrapping, save resulst
  message('running bootstrapped ANCOM-BC for ', layer_spec$name)
  t_start    = Sys.time()
  boots_nagm = calc_ancom_bootstrap(wide_nagm, c(sample_vars, pc_vars),
    layer_spec$subset, layer_spec$size, layer_spec$exc_regex, 
    layer_spec$inc_regex, layer_spec$ref_type,
    layer_spec$fixef_test, layer_spec$fixef_covar, layer_spec$ranef_var, 
    seed = 1, n_boots, n_cores)
  t_stop    = Sys.time()
  fwrite(boots_nagm, file = boots_f)

  # report how long it took
  t_elapsed = difftime(t_stop, t_start, units = 'mins') %>% unclass
  message(sprintf(
    paste0('  (bootstrapping %d boots with %d cores took %.1f minutes;',
      ' %.1f boots / min / core)'), 
    n_boots, n_cores, t_elapsed, n_boots / t_elapsed / n_cores))
}
bootstrapped ANCOM-BC for lesions_NAGM_4pcs already done
ancom_ls  = lapply(names(spec_list), function(nn) {
  # make file
  ancom_obj  = sprintf(ancom_pat, spec_list[[nn]]$name, date_tag) %>% 
    readRDS
  
  return(ancom_obj)
  }) %>% setNames(names(spec_list))
boots_ls  = lapply(names(spec_list), function(nn) {
  # make file
  boots_dt  = sprintf(boots_pat, spec_list[[nn]]$name, date_tag) %>% fread
  
  return(boots_dt)
  }) %>% setNames(names(spec_list))
# load std
ancom_pcs_ls  = lapply(seq_along(pc_vars), function(n_pcs) {
  # make file
  layer_spec  = make_layer_pc_spec(gm_pc_spec, pc_vars, n_pcs = n_pcs)
  ancom_obj   = sprintf(ancom_pat, layer_spec$name, date_tag) %>%
    readRDS
  
  return(ancom_obj)
  }) %>% setNames(paste0(gm_pc_spec$name_str, seq_along(pc_vars), 'pcs'))

# load boots
boots_pcs_ls  = lapply(seq_along(pc_vars), function(n_pcs) {
  # make file
  layer_spec  = make_layer_pc_spec(gm_pc_spec, pc_vars, n_pcs = n_pcs)
  boots_dt    = sprintf(boots_pat, layer_spec$name, date_tag) %>% fread
  
  return(boots_dt)
  }) %>% setNames(paste0(gm_pc_spec$name_str, seq_along(pc_vars), 'pcs'))
ancom_ls      = c(ancom_ls, ancom_pcs_ls, list(lesions_NAGM_4pcs = ancom_nagm))
boots_ls      = c(boots_ls, boots_pcs_ls, list(lesions_NAGM_4pcs = boots_nagm))
pcs_coefs_dt  = calc_pcs_coefs_dt(pc_vars, boots_ls, labels_dt) 

Analysis

Ctrl GM vs WM

for (m in c('nbinom', 'poisson', 'beta')) {
  cat('### ', m, '\n')
  print(plot_wm_vs_gm(conos_dt, model = m))
  cat('\n\n')  
}

nbinom

Version Author Date
9ee5eee wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

poisson

Version Author Date
9ee5eee wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

beta

Version Author Date
9ee5eee wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

Contribution of lesion type and donor to variability in celltype counts

for (nn in names(lrt_ls)) {
  cat('### ', nn, '\n')
  print(plot_lrt_results(lrt_ls[[nn]]$anova_dt, labels_dt))
  cat('\n\n')  
}

WM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

GM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_1pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_2pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_3pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_5pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_6pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_7pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

Abundance of GPR17-expressing cells

(plot_raw_cell_counts_sel_gene(prop_fine_f, conos_dt, sel_g))

Compositional grouping heatmaps

Compositional groupings of samples (CLR)

# plot CLR heatmaps
cat("#### WM\n")

WM

  wm_types    = setdiff(broad_ord, c('Excitatory neurons', 'Inhibitory neurons'))
  props_wm    = calc_props_dt(conos_dt[ type_broad %in% wm_types ], sample_vars) %>%
    .[ matter == "WM" ]
  hm_wm       = plot_clr_heatmap(props_wm, cluster_rows = TRUE, n_clusters = 5, what = 'clr')
  hm_wm       = draw(hm_wm, row_dend_width = unit(0.5, "in"), merge_legend = TRUE)

Version Author Date
54bd2e9 wmacnair 2021-12-08
9ee5eee wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25
cat('\n\n')
cat("#### GM\n")

GM

  gm_types    = setdiff(broad_ord, c('Immune'))
  props_gm    = calc_props_dt(conos_dt[ type_broad %in% gm_types ], sample_vars) %>%
    .[ matter == "GM" ]
  hm_gm       = plot_clr_heatmap(props_gm, cluster_rows = TRUE, n_clusters = 5, what = 'clr')
  hm_gm       = draw(hm_gm, row_dend_width = unit(0.5, "in"), merge_legend = TRUE)

Version Author Date
54bd2e9 wmacnair 2021-12-08
9ee5eee wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25
cat('\n\n')
# save clusters
save_heatmap_clusters(hm_wm@ht_list[[1]], sprintf(clr_pat, "WM", date_tag))
save_heatmap_clusters(hm_gm@ht_list[[1]], sprintf(clr_pat, "GM", date_tag))

Compositional groupings of samples (log proportions)

cat("#### WM\n")

WM

  wm_types    = setdiff(broad_ord, c('Excitatory neurons', 'Inhibitory neurons'))
  props_wm    = calc_props_dt(conos_dt[ type_broad %in% wm_types ], sample_vars) %>%
    .[ matter == "WM" ] # & neuro_ok == TRUE]
  draw(plot_clr_heatmap(props_wm, cluster_rows = FALSE, what = 'log_p'),
    row_dend_width = unit(0.5, "in"), merge_legend = TRUE)

Version Author Date
54bd2e9 wmacnair 2021-12-08
1f4bea5 wmacnair 2021-11-29
7fb1b95 wmacnair 2021-11-25
cat('\n\n')
cat("#### GM\n")

GM

  gm_types    = setdiff(broad_ord, c('Immune'))
  props_gm    = calc_props_dt(conos_dt[ type_broad %in% gm_types ], sample_vars) %>%
    .[ matter == "GM" ] # & neuro_ok == TRUE]
  draw(plot_clr_heatmap(props_gm, cluster_rows = FALSE, what = 'log_p'),
    row_dend_width = unit(0.5, "in"), merge_legend = TRUE)

Version Author Date
54bd2e9 wmacnair 2021-12-08
1f4bea5 wmacnair 2021-11-29
7fb1b95 wmacnair 2021-11-25
cat('\n\n')

Compositional groupings of samples (log proportions, oligodendroglia only)

cat("#### WM\n")

WM

  wm_types    = c('Oligodendrocytes', 'OPCs / COPs')
  props_wm    = calc_props_dt(conos_dt[ type_broad %in% wm_types ], sample_vars) %>%
    .[ matter == "WM" ] # & neuro_ok == TRUE]
  draw(plot_clr_heatmap(props_wm, cluster_rows = FALSE, what = 'log_p'),
    row_dend_width = unit(1, "in"), merge_legend = TRUE)

Version Author Date
54bd2e9 wmacnair 2021-12-08
1f4bea5 wmacnair 2021-11-29
7fb1b95 wmacnair 2021-11-25
cat('\n\n')
cat("#### GM\n")

GM

  gm_types    = c('Oligodendrocytes', 'OPCs / COPs')
  props_gm    = calc_props_dt(conos_dt[ type_broad %in% gm_types ], sample_vars) %>%
    .[ matter == "GM" ] # & neuro_ok == TRUE]
  draw(plot_clr_heatmap(props_gm, cluster_rows = FALSE, what = 'log_p'),
    row_dend_width = unit(1, "in"), merge_legend = TRUE)

Version Author Date
54bd2e9 wmacnair 2021-12-08
1f4bea5 wmacnair 2021-11-29
7fb1b95 wmacnair 2021-11-25
cat('\n\n')

Compositional groupings of samples (log proportions, oligodendroglia only, ordered by patient)

cat("#### WM\n")

WM

  wm_types    = c('Oligodendrocytes', 'OPCs / COPs')
  props_wm    = calc_props_dt(conos_dt[ type_broad %in% wm_types ], sample_vars) %>%
    .[ matter == "WM" ] # & neuro_ok == TRUE]
  draw(plot_clr_heatmap(props_wm, cluster_rows = FALSE, what = 'log_p', 
    order_subj = TRUE), row_dend_width = unit(1, "in"), merge_legend = TRUE)

Version Author Date
54bd2e9 wmacnair 2021-12-08
1f4bea5 wmacnair 2021-11-29
cat('\n\n')
cat("#### GM\n")

GM

  gm_types    = c('Oligodendrocytes', 'OPCs / COPs')
  props_gm    = calc_props_dt(conos_dt[ type_broad %in% gm_types ], sample_vars) %>%
    .[ matter == "GM" ] # & neuro_ok == TRUE]
  draw(plot_clr_heatmap(props_gm, cluster_rows = FALSE, what = 'log_p', 
    order_subj = TRUE), row_dend_width = unit(1, "in"), merge_legend = TRUE)

Version Author Date
54bd2e9 wmacnair 2021-12-08
1f4bea5 wmacnair 2021-11-29
cat('\n\n')

Compositional groupings of samples (GM, CLR, neurons only)

gm_types    = c('Excitatory neurons', 'Inhibitory neurons')
props_gm    = calc_props_dt(conos_dt[ type_broad %in% gm_types ], sample_vars) %>%
  .[ matter == "GM" ] %>%
  merge(wide_neu[, .(sample_id, ctrl_PC01, ctrl_PC02, ctrl_PC03, ctrl_PC04)], 
    by = 'sample_id')
draw(plot_clr_heatmap(props_gm, cluster_rows = FALSE, what = 'clr'),
  row_dend_width = unit(1, "in"), merge_legend = TRUE)

Version Author Date
1f4bea5 wmacnair 2021-11-29
7fb1b95 wmacnair 2021-11-25

Barplots of oligodendroglia proportions

sel_types   = c('OPCs / COPs', 'Oligodendrocytes')
for (m in c('WM', 'GM')) {
  cat('### ', m, '\n')
  print(plot_sample_propn_barplots(conos_dt[matter == m], 
    types = sel_types, show_broad = FALSE))
  cat('\n\n')
}

WM

Version Author Date
97aa6f8 wmacnair 2021-12-08
47a3ec8 wmacnair 2021-12-08

GM

Version Author Date
97aa6f8 wmacnair 2021-12-08
47a3ec8 wmacnair 2021-12-08

Barplots of oligodendroglia proportions 2

sel_types   = c('OPCs / COPs', 'Oligodendrocytes')
for (m in c('WM', 'GM')) {
  cat('### ', m, '\n')
  print(plot_sample_propn_barplots(conos_dt[matter == m], 
    types = sel_types, show_broad = FALSE, split_broad = FALSE))
  cat('\n\n')
}

WM

GM

CLR plots of oligodendroglia

# set up what we want
names_ls    = c("WM", "GM_all", "GM_all_resid", "GM_out", "GM_out_resid")
title_ls    = c("WM", "GM", "GM (w/o layers)", "GM (SD016/13 excluded)", 
  "GM (w/o layers, no SD016/13)") %>% setNames(names_ls)
matter_ls   = c("WM", "GM", "GM", "GM", "GM") %>% setNames(names_ls)
outs_ls     = c(FALSE, FALSE, FALSE, TRUE, TRUE) %>% setNames(names_ls)
layers_ls   = c(FALSE, FALSE, TRUE, FALSE, TRUE) %>% setNames(names_ls)
outlier_ls  = "SD016/13"
sel_pcs     = c("ctrl_PC01", "ctrl_PC02", "ctrl_PC03", "ctrl_PC04")

# run through
for (nn in names_ls) {
  # do title
  cat('### ', title_ls[[ nn ]], '\n')

  # get data
  input_dt  = conos_dt %>%
    .[(matter == matter_ls[[ nn ]]) & (type_broad %in% sel_types)]

  # remove outliers?
  if (outs_ls[[nn]])
    input_dt  = input_dt[ !(subject_id %in% outlier_ls) ]

  # restrict to samples with min. no. of cells
  input_dt  = input_dt[, n_type := .N, by = type_fine ] %>%
    .[ n_type >= min_cells ] %>% .[ order(sample_id, type_fine) ]

  # do either with or without layers
  if (layers_ls[[ nn ]]) {
    suppressWarnings(print(plot_sample_clrs_layers(input_dt, 
      all_pcs_dt[, c("sample_id", sel_pcs), with = FALSE ])))
  } else {
    suppressWarnings(print(plot_sample_clrs(input_dt)))
  }

  cat('\n\n')
}

WM

Version Author Date
8364a6f wmacnair 2021-12-13
9ee5eee wmacnair 2021-12-08
47a3ec8 wmacnair 2021-12-08

GM

Version Author Date
8364a6f wmacnair 2021-12-13
9ee5eee wmacnair 2021-12-08
47a3ec8 wmacnair 2021-12-08

GM (w/o layers)

Version Author Date
8364a6f wmacnair 2021-12-13
9ee5eee wmacnair 2021-12-08
47a3ec8 wmacnair 2021-12-08

GM (SD016/13 excluded)

Version Author Date
8364a6f wmacnair 2021-12-13
9ee5eee wmacnair 2021-12-08

GM (w/o layers, no SD016/13)

Version Author Date
8364a6f wmacnair 2021-12-13
# annotate with oligo groups 
olg_grps_dt   = fread(olg_grps_f) %>% 
  .[, .(subject_id = patient_id, oligo_grp)]
input_dt  = conos_dt %>%
  .[(matter == "WM") & (type_broad %in% sel_types)] %>%
  merge(olg_grps_dt, by = "subject_id") %>%
  .[, n_type := .N, by = type_fine ] %>%
  .[ n_type >= min_cells ] %>% .[ order(sample_id, type_fine) ]

# plot
cat('### ', 'WM with oligo groups', '\n')

WM with oligo groups

  suppressWarnings(print(plot_sample_clrs(input_dt)))

Version Author Date
8364a6f wmacnair 2021-12-13
cat('\n\n')

GM layers

Proportions with layers

(plot_propns_layers(props_dt[ matter == "GM" & str_detect(type_broad, 'neuron') ]))
Warning: Transformation introduced infinite values in continuous y-axis

Version Author Date
9ee5eee wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

PCA of proportions, neurons only, all samples

(plot_pca_results(wide_neu, ctrl_pcs_dt, pc_vars, what = "proj"))

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

Patients over PC1

(plot_patients_over_pc(wide_neu, pc_vars))

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

PC variance explained and layer correlations

(plot_pca_loadings(ctrl_pcs_dt, cut_var_exp = cut_var_exp, 
  cut_layer_cor = cut_layer_cor))

Version Author Date
9ee5eee wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ANCOM-BC results

ANCOM-BC standard results

for (nn in names(ancom_ls)) {
  cat('#### ', nn, '\n')
  print(plot_ancombc_ci(ancom_ls[[nn]], q_cut = 0.05))
  cat('\n\n')  
}

lesions_WM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_1pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_2pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_3pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_5pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_6pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_7pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_NAGM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ANCOM-BC standard results, lesions only

for (nn in names(ancom_ls)) {
  cat('#### ', nn, '\n')
  print(plot_ancombc_ci(ancom_ls[[nn]], 
    coef_filter = "lesion_type", q_cut = 0.05))
  cat('\n\n')  
}

lesions_WM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_1pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_2pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_3pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_5pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_6pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_7pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_NAGM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ANCOM-BC bootstrap results

for (nn in names(boots_ls)) {
  cat('#### ', nn, '\n')
  print(plot_boots_dt(boots_ls[[nn]], min_effect = 0.2))
  cat('\n\n')  
}

lesions_WM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_1pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_2pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_3pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_5pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_6pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_7pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_NAGM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ANCOM-BC bootstrap results, lesions only

for (nn in names(boots_ls)) {
  cat('#### ', nn, '\n')
  print(plot_boots_dt(boots_ls[[nn]], 
    coef_filter = "lesion_type", min_effect = 0.2))
  cat('\n\n')  
}

lesions_WM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_1pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_2pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_3pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_5pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_6pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_7pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_NAGM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ANCOM-BC bootstrap results, lesions, significant only

for (nn in names(boots_ls)) {
  cat('#### ', nn, '\n')
  print(plot_boots_dt(boots_ls[[nn]], 
    coef_filter = "lesion_type", min_effect = 0.2, signif_only = TRUE))
  cat('\n\n')  
}

lesions_WM

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_GM

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_GM_1pcs

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_GM_2pcs

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_GM_3pcs

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_GM_4pcs

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_GM_5pcs

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_GM_6pcs

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_GM_7pcs

Version Author Date
270e5fc wmacnair 2021-11-26

lesions_NAGM_4pcs

Version Author Date
270e5fc wmacnair 2021-11-26

Bootstrap vs standard

for (nn in names(boots_ls)) {
  cat('#### ', nn, '\n')
  print(plot_boots_vs_standard(boots_ls[[nn]], ancom_ls[[nn]], labels_dt,
    q_cut = 0.05, min_effect = 0.2))
  cat('\n\n')  
}

lesions_WM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_1pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_2pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_3pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_5pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_6pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_GM_7pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

lesions_NAGM_4pcs

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

Effect of including PCs, neurons only

for (sel_coef in unique(pcs_coefs_dt$coef)) {
  cat('#### ', sel_coef, '\n')
  print(plot_effect_of_pcs(sel_coef, 
    pcs_coefs_dt[ type_broad %in% gm_pc_spec$broad_sel ] ))
  cat('\n\n')
}

NAGM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

GML

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

sexM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

age_scale

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

pmi_cat2over_12H

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC01

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC02

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC03

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC04

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC06

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC07

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC10

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

Effect of including PCs, other celltypes

for (sel_coef in unique(pcs_coefs_dt$coef)) {
  cat('#### ', sel_coef, '\n')
  print(plot_effect_of_pcs(sel_coef, 
    pcs_coefs_dt[ !(type_broad %in% gm_pc_spec$broad_sel) ]))
  cat('\n\n')
}

NAGM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

GML

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

sexM

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

age_scale

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

pmi_cat2over_12H

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC01

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC02

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC03

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC04

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC06

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC07

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

ctrl_PC10

Version Author Date
47a3ec8 wmacnair 2021-12-08
7fb1b95 wmacnair 2021-11-25

Effect of including PCs, lesions only

sel_coefs   = c("NAGM", "GML")
cat('#### ', 'neurons only', '\n')

neurons only

  g = plot_effect_of_pcs(sel_coefs, 
    pcs_coefs_dt[ type_broad %in% gm_pc_spec$broad_sel ] ) +
    labs(title = "Neurons only")
  print(g)

Version Author Date
270e5fc wmacnair 2021-11-26
7fb1b95 wmacnair 2021-11-25
cat('\n\n')
cat('#### ', 'other celltypes', '\n')

other celltypes

  g = plot_effect_of_pcs(sel_coefs, 
    pcs_coefs_dt[ !(type_broad %in% gm_pc_spec$broad_sel) ] ) +
    labs(title = "Non-neurons only")
  print(g)

Version Author Date
270e5fc wmacnair 2021-11-26
7fb1b95 wmacnair 2021-11-25
cat('\n\n')

Outputs

if ( !all(file.exists(pb_pcs_ls)) ) {
  for (nn in names(pb_f_ls)) {
    # which files?
    pb_f        = pb_f_ls[[ nn ]]
    pb_pcs_f    = pb_pcs_ls[[ nn ]]

    # load full pseudobulk, restrict to just GM
    pb_all      = pb_f %>% readRDS
    pb_pcs      = pb_all[, all_pcs_dt$sample_id]
    for (v in str_subset(names(all_pcs_dt), "ctrl_PC"))
      colData(pb_pcs)[[v]] = all_pcs_dt[[v]] %>% scale %>% `/`(2)

    # save
    saveRDS(pb_pcs, file = pb_pcs_f)    
  }
}
devtools::session_info()
Registered S3 method overwritten by 'cli':
  method     from         
  print.boxx spatstat.geom
- Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 4.0.5 (2021-03-31)
 os       CentOS Linux 7 (Core)       
 system   x86_64, linux-gnu           
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    C                           
 tz       Europe/Zurich               
 date     2021-11-18                  

- Packages -------------------------------------------------------------------
 ! package              * version    date       lib
   abind                  1.4-5      2016-07-21 [2]
   ade4                   1.7-18     2021-09-16 [1]
   ANCOMBC              * 1.0.5      2021-03-09 [1]
   annotate               1.68.0     2020-10-27 [1]
   AnnotationDbi          1.52.0     2020-10-27 [1]
   ape                    5.5        2021-04-25 [1]
   assertthat           * 0.2.1      2019-03-21 [2]
   backports              1.2.1      2020-12-09 [2]
   beachmat               2.6.4      2020-12-20 [1]
   beeswarm               0.4.0      2021-06-01 [1]
   betareg                3.1-4      2021-02-09 [1]
   Biobase              * 2.50.0     2020-10-27 [1]
   BiocGenerics         * 0.36.1     2021-04-16 [1]
   BiocManager            1.30.16    2021-06-15 [1]
   BiocNeighbors          1.8.2      2020-12-07 [1]
   BiocParallel         * 1.24.1     2020-11-06 [1]
   BiocSingular           1.6.0      2020-10-27 [1]
   BiocStyle            * 2.18.1     2020-11-24 [1]
   biomformat             1.18.0     2020-10-27 [1]
   Biostrings             2.58.0     2020-10-27 [1]
   bit                    4.0.4      2020-08-04 [2]
   bit64                  4.0.5      2020-08-30 [2]
   bitops                 1.0-7      2021-04-24 [2]
   blme                   1.0-5      2021-01-05 [1]
   blob                   1.2.2      2021-07-23 [2]
   bluster                1.0.0      2020-10-27 [1]
   boot                   1.3-28     2021-05-03 [2]
   broom                  0.7.9      2021-07-27 [2]
   bslib                  0.3.1      2021-10-06 [2]
   cachem                 1.0.6      2021-08-19 [1]
   Cairo                  1.5-12.2   2020-07-07 [2]
   callr                  3.7.0      2021-04-20 [2]
   caTools                1.18.2     2021-03-28 [2]
   cellranger             1.1.0      2016-07-27 [2]
   circlize             * 0.4.13     2021-06-09 [1]
   cli                    3.0.1      2021-07-17 [1]
   clue                   0.3-60     2021-10-11 [1]
   cluster                2.1.2      2021-04-17 [2]
   codetools              0.2-18     2020-11-04 [2]
   colorout             * 1.2-2      2021-04-15 [1]
   colorRamps             2.3        2012-10-29 [1]
   colorspace             2.0-2      2021-06-24 [1]
   ComplexHeatmap       * 2.6.2      2020-11-12 [1]
   conos                * 1.4.3      2021-08-07 [1]
   cowplot                1.1.1      2020-12-30 [2]
   crayon                 1.4.1      2021-02-08 [2]
   data.table           * 1.14.2     2021-09-27 [2]
   DBI                    1.1.1      2021-01-15 [2]
   DelayedArray           0.16.3     2021-03-24 [1]
   DelayedMatrixStats     1.12.3     2021-02-03 [1]
   deldir                 1.0-6      2021-10-23 [2]
   desc                   1.4.0      2021-09-28 [1]
   DESeq2                 1.30.1     2021-02-19 [1]
   devtools               2.4.2      2021-06-07 [1]
   digest                 0.6.28     2021-09-23 [2]
   doParallel             1.0.16     2020-10-16 [1]
   dplyr                  1.0.7      2021-06-18 [2]
   dqrng                  0.3.0      2021-05-01 [2]
   DropletUtils         * 1.10.3     2021-02-02 [1]
   edgeR                * 3.32.1     2021-01-14 [1]
   ellipsis               0.3.2      2021-04-29 [2]
   evaluate               0.14       2019-05-28 [2]
   fansi                  0.5.0      2021-05-25 [2]
   farver                 2.1.0      2021-02-28 [2]
   fastmap                1.1.0      2021-01-25 [2]
   fitdistrplus           1.1-6      2021-09-28 [2]
   flexmix                2.3-17     2020-10-12 [1]
   forcats              * 0.5.1      2021-01-27 [2]
   foreach                1.5.1      2020-10-15 [2]
   Formula                1.2-4      2020-10-16 [1]
   fs                     1.5.0      2020-07-31 [2]
   future                 1.22.1     2021-08-25 [2]
   future.apply           1.8.1      2021-08-10 [2]
   genefilter             1.72.1     2021-01-21 [1]
   geneplotter            1.68.0     2020-10-27 [1]
   generics               0.1.1      2021-10-25 [2]
   GenomeInfoDb         * 1.26.7     2021-04-08 [1]
   GenomeInfoDbData       1.2.4      2021-04-15 [1]
   GenomicRanges        * 1.42.0     2020-10-27 [1]
   GetoptLong             1.0.5      2020-12-15 [1]
   ggbeeswarm           * 0.6.0      2017-08-07 [1]
   ggplot.multistats    * 1.0.0      2019-10-28 [1]
   ggplot2              * 3.3.5      2021-06-25 [1]
   ggrepel              * 0.9.1      2021-01-15 [2]
   ggridges               0.5.3      2021-01-08 [2]
   git2r                  0.28.0     2021-01-10 [1]
   glmmTMB                1.1.2.3    2021-09-20 [1]
   GlobalOptions          0.1.2      2020-06-10 [1]
   globals                0.14.0     2020-11-22 [2]
   glue                   1.4.2      2020-08-27 [2]
   goftest                1.2-3      2021-10-07 [2]
   googlesheets         * 0.3.0      2018-06-29 [1]
   gplots                 3.1.1      2020-11-28 [2]
   gridExtra              2.3        2017-09-09 [2]
   grr                    0.9.5      2016-08-26 [1]
   gtable                 0.3.0      2019-03-25 [2]
   gtools                 3.9.2      2021-06-06 [2]
   HDF5Array              1.18.1     2021-02-04 [1]
   hexbin                 1.28.2     2021-01-08 [2]
   highr                  0.9        2021-04-16 [2]
   hms                    1.1.1      2021-09-26 [1]
   htmltools              0.5.2      2021-08-25 [2]
   htmlwidgets            1.5.4      2021-09-08 [2]
   httpuv                 1.6.3      2021-09-09 [2]
   httr                   1.4.2      2020-07-20 [2]
   ica                  * 1.0-2      2018-05-24 [2]
   igraph               * 1.2.7      2021-10-15 [2]
   IRanges              * 2.24.1     2020-12-12 [1]
   irlba                  2.3.3      2019-02-05 [2]
   iterators              1.0.13     2020-10-15 [2]
   janitor                2.1.0      2021-01-05 [1]
   jquerylib              0.1.4      2021-04-26 [2]
   jsonlite               1.7.2      2020-12-09 [2]
   KernSmooth             2.23-20    2021-05-03 [2]
   knitr                  1.36       2021-09-29 [1]
   later                  1.3.0      2021-08-18 [2]
   lattice                0.20-45    2021-09-22 [2]
   lazyeval               0.2.2      2019-03-15 [2]
 R leiden                 0.3.8      <NA>       [2]
   leidenAlg              0.1.1      2021-03-03 [1]
   lifecycle              1.0.1      2021-09-24 [2]
   limma                * 3.46.0     2020-10-27 [1]
   listenv                0.8.0      2019-12-05 [2]
   lme4                   1.1-27.1   2021-06-22 [1]
   lmerTest               3.1-3      2020-10-23 [1]
   lmtest                 0.9-38     2020-09-09 [2]
   locfit                 1.5-9.4    2020-03-25 [1]
   lubridate              1.8.0      2021-10-07 [2]
   magick                 2.7.3      2021-08-18 [2]
   magrittr             * 2.0.1      2020-11-17 [1]
   MASS                 * 7.3-54     2021-05-03 [2]
   Matrix               * 1.3-4      2021-06-01 [2]
   Matrix.utils           0.9.8      2020-02-26 [1]
   MatrixGenerics       * 1.2.1      2021-01-30 [1]
   matrixStats          * 0.61.0     2021-09-17 [1]
   memoise                2.0.0      2021-01-26 [1]
   mgcv                   1.8-38     2021-10-06 [1]
   microbiome             1.12.0     2020-10-27 [1]
   mime                   0.12       2021-09-28 [1]
   miniUI                 0.1.1.1    2018-05-18 [2]
   minqa                  1.2.4      2014-10-09 [1]
   modeltools             0.2-23     2020-03-05 [1]
   multtest               2.46.0     2020-10-27 [1]
   munsell                0.5.0      2018-06-12 [2]
   muscat               * 1.5.1      2021-04-15 [1]
   nlme                   3.1-153    2021-09-07 [2]
   nloptr                 1.2.2.2    2020-07-02 [1]
   nnet                   7.3-16     2021-05-03 [2]
   nnls                 * 1.4        2012-03-19 [1]
   numDeriv               2016.8-1.1 2019-06-06 [2]
   parallelly             1.28.1     2021-09-09 [2]
   patchwork            * 1.1.1      2020-12-17 [2]
   pbapply                1.5-0      2021-09-16 [2]
   pbkrtest               0.5.1      2021-03-09 [1]
   permute                0.9-5      2019-03-12 [1]
   phyloseq             * 1.34.0     2020-10-27 [1]
   pillar                 1.6.4      2021-10-18 [1]
   pkgbuild               1.2.0      2020-12-15 [1]
   pkgconfig              2.0.3      2019-09-22 [2]
   pkgload                1.2.3      2021-10-13 [2]
   plotly                 4.10.0     2021-10-09 [2]
   plyr                   1.8.6      2020-03-03 [2]
   png                    0.1-7      2013-12-03 [2]
   polyclip               1.10-0     2019-03-14 [2]
   prettyunits            1.1.1      2020-01-24 [2]
   processx               3.5.2      2021-04-30 [2]
   progress               1.2.2      2019-05-16 [2]
   promises               1.2.0.1    2021-02-11 [2]
   ps                     1.6.0      2021-02-28 [2]
   purrr                * 0.3.4      2020-04-17 [2]
   R.methodsS3            1.8.1      2020-08-26 [1]
   R.oo                   1.24.0     2020-08-26 [1]
   R.utils                2.11.0     2021-09-26 [1]
   R6                     2.5.1      2021-08-19 [2]
   RANN                   2.6.1      2019-01-08 [2]
   rbibutils              2.2.4      2021-10-11 [1]
   RColorBrewer         * 1.1-2      2014-12-07 [2]
   Rcpp                   1.0.7      2021-07-07 [1]
   RcppAnnoy              0.0.19     2021-07-30 [1]
   RCurl                  1.98-1.5   2021-09-17 [1]
   Rdpack                 2.1.2      2021-06-01 [1]
   readxl               * 1.3.1      2019-03-13 [2]
   registry               0.5-1      2019-03-05 [1]
   remotes                2.4.1      2021-09-29 [1]
   reshape2               1.4.4      2020-04-09 [2]
   reticulate           * 1.22       2021-09-17 [2]
   rhdf5                  2.34.0     2020-10-27 [1]
   rhdf5filters           1.2.1      2021-05-03 [1]
   Rhdf5lib               1.12.1     2021-01-26 [1]
   rjson                  0.2.20     2018-06-08 [1]
   rlang                  0.4.12     2021-10-18 [2]
   rmarkdown              2.11       2021-09-14 [1]
   ROCR                   1.0-11     2020-05-02 [2]
   rpart                  4.1-15     2019-04-12 [2]
   rprojroot              2.0.2      2020-11-15 [2]
   RSQLite                2.2.8      2021-08-21 [1]
   rsvd                   1.0.5      2021-04-16 [1]
   Rtsne                  0.15       2018-11-10 [2]
   S4Vectors            * 0.28.1     2020-12-09 [1]
   sandwich               3.0-1      2021-05-18 [1]
   sass                   0.4.0      2021-05-12 [2]
   scales               * 1.1.1      2020-05-11 [2]
   scater               * 1.18.6     2021-02-26 [1]
   scattermore            0.7        2020-11-24 [2]
   sccore                 1.0.0      2021-10-07 [1]
   scran                * 1.18.7     2021-04-16 [1]
   sctransform            0.3.2      2020-12-16 [2]
   scuttle                1.0.4      2020-12-17 [1]
   seriation            * 1.3.1      2021-10-16 [1]
   sessioninfo            1.1.1      2018-11-05 [1]
   Seurat               * 4.0.5      2021-10-17 [2]
   SeuratObject         * 4.0.2      2021-06-09 [2]
   shape                  1.4.6      2021-05-19 [1]
   shiny                  1.7.1      2021-10-02 [2]
   SingleCellExperiment * 1.12.0     2020-10-27 [1]
   snakecase              0.11.0     2019-05-25 [1]
   sparseMatrixStats      1.2.1      2021-02-02 [1]
   spatstat.core          2.3-0      2021-07-16 [2]
   spatstat.data          2.1-0      2021-03-21 [2]
   spatstat.geom          2.3-0      2021-10-09 [2]
   spatstat.sparse        2.0-0      2021-03-16 [2]
   spatstat.utils         2.2-0      2021-06-14 [2]
   statmod                1.4.36     2021-05-10 [1]
   stringi                1.7.4      2021-08-25 [1]
   stringr              * 1.4.0      2019-02-10 [2]
   SummarizedExperiment * 1.20.0     2020-10-27 [1]
   survival               3.2-13     2021-08-24 [2]
   tensor                 1.5        2012-05-05 [2]
   testthat               3.1.0      2021-10-04 [2]
   tibble                 3.1.5      2021-09-30 [1]
   tidyr                  1.1.4      2021-09-27 [2]
   tidyselect             1.1.1      2021-04-30 [2]
   TMB                    1.7.22     2021-09-28 [1]
   TSP                    1.1-11     2021-10-06 [1]
   usethis                2.1.2      2021-10-25 [1]
   utf8                   1.2.2      2021-07-24 [1]
   uwot                 * 0.1.10     2020-12-15 [2]
   variancePartition      1.20.0     2020-10-27 [1]
   vctrs                  0.3.8      2021-04-29 [2]
   vegan                  2.5-7      2020-11-28 [1]
   vipor                  0.4.5      2017-03-22 [1]
   viridis              * 0.6.2      2021-10-13 [1]
   viridisLite          * 0.4.0      2021-04-13 [1]
   whisker                0.4        2019-08-28 [1]
   withr                  2.4.2      2021-04-18 [2]
   workflowr            * 1.6.2      2020-04-30 [1]
   xfun                   0.27       2021-10-18 [1]
   XML                    3.99-0.8   2021-09-17 [1]
   xtable                 1.8-4      2019-04-21 [2]
   XVector                0.30.0     2020-10-27 [1]
   yaml                   2.2.1      2020-02-01 [2]
   zlibbioc               1.36.0     2020-10-27 [1]
   zoo                    1.8-9      2021-03-09 [2]
 source                            
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 Bioconductor                      
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 Bioconductor                      
 CRAN (R 4.0.3)                    
 Bioconductor                      
 Bioconductor                      
 Bioconductor                      
 Bioconductor                      
 Bioconductor                      
 Bioconductor                      
 CRAN (R 4.0.2)                    
 CRAN (R 4.0.2)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.2)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 Github (jalvesaq/colorout@79931fd)
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 Bioconductor                      
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.2)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 Bioconductor                      
 CRAN (R 4.0.5)                    
 Bioconductor                      
 Bioconductor                      
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.2)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 <NA>                              
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.0)                    
 Github (HelenaLC/muscat@c939663)  
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.2)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 Bioconductor                      
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.0)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.1)                    
 CRAN (R 4.0.5)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 Bioconductor                      
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.1)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.3)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.5)                    
 CRAN (R 4.0.0)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    
 Bioconductor                      
 CRAN (R 4.0.3)                    

[1] /pstore/home/macnairw/lib/conda_r3.12
[2] /pstore/home/macnairw/.conda/envs/r_4.0.3/lib/R/library

 R -- Package was removed from disk.

sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /pstore/home/macnairw/.conda/envs/r_4.0.3/lib/libopenblasp-r0.3.12.so

locale:
 [1] LC_CTYPE=C                 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] parallel  stats4    grid      stats     graphics  grDevices utils    
 [8] datasets  methods   base     

other attached packages:
 [1] ggbeeswarm_0.6.0            ggrepel_0.9.1              
 [3] reticulate_1.22             MASS_7.3-54                
 [5] phyloseq_1.34.0             ANCOMBC_1.0.5              
 [7] ica_1.0-2                   purrr_0.3.4                
 [9] nnls_1.4                    muscat_1.5.1               
[11] DropletUtils_1.10.3         edgeR_3.32.1               
[13] limma_3.46.0                googlesheets_0.3.0         
[15] scran_1.18.7                uwot_0.1.10                
[17] scater_1.18.6               SingleCellExperiment_1.12.0
[19] SummarizedExperiment_1.20.0 Biobase_2.50.0             
[21] GenomicRanges_1.42.0        GenomeInfoDb_1.26.7        
[23] IRanges_2.24.1              S4Vectors_0.28.1           
[25] BiocGenerics_0.36.1         MatrixGenerics_1.2.1       
[27] matrixStats_0.61.0          BiocParallel_1.24.1        
[29] ggplot.multistats_1.0.0     patchwork_1.1.1            
[31] seriation_1.3.1             ComplexHeatmap_2.6.2       
[33] SeuratObject_4.0.2          Seurat_4.0.5               
[35] conos_1.4.3                 igraph_1.2.7               
[37] Matrix_1.3-4                readxl_1.3.1               
[39] forcats_0.5.1               ggplot2_3.3.5              
[41] scales_1.1.1                viridis_0.6.2              
[43] viridisLite_0.4.0           assertthat_0.2.1           
[45] stringr_1.4.0               data.table_1.14.2          
[47] magrittr_2.0.1              circlize_0.4.13            
[49] RColorBrewer_1.1-2          BiocStyle_2.18.1           
[51] colorout_1.2-2              workflowr_1.6.2            

loaded via a namespace (and not attached):
  [1] rsvd_1.0.5                ps_1.6.0                 
  [3] foreach_1.5.1             lmtest_0.9-38            
  [5] rprojroot_2.0.2           crayon_1.4.1             
  [7] spatstat.core_2.3-0       rbibutils_2.2.4          
  [9] rhdf5filters_1.2.1        Matrix.utils_0.9.8       
 [11] nlme_3.1-153              backports_1.2.1          
 [13] rlang_0.4.12              XVector_0.30.0           
 [15] ROCR_1.0-11               microbiome_1.12.0        
 [17] irlba_2.3.3               callr_3.7.0              
 [19] nloptr_1.2.2.2            rjson_0.2.20             
 [21] bit64_4.0.5               glue_1.4.2               
 [23] sctransform_0.3.2         processx_3.5.2           
 [25] pbkrtest_0.5.1            vipor_0.4.5              
 [27] spatstat.sparse_2.0-0     AnnotationDbi_1.52.0     
 [29] spatstat.geom_2.3-0       tidyselect_1.1.1         
 [31] usethis_2.1.2             fitdistrplus_1.1-6       
 [33] variancePartition_1.20.0  XML_3.99-0.8             
 [35] tidyr_1.1.4               zoo_1.8-9                
 [37] xtable_1.8-4              evaluate_0.14            
 [39] cli_3.0.1                 Rdpack_2.1.2             
 [41] scuttle_1.0.4             zlibbioc_1.36.0          
 [43] miniUI_0.1.1.1            whisker_0.4              
 [45] bslib_0.3.1               rpart_4.1-15             
 [47] betareg_3.1-4             shiny_1.7.1              
 [49] BiocSingular_1.6.0        xfun_0.27                
 [51] clue_0.3-60               pkgbuild_1.2.0           
 [53] multtest_2.46.0           cluster_2.1.2            
 [55] caTools_1.18.2            TSP_1.1-11               
 [57] biomformat_1.18.0         tibble_3.1.5             
 [59] ape_5.5                   listenv_0.8.0            
 [61] Biostrings_2.58.0         png_0.1-7                
 [63] permute_0.9-5             future_1.22.1            
 [65] withr_2.4.2               bitops_1.0-7             
 [67] plyr_1.8.6                cellranger_1.1.0         
 [69] dqrng_0.3.0               pillar_1.6.4             
 [71] gplots_3.1.1              GlobalOptions_0.1.2      
 [73] cachem_1.0.6              fs_1.5.0                 
 [75] flexmix_2.3-17            GetoptLong_1.0.5         
 [77] DelayedMatrixStats_1.12.3 vctrs_0.3.8              
 [79] ellipsis_0.3.2            generics_0.1.1           
 [81] devtools_2.4.2            tools_4.0.5              
 [83] beeswarm_0.4.0            munsell_0.5.0            
 [85] DelayedArray_0.16.3       pkgload_1.2.3            
 [87] fastmap_1.1.0             compiler_4.0.5           
 [89] abind_1.4-5               httpuv_1.6.3             
 [91] sessioninfo_1.1.1         plotly_4.10.0            
 [93] GenomeInfoDbData_1.2.4    gridExtra_2.3            
 [95] glmmTMB_1.1.2.3           lattice_0.20-45          
 [97] deldir_1.0-6              utf8_1.2.2               
 [99] later_1.3.0               dplyr_1.0.7              
[101] jsonlite_1.7.2            pbapply_1.5-0            
[103] sparseMatrixStats_1.2.1   genefilter_1.72.1        
[105] lazyeval_0.2.2            promises_1.2.0.1         
[107] doParallel_1.0.16         R.utils_2.11.0           
[109] goftest_1.2-3             spatstat.utils_2.2-0     
[111] sandwich_3.0-1            rmarkdown_2.11           
[113] cowplot_1.1.1             blme_1.0-5               
[115] statmod_1.4.36            Rtsne_0.15               
[117] HDF5Array_1.18.1          survival_3.2-13          
[119] numDeriv_2016.8-1.1       yaml_2.2.1               
[121] htmltools_0.5.2           memoise_2.0.0            
[123] modeltools_0.2-23         locfit_1.5-9.4           
[125] digest_0.6.28             mime_0.12                
[127] registry_0.5-1            RSQLite_2.2.8            
[129] future.apply_1.8.1        remotes_2.4.1            
[131] blob_1.2.2                vegan_2.5-7              
[133] R.oo_1.24.0               Formula_1.2-4            
[135] splines_4.0.5             Rhdf5lib_1.12.1          
[137] Cairo_1.5-12.2            RCurl_1.98-1.5           
[139] broom_0.7.9               hms_1.1.1                
[141] rhdf5_2.34.0              colorspace_2.0-2         
[143] BiocManager_1.30.16       shape_1.4.6              
[145] nnet_7.3-16               sass_0.4.0               
[147] Rcpp_1.0.7                RANN_2.6.1               
[149] fansi_0.5.0               parallelly_1.28.1        
[151] R6_2.5.1                  ggridges_0.5.3           
[153] lifecycle_1.0.1           bluster_1.0.0            
[155] minqa_1.2.4               testthat_3.1.0           
[157] leiden_0.3.8              jquerylib_0.1.4          
[159] snakecase_0.11.0          desc_1.4.0               
[161] RcppAnnoy_0.0.19          iterators_1.0.13         
[163] TMB_1.7.22                htmlwidgets_1.5.4        
[165] beachmat_2.6.4            polyclip_1.10-0          
[167] mgcv_1.8-38               globals_0.14.0           
[169] leidenAlg_0.1.1           codetools_0.2-18         
[171] lubridate_1.8.0           gtools_3.9.2             
[173] prettyunits_1.1.1         R.methodsS3_1.8.1        
[175] gtable_0.3.0              DBI_1.1.1                
[177] git2r_0.28.0              tensor_1.5               
[179] httr_1.4.2                highr_0.9                
[181] KernSmooth_2.23-20        stringi_1.7.4            
[183] progress_1.2.2            reshape2_1.4.4           
[185] farver_2.1.0              annotate_1.68.0          
[187] hexbin_1.28.2             magick_2.7.3             
[189] colorRamps_2.3            sccore_1.0.0             
[191] boot_1.3-28               grr_0.9.5                
[193] BiocNeighbors_1.8.2       lme4_1.1-27.1            
[195] ade4_1.7-18               geneplotter_1.68.0       
[197] scattermore_0.7           DESeq2_1.30.1            
[199] bit_4.0.4                 spatstat.data_2.1-0      
[201] janitor_2.1.0             pkgconfig_2.0.3          
[203] lmerTest_3.1-3            knitr_1.36