The various differential expression analyses of the data generated in tmrc3_datasets will occur in this document. Most of the actual work is via the function ‘all_pairwise()’; the word ‘all’ in the name does a lot of work; it is responsible for performing all possible pairwise contrasts using all possible methods for which I have sufficient understanding to be able to write a reasonably robust pairwise function. Currently this is limited to:
The first 3 methods allow one to add surrogate variable estimates to the model when performing the differential expression analyses. Noiseq handles surrogates using its own heuristics, EBSeq is inimicable to that kind of model, and I explicitly chose to not make that possible for basic. I am uncertain at this time how the random effect factors used with dream interact with surrogates from sva. With that in mind, in most instances I usually deal with surrogates/batches in one of a few ways:
The last two options are handled via a function named ‘all_adjusters’ in hpgltools which is responsible for ensuring that the data is sane for the assumptions made by each method and invokes each method (hopefully) properly. It returns both modified counts and model estimates when possible and has implementations for a fair number of methods in this realm. sva is my favorite by a pretty big margin, though I do sometimes use RUV (Risso et al. (2014)) and of course, in writing this document I stumbled into another interesting contender: (Molania et al. (2023)) all_adjusters() also has implementations of every example/method I got out of the papers for sva (e.g. ssva/fsva), isva, smartsva, and some others.
I have been changing hpgltools so that it is now possible to trivially pass arbitrarily complex models to the various methods; with the caveat that there is no good way currently to mix fixed effects and random effects across methods; so I am running dream separately and adding it to the result of all_pairwise post-facto.
Each of the following lists describes the set of contrasts that I think are interesting for the various ways one might consider the TMRC3 dataset. The variables are named according to the assumed data with which they will be used, thus tc_cf_contrasts is expected to be used for the Tumaco+Cali data and provide a series of cure/fail comparisons which (to the extent possible) across both locations. In every case, the name of the list element will be used as the contrast name, and will thus be seen as the sheet name in the output xlsx file(s); the two pieces of the character vector value are the numerator and denominator of the associated contrast.
t_cf_contrast <- list(
"outcome" = c("tumaco_failure", "tumaco_cure"))
cf_contrast <- list(
"outcome" = c("failure", "cure"))
visitcf_contrasts <- list(
"v1cf" = c("v1_failure", "v1_cure"),
"v2cf" = c("v2_failure", "v2_cure"),
"v3cf" = c("v3_failure", "v3_cure"))
visit_contrasts <- list(
"v2v1" = c("c2", "c1"),
"v3v1" = c("c3", "c1"),
"v3v2" = c("c3", "c2"))
visit_v1later <- list(
"later_vs_first" = c("later", "first"))
celltypes <- list(
"eo_mono" = c("eosinophils", "monocytes"),
"ne_mono" = c("neutrophils", "monocytes"),
"eo_ne" = c("eosinophils", "neutrophils"))
ethnicity_contrasts <- list(
"mestizo_indigenous" = c("mestiza", "indigena"),
"mestizo_afrocol" = c("mestiza", "afrocol"),
"indigenous_afrocol" = c("indigena", "afrocol"))
visittype_contrasts_mono <- list(
"v2v1_mono_cure" = c("monocytes_2_cure", "monocytes_1_cure"),
"v2v1_mono_failure" = c("monocytes_2_failure", "monocytes_1_failure"),
"v3v1_mono_cure" = c("monocytes_3_cure", "monocytes_1_cure"),
"v3v1_mono_failure" = c("monocytes_3_failure", "monocytes_1_failure"))
visittype_contrasts_eo <- list(
"v2v1_eo_cure" = c("eosinophils_2_cure", "eosinophils_1_cure"),
"v2v1_eo_failure" = c("eosinophils_2_failure", "eosinophils_1_failure"),
"v3v1_eo_cure" = c("eosinophils_3_cure", "eosinophils_1_cure"),
"v3v1_eo_failure" = c("eosinophils_3_failure", "eosinophils_1_failure"))
visittype_contrasts_ne <- list(
"v2v1_ne_cure" = c("neutrophils_2_cure", "neutrophils_1_cure"),
"v2v1_ne_failure" = c("neutrophils_2_failure", "neutrophils_1_failure"),
"v3v1_ne_cure" = c("neutrophils_3_cure", "neutrophils_1_cure"),
"v3v1_ne_failure" = c("neutrophils_3_failure", "neutrophils_1_failure"))
visittype_contrasts <- c(visittype_contrasts_mono,
visittype_contrasts_eo,
visittype_contrasts_ne)Previously, the over representation analyses (e.g. GO and friends) followed each DE analysis during this document. I recently mentally severed my conception of GO analyses into two camps: over representation analyses in which one provides a group of genes deemed significant in some way and asks if there are known categories which contain these genes more than one would expect at random. In contrast, I am defining gene set enrichment analyses explcitly as the process of passing all genes with their metric of choice (logFC, exprs, whatever) and asking if the distribution of all genes is significant with respect to the categories.
With that in mind, I added a series of explicitly GSEA analyses in my later iterations of these documents so that both ways of thinking are provided.
However, I moved those analyses to a separate document (05enrichment.Rmd) in the hopes of improving their organization.
Start over, this time with only the samples from Tumaco. We currently are assuming these will prove to be the only analyses used for final interpretation. This is primarily because we have insufficient failed treatment samples from Cali. There is one disadvantage when using these samples: they had to travel further than the samples taken in Cali and there is significant variance observed between the two locations and we cannot discern its source. In the worst case scenario (one which I think unlikely), the variance is caused by degraded RNA during transit. We do know that the samples were well-stored in RNALater and frozen/etc, so I am inclined to discount that possibility. (Also, looking at the reads in IGV they don’t ‘look’ degreaded to me.) I think a more compelling difference lies in the different population demographics observed in the two locations. Actually, now that I have typed these sentences out, I think I can semi-test this hypothesis by looking at the set of DE genes between the two locations and compare that result to the Tumaco (and/or Cali) ethnicity comparison which is most representative of the ethnicity differences between them. If I get it into my head to try this, I will need to load the DE tables from the 03differential_expression_both.Rmd document; so I am most likely to try it out in the 07var_coef document, which was mostly written by Theresa and is already examining some similar questions.
Start by considering all Tumaco cell types. Note that in this case we only use SVA, primarily because I am not certain what would be an appropriate batch factor, perhaps visit?
t_cf_clinical_de_sva <- all_pairwise(t_clinical, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## cure failure
## 67 56
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## falr_vs_cr
## limma_vs_deseq 0.8063
## limma_vs_edger 0.8177
## limma_vs_basic 0.8704
## limma_vs_noiseq 0.7287
## deseq_vs_edger 0.9845
## deseq_vs_basic 0.8242
## deseq_vs_noiseq 0.7317
## edger_vs_basic 0.8285
## edger_vs_noiseq 0.7370
## basic_vs_noiseq 0.7978
t_cf_clinical_table_sva <- combine_de_tables(
t_cf_clinical_de_sva, keepers = cf_contrast,
excel = glue("{cf_prefix}/All_Samples/t_clinical_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/All_Samples/t_clinical_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 failure_vs_cure 93 183 103 159
## limma_sigup limma_sigdown
## 1 50 38
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_clinical_sig_sva <- extract_significant_genes(
t_cf_clinical_table_sva,
excel = glue("{cf_prefix}/All_Samples/t_clinical_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/All_Samples/t_clinical_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 50 38 103 159 93 183 16
## basic_down
## outcome 4
## [1] 93 59
## [1] 183 59
Repeat without the biopsies.
t_cf_clinicalnb_de_sva <- all_pairwise(t_clinical_nobiop, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## cure failure
## 58 51
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## falr_vs_cr
## limma_vs_deseq 0.8463
## limma_vs_edger 0.8506
## limma_vs_basic 0.8571
## limma_vs_noiseq 0.7532
## deseq_vs_edger 0.9964
## deseq_vs_basic 0.8267
## deseq_vs_noiseq 0.7746
## edger_vs_basic 0.8367
## edger_vs_noiseq 0.7818
## basic_vs_noiseq 0.8524
t_cf_clinicalnb_table_sva <- combine_de_tables(
t_cf_clinicalnb_de_sva, keepers = cf_contrast,
excel = glue("{cf_prefix}/All_Samples/t_clinical_nobiop_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/All_Samples/t_clinical_nobiop_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 failure_vs_cure 140 75 142 67
## limma_sigup limma_sigdown
## 1 54 46
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_clinicalnb_sig_sva <- extract_significant_genes(
t_cf_clinicalnb_table_sva,
excel = glue("{cf_prefix}/All_Samples/t_clinical_nobiop_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/All_Samples/t_clinical_nobiop_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 54 46 142 67 140 75 29
## basic_down
## outcome 7
## [1] 140 59
## [1] 75 59
As the data structure’s name suggests, the above comparison seeks to learn if there are fail/cure differences discernable across all clinical celltypes in samples taken in Tumaco.
The set of steps taken in this previous block will be essentially repeated for every set of contrasts and way of mixing/matching the data and follows the path:
These datastructures are all exposed to various functions in hpgltools which allow one to poke/compare them; I am not a fan of Excel, but I think the xlsx documents it creates are pretty decent, too.
Later in this document I do a bunch of visit/cf comparisons. In this block I want to explicitly only compare v1 to other visits. This is something I did quite a lot in the 2019 datasets, but never actually moved to this document.
tv1_vs_later <- all_pairwise(t_v1vs, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## first later
## 40 69
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## ltr_vs_frs
## limma_vs_deseq 0.8393
## limma_vs_edger 0.8457
## limma_vs_basic 0.8133
## limma_vs_noiseq 0.7094
## deseq_vs_edger 0.9983
## deseq_vs_basic 0.7946
## deseq_vs_noiseq 0.7474
## edger_vs_basic 0.7984
## edger_vs_noiseq 0.7524
## basic_vs_noiseq 0.8068
tv1_vs_later_table <- combine_de_tables(
tv1_vs_later, keepers = visit_v1later,
excel = glue("{xlsx_prefix}/DE_Visits/tv1_vs_later_tables-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/tv1_vs_later_tables-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 later_vs_first 24 7 22 7
## limma_sigup limma_sigdown
## 1 23 7
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
tv1_vs_later_sig <- extract_significant_genes(
tv1_vs_later_table,
excel = glue("{xlsx_prefix}/DE_Visits/tv1_vs_later_sig-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/tv1_vs_later_sig-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down
## later_vs_first 23 7 22 7 24 7
## basic_up basic_down
## later_vs_first 0 0
## subset_expt(): There were 184, now there are 123 samples.
## A modified expressionSet containing 19952 and 123 sample. There are 164 metadata columns and 15 annotation columns.
## The primary condition is comprised of:
## female, male.
## Its current state is: raw(data).
t_sex_de <- all_pairwise(t_sex, model_batch = "svaseq", methods = methods,
parallel = parallel, filter = TRUE)##
## female male
## 22 101
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## mal_vs_fml
## limma_vs_deseq 0.8596
## limma_vs_edger 0.8663
## limma_vs_basic 0.9481
## limma_vs_noiseq 0.7351
## deseq_vs_edger 0.9909
## deseq_vs_basic 0.8703
## deseq_vs_noiseq 0.7263
## edger_vs_basic 0.8748
## edger_vs_noiseq 0.7283
## basic_vs_noiseq 0.7498
t_sex_table <- combine_de_tables(
t_sex_de, excel = glue("{xlsx_prefix}/Gene_Set_Enrichment/t_sex_table-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/Gene_Set_Enrichment/t_sex_table-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 male_vs_female 129 96 116 95
## limma_sigup limma_sigdown
## 1 54 74
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_sex_sig <- extract_significant_genes(
t_sex_table, excel = glue("{xlsx_prefix}/Gene_Set_Enrichment/t_sex_sig-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/Gene_Set_Enrichment/t_sex_sig-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down
## male_vs_female 54 74 116 95 129 96
## basic_up basic_down
## male_vs_female 15 10
## subset_expt(): There were 184, now there are 122 samples.
## subset_expt(): There were 122, now there are 67 samples.
t_sex_cure_de <- all_pairwise(t_sex_cure, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## female male
## 13 54
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## mal_vs_fml
## limma_vs_deseq 0.7804
## limma_vs_edger 0.8380
## limma_vs_basic 0.9284
## limma_vs_noiseq 0.7515
## deseq_vs_edger 0.9294
## deseq_vs_basic 0.7994
## deseq_vs_noiseq 0.6524
## edger_vs_basic 0.8474
## edger_vs_noiseq 0.6952
## basic_vs_noiseq 0.7882
t_sex_cure_table <- combine_de_tables(
t_sex_cure_de, excel = glue("{xlsx_prefix}/DE_Sex/t_sex_cure_table-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Sex/t_sex_cure_table-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 male_vs_female 174 129 162 143
## limma_sigup limma_sigdown
## 1 64 108
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_sex_cure_sig <- extract_significant_genes(
t_sex_cure_table, excel = glue("{xlsx_prefix}/DE_Sex/t_sex_cure_sig-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Sex/t_sex_cure_sig-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down
## male_vs_female 64 108 162 143 174 129
## basic_up basic_down
## male_vs_female 13 5
t_ethnicity_de <- all_pairwise(t_etnia_expt, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## afrocol indigena mestiza
## 76 19 28
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_ethnicity_table <- combine_de_tables(
t_ethnicity_de, keepers = ethnicity_contrasts,
excel = glue("{xlsx_prefix}/DE_Ethnicity/t_ethnicity_table-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Ethnicity/t_ethnicity_table-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 mestiza_vs_indigena 83 97 67 108
## 2 mestiza_vs_afrocol 57 92 52 96
## 3 indigena_vs_afrocol 165 236 187 216
## limma_sigup limma_sigdown
## 1 58 56
## 2 42 53
## 3 165 147
## Plot describing unique/shared genes in a differential expression table.
t_ethnicity_sig <- extract_significant_genes(
t_ethnicity_table, according_to = "deseq",
excel = glue("{xlsx_prefix}/DE_Ethnicity/t_ethnicity_sig-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Ethnicity/t_ethnicity_sig-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## deseq_up deseq_down
## mestizo_indigenous 83 97
## mestizo_afrocol 57 92
## indigenous_afrocol 165 236
One of the most compelling ideas in the data is the opportunity to find genes in the first visit which may help predict the likelihood that a person will respond well to treatment. The following block will therefore look at cure/fail from Tumaco at visit 1.
t_cf_clinical_v1_de_sva <- all_pairwise(tv1_samples, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## cure failure
## 30 24
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## falr_vs_cr
## limma_vs_deseq 0.7398
## limma_vs_edger 0.7830
## limma_vs_basic 0.6887
## limma_vs_noiseq 0.5606
## deseq_vs_edger 0.9537
## deseq_vs_basic 0.6956
## deseq_vs_noiseq 0.6069
## edger_vs_basic 0.7228
## edger_vs_noiseq 0.6304
## basic_vs_noiseq 0.7772
t_cf_clinical_v1_table_sva <- combine_de_tables(
t_cf_clinical_v1_de_sva, keepers = cf_contrast,
excel = glue("{cf_prefix}/Visits/t_clinical_v1_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Visits/t_clinical_v1_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 failure_vs_cure 27 75 28 55
## limma_sigup limma_sigdown
## 1 3 3
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_clinical_v1_sig_sva <- extract_significant_genes(
t_cf_clinical_v1_table_sva,
excel = glue("{cf_prefix}/Visits/t_clinical_v1_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Visits/t_clinical_v1_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 3 3 28 55 27 75 0
## basic_down
## outcome 0
## [1] 27 59
## [1] 75 59
The visit 2 and visit 3 samples are interesting because they provide an opportunity to see if we can observe changes in response in the middle and end of treatment…
t_cf_clinical_v2_de_sva <- all_pairwise(tv2_samples, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## cure failure
## 20 15
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## falr_vs_cr
## limma_vs_deseq 0.8138
## limma_vs_edger 0.8162
## limma_vs_basic 0.7404
## limma_vs_noiseq 0.6361
## deseq_vs_edger 0.9986
## deseq_vs_basic 0.7689
## deseq_vs_noiseq 0.7586
## edger_vs_basic 0.7702
## edger_vs_noiseq 0.7602
## basic_vs_noiseq 0.8078
t_cf_clinical_v2_table_sva <- combine_de_tables(
t_cf_clinical_v2_de_sva, keepers = cf_contrast,
excel = glue("{cf_prefix}/Visits/t_clinical_v2_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Visits/t_clinical_v2_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 failure_vs_cure 51 15 50 11
## limma_sigup limma_sigdown
## 1 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_clinical_v2_sig_sva <- extract_significant_genes(
t_cf_clinical_v2_table_sva,
excel = glue("{cf_prefix}/Visits/t_clinical_v2_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Visits/t_clinical_v2_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 0 0 50 11 51 15 0
## basic_down
## outcome 0
## [1] 51 59
## [1] 15 59
Now let us switch our view to each individual cell type collected. The hope here is that we will be able to learn some cell-specific differences in the response for people who did(not) respond well.
t_cf_biopsy_de_sva <- all_pairwise(t_biopsies, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 9 5
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.7926
## limma_vs_edger 0.8628
## limma_vs_basic 0.8497
## limma_vs_noiseq 0.7628
## deseq_vs_edger 0.9516
## deseq_vs_basic 0.8164
## deseq_vs_noiseq 0.7927
## edger_vs_basic 0.8809
## edger_vs_noiseq 0.8535
## basic_vs_noiseq 0.8819
t_cf_biopsy_table_sva <- combine_de_tables(
t_cf_biopsy_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Biopsies/t_biopsy_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Biopsies/t_biopsy_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 17 11 19
## edger_sigdown limma_sigup limma_sigdown
## 1 15 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_biopsy_sig_sva <- extract_significant_genes(
t_cf_biopsy_table_sva,
excel = glue("{cf_prefix}/Biopsies/t_cf_biopsy_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Biopsies/t_cf_biopsy_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 0 0 19 15 17 11 0
## basic_down
## outcome 0
## [1] 17 59
## [1] 11 59
Same question, but this time looking at monocytes. In addition, this comparison was done twice, once using SVA and once using visit as a batch factor.
t_cf_monocyte_de_sva <- all_pairwise(t_monocytes, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 21 21
## The svs are added to the expressionset during all_pairwise.
t_monocytes <- t_cf_monocyte_de_sva[["input"]]
t_cf_monocyte_de_sva## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8614
## limma_vs_edger 0.8663
## limma_vs_basic 0.9210
## limma_vs_noiseq 0.8064
## deseq_vs_edger 0.9989
## deseq_vs_basic 0.8506
## deseq_vs_noiseq 0.7947
## edger_vs_basic 0.8560
## edger_vs_noiseq 0.8011
## basic_vs_noiseq 0.8949
t_cf_monocyte_table_sva <- combine_de_tables(
t_cf_monocyte_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Monocytes/t_monocyte_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Monocytes/t_monocyte_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 60 52 56
## edger_sigdown limma_sigup limma_sigdown
## 1 51 11 34
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
## [1] 0.33760 -0.07190 0.09667 -0.09081 -0.13500 0.23270
## The first few values in my pre-change result set are:
## 0.338, -0.072, 0.097, -0.091, -0.135, 0.233
t_cf_monocyte_sig_sva <- extract_significant_genes(
t_cf_monocyte_table_sva,
excel = glue("{cf_prefix}/Monocytes/t_monocyte_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Monocytes/t_monocyte_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 11 34 56 51 60 52 8
## basic_down
## outcome 21
## [1] 60 59
## [1] 52 59
t_cf_monocyte_de_batchvisit <- all_pairwise(t_monocytes, model_batch = TRUE,
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 21 21
##
## 3 2 1
## 13 13 16
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: batch in model/limma.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8120
## limma_vs_edger 0.8150
## limma_vs_basic 0.9509
## limma_vs_noiseq 0.8325
## deseq_vs_edger 0.9998
## deseq_vs_basic 0.8505
## deseq_vs_noiseq 0.7807
## edger_vs_basic 0.8540
## edger_vs_noiseq 0.7852
## basic_vs_noiseq 0.8949
t_cf_monocyte_table_batchvisit <- combine_de_tables(
t_cf_monocyte_de_batchvisit, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Monocytes/t_monocyte_cf_table_batchvisit-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Monocytes/t_monocyte_cf_table_batchvisit-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 43 93 47
## edger_sigdown limma_sigup limma_sigdown
## 1 105 6 13
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_monocyte_sig_batchvisit <- extract_significant_genes(
t_cf_monocyte_table_batchvisit,
excel = glue("{cf_prefix}/Monocytes/t_monocyte_cf_sig_batchvisit-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Monocytes/t_monocyte_cf_sig_batchvisit-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 6 13 47 105 43 93 8
## basic_down
## outcome 21
## [1] 43 59
## [1] 93 59
Now focus in on the monocyte samples on a per-visit basis.
t_cf_monocyte_v1_de_sva <- all_pairwise(tv1_monocytes, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 8 8
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8902
## limma_vs_edger 0.8905
## limma_vs_basic 0.9441
## limma_vs_noiseq 0.8548
## deseq_vs_edger 0.9999
## deseq_vs_basic 0.8866
## deseq_vs_noiseq 0.8760
## edger_vs_basic 0.8870
## edger_vs_noiseq 0.8766
## basic_vs_noiseq 0.9062
t_cf_monocyte_v1_table_sva <- combine_de_tables(
t_cf_monocyte_v1_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Monocytes/t_monocyte_v1_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Monocytes/t_monocyte_v1_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 14 52 15
## edger_sigdown limma_sigup limma_sigdown
## 1 57 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_monocyte_v1_sig_sva <- extract_significant_genes(
t_cf_monocyte_v1_table_sva,
excel = glue("{cf_prefix}/Monocytes/t_monocyte_v1_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Monocytes/t_monocyte_v1_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 0 0 15 57 14 52 0
## basic_down
## outcome 0
## [1] 14 59
## [1] 52 59
sva_aucc <- calculate_aucc(t_cf_monocyte_table_sva[["data"]][[1]],
tbl2 = t_cf_monocyte_table_batchvisit[["data"]][[1]],
py = "deseq_adjp", ly = "deseq_logfc")
sva_aucc## These two tables have an aucc value of: 0.694269508631419 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 182, df = 10860, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8634 0.8726
## sample estimates:
## cor
## 0.8681
shared_ids <- rownames(t_cf_monocyte_table_sva[["data"]][[1]]) %in%
rownames(t_cf_monocyte_table_batchvisit[["data"]][[1]])
first <- t_cf_monocyte_table_sva[["data"]][[1]][shared_ids, ]
second <- t_cf_monocyte_table_batchvisit[["data"]][[1]][rownames(first), ]
cor.test(first[["deseq_logfc"]], second[["deseq_logfc"]])##
## Pearson's product-moment correlation
##
## data: first[["deseq_logfc"]] and second[["deseq_logfc"]]
## t = 182, df = 10860, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8634 0.8726
## sample estimates:
## cor
## 0.8681
Switch context to the Neutrophils, once again repeat the analysis using SVA and visit as a batch factor.
t_cf_neutrophil_de_sva <- all_pairwise(t_neutrophils, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 20 21
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8742
## limma_vs_edger 0.8784
## limma_vs_basic 0.9321
## limma_vs_noiseq 0.8237
## deseq_vs_edger 0.9994
## deseq_vs_basic 0.8755
## deseq_vs_noiseq 0.8196
## edger_vs_basic 0.8813
## edger_vs_noiseq 0.8269
## basic_vs_noiseq 0.8903
t_cf_neutrophil_table_sva <- combine_de_tables(
t_cf_neutrophil_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 129 30 120
## edger_sigdown limma_sigup limma_sigdown
## 1 27 12 12
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_neutrophil_sig_sva <- extract_significant_genes(
t_cf_neutrophil_table_sva,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 12 12 120 27 129 30 4
## basic_down
## outcome 2
## [1] 129 59
## [1] 30 59
t_cf_neutrophil_de_batchvisit <- all_pairwise(t_neutrophils, model_batch = TRUE,
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 20 21
##
## 3 2 1
## 12 13 16
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: batch in model/limma.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8380
## limma_vs_edger 0.8401
## limma_vs_basic 0.9658
## limma_vs_noiseq 0.8544
## deseq_vs_edger 0.9999
## deseq_vs_basic 0.8644
## deseq_vs_noiseq 0.8164
## edger_vs_basic 0.8671
## edger_vs_noiseq 0.8202
## basic_vs_noiseq 0.8903
t_cf_neutrophil_table_batchvisit <- combine_de_tables(
t_cf_neutrophil_de_batchvisit, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_cf_table_batchvisit-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_cf_table_batchvisit-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 92 47 101
## edger_sigdown limma_sigup limma_sigdown
## 1 44 3 1
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_neutrophil_sig_batchvisit <- extract_significant_genes(
t_cf_neutrophil_table_batchvisit,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_cf_sig_batchvisit-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_cf_sig_batchvisit-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 3 1 101 44 92 47 4
## basic_down
## outcome 2
## [1] 92 59
## [1] 47 59
When I did this with the monocytes, I split it up into multiple blocks for each visit. This time I am just going to run them all together.
visitcf_factor <- paste0("v", pData(t_neutrophils)[["visitnumber"]],
pData(t_neutrophils)[["finaloutcome"]])
t_neutrophil_visitcf <- set_expt_conditions(t_neutrophils, fact=visitcf_factor)## The numbers of samples by condition are:
##
## v1cure v1failure v2cure v2failure v3cure v3failure
## 8 8 7 6 5 7
t_cf_neutrophil_visits_de_sva <- all_pairwise(t_neutrophil_visitcf, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## v1cure v1failure v2cure v2failure v3cure v3failure
## 8 8 7 6 5 7
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_cf_neutrophil_visits_table_sva <- combine_de_tables(
t_cf_neutrophil_visits_de_sva, keepers = visitcf_contrasts,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_visitcf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_visitcf_table_sva-v202411.xlsx before writing the tables.
## The keepers has no elements in the coefficients.
## Here are the keepers: v1_failure, v1_cure, v2_failure, v2_cure, v3_failure, v3_cure
## Here are the coefficients: v1failure, v1cure, v2cure, v1cure, v2failure, v1cure, v3cure, v1cure, v3failure, v1cure, v2cure, v1failure, v2failure, v1failure, v3cure, v1failure, v3failure, v1failure, v2failure, v2cure, v3cure, v2cure, v3failure, v2cure, v3cure, v2failure, v3failure, v2failure, v3failure, v3cure
## Error in extract_keepers(extracted, keepers, table_names, all_coefficients, : Unable to find the set of contrasts to keep, fix this and try again.
## Error in eval(expr, envir, enclos): object 't_cf_neutrophil_visits_table_sva' not found
t_cf_neutrophil_visits_sig_sva <- extract_significant_genes(
t_cf_neutrophil_visits_table_sva,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_visitcf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_visitcf_sig_sva-v202411.xlsx before writing the tables.
## Error in eval(expr, envir, enclos): object 't_cf_neutrophil_visits_table_sva' not found
## Error in eval(expr, envir, enclos): object 't_cf_neutrophil_visits_sig_sva' not found
## Error in eval(expr, envir, enclos): object 't_cf_neutrophil_visits_sig_sva' not found
## Error in eval(expr, envir, enclos): object 't_cf_neutrophil_visits_sig_sva' not found
Now V1
t_cf_neutrophil_v1_de_sva <- all_pairwise(tv1_neutrophils, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 8 8
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8182
## limma_vs_edger 0.8319
## limma_vs_basic 0.8910
## limma_vs_noiseq 0.8084
## deseq_vs_edger 0.9946
## deseq_vs_basic 0.8627
## deseq_vs_noiseq 0.8290
## edger_vs_basic 0.8792
## edger_vs_noiseq 0.8474
## basic_vs_noiseq 0.9014
t_cf_neutrophil_v1_table_sva <- combine_de_tables(
t_cf_neutrophil_v1_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_v1_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_v1_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 5 8 5
## edger_sigdown limma_sigup limma_sigdown
## 1 11 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_neutrophil_v1_sig_sva <- extract_significant_genes(
t_cf_neutrophil_v1_table_sva,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_v1_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_v1_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 0 0 5 11 5 8 0
## basic_down
## outcome 0
## [1] 5 59
## [1] 8 59
t_cf_neutrophil_v2_de_sva <- all_pairwise(tv2_neutrophils, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 7 6
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8893
## limma_vs_edger 0.8880
## limma_vs_basic 0.9485
## limma_vs_noiseq 0.8394
## deseq_vs_edger 0.9986
## deseq_vs_basic 0.9021
## deseq_vs_noiseq 0.9024
## edger_vs_basic 0.9026
## edger_vs_noiseq 0.9009
## basic_vs_noiseq 0.8742
t_cf_neutrophil_v2_table_sva <- combine_de_tables(
t_cf_neutrophil_v2_de_sva,
keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_v2_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_v2_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 9 3 20
## edger_sigdown limma_sigup limma_sigdown
## 1 6 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_neutrophil_v2_sig_sva <- extract_significant_genes(
t_cf_neutrophil_v2_table_sva,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_v2_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_v2_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 0 0 20 6 9 3 0
## basic_down
## outcome 0
## [1] 9 59
## [1] 3 59
t_cf_neutrophil_v3_de_sva <- all_pairwise(tv3_neutrophils, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 5 7
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8848
## limma_vs_edger 0.8859
## limma_vs_basic 0.7953
## limma_vs_noiseq 0.7096
## deseq_vs_edger 0.9993
## deseq_vs_basic 0.7530
## deseq_vs_noiseq 0.7575
## edger_vs_basic 0.7515
## edger_vs_noiseq 0.7564
## basic_vs_noiseq 0.8892
t_cf_neutrophil_v3_table_sva <- combine_de_tables(
t_cf_neutrophil_v3_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_v3_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_v3_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 5 1 5
## edger_sigdown limma_sigup limma_sigdown
## 1 1 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_neutrophil_v3_sig_sva <- extract_significant_genes(
t_cf_neutrophil_v3_table_sva,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_v3_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Neutrophils/t_neutrophil_v3_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 0 0 5 1 5 1 0
## basic_down
## outcome 0
## [1] 5 59
## [1] 1 59
sva_aucc <- calculate_aucc(t_cf_neutrophil_table_sva[["data"]][[1]],
tbl2 = t_cf_neutrophil_table_batchvisit[["data"]][[1]],
py = "deseq_adjp", ly = "deseq_logfc")
sva_aucc## These two tables have an aucc value of: 0.673368382537023 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 209, df = 9099, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9060 0.9131
## sample estimates:
## cor
## 0.9096
shared_ids <- rownames(t_cf_neutrophil_table_sva[["data"]][[1]]) %in%
rownames(t_cf_neutrophil_table_batchvisit[["data"]][[1]])
first <- t_cf_neutrophil_table_sva[["data"]][[1]][shared_ids, ]
second <- t_cf_neutrophil_table_batchvisit[["data"]][[1]][rownames(first), ]
cor.test(first[["deseq_logfc"]], second[["deseq_logfc"]])##
## Pearson's product-moment correlation
##
## data: first[["deseq_logfc"]] and second[["deseq_logfc"]]
## t = 209, df = 9099, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9060 0.9131
## sample estimates:
## cor
## 0.9096
This time, with feeling! Repeating the same set of tasks with the eosinophil samples.
t_cf_eosinophil_de_sva <- all_pairwise(t_eosinophils, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 17 9
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.9099
## limma_vs_edger 0.9174
## limma_vs_basic 0.8755
## limma_vs_noiseq 0.7909
## deseq_vs_edger 0.9973
## deseq_vs_basic 0.8488
## deseq_vs_noiseq 0.7864
## edger_vs_basic 0.8546
## edger_vs_noiseq 0.7963
## basic_vs_noiseq 0.8713
t_cf_eosinophil_table_sva <- combine_de_tables(
t_cf_eosinophil_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 116 73 112
## edger_sigdown limma_sigup limma_sigdown
## 1 63 57 34
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_eosinophil_sig_sva <- extract_significant_genes(
t_cf_eosinophil_table_sva,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 57 34 112 63 116 73 0
## basic_down
## outcome 0
## [1] 116 59
## [1] 73 59
| ensembl_gene_id | ensembl_transcript_id | version | transcript_version | description | gene_biotype | cds_length | chromosome_name | strand | start_position | end_position | hgnc_symbol | uniprot_gn_symbol | transcript | mean_cds_len | deseq_logfc | deseq_adjp | edger_logfc | edger_adjp | limma_logfc | limma_adjp | noiseq_logfc | noiseq_adjp | basic_num | basic_den | basic_numvar | basic_denvar | basic_logfc | basic_t | basic_p | basic_adjp | deseq_basemean | deseq_lfcse | deseq_stat | deseq_p | deseq_num | deseq_den | edger_logcpm | edger_lr | edger_p | limma_ave | limma_t | limma_b | limma_p | noiseq_num | noiseq_den | noiseq_theta | noiseq_prob | noiseq_p | limma_adjp_fdr | deseq_adjp_fdr | edger_adjp_fdr | basic_adjp_fdr | noiseq_adjp_fdr | lfc_meta | lfc_var | lfc_varbymed | p_meta | p_var | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ENSG00000198178 | ENSG00000198178 | ENST00000537530 | 10 | 1 | C-type lectin domain family 4 member C [Source:HGNC Symbol;Acc:HGNC:13258] | protein_coding | 267 | 12 | - | 7729415 | 7751605 | CLEC4C | CLEC4C | ENSG00000198178.1 | 510.5 | 5.553 | 0.0019 | 5.170 | 0.1899 | 4.222 | 0.0191 | 1.4675 | 1 | 2.0400 | -2.764 | 8.784 | 8.946 | 4.804 | 3.920 | 0.0012 | 0.1398 | 193.80 | 1.3020 | 4.264 | 0e+00 | 9.622 | 4.0693 | 2.2170 | 6.017 | 0.0142 | -1.4190 | 4.4380 | 0.1193 | 0.0002 | 3.580 | 9.899 | -1.445 | 0.9473 | 0.0527 | 0.0191 | 0.0019 | 0.1899 | 0.1398 | 0.8357 | 4.990 | 4.537e-03 | 9.092e-04 | 4.782e-03 | 6.610e-05 |
| ENSG00000187569 | ENSG00000187569 | ENST00000345088 | 3 | 3 | developmental pluripotency associated 3 [Source:HGNC Symbol;Acc:HGNC:19199] | protein_coding | 480 | 12 | + | 7711433 | 7717559 | DPPA3 | DPPA3 | ENSG00000187569.3 | 480 | 5.461 | 0.0068 | 4.729 | 0.0540 | 3.503 | 0.0470 | 0.6819 | 1 | -0.6872 | -4.301 | 7.263 | 2.839 | 3.614 | 3.662 | 0.0035 | 0.1989 | 23.10 | 1.4290 | 3.821 | 1e-04 | 5.872 | 0.4107 | -0.5913 | 9.820 | 0.0017 | -3.3720 | 3.6980 | -1.6560 | 0.0011 | 2.088 | 3.349 | -1.177 | 0.9103 | 0.0897 | 0.0470 | 0.0068 | 0.0539 | 0.1989 | 0.8357 | 4.447 | 4.154e-01 | 9.341e-02 | 9.720e-04 | 6.397e-07 |
| ENSG00000136235 | ENSG00000136235 | ENST00000479625 | 16 | 1 | glycoprotein nmb [Source:HGNC Symbol;Acc:HGNC:4462] | protein_coding | undefined | 7 | + | 23235967 | 23275108 | GPNMB | GPNMB | ENSG00000136235.1 | 1447.5 | 5.409 | 0.0004 | 5.373 | 0.0001 | 3.868 | 0.1750 | 1.2238 | 1 | -1.1190 | -3.695 | 12.101 | 2.665 | 2.576 | 2.102 | 0.0621 | 0.4987 | 53.03 | 1.1380 | 4.751 | 0e+00 | 6.906 | 1.4968 | 0.4580 | 25.550 | 0.0000 | -3.2370 | 2.5220 | -3.2560 | 0.0183 | 2.100 | 4.905 | -1.087 | 0.9259 | 0.0741 | 0.1750 | 0.0004 | 0.0001 | 0.4987 | 0.8357 | 4.802 | 5.307e-02 | 1.105e-02 | 6.111e-03 | 1.120e-04 |
| ENSG00000089012 | ENSG00000089012 | ENST00000497407 | 14 | 2 | signal regulatory protein gamma [Source:HGNC Symbol;Acc:HGNC:15757] | protein_coding | undefined | 20 | - | 1629152 | 1657779 | SIRPG | SIRPG | ENSG00000089012.2 | 880.8 | 4.042 | 0.0000 | 4.019 | 0.0000 | 1.596 | 0.6631 | 2.7349 | 1 | 0.8317 | -1.681 | 13.876 | 1.355 | 2.513 | 1.974 | 0.0805 | 0.5427 | 272.50 | 0.7310 | 5.529 | 0e+00 | 7.575 | 3.5330 | 2.7060 | 32.770 | 0.0000 | -1.1480 | 0.9799 | -5.0030 | 0.3364 | 2.385 | 15.874 | -2.097 | 0.9883 | 0.0117 | 0.6630 | 0.0000 | 0.0000 | 0.5427 | 0.8357 | 3.148 | 1.581e+00 | 5.023e-01 | 1.121e-01 | 3.772e-02 |
| ENSG00000089127 | ENSG00000089127 | ENST00000540589 | 13 | 2 | 2’-5’-oligoadenylate synthetase 1 [Source:HGNC Symbol;Acc:HGNC:8086] | protein_coding | 68 | 12 | + | 112906783 | 112933222 | OAS1 | OAS1 | ENSG00000089127.2 | 682.8 | 3.933 | 0.0000 | 3.943 | 0.0000 | 3.338 | 0.0595 | 2.1220 | 1 | 1.9510 | -1.301 | 8.237 | 1.116 | 3.252 | 3.284 | 0.0092 | 0.2669 | 184.60 | 0.5478 | 7.179 | 0e+00 | 7.841 | 3.9082 | 2.1560 | 44.590 | 0.0000 | -0.4596 | 3.4950 | -1.3000 | 0.0018 | 2.522 | 10.978 | -2.205 | 0.9849 | 0.0151 | 0.0595 | 0.0000 | 0.0000 | 0.2669 | 0.8357 | 3.722 | 1.789e-02 | 4.806e-03 | 5.900e-04 | 1.044e-06 |
| ENSG00000137959 | ENSG00000137959 | ENST00000450498 | 16 | 1 | interferon induced protein 44 like [Source:HGNC Symbol;Acc:HGNC:17817] | protein_coding | 699 | 1 | + | 78619922 | 78646145 | IFI44L | IFI44L | ENSG00000137959.1 | 783.333333333333 | 3.828 | 0.0000 | 3.831 | 0.0000 | 3.443 | 0.0122 | 3.6168 | 0 | 5.5560 | 1.793 | 6.584 | 3.318 | 3.763 | 3.909 | 0.0020 | 0.1645 | 1932.00 | 0.5402 | 7.087 | 0e+00 | 11.304 | 7.4756 | 5.4900 | 57.380 | 0.0000 | 3.0090 | 4.7380 | 1.6850 | 0.0001 | 7.837 | 96.140 | -3.316 | 1.0000 | 0.0000 | 0.0122 | 0.0000 | 0.0000 | 0.1645 | 0.0000 | 3.691 | 2.640e-03 | 7.153e-04 | 2.393e-05 | 1.717e-09 |
| ensembl_gene_id | ensembl_transcript_id | version | transcript_version | description | gene_biotype | cds_length | chromosome_name | strand | start_position | end_position | hgnc_symbol | uniprot_gn_symbol | transcript | mean_cds_len | deseq_logfc | deseq_adjp | edger_logfc | edger_adjp | limma_logfc | limma_adjp | noiseq_logfc | noiseq_adjp | basic_num | basic_den | basic_numvar | basic_denvar | basic_logfc | basic_t | basic_p | basic_adjp | deseq_basemean | deseq_lfcse | deseq_stat | deseq_p | deseq_num | deseq_den | edger_logcpm | edger_lr | edger_p | limma_ave | limma_t | limma_b | limma_p | noiseq_num | noiseq_den | noiseq_theta | noiseq_prob | noiseq_p | limma_adjp_fdr | deseq_adjp_fdr | edger_adjp_fdr | basic_adjp_fdr | noiseq_adjp_fdr | lfc_meta | lfc_var | lfc_varbymed | p_meta | p_var | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ENSG00000179344 | ENSG00000179344 | ENST00000399084 | 16 | 5 | major histocompatibility complex, class II, DQ beta 1 [Source:HGNC Symbol;Acc:HGNC:4944] | protein_coding | 786 | 6 | - | 32659467 | 32668383 | HLA-DQB1 | HLA-DQB1 | ENSG00000179344.5 | 645.5 | -5.676 | 0.0000 | -5.668 | 0.0000 | -7.609 | 0.0156 | -4.4060 | 0 | 0.0597 | 5.6120 | 5.9251 | 7.993 | -5.552 | -5.227 | 0.0001 | 0.0515 | 4151.00 | 0.8487 | -6.688 | 0.0000 | 6.783 | 12.458 | 6.575 | 36.270 | 0.0000 | 3.5810 | -4.601 | 1.286 | 0.0001 | 104.486 | 4.928 | 4.5901 | 1.0000 | 0.0000 | 0.0157 | 0.0000 | 0.0000 | 0.0515 | 0.0000 | -5.948 | 1.293e+00 | -2.173e-01 | 3.417e-05 | 3.502e-09 |
| ENSG00000112139 | ENSG00000112139 | ENST00000515437 | 16 | 5 | MAM domain containing glycosylphosphatidylinositol anchor 1 [Source:HGNC Symbol;Acc:HGNC:19267] | protein_coding | 388 | 6 | - | 37630679 | 37699306 | MDGA1 | MDGA1 | ENSG00000112139.5 | 1438.71428571429 | -5.038 | 0.0015 | -4.942 | 0.0396 | -2.842 | 0.2587 | -0.7507 | 1 | -3.3850 | -0.1629 | 10.6461 | 14.783 | -3.222 | -2.249 | 0.0366 | 0.4206 | 149.80 | 1.1640 | -4.329 | 0.0000 | 2.706 | 7.744 | 1.813 | 10.660 | 0.0011 | -1.5710 | -2.140 | -3.688 | 0.0422 | 5.239 | 3.114 | 0.7443 | 0.8075 | 0.1925 | 0.2587 | 0.0015 | 0.0395 | 0.4206 | 0.8357 | -3.895 | 9.310e-01 | -2.390e-01 | 1.444e-02 | 5.784e-04 |
| ENSG00000203972 | ENSG00000203972 | ENST00000545705 | 10 | 1 | glycine-N-acyltransferase like 3 [Source:HGNC Symbol;Acc:HGNC:21349] | protein_coding | 468 | 6 | + | 49499923 | 49528078 | GLYATL3 | GLYATL3 | ENSG00000203972.1 | 667.5 | -4.721 | 0.0496 | -4.602 | 0.0362 | -2.961 | 0.1917 | -0.4092 | 1 | -5.7280 | -3.3770 | 0.5218 | 6.712 | -2.351 | -3.493 | 0.0023 | 0.1675 | 27.99 | 1.5570 | -3.033 | 0.0024 | -1.882 | 2.839 | -0.443 | 10.870 | 0.0010 | -4.5450 | -2.444 | -3.578 | 0.0219 | 2.711 | 2.042 | 0.5496 | 0.6925 | 0.3075 | 0.1916 | 0.0496 | 0.0362 | 0.1675 | 0.9068 | -3.900 | 8.990e-02 | -2.305e-02 | 8.417e-03 | 1.359e-04 |
| ENSG00000196526 | ENSG00000196526 | ENST00000358461 | 10 | 6 | actin filament associated protein 1 [Source:HGNC Symbol;Acc:HGNC:24017] | protein_coding | 2193 | 4 | - | 7758714 | 7939926 | AFAP1 | AFAP1 | ENSG00000196526.6 | 1911 | -3.293 | 0.0253 | -3.293 | 0.0578 | -2.537 | 0.2975 | -2.2170 | 1 | 0.5888 | 2.6700 | 2.1638 | 11.578 | -2.081 | -2.168 | 0.0405 | 0.4335 | 982.20 | 0.9856 | -3.341 | 0.0008 | 6.892 | 10.185 | 4.492 | 9.592 | 0.0020 | 1.8040 | -1.997 | -4.140 | 0.0567 | 23.858 | 5.131 | 2.1394 | 0.9761 | 0.0239 | 0.2975 | 0.0253 | 0.0578 | 0.4335 | 0.8357 | -2.956 | 1.507e-01 | -5.098e-02 | 1.982e-02 | 1.018e-03 |
| ENSG00000175592 | ENSG00000175592 | ENST00000312562 | 9 | 7 | FOS like 1, AP-1 transcription factor subunit [Source:HGNC Symbol;Acc:HGNC:13718] | protein_coding | 816 | 11 | - | 65892049 | 65900573 | FOSL1 | FOSL1 | ENSG00000175592.7 | 496 | -3.096 | 0.0000 | -3.081 | 0.0000 | -2.220 | 0.1738 | -0.7531 | 1 | 0.1522 | 1.8020 | 3.6253 | 4.212 | -1.650 | -2.045 | 0.0561 | 0.4818 | 267.80 | 0.5691 | -5.441 | 0.0000 | 5.087 | 8.184 | 2.640 | 30.630 | 0.0000 | 1.0720 | -2.527 | -3.084 | 0.0181 | 6.345 | 3.764 | 1.1519 | 0.9081 | 0.0919 | 0.1738 | 0.0000 | 0.0000 | 0.4818 | 0.8357 | -2.751 | 2.006e-01 | -7.290e-02 | 6.047e-03 | 1.097e-04 |
| ENSG00000122877 | ENSG00000122877 | ENST00000637191 | 16 | 1 | early growth response 2 [Source:HGNC Symbol;Acc:HGNC:3239] | protein_coding | 418 | 10 | - | 62811996 | 62919900 | EGR2 | EGR2 | ENSG00000122877.1 | 1140.25 | -2.789 | 0.0116 | -2.780 | 0.0109 | -2.010 | 0.2752 | -0.6118 | 1 | -1.2330 | -0.0550 | 0.8328 | 5.118 | -1.178 | -1.878 | 0.0731 | 0.5187 | 96.53 | 0.7679 | -3.632 | 0.0003 | 3.932 | 6.721 | 1.188 | 14.120 | 0.0002 | -0.7511 | -2.077 | -3.768 | 0.0481 | 3.917 | 2.563 | 0.7938 | 0.8090 | 0.1910 | 0.2752 | 0.0116 | 0.0109 | 0.5187 | 0.8357 | -2.514 | 2.515e-01 | -1.000e-01 | 1.619e-02 | 7.646e-04 |
Repeat with batch in the model.
t_cf_eosinophil_de_batchvisit <- all_pairwise(t_eosinophils, model_batch = TRUE,
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 17 9
##
## 3 2 1
## 9 9 8
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: batch in model/limma.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8678
## limma_vs_edger 0.8696
## limma_vs_basic 0.9676
## limma_vs_noiseq 0.8444
## deseq_vs_edger 0.9998
## deseq_vs_basic 0.8961
## deseq_vs_noiseq 0.8351
## edger_vs_basic 0.8977
## edger_vs_noiseq 0.8396
## basic_vs_noiseq 0.8713
t_cf_eosinophil_table_batchvisit <- combine_de_tables(
t_cf_eosinophil_de_batchvisit, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_cf_table_batchvisit-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_cf_table_batchvisit-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 99 35 103
## edger_sigdown limma_sigup limma_sigdown
## 1 24 35 15
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_eosinophil_sig_batchvisit <- extract_significant_genes(
t_cf_eosinophil_table_batchvisit,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_cf_sig_batchvisit-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_cf_sig_batchvisit-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 35 15 103 24 99 35 0
## basic_down
## outcome 0
## [1] 99 59
## [1] 35 59
| ensembl_gene_id | ensembl_transcript_id | version | transcript_version | description | gene_biotype | cds_length | chromosome_name | strand | start_position | end_position | hgnc_symbol | uniprot_gn_symbol | transcript | mean_cds_len | deseq_logfc | deseq_adjp | edger_logfc | edger_adjp | limma_logfc | limma_adjp | noiseq_logfc | noiseq_adjp | basic_num | basic_den | basic_numvar | basic_denvar | basic_logfc | basic_t | basic_p | basic_adjp | deseq_basemean | deseq_lfcse | deseq_stat | deseq_p | deseq_num | deseq_den | edger_logcpm | edger_lr | edger_p | limma_ave | limma_t | limma_b | limma_p | noiseq_num | noiseq_den | noiseq_theta | noiseq_prob | noiseq_p | limma_adjp_fdr | deseq_adjp_fdr | edger_adjp_fdr | basic_adjp_fdr | noiseq_adjp_fdr | lfc_meta | lfc_var | lfc_varbymed | p_meta | p_var | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ENSG00000165949 | ENSG00000165949 | ENST00000611954 | 12 | 4 | interferon alpha inducible protein 27 [Source:HGNC Symbol;Acc:HGNC:5397] | protein_coding | 180 | 14 | + | 94104836 | 94116698 | IFI27 | IFI27 | ENSG00000165949.4 | 287.454545454545 | 5.668 | 0e+00 | 5.624 | 0e+00 | 4.397 | 0.0591 | 1.2302 | 1 | -0.1291 | -3.3160 | 7.379 | 1.696 | 3.186 | 3.323 | 0.0077 | 0.2504 | 54.63 | 0.8188 | 6.923 | 0 | 7.505 | 1.8370 | 0.4882 | 47.95 | 0 | -2.6550 | 3.858 | -1.1070 | 0.0007 | 2.125 | 4.985 | -1.156 | 0.9137 | 0.0863 | 0.0591 | 0e+00 | 0e+00 | 0.2504 | 0.8357 | 5.230 | 0.000e+00 | 0.000e+00 | 2.264e-04 | 1.537e-07 |
| ENSG00000187569 | ENSG00000187569 | ENST00000345088 | 3 | 3 | developmental pluripotency associated 3 [Source:HGNC Symbol;Acc:HGNC:19199] | protein_coding | 480 | 12 | + | 7711433 | 7717559 | DPPA3 | DPPA3 | ENSG00000187569.3 | 480 | 5.537 | 4e-04 | 5.386 | 1e-04 | 4.404 | 0.0351 | 0.6819 | 1 | -0.6872 | -4.3010 | 7.263 | 2.839 | 3.614 | 3.662 | 0.0035 | 0.1989 | 23.10 | 1.1660 | 4.747 | 0 | 5.915 | 0.3782 | -0.6406 | 25.31 | 0 | -3.3720 | 4.263 | -0.7244 | 0.0002 | 2.088 | 3.349 | -1.177 | 0.9103 | 0.0897 | 0.0351 | 4e-04 | 1e-04 | 0.1989 | 0.8357 | 5.088 | 3.906e-02 | 7.677e-03 | 7.965e-05 | 1.843e-08 |
| ENSG00000136235 | ENSG00000136235 | ENST00000479625 | 16 | 1 | glycoprotein nmb [Source:HGNC Symbol;Acc:HGNC:4462] | protein_coding | undefined | 7 | + | 23235967 | 23275108 | GPNMB | GPNMB | ENSG00000136235.1 | 1447.5 | 5.426 | 2e-04 | 5.360 | 0e+00 | 2.104 | 0.5947 | 1.2238 | 1 | -1.1190 | -3.6950 | 12.101 | 2.665 | 2.576 | 2.102 | 0.0621 | 0.4987 | 53.03 | 1.0740 | 5.053 | 0 | 7.515 | 2.0897 | 0.4259 | 29.50 | 0 | -3.2370 | 1.413 | -4.4990 | 0.1695 | 2.100 | 4.905 | -1.087 | 0.9259 | 0.0741 | 0.5947 | 2e-04 | 0e+00 | 0.4987 | 0.8357 | 4.060 | 2.227e+00 | 5.485e-01 | 5.650e-02 | 9.577e-03 |
| ENSG00000089127 | ENSG00000089127 | ENST00000540589 | 13 | 2 | 2’-5’-oligoadenylate synthetase 1 [Source:HGNC Symbol;Acc:HGNC:8086] | protein_coding | 68 | 12 | + | 112906783 | 112933222 | OAS1 | OAS1 | ENSG00000089127.2 | 682.8 | 4.820 | 0e+00 | 4.830 | 0e+00 | 3.978 | 0.1341 | 2.1220 | 1 | 1.9510 | -1.3010 | 8.237 | 1.116 | 3.252 | 3.284 | 0.0092 | 0.2669 | 184.60 | 0.7144 | 6.746 | 0 | 8.840 | 4.0197 | 2.1430 | 56.76 | 0 | -0.4596 | 3.160 | -1.9060 | 0.0040 | 2.522 | 10.978 | -2.205 | 0.9849 | 0.0151 | 0.1341 | 0e+00 | 0e+00 | 0.2669 | 0.8357 | 4.652 | 5.441e-02 | 1.170e-02 | 1.328e-03 | 5.293e-06 |
| ENSG00000111335 | ENSG00000111335 | ENST00000551603 | 12 | 1 | 2’-5’-oligoadenylate synthetase 2 [Source:HGNC Symbol;Acc:HGNC:8087] | protein_coding | 183 | 12 | + | 112978395 | 113011723 | OAS2 | OAS2 | ENSG00000111335.1 | 1319.5 | 4.447 | 0e+00 | 4.461 | 0e+00 | 3.601 | 0.2035 | 3.0969 | 0 | 4.0180 | 0.8398 | 12.517 | 3.025 | 3.178 | 2.537 | 0.0293 | 0.3953 | 1028.00 | 0.8157 | 5.451 | 0 | 11.444 | 6.9971 | 4.5830 | 38.11 | 0 | 1.7970 | 2.779 | -2.7210 | 0.0100 | 5.227 | 44.719 | -2.937 | 1.0000 | 0.0000 | 0.2035 | 0e+00 | 0e+00 | 0.3953 | 0.0000 | 4.110 | 6.269e-02 | 1.525e-02 | 3.340e-03 | 3.347e-05 |
| ENSG00000137959 | ENSG00000137959 | ENST00000450498 | 16 | 1 | interferon induced protein 44 like [Source:HGNC Symbol;Acc:HGNC:17817] | protein_coding | 699 | 1 | + | 78619922 | 78646145 | IFI44L | IFI44L | ENSG00000137959.1 | 783.333333333333 | 4.200 | 0e+00 | 4.213 | 0e+00 | 3.902 | 0.0422 | 3.6168 | 0 | 5.5560 | 1.7930 | 6.584 | 3.318 | 3.763 | 3.909 | 0.0020 | 0.1645 | 1932.00 | 0.7590 | 5.534 | 0 | 12.253 | 8.0528 | 5.4890 | 40.52 | 0 | 3.0090 | 4.118 | 0.2407 | 0.0003 | 7.837 | 96.140 | -3.316 | 1.0000 | 0.0000 | 0.0422 | 0e+00 | 0e+00 | 0.1645 | 0.0000 | 4.204 | 7.374e-02 | 1.754e-02 | 1.151e-04 | 3.976e-08 |
| ensembl_gene_id | ensembl_transcript_id | version | transcript_version | description | gene_biotype | cds_length | chromosome_name | strand | start_position | end_position | hgnc_symbol | uniprot_gn_symbol | transcript | mean_cds_len | deseq_logfc | deseq_adjp | edger_logfc | edger_adjp | limma_logfc | limma_adjp | noiseq_logfc | noiseq_adjp | basic_num | basic_den | basic_numvar | basic_denvar | basic_logfc | basic_t | basic_p | basic_adjp | deseq_basemean | deseq_lfcse | deseq_stat | deseq_p | deseq_num | deseq_den | edger_logcpm | edger_lr | edger_p | limma_ave | limma_t | limma_b | limma_p | noiseq_num | noiseq_den | noiseq_theta | noiseq_prob | noiseq_p | limma_adjp_fdr | deseq_adjp_fdr | edger_adjp_fdr | basic_adjp_fdr | noiseq_adjp_fdr | lfc_meta | lfc_var | lfc_varbymed | p_meta | p_var | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ENSG00000189430 | ENSG00000189430 | ENST00000338835 | 13 | 9 | natural cytotoxicity triggering receptor 1 [Source:HGNC Symbol;Acc:HGNC:6731] | protein_coding | 864 | 19 | + | 54906148 | 54916140 | NCR1 | NCR1 | ENSG00000189430.9 | 798.5 | -5.820 | 0.0002 | -5.752 | 0.0019 | -3.214 | 0.2894 | -0.7731 | 1 | -4.4710 | -1.0630 | 1.835 | 11.567 | -3.408 | -3.624 | 0.0014 | 0.1472 | 93.09 | 1.1550 | -5.038 | 0e+00 | 1.4989 | 7.319 | 1.0570 | 19.19 | 0e+00 | -2.621 | -2.436 | -3.3850 | 0.0220 | 3.639 | 2.130 | 1.1623 | 0.9112 | 0.0888 | 0.2894 | 0.0002 | 0.0019 | 0.1472 | 0.8357 | -5.110 | 1.583e+00 | -3.098e-01 | 7.344e-03 | 1.615e-04 |
| ENSG00000179344 | ENSG00000179344 | ENST00000399084 | 16 | 5 | major histocompatibility complex, class II, DQ beta 1 [Source:HGNC Symbol;Acc:HGNC:4944] | protein_coding | 786 | 6 | - | 32659467 | 32668383 | HLA-DQB1 | HLA-DQB1 | ENSG00000179344.5 | 645.5 | -5.667 | 0.0000 | -5.653 | 0.0006 | -5.936 | 0.0332 | -4.4060 | 0 | 0.0597 | 5.6120 | 5.925 | 7.993 | -5.552 | -5.227 | 0.0001 | 0.0515 | 4151.00 | 0.8879 | -6.382 | 0e+00 | 8.4098 | 14.076 | 6.5750 | 21.99 | 0e+00 | 3.581 | -4.357 | 0.8177 | 0.0002 | 104.486 | 4.928 | 4.5901 | 1.0000 | 0.0000 | 0.0332 | 0.0000 | 0.0006 | 0.0515 | 0.0000 | -5.464 | 1.039e-01 | -1.902e-02 | 6.255e-05 | 1.123e-08 |
| ENSG00000162669 | ENSG00000162669 | ENST00000427444 | 16 | 1 | helicase for meiosis 1 [Source:HGNC Symbol;Acc:HGNC:20193] | protein_coding | 589 | 1 | - | 91260766 | 91404856 | HFM1 | HFM1 | ENSG00000162669.1 | 1528.4 | -4.617 | 0.0012 | -4.588 | 0.0054 | -2.665 | 0.1784 | -1.2318 | 1 | -3.0190 | -0.0765 | 2.110 | 8.425 | -2.942 | -3.444 | 0.0021 | 0.1672 | 207.70 | 1.0200 | -4.526 | 0e+00 | 4.2354 | 8.853 | 2.1480 | 16.51 | 0e+00 | -1.450 | -2.912 | -2.4740 | 0.0073 | 5.418 | 2.307 | 1.1461 | 0.9059 | 0.0941 | 0.1784 | 0.0012 | 0.0054 | 0.1672 | 0.8357 | -3.922 | 2.638e-01 | -6.727e-02 | 2.452e-03 | 1.764e-05 |
| ENSG00000167634 | ENSG00000167634 | ENST00000328092 | 12 | 9 | NLR family pyrin domain containing 7 [Source:HGNC Symbol;Acc:HGNC:22947] | protein_coding | 3030 | 19 | - | 54923509 | 54966312 | NLRP7 | NLRP7 | ENSG00000167634.9 | 2077.44444444444 | -4.061 | 0.0071 | -4.004 | 0.0317 | -1.875 | 0.4968 | -0.3273 | 1 | -4.1970 | -2.2500 | 0.258 | 8.472 | -1.947 | -2.682 | 0.0153 | 0.3229 | 27.08 | 1.0170 | -3.995 | 1e-04 | 0.8671 | 4.928 | -0.7663 | 12.24 | 5e-04 | -3.363 | -1.721 | -4.2100 | 0.0971 | 2.616 | 2.085 | 0.6656 | 0.7700 | 0.2300 | 0.4968 | 0.0071 | 0.0317 | 0.3229 | 0.8626 | -3.179 | 1.172e+00 | -3.687e-01 | 3.255e-02 | 3.126e-03 |
| ENSG00000196526 | ENSG00000196526 | ENST00000358461 | 10 | 6 | actin filament associated protein 1 [Source:HGNC Symbol;Acc:HGNC:24017] | protein_coding | 2193 | 4 | - | 7758714 | 7939926 | AFAP1 | AFAP1 | ENSG00000196526.6 | 1911 | -3.879 | 0.0038 | -3.877 | 0.0088 | -2.357 | 0.3886 | -2.2170 | 1 | 0.5888 | 2.6700 | 2.164 | 11.578 | -2.081 | -2.168 | 0.0405 | 0.4335 | 982.20 | 0.9252 | -4.192 | 0e+00 | 6.7815 | 10.660 | 4.4950 | 15.42 | 1e-04 | 1.804 | -2.067 | -4.0740 | 0.0489 | 23.858 | 5.131 | 2.1394 | 0.9761 | 0.0239 | 0.3886 | 0.0038 | 0.0088 | 0.4335 | 0.8357 | -3.320 | 3.403e-01 | -1.025e-01 | 1.633e-02 | 7.942e-04 |
| ENSG00000277150 | ENSG00000277150 | ENST00000622749 | 1 | 1 | coagulation factor VIII associated 3 [Source:HGNC Symbol;Acc:HGNC:31850] | protein_coding | 1116 | X | - | 155456914 | 155458672 | F8A3 | F8A1 | ENSG00000277150.1 | 1116 | -3.788 | 0.0153 | -3.704 | 0.0589 | -1.712 | 0.3848 | -0.3180 | 1 | -4.5610 | -2.3170 | 1.574 | 6.415 | -2.244 | -3.020 | 0.0059 | 0.2249 | 21.72 | 1.0170 | -3.724 | 2e-04 | 1.9848 | 5.772 | -1.5770 | 10.78 | 1e-03 | -3.506 | -2.080 | -3.8470 | 0.0476 | 2.591 | 2.078 | 0.5401 | 0.6847 | 0.3153 | 0.3849 | 0.0154 | 0.0588 | 0.2249 | 0.9109 | -2.842 | 9.067e-01 | -3.191e-01 | 1.628e-02 | 7.364e-04 |
Repeat with visit in the condition contrast.
visitcf_factor <- paste0("v", pData(t_eosinophils)[["visitnumber"]],
pData(t_eosinophils)[["finaloutcome"]])
t_eosinophil_visitcf <- set_expt_conditions(t_eosinophils, fact = visitcf_factor)## The numbers of samples by condition are:
##
## v1cure v1failure v2cure v2failure v3cure v3failure
## 5 3 6 3 6 3
t_cf_eosinophil_visits_de_sva <- all_pairwise(t_eosinophil_visitcf, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## v1cure v1failure v2cure v2failure v3cure v3failure
## 5 3 6 3 6 3
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_cf_eosinophil_visits_table_sva <- combine_de_tables(
t_cf_eosinophil_visits_de_sva, keepers = visitcf_contrasts,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_visitcf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_visitcf_table_sva-v202411.xlsx before writing the tables.
## The keepers has no elements in the coefficients.
## Here are the keepers: v1_failure, v1_cure, v2_failure, v2_cure, v3_failure, v3_cure
## Here are the coefficients: v1failure, v1cure, v2cure, v1cure, v2failure, v1cure, v3cure, v1cure, v3failure, v1cure, v2cure, v1failure, v2failure, v1failure, v3cure, v1failure, v3failure, v1failure, v2failure, v2cure, v3cure, v2cure, v3failure, v2cure, v3cure, v2failure, v3failure, v2failure, v3failure, v3cure
## Error in extract_keepers(extracted, keepers, table_names, all_coefficients, : Unable to find the set of contrasts to keep, fix this and try again.
## Error in eval(expr, envir, enclos): object 't_cf_eosinophil_visits_table_sva' not found
t_cf_eosinophil_visits_sig_sva <- extract_significant_genes(
t_cf_eosinophil_visits_table_sva,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_visitcf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_visitcf_sig_sva-v202411.xlsx before writing the tables.
## Error in eval(expr, envir, enclos): object 't_cf_eosinophil_visits_table_sva' not found
## Error in eval(expr, envir, enclos): object 't_cf_eosinophil_visits_sig_sva' not found
## Error in eval(expr, envir, enclos): object 't_cf_eosinophil_visits_sig_sva' not found
## Error in eval(expr, envir, enclos): object 't_cf_eosinophil_visits_sig_sva' not found
## Error in eval(expr, envir, enclos): object 't_cf_eosinophil_visits_sig_sva' not found
## Error in eval(expr, envir, enclos): object 't_cf_eosinophil_visits_sig_sva' not found
As a reminder, there are a few genes of particular interest:
expected_genes <- c("IFI44L", "IFI27", "PRR5", "PRR5-ARHGAP8", "RHCE",
"FBXO39", "RSAD2", "SMTNL1", "USP18", "AFAP1")
annot <- fData(t_monocytes)
wanted_idx <- annot[["hgnc_symbol"]] %in% expected_genes
expected_ensg <- rownames(annot)[wanted_idx]Let us add a new block in which we test a concern: if we explicitly add visit to the model (with sva, potentially without too), will that change the results we observe? My assumption is that it should change the results very minimally; but we should make absolutely certain that this is true. The neutrophils are the place to test this first because they have some of the most variance observed in the data.
Therefore I want to have an instance of the pairwise contrast that has a model of ~ finaloutcome + visitnumber + SVs where the SVs come from an invocation of sva which also has finaloutcome + visitnumber before the null model.
In theory, all_pairwise() is able to do this via the argument alt_model, but it may be safer to do it manually in order to absolutely ensure that nothing unintended happens.
Either above or below this section I have a nearly identical block which seeks to demonstrate the similarities/difference observed between my preferred/simplified model vs. a more explicitly correct and complex model. If the trend holds from what we observed with the eosinophils and neutrophils, I would expect to see that the results are marginally ‘better’ (as defined by the strength of the perceived interleukin response and raw number of ‘significant’ genes); but I remain worried that this will prove a more brittle and error-prone analysis.
Start out by extracting the perceived svs via svaseq on the filtered input.
## The original pairwise invocation with sva:
##t_cf_monocyte_de_sva <- all_pairwise(t_monocyte, model_batch = "svaseq",
## filter = TRUE, parallel = FALSE,
## methods = methods)
test_monocytes <- normalize_expt(t_monocytes, filter = "simple")## Removing 0 low-count genes (10862 remaining).
test_mono_design <- pData(test_monocytes)
test_formula <- as.formula("~ finaloutcome + visitnumber")
test_model <- model.matrix(test_formula, data = test_mono_design)
null_formula <- as.formula("~ visitnumber")
null_model <- model.matrix(null_formula, data = test_mono_design)
linear_mtrx <- exprs(test_monocytes)
l2_mtrx <- log2(linear_mtrx + 1)
chosen_surrogates <- sva::num.sv(dat = l2_mtrx, mod = test_model)
chosen_surrogates## [1] 2
surrogate_result <- sva::svaseq(
dat = linear_mtrx, n.sv = chosen_surrogates, mod = test_model, mod0 = null_model)## Number of significant surrogate variables is: 2
## Iteration (out of 5 ):1 2 3 4 5
We can now create a new DESeq2 dataset which takes these putative surrogates into account.
colnames(model_adjust) <- paste0("SV", seq_len(chosen_surrogates))
rownames(model_adjust) <- rownames(pData(test_monocytes))
addition_string <- ""
for (sv in colnames(model_adjust)) {
addition_string <- paste0(addition_string, " + ", sv)
}
longer_model <- as.formula(glue("~ finaloutcome + visitnumber{addition_string}"))
mono_design_svs <- cbind(test_mono_design, model_adjust)
summarized <- DESeq2::DESeqDataSetFromMatrix(countData = linear_mtrx,
colData = mono_design_svs,
design = longer_model)## converting counts to integer mode
In order to compare these and the previous results, I tend to rely on simple correlations and aucc plots. I have been reading the modelr code recently and it looks like there is a suite of other metrics which might be more appropriate.
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
deseq_table <- as.data.frame(DESeq2::results(object = deseq_run,
contrast = c("finaloutcome", "failure", "cure"),
format = "DataFrame"))
big_table <- t_cf_monocyte_table_sva[["data"]][["outcome"]]
only_deseq <- big_table[, c("deseq_logfc", "deseq_adjp")]
merged <- merge(deseq_table, only_deseq, by = "row.names")
rownames(merged) <- merged[["Row.names"]]
merged[["Row.names"]] <- NULL
cor_value <- cor.test(merged[["log2FoldChange"]], merged[["deseq_logfc"]])
cor_value##
## Pearson's product-moment correlation
##
## data: merged[["log2FoldChange"]] and merged[["deseq_logfc"]]
## t = 1075, df = 10860, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9952 0.9955
## sample estimates:
## cor
## 0.9953
logfc_plotter <- plot_linear_scatter(merged[, c("log2FoldChange", "deseq_logfc")])
logfc_plot <- logfc_plotter[["scatter"]] +
xlab("DESeq2 log2FC: Visit explicitly in model") +
ylab("DESeq2 log2FC: Default pairwise comparison") +
ggtitle(glue("Comparing results from models: {prettyNum(cor_value[['estimate']])} (pearson)"))
pp(file = "figures/compare_cf_and_visit_in_model_monocyte_logfc.svg")
logfc_plot
dev.off()## png
## 2
## Warning in cor.test.default(merged[["padj"]], merged[["deseq_adjp"]], method =
## "spearman"): Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: merged[["padj"]] and merged[["deseq_adjp"]]
## S = 1.3e+09, p-value <2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.9938
adjp_plotter <- plot_linear_scatter(merged[, c("padj", "deseq_adjp")])
adjp_plot <- adjp_plotter[["scatter"]] +
xlab("DESeq2 adjp: Visit explicitly in model") +
ylab("DESeq2 adjp: Default pairwise comparison") +
ggtitle(glue("Comparing results from models: {prettyNum(cor_value[['estimate']])} (spearman)"))
pp(file = "images/compare_cf_and_visit_in_model_monocyte_adjp.svg")
adjp_plot
dev.off()## png
## 2
previous_sig_idx <- big_table[["deseq_adjp"]] <= 0.05 & abs(big_table[["deseq_logfc"]] >= 1.0)
summary(previous_sig_idx)## Mode FALSE TRUE
## logical 10802 60
previous_genes <- rownames(big_table)[previous_sig_idx]
new_sig_idx <- abs(deseq_table[["log2FoldChange"]]) >= 1.0 & deseq_table[["padj"]] < 0.05
new_genes <- rownames(deseq_table)[new_sig_idx]
na_idx <- is.na(new_genes)
new_genes <- new_genes[!na_idx]
Vennerable::Venn(list("previous" = previous_genes, "new" = new_genes))## A Venn object on 2 sets named
## previous,new
## 00 10 01 11
## 0 7 57 53
## A set of ontologies produced by gprofiler using 110
## genes against the hsapiens annotations and significance cutoff 0.05.
## There are:
## 9 MF
## 147 BP
## 0 KEGG
## 0 REAC
## 0 WP
## 2 TF
## 0 MIRNA
## 0 HPA
## 0 CORUM
## 0 HP hits.
## A set of ontologies produced by gprofiler using 60
## genes against the hsapiens annotations and significance cutoff 0.05.
## There are:
## 0 MF
## 44 BP
## 3 KEGG
## 0 REAC
## 2 WP
## 0 TF
## 0 MIRNA
## 0 HPA
## 0 CORUM
## 0 HP hits.
new_annotated <- merge(fData(t_monocytes), deseq_table, by = "row.names")
rownames(new_annotated) <- new_annotated[["Row.names"]]
new_annotated[["Row.names"]] <- NULL
write_xlsx(data = new_annotated, excel = "excel/monocyte_visit_in_model_sva_cf_new.xlsx")## Deleting the file excel/monocyte_visit_in_model_sva_cf_new.xlsx before writing the tables.
## write_xlsx() wrote excel/monocyte_visit_in_model_sva_cf_new.xlsx.
## The cursor is on sheet first, row: 10865 column: 23.
old_annotated <- merge(fData(t_eosinophils), big_table, by = "row.names")
rownames(old_annotated) <- old_annotated[["Row.names"]]
old_annotated[["Row.names"]] <- NULL
write_xlsx(data = old_annotated, excel = "excel/monocyte_visit_in_model_sva_cf_old.xlsx")## Deleting the file excel/monocyte_visit_in_model_sva_cf_old.xlsx before writing the tables.
## write_xlsx() wrote excel/monocyte_visit_in_model_sva_cf_old.xlsx.
## The cursor is on sheet first, row: 10865 column: 76.
Are the expected Ensembl gene IDs found in this new set?
## [1] 10
We wish to ensure that my model simplification did not do anything incorrect to the data for all three cell types, I already did this for the neutrophils, let us repeat for the eosinophils. I am therefore (mostly) copy/pasting the neutrophil section here.a
## The original pairwise invocation with sva:
#t_cf_eosinophil_de_sva <- all_pairwise(t_eosinophils, model_batch = "svaseq",
# filter = TRUE, parallel=FALSE, methods = methods)
test_eosinophils <- normalize_expt(t_eosinophils, filter = "simple")## Removing 2652 low-count genes (17300 remaining).
test_eo_design <- pData(test_eosinophils)
test_formula <- as.formula("~ 0 + finaloutcome + visitnumber")
test_model <- model.matrix(test_formula, data = test_eo_design)
null_formula <- as.formula("~ 0 + visitnumber")
null_model <- model.matrix(null_formula, data = test_eo_design)
linear_mtrx <- exprs(test_eosinophils)
l2_mtrx <- log2(linear_mtrx + 1)
chosen_surrogates <- sva::num.sv(dat = l2_mtrx, mod = test_model)
chosen_surrogates## [1] 3
surrogate_result <- sva::svaseq(
dat = linear_mtrx, n.sv = chosen_surrogates, mod = test_model, mod0 = null_model)## Number of significant surrogate variables is: 3
## Iteration (out of 5 ):1 2 3 4 5
model_adjust <- as.matrix(surrogate_result[["sv"]])
colnames(model_adjust) <- c("SV1", "SV2", "SV3")
rownames(model_adjust) <- rownames(pData(test_eosinophils))
longer_model <- as.formula("~ finaloutcome + visitnumber + SV1 + SV2 + SV3")
eo_design_svs <- cbind(test_eo_design, model_adjust)
summarized <- DESeq2::DESeqDataSetFromMatrix(countData = linear_mtrx,
colData = eo_design_svs,
design = longer_model)## converting counts to integer mode
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
deseq_table <- as.data.frame(DESeq2::results(object = deseq_run,
contrast = c("finaloutcome", "failure", "cure"),
format = "DataFrame"))
big_table <- t_cf_eosinophil_table_sva[["data"]][["outcome"]]
only_deseq <- big_table[, c("deseq_logfc", "deseq_adjp")]
merged <- merge(deseq_table, only_deseq, by = "row.names")
rownames(merged) <- merged[["Row.names"]]
merged[["Row.names"]] <- NULL
cor_value <- cor.test(merged[["log2FoldChange"]], merged[["deseq_logfc"]])
cor_value##
## Pearson's product-moment correlation
##
## data: merged[["log2FoldChange"]] and merged[["deseq_logfc"]]
## t = 228, df = 10530, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9084 0.9149
## sample estimates:
## cor
## 0.9117
logfc_plotter <- plot_linear_scatter(merged[, c("log2FoldChange", "deseq_logfc")])
logfc_plot <- logfc_plotter[["scatter"]] +
xlab("DESeq2 log2FC: Visit explicitly in model") +
ylab("DESeq2 log2FC: Default pairwise comparison") +
ggtitle(glue("Comparing results from models: {prettyNum(cor_value[['estimate']])} (pearson)"))
pp(file = "figures/compare_cf_and_visit_in_model_eosinophil_logfc.svg")
logfc_plot
dev.off()## png
## 2
## Warning in cor.test.default(merged[["padj"]], merged[["deseq_adjp"]], method =
## "spearman"): Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: merged[["padj"]] and merged[["deseq_adjp"]]
## S = 3.5e+10, p-value <2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.8213
adjp_plotter <- plot_linear_scatter(merged[, c("padj", "deseq_adjp")])
adjp_plot <- adjp_plotter[["scatter"]] +
xlab("DESeq2 adjp: Visit explicitly in model") +
ylab("DESeq2 adjp: Default pairwise comparison") +
ggtitle(glue("Comparing results from models: {prettyNum(cor_value[['estimate']])} (spearman)"))
pp(file = "images/compare_cf_and_visit_in_model_eosinophil_adjp.svg")
adjp_plot
dev.off()## png
## 2
previous_sig_idx <- big_table[["deseq_adjp"]] <= 0.05 & abs(big_table[["deseq_logfc"]] >= 1.0)
summary(previous_sig_idx)## Mode FALSE TRUE
## logical 10416 116
previous_genes <- rownames(big_table)[previous_sig_idx]
new_sig_idx <- abs(deseq_table[["log2FoldChange"]]) >= 1.0 & deseq_table[["padj"]] < 0.05
new_genes <- rownames(deseq_table)[new_sig_idx]
na_idx <- is.na(new_genes)
new_genes <- new_genes[!na_idx]
Vennerable::Venn(list("previous" = previous_genes, "new" = new_genes))## A Venn object on 2 sets named
## previous,new
## 00 10 01 11
## 0 38 193 78
## A set of ontologies produced by gprofiler using 271
## genes against the hsapiens annotations and significance cutoff 0.05.
## There are:
## 11 MF
## 186 BP
## 4 KEGG
## 6 REAC
## 5 WP
## 7 TF
## 0 MIRNA
## 1 HPA
## 0 CORUM
## 0 HP hits.
## A set of ontologies produced by gprofiler using 116
## genes against the hsapiens annotations and significance cutoff 0.05.
## There are:
## 26 MF
## 112 BP
## 3 KEGG
## 7 REAC
## 4 WP
## 72 TF
## 1 MIRNA
## 0 HPA
## 0 CORUM
## 0 HP hits.
new_annotated <- merge(fData(t_eosinophils), deseq_table, by = "row.names")
rownames(new_annotated) <- new_annotated[["Row.names"]]
new_annotated[["Row.names"]] <- NULL
write_xlsx(data = new_annotated, excel = "excel/eosinophil_visit_in_model_sva_cf_new.xlsx")## Deleting the file excel/eosinophil_visit_in_model_sva_cf_new.xlsx before writing the tables.
## write_xlsx() wrote excel/eosinophil_visit_in_model_sva_cf_new.xlsx.
## The cursor is on sheet first, row: 17303 column: 23.
old_annotated <- merge(fData(t_eosinophils), big_table, by = "row.names")
rownames(old_annotated) <- old_annotated[["Row.names"]]
old_annotated[["Row.names"]] <- NULL
write_xlsx(data = old_annotated, excel = "excel/eosinophil_visit_in_model_sva_cf_old.xlsx")## Deleting the file excel/eosinophil_visit_in_model_sva_cf_old.xlsx before writing the tables.
## write_xlsx() wrote excel/eosinophil_visit_in_model_sva_cf_old.xlsx.
## The cursor is on sheet first, row: 10535 column: 76.
Check our genes of particular interest
## [1] 5
Not quite as good as the monocytes?
## The original pairwise invocation with sva:
## t_cf_neutrophil_de_sva <- all_pairwise(t_neutrophils, model_batch = "svaseq",
## parallel = parallel, filter = TRUE,
## methods = methods)
test_neutrophils <- normalize_expt(t_neutrophils, filter = "simple")## Removing 2652 low-count genes (17300 remaining).
test_neut_design <- pData(test_neutrophils)
test_formula <- as.formula("~ 0 + finaloutcome + visitnumber")
test_model <- model.matrix(test_formula, data = test_neut_design)
## Note to self: double-check that the following line is correct.
null_formula <- as.formula("~ 0 + visitnumber")
## null_model <- test_model[, c(1, 2)]
null_model <- model.matrix(null_formula, data = test_neut_design)
linear_mtrx <- exprs(test_neutrophils)
l2_mtrx <- log2(linear_mtrx + 1)
chosen_surrogates <- sva::num.sv(dat = l2_mtrx, mod = test_model)
chosen_surrogates## [1] 4
surrogate_result <- sva::svaseq(
dat = linear_mtrx, n.sv = chosen_surrogates, mod = test_model, mod0 = null_model)## Number of significant surrogate variables is: 4
## Iteration (out of 5 ):1 2 3 4 5
model_adjust <- as.matrix(surrogate_result[["sv"]])
## I don't think the following is actually required, but it is weird to just have this
## unnamed matrix hangingout.
## Set the columns to the SV#s
colnames(model_adjust) <- c("SV1", "SV2", "SV3", "SV4")
## Set the rows the sample IDs
rownames(model_adjust) <- rownames(pData(test_neutrophils))
longer_model <- as.formula("~ finaloutcome + visitnumber + SV1 + SV2 + SV3 + SV4")
neut_design_svs <- cbind(test_neut_design, model_adjust)
summarized <- DESeq2::DESeqDataSetFromMatrix(countData = linear_mtrx,
colData = neut_design_svs,
design = longer_model)## converting counts to integer mode
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
deseq_table <- as.data.frame(DESeq2::results(object = deseq_run,
contrast = c("finaloutcome", "failure", "cure"),
format = "DataFrame"))
## We should be able to directly compare this to the the deseq columns from the above
## data structure named: t_cf_neutrophil_table_sva
big_table <- t_cf_neutrophil_table_sva[["data"]][["outcome"]]
only_deseq <- big_table[, c("deseq_logfc", "deseq_adjp")]
merged <- merge(deseq_table, only_deseq, by = "row.names")
rownames(merged) <- merged[["Row.names"]]
merged[["Row.names"]] <- NULL
cor_value <- cor.test(merged[["log2FoldChange"]], merged[["deseq_logfc"]])
cor_value##
## Pearson's product-moment correlation
##
## data: merged[["log2FoldChange"]] and merged[["deseq_logfc"]]
## t = 393, df = 9099, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9706 0.9729
## sample estimates:
## cor
## 0.9718
logfc_plotter <- plot_linear_scatter(merged[, c("log2FoldChange", "deseq_logfc")])
logfc_plot <- logfc_plotter[["scatter"]] +
xlab("DESeq2 log2FC: Visit explicitly in model") +
ylab("DESeq2 log2FC: Default pairwise comparison") +
ggtitle(glue("Comparing results from models: {prettyNum(cor_value[['estimate']])} (pearson)"))
pp(file = "figures/compare_cf_and_visit_in_model_neutrophil_logfc.svg")
logfc_plot
dev.off()## png
## 2
## Warning in cor.test.default(merged[["padj"]], merged[["deseq_adjp"]], method =
## "spearman"): Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: merged[["padj"]] and merged[["deseq_adjp"]]
## S = 1e+10, p-value <2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.92
adjp_plotter <- plot_linear_scatter(merged[, c("padj", "deseq_adjp")])
adjp_plot <- adjp_plotter[["scatter"]] +
xlab("DESeq2 adjp: Visit explicitly in model") +
ylab("DESeq2 adjp: Default pairwise comparison") +
ggtitle(glue("Comparing results from models: {prettyNum(cor_value[['estimate']])} (spearman)"))
pp(file = "images/compare_cf_and_visit_in_model_neutrophil_adjp.svg")
adjp_plot
dev.off()## png
## 2
previous_sig_idx <- big_table[["deseq_adjp"]] <= 0.05 & abs(big_table[["deseq_logfc"]] >= 1.0)
summary(previous_sig_idx)## Mode FALSE TRUE
## logical 8972 129
previous_genes <- rownames(big_table)[previous_sig_idx]
new_sig_idx <- abs(deseq_table[["log2FoldChange"]]) >= 1.0 & deseq_table[["padj"]] < 0.05
new_genes <- rownames(deseq_table)[new_sig_idx]
na_idx <- is.na(new_genes)
new_genes <- new_genes[!na_idx]
Vennerable::Venn(list("previous" = previous_genes, "new" = new_genes))## A Venn object on 2 sets named
## previous,new
## 00 10 01 11
## 0 50 92 79
## A set of ontologies produced by gprofiler using 171
## genes against the hsapiens annotations and significance cutoff 0.05.
## There are:
## 1 MF
## 12 BP
## 0 KEGG
## 2 REAC
## 0 WP
## 3 TF
## 2 MIRNA
## 0 HPA
## 0 CORUM
## 0 HP hits.
## A set of ontologies produced by gprofiler using 129
## genes against the hsapiens annotations and significance cutoff 0.05.
## There are:
## 4 MF
## 67 BP
## 0 KEGG
## 5 REAC
## 2 WP
## 56 TF
## 0 MIRNA
## 0 HPA
## 0 CORUM
## 0 HP hits.
new_annotated <- merge(fData(t_neutrophils), deseq_table, by = "row.names")
rownames(new_annotated) <- new_annotated[["Row.names"]]
new_annotated[["Row.names"]] <- NULL
write_xlsx(data = new_annotated, excel = "excel/neutrophil_visit_in_model_sva_cf_new.xlsx")## Deleting the file excel/neutrophil_visit_in_model_sva_cf_new.xlsx before writing the tables.
## write_xlsx() wrote excel/neutrophil_visit_in_model_sva_cf_new.xlsx.
## The cursor is on sheet first, row: 17303 column: 23.
old_annotated <- merge(fData(t_neutrophils), big_table, by = "row.names")
rownames(old_annotated) <- old_annotated[["Row.names"]]
old_annotated[["Row.names"]] <- NULL
write_xlsx(data = old_annotated, excel = "excel/neutrophil_visit_in_model_sva_cf_old.xlsx")## Deleting the file excel/neutrophil_visit_in_model_sva_cf_old.xlsx before writing the tables.
## write_xlsx() wrote excel/neutrophil_visit_in_model_sva_cf_old.xlsx.
## The cursor is on sheet first, row: 9104 column: 76.
Once again, see how many of our favorite genes are here
## [1] 8
When the above work was reviewed for publication, one concern raised arose because we are not considering the variance of each person in the contrasts above and are potentially over-representing the significance/power of the results because the models we are using do not include the donor. My previous understanding was that it is sufficient to include visit in the model because that would result in a model matrix which separates samples from each person; but I am now reasonably certain this is incorrect.
Therefore, the previous couple of blocks I now think are not approaching this problem correctly. We spent some time talking with Neal and discussing the various models and methods we employed. He made a series of suggestions about ways which might prove more correct. It seems that a mixed linear model is the most appropriate method for this type of query. I think I can perform that with limma, via voom. Let us try and see what happens. After doing some reading, I think the most appropriate way to perform this is to use dream() from varianceParition, which is cool because I really like it.
As I write this, we are reasonably certain that a mixed linear model provides a statistically correct framework for representing our expression data as a function of finaloutcome, visit, and person, e.g:
exprs ~ finaloutcome + visit + (1|donor)
In our discussions surrounding the various ways to compare/contrast the various results with/out the mixed linear model; there were a few primary goals laid out by Maria Adelaida and Neal. The goal is to observe if/how well our previous analyses agree with results obtained using a mixed linear model. There are a couple of caveats:
So, with that in mind, Maria Adelaida, Najib, and Neal focused on repeating a useful subset of the analyses using the mlm and comparing them to our extant results rather than re-implementing everything. The following are the things they suggested are the most important comparison points:
I have already written a skeleton function ‘dream_pairwise()’ as a sibling to my other *_pairwise() functions. I think that with some minor modifications (or maybe none at all, when I wrote it I was thinking about fun models that variancePartition supports) it can accept the mixed linear model of interest.
mixed_fstring <- "~ 0 + finaloutcome + visitnumber + (1|donor)"
mixed_form <- as.formula(mixed_fstring)
get_formula_factors(mixed_form)## Getting factors from: ~0 + finaloutcome + visitnumber + (1 | donor).
## $type
## [1] "cellmeans"
##
## $interaction
## [1] FALSE
##
## $mixed
## [1] TRUE
##
## $mixers
## [1] "1" "donor"
##
## $cellmeans_intercept
## [1] "0"
##
## $factors
## [1] "finaloutcome" "visitnumber" "donor"
## The numbers of samples by condition are:
##
## cure failure
## 17 9
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$libsize.
## Limma step 1/6: choosing model.
## Warning in Ops.factor(1, donor): '|' not meaningful for factors
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + visitnumber + (1 | donor).
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## cure failure
## 17 9
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/5: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/5: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/5: Creating table: finaloutcomefailure. Adjust = BH
## Limma step 6/6: 4/5: Creating table: visitnumber2. Adjust = BH
## Limma step 6/6: 5/5: Creating table: visitnumber1. Adjust = BH
## The numbers of samples by condition are:
##
## cure failure
## 21 21
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$best_libsize.
## Limma step 1/6: choosing model.
## Warning in Ops.factor(1, donor): '|' not meaningful for factors
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + visitnumber + (1 | donor).
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## cure failure
## 21 21
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/5: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/5: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/5: Creating table: finaloutcomefailure. Adjust = BH
## Limma step 6/6: 4/5: Creating table: visitnumber2. Adjust = BH
## Limma step 6/6: 5/5: Creating table: visitnumber1. Adjust = BH
## The numbers of samples by condition are:
##
## cure failure
## 20 21
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$libsize.
## Limma step 1/6: choosing model.
## Warning in Ops.factor(1, donor): '|' not meaningful for factors
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + visitnumber + (1 | donor).
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## cure failure
## 20 21
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Warning in variancePartition::dream(exprObj = fun_voom, formula = model_string, : Model failed for 1 responses.
## See errors with attr(., 'errors')
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/5: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/5: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/5: Creating table: finaloutcomefailure. Adjust = BH
## Limma step 6/6: 4/5: Creating table: visitnumber2. Adjust = BH
## Limma step 6/6: 5/5: Creating table: visitnumber1. Adjust = BH
mixed_fstring_fv <- "~ 0 + finaloutcome + visitnumber"
mixed_form_fv <- as.formula(mixed_fstring_fv)
get_formula_factors(mixed_form_fv)## Getting factors from: ~0 + finaloutcome + visitnumber.
## $type
## [1] "cellmeans"
##
## $interaction
## [1] FALSE
##
## $mixed
## [1] FALSE
##
## $cellmeans_intercept
## [1] "0"
##
## $factors
## [1] "finaloutcome" "visitnumber"
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$libsize.
## Limma step 1/6: choosing model.
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + visitnumber.
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## cure failure
## 17 9
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/5: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/5: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/5: Creating table: finaloutcomefailure. Adjust = BH
## Limma step 6/6: 4/5: Creating table: visitnumber2. Adjust = BH
## Limma step 6/6: 5/5: Creating table: visitnumber1. Adjust = BH
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$best_libsize.
## Limma step 1/6: choosing model.
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + visitnumber.
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## cure failure
## 21 21
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/5: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/5: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/5: Creating table: finaloutcomefailure. Adjust = BH
## Limma step 6/6: 4/5: Creating table: visitnumber2. Adjust = BH
## Limma step 6/6: 5/5: Creating table: visitnumber1. Adjust = BH
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$libsize.
## Limma step 1/6: choosing model.
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + visitnumber.
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## cure failure
## 20 21
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/5: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/5: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/5: Creating table: finaloutcomefailure. Adjust = BH
## Limma step 6/6: 4/5: Creating table: visitnumber2. Adjust = BH
## Limma step 6/6: 5/5: Creating table: visitnumber1. Adjust = BH
There are a couple observations here which are important and/or troubling:
In this block I am looking at the similarities between the mixed model with donor and without donor (which is no longer a mixed model; it is just using the dream functions (which I am pretty sure just fall back to limma when there is not a random effect)).
monocyte_visit_with_donor <- mixed_monocyte_de$all_tables$contrasts[[1]]
monocyte_visit_without_donor <- mixed_monocyte_fv_de$all_tables$contrasts[[1]]
donor_aucc <- calculate_aucc(monocyte_visit_with_donor, monocyte_visit_without_donor,
px = "adj.P.Val", py = "adj.P.Val",
lx = "logFC", ly = "logFC")
donor_aucc## These two tables have an aucc value of: 0.181648763461226 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 279, df = 10860, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9344 0.9390
## sample estimates:
## cor
## 0.9367
with_donor_genes <- abs(monocyte_visit_with_donor[["logFC"]]) >= 1.0 &
monocyte_visit_with_donor[["P.Value"]] <= 0.05
without_donor_genes <- abs(monocyte_visit_without_donor[["logFC"]]) >= 1.0 &
monocyte_visit_with_donor[["P.Value"]] <= 0.05
donor_genes <- rownames(monocyte_visit_with_donor)[with_donor_genes]
visit_genes <- rownames(monocyte_visit_with_donor)[without_donor_genes]
venn_lst <- list(
"with_donor" = donor_genes,
"with_visit" = visit_genes)
Vennerable::Venn(venn_lst)## A Venn object on 2 sets named
## with_donor,with_visit
## 00 10 01 11
## 0 1 0 38
neutrophil_visit_with_donor <- mixed_neutrophil_de$all_tables$contrasts[[1]]
neutrophil_visit_without_donor <- mixed_neutrophil_fv_de$all_tables$contrasts[[1]]
donor_aucc <- calculate_aucc(neutrophil_visit_with_donor, neutrophil_visit_without_donor,
px = "adj.P.Val", py = "adj.P.Val",
lx = "logFC", ly = "logFC")
donor_aucc## These two tables have an aucc value of: 0.45943012715466 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 323, df = 19949, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9139 0.9183
## sample estimates:
## cor
## 0.9161
with_donor_genes <- abs(neutrophil_visit_with_donor[["logFC"]]) >= 1.0 &
neutrophil_visit_with_donor[["P.Value"]] <= 0.05
without_donor_genes <- abs(neutrophil_visit_without_donor[["logFC"]]) >= 1.0 &
neutrophil_visit_with_donor[["P.Value"]] <= 0.05## Warning in abs(neutrophil_visit_without_donor[["logFC"]]) >= 1 &
## neutrophil_visit_with_donor[["P.Value"]] <= : longer object length is not a
## multiple of shorter object length
donor_genes <- rownames(neutrophil_visit_with_donor)[with_donor_genes]
visit_genes <- rownames(neutrophil_visit_with_donor)[without_donor_genes]
venn_lst <- list(
"with_donor" = donor_genes,
"with_visit" = visit_genes)
Vennerable::Venn(venn_lst)## A Venn object on 2 sets named
## with_donor,with_visit
## 00 10 01 11
## 0 0 0 208
eosinophil_visit_with_donor <- mixed_eosinophil_de$all_tables$contrasts[[1]]
eosinophil_visit_without_donor <- mixed_eosinophil_fv_de$all_tables$contrasts[[1]]
donor_aucc <- calculate_aucc(eosinophil_visit_with_donor, eosinophil_visit_without_donor,
px = "adj.P.Val", py = "adj.P.Val",
lx = "logFC", ly = "logFC")
donor_aucc## These two tables have an aucc value of: 0.90324615179282 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 746, df = 19950, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.982 0.983
## sample estimates:
## cor
## 0.9825
with_donor_genes <- abs(eosinophil_visit_with_donor[["logFC"]]) >= 1.0 &
eosinophil_visit_with_donor[["P.Value"]] <= 0.05
without_donor_genes <- abs(eosinophil_visit_without_donor[["logFC"]]) >= 1.0 &
eosinophil_visit_with_donor[["P.Value"]] <= 0.05
donor_genes <- rownames(eosinophil_visit_with_donor)[with_donor_genes]
visit_genes <- rownames(eosinophil_visit_with_donor)[without_donor_genes]
venn_lst <- list(
"with_donor" = donor_genes,
"with_visit" = visit_genes)
Vennerable::Venn(venn_lst)## A Venn object on 2 sets named
## with_donor,with_visit
## 00 10 01 11
## 0 0 26 3709
Compare back to deseq with SVA and with SVA+visit
deseq_aucc <- calculate_aucc(merged, monocyte_visit_without_donor,
px = "deseq_adjp", py = "P.Value",
lx = "deseq_logfc", ly = "logFC")
deseq_aucc## These two tables have an aucc value of: 0.163270071446454 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 41, df = 8577, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3870 0.4224
## sample estimates:
## cor
## 0.4048
deseq_genes_idx <- abs(merged[["deseq_logfc"]]) >= 1.0 &
merged[["deseq_adjp"]] <= 0.05
without_donor_genes_idx <- abs(monocyte_visit_without_donor[["logFC"]]) >= 1.0 &
monocyte_visit_with_donor[["P.Value"]] <= 0.05
deseq_genes <- rownames(merged)[deseq_genes_idx]
visit_genes <- rownames(monocyte_visit_with_donor)[without_donor_genes_idx]
venn_lst <- list(
"with_donor" = deseq_genes,
"with_visit" = visit_genes)
Vennerable::Venn(venn_lst)## A Venn object on 2 sets named
## with_donor,with_visit
## 00 10 01 11
## 0 150 29 9
And with visit
deseq_aucc <- calculate_aucc(merged, monocyte_visit_without_donor,
px = "log2FoldChange", py = "padj",
lx = "adj.P.Val", ly = "logFC")
deseq_aucc## These two tables have an aucc value of: 0.35991873206617 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = -32, df = 8577, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.3471 -0.3093
## sample estimates:
## cor
## -0.3283
deseq_genes_idx <- abs(merged[["log2FoldChange"]]) >= 1.0 &
merged[["padj"]] <= 0.05
without_donor_genes_idx <- abs(monocyte_visit_without_donor[["logFC"]]) >= 1.0 &
monocyte_visit_with_donor[["P.Value"]] <= 0.05
deseq_genes <- rownames(merged)[deseq_genes_idx]
visit_genes <- rownames(monocyte_visit_with_donor)[without_donor_genes_idx]
venn_lst <- list(
"with_donor" = deseq_genes,
"with_visit" = visit_genes)
Vennerable::Venn(venn_lst)## A Venn object on 2 sets named
## with_donor,with_visit
## 00 10 01 11
## 0 104 29 9
mixed_fstring_fd <- "~ 0 + finaloutcome + (1|donor)"
mixed_form_fd <- as.formula(mixed_fstring_fd)
get_formula_factors(mixed_form_fd)## Getting factors from: ~0 + finaloutcome + (1 | donor).
## $type
## [1] "cellmeans"
##
## $interaction
## [1] FALSE
##
## $mixed
## [1] TRUE
##
## $mixers
## [1] "1" "donor"
##
## $cellmeans_intercept
## [1] "0"
##
## $factors
## [1] "finaloutcome" "donor"
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$libsize.
## Limma step 1/6: choosing model.
## Warning in Ops.factor(1, donor): '|' not meaningful for factors
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + (1 | donor).
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## tumaco_cure tumaco_failure
## 17 9
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/3: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/3: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/3: Creating table: finaloutcomefailure. Adjust = BH
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$best_libsize.
## Limma step 1/6: choosing model.
## Warning in Ops.factor(1, donor): '|' not meaningful for factors
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + (1 | donor).
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## tumaco_cure tumaco_failure
## 21 21
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/3: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/3: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/3: Creating table: finaloutcomefailure. Adjust = BH
## libsize was not specified, this parameter has profound effects on limma's result.
## Using the libsize from expt$libsize.
## Limma step 1/6: choosing model.
## Warning in Ops.factor(1, donor): '|' not meaningful for factors
## Attempting voomWithDreamWeights.
## Getting factors from: ~0 + finaloutcome + (1 | donor).
## Limma/varpart step 3/6: running dream.
## The provided conditions are:
## conditions
## tumaco_cure tumaco_failure
## 20 21
## Choosing among model matrix columns: finaloutcomecure, finaloutcomefailure.
## Limma step 6/6: Writing limma outputs.
## Limma step 6/6: 1/3: Creating table: failure_vs_cure. Adjust = BH
## Limma step 6/6: 2/3: Creating table: finaloutcomecure. Adjust = BH
## Limma step 6/6: 3/3: Creating table: finaloutcomefailure. Adjust = BH
dream_result <- mixed_monocyte_de[["all_tables"]][["contrasts"]][[1]]
big_table <- t_cf_monocyte_table_sva[["data"]][["outcome"]]
merged <- merge(big_table, dream_result, by = "row.names")
rownames(merged) <- merged[["Row.names"]]
merged[["Row.names"]] <- NULL
cor_value <- cor.test(merged[["logFC"]], merged[["deseq_logfc"]])
cor_value##
## Pearson's product-moment correlation
##
## data: merged[["logFC"]] and merged[["deseq_logfc"]]
## t = 163, df = 10860, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8367 0.8476
## sample estimates:
## cor
## 0.8422
t_cf_monocyte_de_sva[["dream"]] <- mixed_monocyte_de
test <- combine_de_tables(t_cf_monocyte_de_sva, excel = "/tmp/test_combined.xlsx")
test_aucc <- calculate_aucc(big_table, tbl2 = dream_result,
px = "deseq_adjp", py = "adj.P.Val",
lx = "deseq_logfc", ly = "logFC")
logfc_plotter <- plot_linear_scatter(merged[, c("logFC", "deseq_logfc")])
logfc_plot <- logfc_plotter[["scatter"]] +
xlab("Dream log2FC with (1|donor) and visit in model") +
ylab("DESeq2 log2FC: Default pairwise comparison") +
ggtitle(glue("Comparing results from models: {prettyNum(cor_value[['estimate']])} (pearson)"))
pp(file = "figures/compare_cf_and_visit_in_model_monocyte_logfc.svg")
logfc_plot
dev.off()## png
## 2
previous_sig_idx <- merged[["deseq_adjp"]] <= 0.05 & abs(merged[["deseq_logfc"]] >= 1.0)
summary(previous_sig_idx)## Mode FALSE TRUE
## logical 10802 60
previous_genes <- rownames(merged)[previous_sig_idx]
new_sig_idx <- abs(merged[["logFC"]]) >= 1.0 & merged[["P.Value"]] < 0.05
summary(new_sig_idx)## Mode FALSE TRUE
## logical 10823 39
new_genes <- rownames(merged)[new_sig_idx]
na_idx <- is.na(new_genes)
new_genes <- new_genes[!na_idx]
annot <- fData(t_monocytes)
compare <- Vennerable::Venn(list("previous" = previous_genes, "new" = new_genes))
shared_genes <- compare@IntersectionSets[["11"]]
name_idx <- rownames(annot) %in% shared_genes
annot[name_idx, ]## ensembl_gene_id ensembl_transcript_id version
## ENSG00000106772 ENSG00000106772 ENST00000480674 18
## ENSG00000120217 ENSG00000120217 ENST00000492923 14
## ENSG00000121653 ENSG00000121653 ENST00000395629 11
## ENSG00000131203 ENSG00000131203 ENST00000519154 13
## ENSG00000134321 ENSG00000134321 ENST00000489749 12
## ENSG00000135116 ENSG00000135116 ENST00000586941 9
## ENSG00000147138 ENSG00000147138 ENST00000645147 2
## ENSG00000165164 ENSG00000165164 ENST00000297866 14
## ENSG00000165338 ENSG00000165338 ENST00000498446 16
## ENSG00000183801 ENSG00000183801 ENST00000329293 8
## ENSG00000203907 ENSG00000203907 ENST00000441145 9
## ENSG00000214872 ENSG00000214872 ENST00000399154 8
## ENSG00000232629 ENSG00000232629 ENST00000427449 9
## ENSG00000248405 ENSG00000248405 ENST00000361473 10
## ENSG00000263715 ENSG00000263715 ENST00000587305 7
## ENSG00000277632 ENSG00000277632 ENST00000613922 2
## transcript_version
## ENSG00000106772 1
## ENSG00000120217 1
## ENSG00000121653 2
## ENSG00000131203 5
## ENSG00000134321 1
## ENSG00000135116 1
## ENSG00000147138 1
## ENSG00000165164 9
## ENSG00000165338 1
## ENSG00000183801 4
## ENSG00000203907 1
## ENSG00000214872 3
## ENSG00000232629 1
## ENSG00000248405 9
## ENSG00000263715 1
## ENSG00000277632 2
## description
## ENSG00000106772 prune homolog 2 with BCH domain [Source:HGNC Symbol;Acc:HGNC:25209]
## ENSG00000120217 CD274 molecule [Source:HGNC Symbol;Acc:HGNC:17635]
## ENSG00000121653 mitogen-activated protein kinase 8 interacting protein 1 [Source:HGNC Symbol;Acc:HGNC:6882]
## ENSG00000131203 indoleamine 2,3-dioxygenase 1 [Source:HGNC Symbol;Acc:HGNC:6059]
## ENSG00000134321 radical S-adenosyl methionine domain containing 2 [Source:HGNC Symbol;Acc:HGNC:30908]
## ENSG00000135116 harakiri, BCL2 interacting protein [Source:HGNC Symbol;Acc:HGNC:5185]
## ENSG00000147138 G protein-coupled receptor 174 [Source:HGNC Symbol;Acc:HGNC:30245]
## ENSG00000165164 cilia and flagella associated protein 47 [Source:HGNC Symbol;Acc:HGNC:26708]
## ENSG00000165338 HECT domain E3 ubiquitin protein ligase 2 [Source:HGNC Symbol;Acc:HGNC:26736]
## ENSG00000183801 olfactomedin like 1 [Source:HGNC Symbol;Acc:HGNC:24473]
## ENSG00000203907 oocyte expressed protein [Source:HGNC Symbol;Acc:HGNC:21382]
## ENSG00000214872 smoothelin like 1 [Source:HGNC Symbol;Acc:HGNC:32394]
## ENSG00000232629 major histocompatibility complex, class II, DQ beta 2 [Source:HGNC Symbol;Acc:HGNC:4945]
## ENSG00000248405 PRR5-ARHGAP8 readthrough [Source:HGNC Symbol;Acc:HGNC:34512]
## ENSG00000263715 LINC02210-CRHR1 readthrough [Source:HGNC Symbol;Acc:HGNC:51483]
## ENSG00000277632 C-C motif chemokine ligand 3 [Source:HGNC Symbol;Acc:HGNC:10627]
## gene_biotype cds_length chromosome_name strand start_position
## ENSG00000106772 protein_coding undefined 9 - 76611376
## ENSG00000120217 protein_coding undefined 9 + 5450503
## ENSG00000121653 protein_coding 2106 11 + 45885651
## ENSG00000131203 protein_coding 540 8 + 39902275
## ENSG00000134321 protein_coding undefined 2 + 6865806
## ENSG00000135116 protein_coding undefined 12 - 116856144
## ENSG00000147138 protein_coding 1002 X + 79144663
## ENSG00000165164 protein_coding 2931 X + 35919734
## ENSG00000165338 protein_coding undefined 10 + 91409280
## ENSG00000183801 protein_coding 1209 11 + 7485388
## ENSG00000203907 protein_coding 201 6 - 73368555
## ENSG00000214872 protein_coding 1374 11 + 57542641
## ENSG00000232629 protein_coding 656 6 - 32756098
## ENSG00000248405 protein_coding 1695 22 + 44702233
## ENSG00000263715 protein_coding undefined 17 + 45620344
## ENSG00000277632 protein_coding 279 17 - 36088256
## end_position hgnc_symbol uniprot_gn_symbol
## ENSG00000106772 76906114 PRUNE2 PRUNE2
## ENSG00000120217 5470566 CD274 CD274
## ENSG00000121653 45906465 MAPK8IP1 MAPK8IP1
## ENSG00000131203 39928790 IDO1 IDO1
## ENSG00000134321 6898239 RSAD2 RSAD2
## ENSG00000135116 116881441 HRK HRK
## ENSG00000147138 79175315 GPR174 GPR174
## ENSG00000165164 36385317 CFAP47 CFAP47
## ENSG00000165338 91514829 HECTD2 HECTD2
## ENSG00000183801 7511377 OLFML1 OLFML1
## ENSG00000203907 73395133 OOEP OOEP
## ENSG00000214872 57550274 SMTNL1 SMTNL1
## ENSG00000232629 32763532 HLA-DQB2 HLA-DQB2
## ENSG00000248405 44862706 PRR5-ARHGAP8 PRR5-ARHGAP8
## ENSG00000263715 45835826 LINC02210-CRHR1 CRHR1
## ENSG00000277632 36090169 CCL3 CCL3
## transcript mean_cds_len
## ENSG00000106772 ENSG00000106772.1 4640
## ENSG00000120217 ENSG00000120217.1 702
## ENSG00000121653 ENSG00000121653.2 2121
## ENSG00000131203 ENSG00000131203.5 642.166666666667
## ENSG00000134321 ENSG00000134321.1 754.5
## ENSG00000135116 ENSG00000135116.1 166.5
## ENSG00000147138 ENSG00000147138.1 1002
## ENSG00000165164 ENSG00000165164.9 3307.6
## ENSG00000165338 ENSG00000165338.1 1329.8
## ENSG00000183801 ENSG00000183801.4 698.5
## ENSG00000203907 ENSG00000203907.1 312
## ENSG00000214872 ENSG00000214872.3 1429.5
## ENSG00000232629 ENSG00000232629.1 740.75
## ENSG00000248405 ENSG00000248405.9 1713.66666666667
## ENSG00000263715 ENSG00000263715.1 723
## ENSG00000277632 ENSG00000277632.2 279
Now that I have performed all of the above, I think it should be possible to have a working analysis using dream that includes celltype, visitnumber, finaloutcome, donor, and perhaps SVs.
mixed_fstring <- "~ 0 + finaloutcome + typeofcells + visitnumber + (1|donor)"
mixed_formula <- as.formula(mixed_fstring)
mixed_fstring_svs <- "~ 0 + finaloutcome + typeofcells + visitnumber + (1|donor) + svaseq_SV1 + svaseq_SV2 + svaseq_SV3 + svaseq_SV4"
mixed_formula_svs <- as.formula(mixed_fstring_svs)
all_dream_de <- dream_pairwise(t_clinical_nobiop, alt_model = mixed_formula)
dream_result <- all_dream_de$all_tables[["contrasts"]][["failure_vs_cure"]] %>%
arrange(desc(logFC))
fc_sig_idx <- dream_result[["logFC"]] >= 1.0 & dream_result[["z.std"]] >= 2.0
dream_sig <- rownames(dream_result[fc_sig_idx, ])
fData(t_monocytes)[dream_sig, ]
svs_all_dream_de <- dream_pairwise(t_clinical_nobiop, alt_model = mixed_formula_svs)
test <- hpgl_padjust(svs_all_dream_de$all_tables$contrasts[[1]], pvalue_column = "P.Value",
mean_column = "AveExpr", method = "ihw", type = "limma")One figure I did not create is a venn diagram showing the overlap of the eosionphil, neutrophil, and monocyte results and the 10 genes shared among them all. At least in theory I should be easily able to create a similar/identical plot.
observed_eosinophils <- c(
rownames(t_cf_eosinophil_sig_sva[["deseq"]][["ups"]][["outcome"]]),
rownames(t_cf_eosinophil_sig_sva[["deseq"]][["downs"]][["outcome"]]))
observed_monocytes <- c(
rownames(t_cf_monocyte_sig_sva[["deseq"]][["ups"]][["outcome"]]),
rownames(t_cf_monocyte_sig_sva[["deseq"]][["downs"]][["outcome"]]))
observed_neutrophils <- c(
rownames(t_cf_neutrophil_sig_sva[["deseq"]][["ups"]][["outcome"]]),
rownames(t_cf_neutrophil_sig_sva[["deseq"]][["downs"]][["outcome"]]))
venn_input <- list(
"eosinophil" = observed_eosinophils,
"monocyte" = observed_monocytes,
"neutrophils" = observed_neutrophils)
shared <- Vennerable::Venn(venn_input)
shared## A Venn object on 3 sets named
## eosinophil,monocyte,neutrophils
## 000 100 010 110 001 101 011 111
## 0 134 81 10 105 33 9 12
intersect <- "eosinophil:monocyte:neutrophils"
celltype_upset <- UpSetR::upset(UpSetR::fromList(venn_input), text.scale = 2)
celltype_upsetcelltype_shared_genes <- overlap_groups(venn_input)
celltype_geneids <- overlap_geneids(celltype_shared_genes, intersect)
ids <- attr(celltype_shared_genes, "elements")[celltype_shared_genes[[intersect]]]
ids## eosinophil4 eosinophil6 eosinophil7 eosinophil9
## "ENSG00000089012" "ENSG00000137959" "ENSG00000115155" "ENSG00000165949"
## eosinophil23 eosinophil24 eosinophil28 eosinophil41
## "ENSG00000186654" "ENSG00000248405" "ENSG00000188672" "ENSG00000177294"
## eosinophil46 eosinophil52 eosinophil54 eosinophil120
## "ENSG00000134321" "ENSG00000214872" "ENSG00000184979" "ENSG00000196526"
## [1] "SIRPG" "IFI44L" "OTOF" "IFI27" "PRR5"
## [6] "PRR5-ARHGAP8" "RHCE" "FBXO39" "RSAD2" "SMTNL1"
## [11] "USP18" "AFAP1"
Note to self, when I rendered the html, stupid R ran out of temp files and so did not actually print the darn html document, as a result I modified the render function to try to make sure there is a clean directory in which to work; testing now. If it continues to not work, I will need to remove some of the images created in this document.
num_color <- color_choices[["clinic_cf"]][["tumaco_failure"]]
den_color <- color_choices[["clinic_cf"]][["tumaco_cure"]]
cf_monocyte_table <- t_cf_monocyte_table_sva[["data"]][["outcome"]]
cf_monocyte_volcano <- plot_volcano_condition_de(
cf_monocyte_table, "outcome", label = expected_genes,
fc_col = "deseq_logfc", p_col = "deseq_adjp", line_position = NULL,
color_high = num_color, color_low = den_color, label_size = 6)
pp(file = "figures/cf_monocyte_volcano_labeled.svg")
cf_monocyte_volcano[["plot"]]
dev.off()## png
## 2
cf_monocyte_volcano_top10 <- plot_volcano_condition_de(
cf_monocyte_table, "outcome", label = 10,
fc_col = "deseq_logfc", p_col = "deseq_adjp", line_position = NULL,
color_high = num_color, color_low = den_color, label_size = 6)
pp(file = glue("images/cf_monocyte_volcano_labeled_top10-v{ver}.svg"))
cf_monocyte_volcano_top10[["plot"]]
dev.off()## png
## 2
cf_eosinophil_table <- t_cf_eosinophil_table_sva[["data"]][["outcome"]]
cf_eosinophil_volcano <- plot_volcano_condition_de(
cf_eosinophil_table, "outcome", label = expected_genes,
fc_col = "deseq_logfc", p_col = "deseq_adjp", line_position = NULL,
color_high = num_color, color_low = den_color, label_size = 6)
pp(file = "figures/cf_eosinophil_volcano_labeled.svg")
cf_eosinophil_volcano[["plot"]]
dev.off()## png
## 2
cf_eosinophil_volcano_top10 <- plot_volcano_condition_de(
cf_eosinophil_table, "outcome", label = 10,
fc_col = "deseq_logfc", p_col = "deseq_adjp", line_position = NULL,
color_high = num_color, color_low = den_color, label_size = 6)
pp(file = glue("images/cf_eosinophil_volcano_labeled_top10-v{ver}.svg"))
cf_eosinophil_volcano_top10[["plot"]]
dev.off()## png
## 2
cf_neutrophil_table <- t_cf_neutrophil_table_sva[["data"]][["outcome"]]
cf_neutrophil_volcano <- plot_volcano_condition_de(
cf_neutrophil_table, "outcome", label = expected_genes,
fc_col = "deseq_logfc", p_col = "deseq_adjp", line_position = NULL,
color_high = num_color, color_low = den_color, label_size = 6)
pp(file = "figures/cf_neutrophil_volcano_labeled.svg")
cf_neutrophil_volcano[["plot"]]
dev.off()## png
## 2
cf_neutrophil_volcano_top10 <- plot_volcano_condition_de(
cf_neutrophil_table, "outcome", label = 10,
fc_col = "deseq_logfc", p_col = "deseq_adjp", line_position = NULL,
color_high = num_color, color_low = den_color, label_size = 6)
pp(file = glue("images/cf_neutrophil_volcano_labeled_top10-v{ver}.svg"))
cf_neutrophil_volcano_top10[["plot"]]
dev.off()## png
## 2
t_cf_eosinophil_v1_de_sva <- all_pairwise(tv1_eosinophils, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 5 3
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8465
## limma_vs_edger 0.8498
## limma_vs_basic 0.9207
## limma_vs_noiseq 0.8343
## deseq_vs_edger 0.9996
## deseq_vs_basic 0.8702
## deseq_vs_noiseq 0.7807
## edger_vs_basic 0.8716
## edger_vs_noiseq 0.7850
## basic_vs_noiseq 0.8407
t_cf_eosinophil_v1_table_sva <- combine_de_tables(
t_cf_eosinophil_v1_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_v1_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_v1_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 13 19 11
## edger_sigdown limma_sigup limma_sigdown
## 1 10 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_eosinophil_v1_sig_sva <- extract_significant_genes(
t_cf_eosinophil_v1_table_sva,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_v1_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_v1_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 13 19 11
## edger_sigdown limma_sigup limma_sigdown
## 1 10 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
## [1] 13 59
## [1] 19 59
t_cf_eosinophil_v2_de_sva <- all_pairwise(tv2_eosinophils, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 6 3
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.8540
## limma_vs_edger 0.8581
## limma_vs_basic 0.8937
## limma_vs_noiseq 0.7844
## deseq_vs_edger 0.9996
## deseq_vs_basic 0.8446
## deseq_vs_noiseq 0.8332
## edger_vs_basic 0.8465
## edger_vs_noiseq 0.8360
## basic_vs_noiseq 0.8616
t_cf_eosinophil_v2_table_sva <- combine_de_tables(
t_cf_eosinophil_v2_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_v2_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_v2_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 9 4 10
## edger_sigdown limma_sigup limma_sigdown
## 1 1 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_eosinophil_v2_sig_sva <- extract_significant_genes(
t_cf_eosinophil_v2_table_sva,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_v2_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_v2_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 0 0 10 1 9 4 0
## basic_down
## outcome 0
## [1] 9 59
## [1] 4 59
t_cf_eosinophil_v3_de_sva <- all_pairwise(tv3_eosinophils, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## tumaco_cure tumaco_failure
## 6 3
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## tmc_flr___
## limma_vs_deseq 0.9137
## limma_vs_edger 0.9138
## limma_vs_basic 0.8620
## limma_vs_noiseq 0.7838
## deseq_vs_edger 1.0000
## deseq_vs_basic 0.8019
## deseq_vs_noiseq 0.8252
## edger_vs_basic 0.8021
## edger_vs_noiseq 0.8258
## basic_vs_noiseq 0.8696
t_cf_eosinophil_v3_table_sva <- combine_de_tables(
t_cf_eosinophil_v3_de_sva, keepers = t_cf_contrast,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_v3_cf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_v3_cf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup
## 1 tumaco_failure_vs_tumaco_cure 68 29 73
## edger_sigdown limma_sigup limma_sigdown
## 1 10 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_cf_eosinophil_v3_sig_sva <- extract_significant_genes(
t_cf_eosinophil_v3_table_sva,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_v3_cf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Eosinophils/t_eosinophil_v3_cf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## outcome 0 0 73 10 68 29 0
## basic_down
## outcome 0
## [1] 68 59
## [1] 29 59
sva_aucc <- calculate_aucc(t_cf_eosinophil_table_sva[["data"]][[1]],
tbl2 = t_cf_eosinophil_table_batchvisit[["data"]][[1]],
py = "deseq_adjp", ly = "deseq_logfc")
sva_aucc## These two tables have an aucc value of: 0.575992158061818 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 152, df = 10530, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8232 0.8351
## sample estimates:
## cor
## 0.8292
shared_ids <- rownames(t_cf_eosinophil_table_sva[["data"]][[1]]) %in%
rownames(t_cf_eosinophil_table_batchvisit[["data"]][[1]])
first <- t_cf_eosinophil_table_sva[["data"]][[1]][shared_ids, ]
second <- t_cf_eosinophil_table_batchvisit[["data"]][[1]][rownames(first), ]
cor.test(first[["deseq_logfc"]], second[["deseq_logfc"]])##
## Pearson's product-moment correlation
##
## data: first[["deseq_logfc"]] and second[["deseq_logfc"]]
## t = 152, df = 10530, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8232 0.8351
## sample estimates:
## cor
## 0.8292
t_mono_neut_sva_aucc <- calculate_aucc(t_cf_monocyte_table_sva[["data"]][["outcome"]],
tbl2 = t_cf_neutrophil_table_sva[["data"]][["outcome"]],
py = "deseq_adjp", ly = "deseq_logfc")
t_mono_neut_sva_aucc## These two tables have an aucc value of: 0.204260579576817 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 43, df = 8577, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4028 0.4376
## sample estimates:
## cor
## 0.4204
t_mono_eo_sva_aucc <- calculate_aucc(t_cf_monocyte_table_sva[["data"]][["outcome"]],
tbl2 = t_cf_eosinophil_table_sva[["data"]][["outcome"]],
py = "deseq_adjp", ly = "deseq_logfc")
t_mono_eo_sva_aucc## These two tables have an aucc value of: 0.0963272498511824 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 22, df = 9765, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.2016 0.2393
## sample estimates:
## cor
## 0.2206
t_neut_eo_sva_aucc <- calculate_aucc(t_cf_neutrophil_table_sva[["data"]][["outcome"]],
tbl2 = t_cf_eosinophil_table_sva[["data"]][["outcome"]],
py = "deseq_adjp", ly = "deseq_logfc")
t_neut_eo_sva_aucc## These two tables have an aucc value of: 0.201619581335336 and correlation:
##
## Pearson's product-moment correlation
##
## data: tbl[[lx]] and tbl[[ly]]
## t = 42, df = 8571, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3974 0.4324
## sample estimates:
## cor
## 0.4151
For these contrasts, we want to see fail_v1 vs. cure_v1, fail_v2 vs. cure_v2 etc. As a result, we will need to juggle the data slightly and add another set of contrasts.
t_visit_cf_all_de_sva <- all_pairwise(t_visitcf, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## v1_cure v1_failure v2_cure v2_failure v3_cure v3_failure
## 30 24 20 15 17 17
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_visit_cf_all_table_sva <- combine_de_tables(
t_visit_cf_all_de_sva, keepers = visitcf_contrasts,
excel = glue("{cf_prefix}/t_all_visitcf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/t_all_visitcf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 v1_failure_vs_v1_cure 26 82 26 58
## 2 v2_failure_vs_v2_cure 51 41 43 28
## 3 v3_failure_vs_v3_cure 77 32 33 25
## limma_sigup limma_sigdown
## 1 9 17
## 2 3 0
## 3 3 0
## Plot describing unique/shared genes in a differential expression table.
t_visit_cf_all_sig_sva <- extract_significant_genes(
t_visit_cf_all_table_sva,
excel = glue("{cf_prefix}/t_all_visitcf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/t_all_visitcf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## v1cf 9 17 26 58 26 82 0
## v2cf 3 0 43 28 51 41 0
## v3cf 3 0 33 25 77 32 0
## basic_down
## v1cf 0
## v2cf 0
## v3cf 0
visitcf_factor <- paste0("v", pData(t_monocytes)[["visitnumber"]], "_",
pData(t_monocytes)[["finaloutcome"]])
t_monocytes_visitcf <- set_expt_conditions(t_monocytes, fact = visitcf_factor)## The numbers of samples by condition are:
##
## v1_cure v1_failure v2_cure v2_failure v3_cure v3_failure
## 8 8 7 6 6 7
t_visit_cf_monocyte_de_sva <- all_pairwise(t_monocytes_visitcf, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## v1_cure v1_failure v2_cure v2_failure v3_cure v3_failure
## 8 8 7 6 6 7
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_visit_cf_monocyte_table_sva <- combine_de_tables(
t_visit_cf_monocyte_de_sva, keepers = visitcf_contrasts,
excel = glue("{cf_prefix}/Monocytes/t_monocyte_visitcf_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Monocytes/t_monocyte_visitcf_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 v1_failure_vs_v1_cure 15 10 10 13
## 2 v2_failure_vs_v2_cure 0 0 0 0
## 3 v3_failure_vs_v3_cure 0 0 0 0
## limma_sigup limma_sigdown
## 1 1 1
## 2 0 0
## 3 0 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_visit_cf_monocyte_sig_sva <- extract_significant_genes(
t_visit_cf_monocyte_table_sva,
excel = glue("{cf_prefix}/Monocytes/t_monocyte_visitcf_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Cure_Fail/Monocytes/t_monocyte_visitcf_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## v1cf 1 1 10 13 15 10 0
## v2cf 0 0 0 0 0 0 0
## v3cf 0 0 0 0 0 0 0
## basic_down
## v1cf 0
## v2cf 0
## v3cf 0
t_v1fc_deseq_ma <- t_visit_cf_monocyte_table_sva[["plots"]][["v1cf"]][["deseq_ma_plots"]][["plot"]]
dev <- pp(file = "images/monocyte_cf_de_v1_maplot.png")
t_v1fc_deseq_ma## NULL
## NULL
t_v2fc_deseq_ma <- t_visit_cf_monocyte_table_sva[["plots"]][["v2cf"]][["deseq_ma_plots"]][["plot"]]
dev <- pp(file = "images/monocyte_cf_de_v2_maplot.png")
t_v2fc_deseq_ma## NULL
## NULL
t_v3fc_deseq_ma <- t_visit_cf_monocyte_table_sva[["plots"]][["v3cf"]][["deseq_ma_plots"]][["plot"]]
dev <- pp(file = "images/monocyte_cf_de_v3_maplot.png")
t_v3fc_deseq_ma## NULL
## NULL
One query from Alejandro is to look at the genes shared up/down across visits. I am not entirely certain we have enough samples for this to work, but let us find out.
I am thinking this is a good place to use the AUCC curves I learned about thanks to Julie Cridland.
Note that the following is all monocyte samples, this should therefore potentially be moved up and a version of this with only the Tumaco samples put here?
v1cf <- t_visit_cf_monocyte_table_sva[["data"]][["v1cf"]]
v2cf <- t_visit_cf_monocyte_table_sva[["data"]][["v2cf"]]
v3cf <- t_visit_cf_monocyte_table_sva[["data"]][["v3cf"]]
v1_sig <- c(
rownames(t_visit_cf_monocyte_sig_sva[["deseq"]][["ups"]][["v1cf"]]),
rownames(t_visit_cf_monocyte_sig_sva[["deseq"]][["downs"]][["v1cf"]]))
length(v1_sig)## [1] 25
v2_sig <- c(
rownames(t_visit_cf_monocyte_sig_sva[["deseq"]][["ups"]][["v2cf"]]),
rownames(t_visit_cf_monocyte_sig_sva[["deseq"]][["downs"]][["v2cf"]]))
length(v2_sig)## [1] 0
v3_sig <- c(
rownames(t_visit_cf_monocyte_sig_sva[["deseq"]][["ups"]][["v2cf"]]),
rownames(t_visit_cf_monocyte_sig_sva[["deseq"]][["downs"]][["v2cf"]]))
length(v3_sig)## [1] 0
t_monocyte_visit_aucc_v2v1 <- calculate_aucc(v1cf, tbl2 = v2cf,
py = "deseq_adjp", ly = "deseq_logfc")
dev <- pp(file = "images/monocyte_visit_v2v1_aucc.png")
t_monocyte_visit_aucc_v2v1[["plot"]]
closed <- dev.off()
t_monocyte_visit_aucc_v2v1[["plot"]]t_monocyte_visit_aucc_v3v1 <- calculate_aucc(v1cf, tbl2 = v3cf,
py = "deseq_adjp", ly = "deseq_logfc")
dev <- pp(file = "images/monocyte_visit_v3v1_aucc.png")
t_monocyte_visit_aucc_v3v1[["plot"]]
closed <- dev.off()
t_monocyte_visit_aucc_v3v1[["plot"]]visitcf_factor <- paste0("v", pData(t_neutrophils)[["visitnumber"]], "_",
pData(t_neutrophils)[["finaloutcome"]])
t_neutrophil_visitcf <- set_expt_conditions(t_neutrophils, fact = visitcf_factor)## The numbers of samples by condition are:
##
## v1_cure v1_failure v2_cure v2_failure v3_cure v3_failure
## 8 8 7 6 5 7
t_visit_cf_neutrophil_de_sva <- all_pairwise(t_neutrophil_visitcf, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods)##
## v1_cure v1_failure v2_cure v2_failure v3_cure v3_failure
## 8 8 7 6 5 7
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_visit_cf_neutrophil_table_sva <- combine_de_tables(
t_visit_cf_neutrophil_de_sva, keepers = visitcf_contrasts,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_visitcf_table_sva-v{ver}.xlsx"))
t_visit_cf_neutrophil_table_sva## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 v1_failure_vs_v1_cure 12 6 6 6
## 2 v2_failure_vs_v2_cure 2 6 2 3
## 3 v3_failure_vs_v3_cure 2 2 0 2
## limma_sigup limma_sigdown
## 1 1 0
## 2 0 0
## 3 0 0
## Plot describing unique/shared genes in a differential expression table.
t_visit_cf_neutrophil_sig_sva <- extract_significant_genes(
t_visit_cf_neutrophil_table_sva,
excel = glue("{cf_prefix}/Neutrophils/t_neutrophil_visitcf_sig_sva-v{ver}.xlsx"))
t_visit_cf_neutrophil_sig_sva## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## v1cf 1 0 6 6 12 6 0
## v2cf 0 0 2 3 2 6 0
## v3cf 0 0 0 2 2 2 0
## basic_down
## v1cf 0
## v2cf 0
## v3cf 0
visitcf_factor <- paste0("v", pData(t_eosinophils)[["visitnumber"]], "_",
pData(t_eosinophils)[["finaloutcome"]])
t_eosinophil_visitcf <- set_expt_conditions(t_eosinophils, fact = visitcf_factor)## The numbers of samples by condition are:
##
## v1_cure v1_failure v2_cure v2_failure v3_cure v3_failure
## 5 3 6 3 6 3
t_visit_cf_eosinophil_de_sva <- all_pairwise(t_eosinophil_visitcf, model_batch = "svaseq",
parallel = parallel, filter = TRUE,
methods = methods, keepers = visitcf_contrasts)##
## v1_cure v1_failure v2_cure v2_failure v3_cure v3_failure
## 5 3 6 3 6 3
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_visit_cf_eosinophil_table_sva <- combine_de_tables(
t_visit_cf_eosinophil_de_sva, keepers = visitcf_contrasts,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_visitcf_table_sva-v{ver}.xlsx"))
t_visit_cf_eosinophil_table_sva## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 v1_failure_vs_v1_cure 9 11 2 3
## 2 v2_failure_vs_v2_cure 4 3 5 2
## 3 v3_failure_vs_v3_cure 14 7 17 2
## limma_sigup limma_sigdown
## 1 0 1
## 2 0 0
## 3 0 0
## Plot describing unique/shared genes in a differential expression table.
t_visit_cf_eosinophil_sig_sva <- extract_significant_genes(
t_visit_cf_eosinophil_table_sva,
excel = glue("{cf_prefix}/Eosinophils/t_eosinophil_visitcf_sig_sva-v{ver}.xlsx"))
t_visit_cf_eosinophil_sig_sva## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## v1cf 0 1 2 3 9 11 0
## v2cf 0 0 5 2 4 3 0
## v3cf 0 0 17 2 14 7 0
## basic_down
## v1cf 0
## v2cf 0
## v3cf 0
Having put some SL read mapping information in the sample sheet, Maria Adelaida added a new column using it with the putative persistence state on a per-sample basis. One question which arised from that: what differences are observable between the persistent yes vs. no samples on a per-cell-type basis among the visit 3 samples.
First things first, create the datasets.
persistence_expt <- subset_expt(t_clinical, subset = "persistence=='Y'|persistence=='N'") %>%
subset_expt(subset = 'visitnumber==3') %>%
set_expt_conditions(fact = 'persistence')## subset_expt(): There were 123, now there are 83 samples.
## subset_expt(): There were 83, now there are 30 samples.
## The numbers of samples by condition are:
##
## N Y
## 6 24
## persistence_biopsy <- subset_expt(persistence_expt, subset = "typeofcells=='biopsy'")
persistence_monocyte <- subset_expt(persistence_expt, subset = "typeofcells=='monocytes'")## subset_expt(): There were 30, now there are 12 samples.
## subset_expt(): There were 30, now there are 10 samples.
## subset_expt(): There were 30, now there are 8 samples.
See if there are any patterns which look usable.
## All
persistence_norm <- normalize_expt(persistence_expt, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 2767 low-count genes (11389 remaining).
## transform_counts: Found 15 values equal to 0, adding 1 to the matrix.
persistence_nb <- normalize_expt(persistence_expt, transform = "log2", convert = "cpm",
batch = "svaseq", filter = TRUE)## Removing 2767 low-count genes (11389 remaining).
## Setting 1544 low elements to zero.
## transform_counts: Found 1544 values equal to 0, adding 1 to the matrix.
## Biopsies
##persistence_biopsy_norm <- normalize_expt(persistence_biopsy, transform = "log2", convert = "cpm",
## norm = "quant", filter = TRUE)
##plot_pca(persistence_biopsy_norm)[["plot"]]
## Insufficient data
## Monocytes
persistence_monocyte_norm <- normalize_expt(persistence_monocyte, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 3827 low-count genes (10329 remaining).
## transform_counts: Found 1 values equal to 0, adding 1 to the matrix.
persistence_monocyte_nb <- normalize_expt(persistence_monocyte, transform = "log2", convert = "cpm",
batch = "svaseq", filter = TRUE)## Removing 3827 low-count genes (10329 remaining).
## Setting 47 low elements to zero.
## transform_counts: Found 47 values equal to 0, adding 1 to the matrix.
## Neutrophils
persistence_neutrophil_norm <- normalize_expt(persistence_neutrophil, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 5762 low-count genes (8394 remaining).
## transform_counts: Found 2 values equal to 0, adding 1 to the matrix.
persistence_neutrophil_nb <- normalize_expt(persistence_neutrophil, transform = "log2", convert = "cpm",
batch = "svaseq", filter = TRUE)## Removing 5762 low-count genes (8394 remaining).
## Setting 46 low elements to zero.
## transform_counts: Found 46 values equal to 0, adding 1 to the matrix.
## Eosinophils
persistence_eosinophil_norm <- normalize_expt(persistence_eosinophil, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 4126 low-count genes (10030 remaining).
## transform_counts: Found 1 values equal to 0, adding 1 to the matrix.
persistence_eosinophil_nb <- normalize_expt(persistence_eosinophil, transform = "log2", convert = "cpm",
batch = "svaseq", filter = TRUE)## Removing 4126 low-count genes (10030 remaining).
## Setting 25 low elements to zero.
## transform_counts: Found 25 values equal to 0, adding 1 to the matrix.
persistence_de_sva <- all_pairwise(persistence_expt, filter = TRUE, methods = methods,
parallel = parallel, model_batch = "svaseq")##
## N Y
## 6 24
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## Y_vs_N
## limma_vs_deseq 0.8111
## limma_vs_edger 0.8765
## limma_vs_basic 0.8218
## limma_vs_noiseq 0.6444
## deseq_vs_edger 0.9605
## deseq_vs_basic 0.7178
## deseq_vs_noiseq 0.5868
## edger_vs_basic 0.7791
## edger_vs_noiseq 0.6433
## basic_vs_noiseq 0.7960
persistence_table_sva <- combine_de_tables(
persistence_de_sva,
excel = glue("{xlsx_prefix}/DE_Persistence/persistence_all_de_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Persistence/persistence_all_de_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup
## 1 Y_vs_N 55 44 26 49 7
## limma_sigdown
## 1 22
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
persistence_monocyte_de_sva <- all_pairwise(persistence_monocyte, filter = TRUE,
parallel = parallel, model_batch = "svaseq",
methods = methods)##
## N Y
## 2 10
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## Y_vs_N
## limma_vs_deseq 0.9260
## limma_vs_edger 0.9270
## limma_vs_basic 0.9858
## limma_vs_noiseq 0.9013
## deseq_vs_edger 1.0000
## deseq_vs_basic 0.9237
## deseq_vs_noiseq 0.9181
## edger_vs_basic 0.9245
## edger_vs_noiseq 0.9193
## basic_vs_noiseq 0.9039
persistence_monocyte_table_sva <- combine_de_tables(
persistence_monocyte_de_sva,
excel = glue("{xlsx_prefix}/DE_Persistence/persistence_monocyte_de_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Persistence/persistence_monocyte_de_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup
## 1 Y_vs_N 1 0 0 1 0
## limma_sigdown
## 1 0
## Only Y_vs_N_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
persistence_neutrophil_de_sva <- all_pairwise(persistence_neutrophil, filter = TRUE,
parallel = parallel, model_batch = "svaseq",
methods = methods)##
## N Y
## 3 7
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## Y_vs_N
## limma_vs_deseq 0.9407
## limma_vs_edger 0.9408
## limma_vs_basic 0.8808
## limma_vs_noiseq 0.7817
## deseq_vs_edger 0.9985
## deseq_vs_basic 0.8271
## deseq_vs_noiseq 0.7593
## edger_vs_basic 0.8283
## edger_vs_noiseq 0.7602
## basic_vs_noiseq 0.9003
persistence_neutrophil_table_sva <- combine_de_tables(
persistence_neutrophil_de_sva,
excel = glue("{xlsx_prefix}/DE_Persistence/persistence_neutrophil_de_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Persistence/persistence_neutrophil_de_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup
## 1 Y_vs_N 26 49 17 35 0
## limma_sigdown
## 1 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
## There are insufficient samples (1) in the 'N' category.
##persistence_eosinophil_de_sva <- all_pairwise(persistence_eosinophil, filter = TRUE,
## parallel = parallel, model_batch = "svaseq",
## methods = methods)
##persistence_eosinophil_de_sva
##persistence_eosinophil_table_sva <- combine_de_tables(
## persistence_eosinophil_de_sva,
## excel = glue("{xlsx_prefix}/DE_Persistence/persistence_eosinophil_de_sva-v{ver}.xlsx"))t_visit_all_de_sva <- all_pairwise(t_visit, filter = TRUE, methods = methods,
parallel = parallel, model_batch = "svaseq")##
## 3 2 1
## 34 35 40
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_visit_all_table_sva <- combine_de_tables(
t_visit_all_de_sva, keepers = visit_contrasts,
excel = glue("{xlsx_prefix}/DE_Visits/t_all_visit_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/t_all_visit_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup
## 1 c2_vs_c1 25 9 20 10 19
## 2 c3_vs_c1 20 20 18 16 21
## 3 c3_vs_c2 0 2 0 2 0
## limma_sigdown
## 1 7
## 2 7
## 3 0
## Plot describing unique/shared genes in a differential expression table.
t_visit_all_sig_sva <- extract_significant_genes(
t_visit_all_table_sva,
excel = glue("{xlsx_prefix}/DE_Visits/t_all_visit_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/t_all_visit_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## v2v1 19 7 20 10 25 9 0
## v3v1 21 7 18 16 20 20 0
## v3v2 0 0 0 2 0 2 0
## basic_down
## v2v1 0
## v3v1 0
## v3v2 0
## The numbers of samples by condition are:
##
## 3 2 1
## 13 13 16
t_visit_monocyte_de_sva <- all_pairwise(t_visit_monocytes, filter = TRUE,
parallel = parallel, model_batch = "svaseq",
methods = methods)##
## 3 2 1
## 13 13 16
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_visit_monocyte_table_sva <- combine_de_tables(
t_visit_monocyte_de_sva, keepers = visit_contrasts,
excel = glue("{xlsx_prefix}/DE_Visits/Monocytes/t_monocyte_visit_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Monocytes/t_monocyte_visit_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup
## 1 c2_vs_c1 1 2 1 1 0
## 2 c3_vs_c1 2 1 1 1 0
## 3 c3_vs_c2 0 0 0 0 0
## limma_sigdown
## 1 0
## 2 0
## 3 0
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Plot describing unique/shared genes in a differential expression table.
t_visit_monocyte_sig_sva <- extract_significant_genes(
t_visit_monocyte_table_sva,
excel = glue("{xlsx_prefix}/DE_Visits/Monocytes/t_monocyte_visit_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Monocytes/t_monocyte_visit_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## v2v1 0 0 1 1 1 2 0
## v3v1 0 0 1 1 2 1 0
## v3v2 0 0 0 0 0 0 0
## basic_down
## v2v1 0
## v3v1 0
## v3v2 0
## The numbers of samples by condition are:
##
## 3 2 1
## 12 13 16
t_visit_neutrophil_de_sva <- all_pairwise(t_visit_neutrophils, filter = TRUE,
parallel = parallel, model_batch = "svaseq",
methods = methods)##
## 3 2 1
## 12 13 16
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_visit_neutrophil_table_sva <- combine_de_tables(
t_visit_neutrophil_de_sva, keepers = visit_contrasts,
excel = glue("{xlsx_prefix}/DE_Visits/Neutrophils/t_neutrophil_visit_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Neutrophils/t_neutrophil_visit_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup
## 1 c2_vs_c1 111 88 111 88 116
## 2 c3_vs_c1 127 45 122 44 93
## 3 c3_vs_c2 1 0 0 0 0
## limma_sigdown
## 1 52
## 2 67
## 3 0
## Plot describing unique/shared genes in a differential expression table.
t_visit_neutrophil_sig_sva <- extract_significant_genes(
t_visit_neutrophil_table_sva,
excel = glue("{xlsx_prefix}/DE_Visits/Neutrophils/t_neutrophil_visit_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Neutrophils/t_neutrophil_visit_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down basic_up
## v2v1 116 52 111 88 111 88 83
## v3v1 93 67 122 44 127 45 52
## v3v2 0 0 0 0 1 0 0
## basic_down
## v2v1 35
## v3v1 17
## v3v2 0
## The numbers of samples by condition are:
##
## 3 2 1
## 9 9 8
t_visit_eosinophil_de <- all_pairwise(t_visit_eosinophils, filter = TRUE,
parallel = parallel, model_batch = "svaseq",
methods = methods)##
## 3 2 1
## 9 9 8
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_visit_eosinophil_table <- combine_de_tables(
t_visit_eosinophil_de, keepers = visit_contrasts,
excel = glue("{xlsx_prefix}/DE_Visits/Eosinophils/t_eosinophil_visit_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Eosinophils/t_eosinophil_visit_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup
## 1 c2_vs_c1 0 0 0 0 0
## 2 c3_vs_c1 0 0 0 0 0
## 3 c3_vs_c2 0 0 0 0 0
## limma_sigdown
## 1 0
## 2 0
## 3 0
## Only has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
t_visit_eosinophil_sig <- extract_significant_genes(
t_visit_eosinophil_table,
excel = glue("{xlsx_prefix}/DE_Visits/Eosinophils/t_eosinophil_visit_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Eosinophils/t_eosinophil_visit_sig_sva-v202411.xlsx before writing the tables.
observed_v1_eosinophils <- c(
rownames(t_cf_eosinophil_v1_sig_sva[["deseq"]][["ups"]][["outcome"]]),
rownames(t_cf_eosinophil_v1_sig_sva[["deseq"]][["downs"]][["outcome"]]))
observed_v1_monocytes <- c(
rownames(t_cf_monocyte_v1_sig_sva[["deseq"]][["ups"]][["outcome"]]),
rownames(t_cf_monocyte_v1_sig_sva[["deseq"]][["downs"]][["outcome"]]))
observed_v1_neutrophils <- c(
rownames(t_cf_neutrophil_v1_sig_sva[["deseq"]][["ups"]][["outcome"]]),
rownames(t_cf_neutrophil_v1_sig_sva[["deseq"]][["downs"]][["outcome"]]))
venn_input <- list(
"eosinophil" = observed_v1_eosinophils,
"monocyte" = observed_v1_monocytes,
"neutrophils" = observed_v1_neutrophils)
shared <- Vennerable::Venn(venn_input)
shared## A Venn object on 3 sets named
## eosinophil,monocyte,neutrophils
## 000 100 010 110 001 101 011 111
## 0 30 63 2 12 0 1 0
Najib suggests that we should look at all cell types together at visit 1. Let us try and see what happens… Oh, I already did this in the block ‘Separate the Tumaco data by visit’ above.
Alejandro showed some ROC curves for eosinophil data showing sensitivity vs. specificity of a couple genes which were observed in v1 eosinophils vs. all-times eosinophils across cure/fail. I am curious to better understand how this was done and what utility it might have in other contexts.
To that end, I want to try something similar myself. In order to properly perform the analysis with these various tools, I need to reconfigure the data in a pretty specific format:
If I intend to use this for our tx data, I will likely need a utility function to create the properly formatted input df.
For the purposes of my playing, I will choose three genes from the eosinophil C/F table, one which is significant, one which is not, and an arbitrary.
The input genes will therefore be chosen from the data structure: t_cf_eosinophil_table_sva:
ENSG00000198178, ENSG00000179344, ENSG00000182628
## There appear to be 5355 genes without a length.
This paper is DOI:10.1126/scitranslmed.aax4204
Variable gene expression and parasite load predict treatment outcome in cutaneous leishmaniasis.
One query from Maria Adelaida is to see how this data fits with ours. I have read this paper a couple of times now and I get confused on a couple of points every time, which I will explain in a moment. The expermental design is key to my confusion and key to what I think is being missed in our interpretation of the results:
external_norm <- normalize_expt(external_cf, filter = TRUE, norm = "quant",
convert = "cpm", transform = "log2")## Removing 7327 low-count genes (14154 remaining).
## The result of performing a fast_svd dimension reduction.
## The x-axis is PC1 and the y-axis is PC2
## Colors are defined by cure, failure
## Shapes are defined by female, male.
external_nb <- normalize_expt(external_cf, filter = TRUE, batch = "svaseq",
convert = "cpm", transform = "log2")## Removing 7327 low-count genes (14154 remaining).
## Setting 171 low elements to zero.
## transform_counts: Found 171 values equal to 0, adding 1 to the matrix.
## The result of performing a fast_svd dimension reduction.
## The x-axis is PC1 and the y-axis is PC2
## Colors are defined by cure, failure
## Shapes are defined by female, male.
external_de <- all_pairwise(external_cf, filter = TRUE, methods = methods,
parallel = parallel, model_batch = "svaseq")##
## cure failure
## 14 7
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
## The logFC agreement among the methods follows:
## falr_vs_cr
## limma_vs_deseq 0.8487
## limma_vs_edger 0.8497
## limma_vs_basic 0.4180
## limma_vs_noiseq 0.3286
## deseq_vs_edger 0.9997
## deseq_vs_basic 0.3908
## deseq_vs_noiseq 0.3756
## edger_vs_basic 0.3914
## edger_vs_noiseq 0.3768
## basic_vs_noiseq 0.9338
## Deleting the file excel/scott_table.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown
## 1 failure_vs_cure 0 0 0 0
## limma_sigup limma_sigdown
## 1 0 0
## Only has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## Deleting the file excel/scott_sig.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down
## failure_vs_cure 0 0 0 0 0 0
## basic_up basic_down
## failure_vs_cure 0 0
I think I am getting a significantly different result from Scott, so I am going to do an explicit side-by-side comparison of our results at each step. In order to do this, I am using the capsule they kindly provided with their publication.
I am copy/pasting material from their publication with some modification which I will note as I go.
Here is their block ‘r packages’
Note/Spoiler alert: It actually turns out our results are basically relatively similar, I just didn’t understand what comparisons are actually in paper vs those I have primary interest. In addition, we handled gene IDs differently (gene card vs. EnsemblID) which has a surprisingly big effect.
Oh, I just realized that when I did these analyses, I did them in a completely separate tree and compared the results post-facto. This assumption remains in this document and therefore is unlikely to work properly in the containerized environment I am attempting to create. Given that the primary goal of this section is to show to myself that I compared the two datasets as thoroughly as I could, perhaps I should just disable them for the container and allow the reader to perform the exercise de-novo.
library(tidyverse)
library(ggthemes)
library(reshape2)
library(edgeR)
library(patchwork)
library(vegan)
library(DT)
library(tximport)
library(gplots)
library(FinCal)
library(ggrepel)
library(gt)
library(ggExtra)
library(EnsDb.Hsapiens.v86)
library(stringr)
library(cowplot)
library(ggpubr)I have a separate tree in which I copied the capsule and data. I performed exactly their steps kallisto quant steps within it and put the output data into the same place within it. I did change the commands slightly because I downloaded the files from SRA and so don’t have them with names like ‘host_CL01’, but instead ‘PRJNA…’. But the samples are in the same order, so I sent the output files to the same final filenames. Here is an example from the first sample:
cd preprocessing
module add kallisto
kallisto index -i Homo_sapiens.GRCh38.cdna.all.Index Homo_sapiens.GRCh38.cdna.all.fa
# Map reads to the indexed reference transcriptome for HOST
# first the healthy subjects (HS)
export LESS = '--buffers 0 -B'
kallisto quant -i Homo_sapiens.GRCh38.cdna.all.Index -o host_HS01 -t 24 -b 60 \
--single -l 250 -s 30 <(less SRR8668755/*-trimmed.fastq.xz) 2>host_HS01.log 1>&2 &I am going to change the path very slightly in the following block simply because I put the capsule in a separate directory and do not want to copy it here. Otherwise it is unmodified. Also, the function gt::tab_header() annoys the crap out of me.
import <- read_tsv("../scott_2019/capsule-6534016/data/studydesign.txt")
import %>% dplyr::filter(disease == "cutaneous") %>%
dplyr::select(-2) %>% gt() %>%
tab_header(title = md("Clinical metadata from patients with cutaneous leishmaniasis (CL)"),
subtitle = md("`(n=21)`")) %>% cols_align(align = "center", columns = TRUE)
targets.lesion <- import
targets.onlypatients <- targets.lesion[8:28,] # only CL lesions (n=21)
# Making factors that will be used for pairwise comparisons:
# HS vs. CL lesions as a factor:
disease.lesion <- factor(targets.lesion$disease)
# Cure vs. Failure lesions as a factor:
treatment.lesion <- factor(targets.onlypatients$treatment_outcome)They did use a slightly different annotation set, Ensembl revision 86. Once again I am modifying the paths slightly to reflect where I put the capsule.
# capturing Ensembl transcript IDs (tx) and gene symbols ("gene_name") from
# EnsDb.Hsapiens.v86 annotation package
Tx <- as.data.frame(transcripts(EnsDb.Hsapiens.v86,
columns=c(listColumns(EnsDb.Hsapiens.v86, "tx"),
"gene_name")))
Tx <- dplyr::rename(Tx, target_id = tx_id)
row.names(Tx) <- NULL
Tx <- Tx[,c(6,12)]
# getting file paths for Kallisto outputs
paths.all <- file.path("../scott_2019/capsule-6534016/data/readMapping/human", targets.lesion$sample, "abundance.h5")
paths.patients <- file.path("../scott_2019/capsule-6534016/data/readMapping/human", targets.onlypatients$sample, "abundance.h5")
# importing .h5 Kallisto data and collapsing transcript-level data to genes
Txi.lesion.coding <- tximport(paths.all,
type = "kallisto",
tx2gene = Tx,
txOut = FALSE,
ignoreTxVersion = TRUE,
countsFromAbundance = "lengthScaledTPM")
# importing againg, but this time just the CL patients
Txi.lesion.coding.onlypatients <- tximport(paths.patients,
type = "kallisto",
tx2gene = Tx,
txOut = FALSE,
ignoreTxVersion = TRUE,
countsFromAbundance = "lengthScaledTPM")The block ‘visualizationDatasets’ follows unchanged. In the next block I will add another plot or perhaps 2
# First make a DGEList from the counts:
Txi.lesion.coding.DGEList <- DGEList(Txi.lesion.coding$counts)
colnames(Txi.lesion.coding.DGEList$counts) <- targets.lesion$sample
colnames(Txi.lesion.coding$counts) <- targets.lesion$sample
Txi.lesion.coding.DGEList.OP <- DGEList(Txi.lesion.coding.onlypatients$counts)
colnames(Txi.lesion.coding.DGEList.OP) <- targets.onlypatients$sample
# Convert to counts per million:
Txi.lesion.coding.DGEList.cpm <- edgeR::cpm(Txi.lesion.coding.DGEList, log = TRUE)
Txi.lesion.coding.DGEList.OP.cpm <- edgeR::cpm(Txi.lesion.coding.DGEList.OP, log = TRUE)
keepers.coding <- rowSums(Txi.lesion.coding.DGEList.cpm>1)>=7
keepers.coding.OP <- rowSums(Txi.lesion.coding.DGEList.OP.cpm>1)>=7
Txi.lesion.coding.DGEList.filtered <- Txi.lesion.coding.DGEList[keepers.coding,]
Txi.lesion.coding.DGEList.OP.filtered <- Txi.lesion.coding.DGEList.OP[keepers.coding.OP,]
# convert back to cpm:
Txi.lesion.coding.DGEList.LogCPM.filtered <- edgeR::cpm(Txi.lesion.coding.DGEList.filtered,
log=TRUE)
Txi.lesion.coding.DGEList.LogCPM.OP.filtered <- edgeR::cpm(Txi.lesion.coding.DGEList.OP.filtered,
log=TRUE)
# Normalizing data:
calcNorm1 <- calcNormFactors(Txi.lesion.coding.DGEList.filtered, method = "TMM")
calcNorm2 <- calcNormFactors(Txi.lesion.coding.DGEList.OP.filtered, method = "TMM")
Txi.lesion.coding.DGEList.LogCPM.filtered.norm <- edgeR::cpm(calcNorm1, log=TRUE)
colnames(Txi.lesion.coding.DGEList.LogCPM.filtered.norm) <- targets.lesion$sample
Txi.lesion.coding.DGEList.OP.LogCPM.filtered.norm <- edgeR::cpm(calcNorm2, log=TRUE)
colnames(Txi.lesion.coding.DGEList.OP.LogCPM.filtered.norm) <- targets.onlypatients$sample
# Raw dataset:
V1 <- as.data.frame(Txi.lesion.coding.DGEList.cpm)
colnames(V1) <- targets.lesion$sample
V1 <- melt(V1)
colnames(V1) <- c("sample","expression")
# Filtered dataset:
V1.1 <- as.data.frame(Txi.lesion.coding.DGEList.LogCPM.filtered)
colnames(V1.1) <- targets.lesion$sample
V1.1 <- melt(V1.1)
colnames(V1.1) <- c("sample","expression")
# Filtered-normalized dataset:
V1.1.1 <- as.data.frame(Txi.lesion.coding.DGEList.LogCPM.filtered.norm)
colnames(V1.1.1) <- targets.lesion$sample
V1.1.1 <- melt(V1.1.1)
colnames(V1.1.1) <- c("sample","expression")
# plotting:
ggplot(V1, aes(x=sample, y=expression, fill=sample)) +
geom_violin(trim = TRUE, show.legend = TRUE) +
stat_summary(fun.y = "median", geom = "point", shape = 95, size = 10, color = "black") +
theme_bw() +
theme(legend.position = "none", axis.title=element_text(size=7),
axis.title.x=element_blank(), axis.text=element_text(size=5),
axis.text.x = element_text(angle = 90, hjust = 1),
plot.title = element_text(size = 7)) +
ggtitle("Raw dataset") +
ggplot(V1.1, aes(x=sample, y=expression, fill=sample)) +
geom_violin(trim = TRUE, show.legend = TRUE) +
stat_summary(fun.y = "median", geom = "point", shape = 95, size = 10, color = "black") +
theme_bw() +
theme(legend.position = "none", axis.title=element_text(size=7),
axis.title.x=element_blank(), axis.text=element_text(size=5),
axis.text.x = element_text(angle = 90, hjust = 1),
plot.title = element_text(size = 7)) +
ggtitle("Filtered dataset") +
ggplot(V1.1.1, aes(x=sample, y=expression, fill=sample)) +
geom_violin(trim = TRUE, show.legend = TRUE) +
stat_summary(fun.y = "median", geom = "point", shape = 95, size = 10, color = "black") +
theme_bw() +
theme(legend.position = "none", axis.title=element_text(size=7),
axis.title.x=element_blank(), axis.text=element_text(size=5),
axis.text.x = element_text(angle = 90, hjust = 1),
plot.title = element_text(size = 7)) +
ggtitle("Filtered and normalized dataset")The following block in their dataset recreated the matrix without filtering and will use that for differential expression. It is a little hard to follow for me because they subset based on the sample numbers (8 to 28, which if I am not mistaken just drops the healthy samples?).
DataNotFiltered_Norm_OP <- calcNormFactors(Txi.lesion.coding.DGEList[,8:28],
method = "TMM")
DataNotFiltered_Norm_log2CPM_OP <- edgeR::cpm(DataNotFiltered_Norm_OP, log=TRUE)
colnames(DataNotFiltered_Norm_log2CPM_OP) <- targets.onlypatients$sample
CPM_normData_notfiltered_OP <- 2^(DataNotFiltered_Norm_log2CPM_OP)
#uncomment the next line to produce raw data that was uploaded to the Gene Expression Omnibus (GEO) for publication.
#write.table(Txi.lesion.coding$counts, file = "Amorim_GEO_raw.txt", sep = "\t", quote = FALSE)
# Including all the individuals (HS and CL patients) for public domain submission:
DataNotFiltered_Norm <- calcNormFactors(Txi.lesion.coding.DGEList, method = "TMM")
DataNotFiltered_Norm_log2CPM <- edgeR::cpm(DataNotFiltered_Norm, log=TRUE)
colnames(DataNotFiltered_Norm_log2CPM) <- targets.lesion$sample
CPM_normData_notfiltered <- 2^(DataNotFiltered_Norm_log2CPM)
#uncomment the next line to produce the normalized data file that was uploaded to the Gene Expression Omnibus (GEO) for publication.
#write.table(DataNotFiltered_Norm_log2CPM, "Amorim_GEO_normalized.txt", sep = "\t", quote = FALSE)The following block generated a couple of the figures in the paper and comprise a pretty straightforward PCA. I am going to make a following block containing the same image with the cure/fail visualization using the same method/data.
pca.res <- prcomp(t(Txi.lesion.coding.DGEList.LogCPM.filtered.norm), scale.=F, retx=T)
pc.var <- pca.res$sdev^2
pc.per <- round(pc.var/sum(pc.var)*100, 1)
data.frame <- as.data.frame(pca.res$x)
# Calculate distance between samples by permanova:
allsamples.dist <- vegdist(t(2^Txi.lesion.coding.DGEList.LogCPM.filtered.norm),
method = "bray")
vegan <- adonis2(allsamples.dist~targets.lesion$disease,
data=targets.lesion,
permutations = 999, method="bray")
targets.lesion$disease
ggplot(data.frame, aes(x=PC1, y=PC2, color=factor(targets.lesion$disease))) +
geom_point(size=5, shape=20) +
theme_calc() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.text.x = element_text(size = 15, vjust = 0.5),
axis.text.y = element_text(size = 15), axis.title = element_text(size = 15),
legend.position="none") +
scale_color_manual(values = c("#073F80","#EB512C")) +
annotate("text", x=-50, y=80, label=paste("Permanova Pr(>F) =",
vegan[1,5]), size=3, fontface="bold") +
xlab(paste("PC1 -",pc.per[1],"%")) +
ylab(paste("PC2 -",pc.per[2],"%")) +
xlim(-200,110)I just realized that somewhere along the way in creating this container, I messed up this analysis pretty badly:
When I originally did this on my workstation I had an actual 1:1 comparison and saw that our results were quite similar. I need to bring that back into this in order to show that neither we nor they are crazy people.
Either way, I think the main takeaway is that their dataset does not spend much time looking at cure/fail but instead control/infected for a reason.
Note, the fun aspects of the experiment (time to cure, size of lesion, etc) are not annotated in the metadata provided by SRA, but instead may be found in the capsule kindly provided by the lab. As a result, I copied that file into the sample_sheets/ directory and have added it to the expressionset. There is an important caveat, though: I did not include the non-diseased samples for this comparison; as a result the disease metadata factor is boring (e.g. it is only cutaneous).
external_cf[["accession"]] <- pData(external_cf)[["sample"]]
disease_factor <- pData(external_cf)[["disease"]]
table(disease_factor)## disease_factor
## cutaneous
## 21
## The numbers of samples by condition are:
##
## cutaneous
## 21
## Removing 7327 low-count genes (14154 remaining).
## transform_counts: Found 165 values equal to 0, adding 1 to the matrix.
## The result of performing a fast_svd dimension reduction.
## The x-axis is PC1 and the y-axis is PC2
## Colors are defined by cure, failure
## Shapes are defined by female, male.
Use the following block if you wish to bring together SRA-downloaded data with the experimental design from the Scott paper. It requires running the blocks above in which I loaded the capsule-derived metadata.
test <- pData(external_cf)
test_import <- as.data.frame(import)
test_import[["accession"]] <- pData(external_cf[["accession"]])
test_merged <- merge(test, import, by = "accession")This is real comparison point to their cure/fail analysis.
I am just copy/pasting their code again, but changing the color factor so that cure is purple, failure is red, and na(uninfected) is black.
The following plot should be the first direct comparison point between the two analysis pipelines. Thus, if you look back a few block at my invocation of plot_pca(external_norm), you will see a green/orange plot which is functionally identical if you note:
With those caveats in mind, it is trivial to find the same relationshipes in the samples. E.g. the bottom red/purple individual samples are in the same relative position as my top orange/green pair. the same 4 samples are relative x-axis outliers (my right green, their left purple). The last 6 samples (my orange, their red) are all in the relative orientation.
I think I can further prove the similarity of our inputs via a direct comparison of the datastructures: Txi.lesion.coding.DGEList.LogCPM.filtered.norm (ugh what a name) vs. external_cf. In order to make that comparison, I need to rename my rows to the genecard IDs and the columns.
their_norm_exprs <- Txi.lesion.coding.DGEList.LogCPM.filtered.norm
my_hgnc_ids <- make.names(fData(external_cf)[["hgnc_symbol"]], unique = TRUE)
my_renamed <- set_expt_genenames(external_cf, ids = my_hgnc_ids)
my_norm <- normalize_expt(my_renamed, filter = TRUE, transform = "log2", convert = "cpm")
my_norm_exprs <- as.data.frame(exprs(my_norm))
our_exprs <- merge(their_norm_exprs, my_norm_exprs, by = "row.names")
rownames(our_exprs) <- our_exprs[["Row.names"]]
our_exprs[["Row.names"]] <- NULL
dim(our_exprs)
## I fully expected a correlation heatmap of the combined
## data to show a set of paired samples across the board.
## That is absolutely not true.
correlations <- plot_corheat(our_exprs)
correlations[["scatter"]]
correlations[["plot"]]color_fact <- factor(targets.lesion$treatment_outcome)
levels(color_fact)
## Added by atb to see cure/fail on the same dataset
ggplot(data.frame, aes(x=PC1, y=PC2, color=color_fact)) +
geom_point(size=5, shape=20) +
theme_calc() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.text.x = element_text(size = 15, vjust = 0.5),
axis.text.y = element_text(size = 15), axis.title = element_text(size = 15),
legend.position="none") +
scale_color_manual(values = c("purple", "red","black")) +
annotate("text", x=-50, y=80, label=paste("Permanova Pr(>F) =",
vegan[1,5]), size=3, fontface="bold") +
xlab(paste("PC1 -",pc.per[1],"%")) +
ylab(paste("PC2 -",pc.per[2],"%")) +
xlim(-200,110)The following is their comparison of healthy tissue vs. CL lesion and Failure vs. Cure. I am going to follow it with my analagous examination using limma. Note, each of the pairs of variables created in the following block is xxx followed by xxx.treat; the former is healthy vs lesion and the latter is the fail vs cure set.
# Model matrices:
# CL lesions vs. HS:
design.lesion <- model.matrix(~0 + disease.lesion)
colnames(design.lesion) <- levels(disease.lesion)
# Failure vs. Cure:
design.lesion.treatment <- model.matrix(~0 + treatment.lesion)
colnames(design.lesion.treatment) <- levels(treatment.lesion)
myDGEList.lesion.coding <- DGEList(calcNorm1$counts)
myDGEList.OP.NotFil <- DGEList(CPM_normData_notfiltered_OP)
# Model mean-variance trend and fit linear model to data.
# Use VOOM function from Limma package to model the mean-variance relationship
normData.lesion.coding <- voom(myDGEList.lesion.coding, design.lesion)
normData.OP.NotFil <- voom(myDGEList.OP.NotFil, design.lesion.treatment)
colnames(normData.lesion.coding) <- targets.lesion$sample
colnames(normData.OP.NotFil) <- targets.onlypatients$sample
# fit a linear model to your data
fit.lesion.coding <- lmFit(normData.lesion.coding, design.lesion)
fit.lesion.coding.treatment <- lmFit(normData.OP.NotFil, design.lesion.treatment)
# contrast matrix
contrast.matrix.lesion <- makeContrasts(CL.vs.CON = cutaneous - control,
levels=design.lesion)
contrast.matrix.lesion.treat <- makeContrasts(failure.vs.cure = failure - cure,
levels=design.lesion.treatment)
# extract the linear model fit
fits.lesion.coding <- contrasts.fit(fit.lesion.coding,
contrast.matrix.lesion)
fits.lesion.coding.treat <- contrasts.fit(fit.lesion.coding.treatment,
contrast.matrix.lesion.treat)
# get bayesian stats for your linear model fit
ebFit.lesion.coding <- eBayes(fits.lesion.coding)
ebFit.lesion.coding.treat <- eBayes(fits.lesion.coding.treat)
# TopTable ----
allHits.lesion.coding <- topTable(ebFit.lesion.coding,
adjust ="BH", coef=1,
number=34935, sort.by="logFC")
allHits.lesion.coding.treat <- topTable(ebFit.lesion.coding.treat,
adjust ="BH", coef=1,
number=34776, sort.by="logFC")
myTopHits <- rownames_to_column(allHits.lesion.coding, "geneID")
myTopHits.treat <- rownames_to_column(allHits.lesion.coding.treat, "geneID")
# mutate the format of numeric values:
myTopHits <- mutate(myTopHits, log10Pval = round(-log10(adj.P.Val),2),
adj.P.Val = round(adj.P.Val, 2),
B = round(B, 2),
AveExpr = round(AveExpr, 2),
t = round(t, 2),
logFC = round(logFC, 2),
geneID = geneID)
myTopHits.treat <- mutate(myTopHits.treat, log10Pval = round(-log10(adj.P.Val),2),
adj.P.Val = round(adj.P.Val, 2),
B = round(B, 2),
AveExpr = round(AveExpr, 2),
t = round(t, 2),
logFC = round(logFC, 2),
geneID = geneID)
#save(myTopHits, file = "myTopHits")
#save(myTopHits.treat, file = "myTopHits.treat")my_filt <- normalize_expt(my_renamed, filter = "simple")
limma_cf <- limma_pairwise(my_filt, model_batch = FALSE)
my_table <- limma_cf[["all_tables"]][["failure_vs_cure"]]
their_table <- myTopHits.treat
dim(my_table)
dim(myTopHits.treat)
our_table <- merge(my_table, myTopHits.treat, by.x = "row.names", by.y = "geneID")
dim(our_table)
comparison <- plot_linear_scatter(our_table[, c("logFC.x", "logFC.y")])
comparison$scatter
comparison$correlation
comparison$lm_modelOk, so there is a constituitive difference in our results, and it is significant. What does that mean for the set of genes observed?
With that said, in my most recent manual run of this, the results are quite good, I got a 0.75 correlation; I bet the primary outliers (on the axes) are just genes for which we got different gene<->tx mappings due to me using hisat and their usage of kallisto.
I guess I can test this hypothesis by just swapping in their counts into my data structure.
test_counts <- as.data.frame(myDGEList.lesion.coding[["counts"]])
test_counts[["host_HS01"]] <- NULL
test_counts[["host_HS02"]] <- NULL
test_counts[["host_HS03"]] <- NULL
test_counts[["host_HS04"]] <- NULL
test_counts[["host_HS05"]] <- NULL
test_counts[["host_HS06"]] <- NULL
test_counts[["host_HS07"]] <- NULL
dim(test_counts)
dim(exprs(my_test))
## Oh, that surprises me, the kallisto data has ~ 6k fewer genes?Let us look at the top/bottom 100 genes of these two datasets and see if they have any similarities.
Note to self, set up s4 dispatch on compare_de_tables!
compared <- compare_de_tables(only_tmrc3_table, external_table, first_table = 1, second_table = 1)
compared$scatter##
## Pearson's product-moment correlation
##
## data: df[[xcol]] and df[[ycol]]
## t = 14, df = 13240, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1033 0.1369
## sample estimates:
## cor
## 0.1201
I assume this request came out of the review process, but I am not quite sure where to put it. If I understand it correctly, the goal is to look across visits for combinations of cure and fail (not fail/cure, but v2/v1) and across cell types.
Thus, in order to do this, I will need to combine those three parameters or set up a more complex model to handle this.
## The numbers of samples by condition are:
##
## eosinophils_1_cure eosinophils_1_failure eosinophils_2_cure
## 5 3 6
## eosinophils_2_failure eosinophils_3_cure eosinophils_3_failure
## 3 6 3
## monocytes_1_cure monocytes_1_failure monocytes_2_cure
## 8 8 7
## monocytes_2_failure monocytes_3_cure monocytes_3_failure
## 6 6 7
## neutrophils_1_cure neutrophils_1_failure neutrophils_2_cure
## 8 8 7
## neutrophils_2_failure neutrophils_3_cure neutrophils_3_failure
## 6 5 7
t_cellvisitcf_de <- all_pairwise(t_cellvisitcf, keepers = visittype_contrasts,
model_batch = "svaseq", filter = TRUE, parallel = parallel,
methods = methods)##
## eosinophils_1_cure eosinophils_1_failure eosinophils_2_cure
## 5 3 6
## eosinophils_2_failure eosinophils_3_cure eosinophils_3_failure
## 3 6 3
## monocytes_1_cure monocytes_1_failure monocytes_2_cure
## 8 8 7
## monocytes_2_failure monocytes_3_cure monocytes_3_failure
## 6 6 7
## neutrophils_1_cure neutrophils_1_failure neutrophils_2_cure
## 8 8 7
## neutrophils_2_failure neutrophils_3_cure neutrophils_3_failure
## 6 5 7
## A pairwise differential expression with results from: basic, deseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 10 comparisons.
t_cellvisitcf_mono_table <- combine_de_tables(
t_cellvisitcf_de, keepers = visittype_contrasts_mono,
excel = glue("{xlsx_prefix}/DE_Visits/Cure_Fail/monocyte_visit_cf_combined_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Cure_Fail/monocyte_visit_cf_combined_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown
## 1 monocytes_2_cure_vs_monocytes_1_cure 0 2
## 2 monocytes_2_failure_vs_monocytes_1_failure 2 2
## 3 monocytes_3_cure_vs_monocytes_1_cure 1 3
## 4 monocytes_3_failure_vs_monocytes_1_failure 1 3
## edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 0 0 0 0
## 2 1 1 1 0
## 3 0 0 0 0
## 4 0 0 0 0
## Plot describing unique/shared genes in a differential expression table.
t_cellvisitcf_mono_sig <- extract_significant_genes(
t_cellvisitcf_mono_table,
excel = glue("{xlsx_prefix}/DE_Visits/Cure_Fail/monocyte_visit_cf_combined_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Cure_Fail/monocyte_visit_cf_combined_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down
## v2v1_mono_cure 0 0 0 0 0 2
## v2v1_mono_failure 1 0 1 1 2 2
## v3v1_mono_cure 0 0 0 0 1 3
## v3v1_mono_failure 0 0 0 0 1 3
## basic_up basic_down
## v2v1_mono_cure 0 0
## v2v1_mono_failure 0 0
## v3v1_mono_cure 0 0
## v3v1_mono_failure 0 0
t_cellvisitcf_neut_table <- combine_de_tables(
t_cellvisitcf_de, keepers = visittype_contrasts_ne,
excel = glue("{xlsx_prefix}/DE_Visits/Cure_Fail/neutrophil_visit_cf_combined_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Cure_Fail/neutrophil_visit_cf_combined_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown
## 1 neutrophils_2_cure_vs_neutrophils_1_cure 85 132
## 2 neutrophils_2_failure_vs_neutrophils_1_failure 127 150
## 3 neutrophils_3_cure_vs_neutrophils_1_cure 105 195
## 4 neutrophils_3_failure_vs_neutrophils_1_failure 87 24
## edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 75 118 90 32
## 2 116 175 105 42
## 3 110 157 114 39
## 4 77 20 56 36
## Plot describing unique/shared genes in a differential expression table.
t_cellvisitcf_neut_sig <- extract_significant_genes(
t_cellvisitcf_neut_table,
excel = glue("{xlsx_prefix}/DE_Visits/Cure_Fail/neutrophil_visit_cf_combined_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Cure_Fail/neutrophil_visit_cf_combined_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down
## v2v1_ne_cure 90 32 75 118 85 132
## v2v1_ne_failure 105 42 116 175 127 150
## v3v1_ne_cure 114 39 110 157 105 195
## v3v1_ne_failure 56 36 77 20 87 24
## basic_up basic_down
## v2v1_ne_cure 2 0
## v2v1_ne_failure 4 0
## v3v1_ne_cure 0 0
## v3v1_ne_failure 0 0
t_cellvisitcf_eo_table <- combine_de_tables(
t_cellvisitcf_de, keepers = visittype_contrasts_eo,
excel = glue("{xlsx_prefix}/DE_Visits/Cure_Fail/eosinophil_visit_cf_combined_table_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Cure_Fail/eosinophil_visit_cf_combined_table_sva-v202411.xlsx before writing the tables.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown
## 1 eosinophils_2_cure_vs_eosinophils_1_cure 5 1
## 2 eosinophils_2_failure_vs_eosinophils_1_failure 1 5
## 3 eosinophils_3_cure_vs_eosinophils_1_cure 9 1
## 4 eosinophils_3_failure_vs_eosinophils_1_failure 0 8
## edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 0 0 0 0
## 2 0 0 0 0
## 3 0 0 0 1
## 4 0 0 0 0
## Plot describing unique/shared genes in a differential expression table.
t_cellvisitcf_eo_sig <- extract_significant_genes(
t_cellvisitcf_eo_table,
excel = glue("{xlsx_prefix}/DE_Visits/Cure_Fail/eosinophil_visit_cf_combined_sig_sva-v{ver}.xlsx"))## Deleting the file analyses/4_tumaco/DE_Visits/Cure_Fail/eosinophil_visit_cf_combined_sig_sva-v202411.xlsx before writing the tables.
## A set of genes deemed significant according to limma, edger, deseq, basic.
## The parameters defining significant were:
## LFC cutoff: 1 adj P cutoff: 0.05
## limma_up limma_down edger_up edger_down deseq_up deseq_down
## v2v1_eo_cure 0 0 0 0 5 1
## v2v1_eo_failure 0 0 0 0 1 5
## v3v1_eo_cure 0 1 0 0 9 1
## v3v1_eo_failure 0 0 0 0 0 8
## basic_up basic_down
## v2v1_eo_cure 0 0
## v2v1_eo_failure 0 0
## v3v1_eo_cure 0 0
## v3v1_eo_failure 0 0