2.4 Primary queries
There is a series of initial questions which make some sense to me, but these do not necessarily match the set of questions which are most pressing. I am hoping to pull both of these sets of queries in one.
Before extracting these groups of queries, let us invoke the all_pairwise() function and get all of the likely contrasts along with one or more extras that might prove useful (the ‘extra’ argument).
The structure of these blocks will all basically be identical:
- Perform a set of pairwise contrasts of all the conditions against each other. Optionally use sva.
- Given that result, dump it in its entirety to an xlsx file in the analyses/ directory.
- Given those combined tables, extract from them the set deemed ‘significant’ by whatever criteria we want to try. (Usually |lfc| >= 1.0, adjusted p <= 0.05; but potentially also expression >= x and sometimes a set of less stringent values (|lfc| >= 0.6))
- Given one or more gene sets deemed ‘significant’ pass them to gProfiler2 and see what pops out.
2.4.1 Combined U937 and Macrophages: Compare drug effects
When we have the u937 cells in the same dataset as the macrophages, that provides an interesting opportunity to see if we can observe drug-dependant effects which are shared across both cell types.
Note to self: given the changes to hpgltools I may need to specify the statistical model string when I am using svaseq for some/many/all of these comparisons.
## antimony none
## 34 34
## Macrophages U937
## 54 14
## Warning: attributes are not identical across measure variables; they will be
## dropped
## Running normalize_se.
## Removing 9198 low-count genes (12283 remaining).
## Error in h(simpleError(msg, call)) :
## error in evaluating the argument 'x' in selecting a method for function 'colData': object 'se' not found
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## Warning in createContrastL(objFlt$formula, objFlt$data, L): Contrasts with only
## a single non-zero term are already evaluated by default.
## conditions
## antimony none
## 34 34
## conditions
## antimony none
## 34 34
## A pairwise differential expression with results from: basic, deseq, ebseq, edger, limma.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 1 comparisons.
## The logFC agreement among the methods follows:
## nn_vs_ntmn
## deseq_vs_dream 0.9787
## deseq_vs_ebseq 0.9153
## deseq_vs_edger 0.9990
## deseq_vs_limma 0.9733
## dream_vs_ebseq 0.9534
## dream_vs_edger 0.9806
## dream_vs_limma 0.9956
## ebseq_vs_edger 0.9179
## ebseq_vs_limma 0.9504
## edger_vs_limma 0.9752
drug_table <- combine_de_tables(
drug_de, keepers = tmrc2_drug_keepers,
excel = glue("analyses/macrophage_de/de_tables/macrophage_drug_comparison-v{ver}.xlsx"))## This function is intended to write xlsx files.
## It was passed an object of type DFrame and does not know what to do with it.
## Error in .setupMethodsTables(fdef, initialize = TRUE): no slot of name "group" for this object of class "derivedDefaultMethod"
## Error: object 'drug_table' not found
#combined_to_tsv(drug_table, celltype = "all")
drug_sig <- extract_significant_genes(
drug_table,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_drug_sig-v{ver}.xlsx"))## Error: object 'drug_table' not found
## Error: object 'drug_sig' not found
drug_highsig <- extract_significant_genes(
drug_table, min_mean_exprs = high_expression, exprs_column = high_expression_column,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_drug_highsig-v{ver}.xlsx"))## Error: object 'drug_table' not found
## Error: object 'drug_highsig' not found
drug_lesssig <- extract_significant_genes(
drug_table, lfc = 0.6,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_drug_lesssig-v{ver}.xlsx"))## Error: object 'drug_table' not found
## Error: object 'drug_lesssig' not found
2.4.1.1 gProfiler2 results of the significant drug genes
## Error: object 'drug_sig' not found
## Error: object 'all_drug_gp' not found
## Error: object 'all_drug_gp' not found
## Error: object 'drug_lesssig' not found
## Error: object 'all_drug_lesssig' not found
2.4.2 Combined U937 and Macrophages: compare cell types
There are a couple of ways one might want to directly compare the two cell types.
- Given that the variance between the two celltypes is so huge, just compare all samples.
- One might want to compare them with the interaction effects of drug/zymodeme.
## Macrophages U937
## 54 14
## antimony none
## 34 34
## Running normalize_se.
## Removing 9198 low-count genes (12283 remaining).
## Error in h(simpleError(msg, call)) :
## error in evaluating the argument 'x' in selecting a method for function 'colData': object 'se' not found
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## Warning in createContrastL(objFlt$formula, objFlt$data, L): Contrasts with only
## a single non-zero term are already evaluated by default.
## conditions
## Macrophages U937
## 54 14
## conditions
## Macrophages U937
## 54 14
## A pairwise differential expression with results from: basic, deseq, ebseq, edger, limma.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 1 comparisons.
## The logFC agreement among the methods follows:
## U937_vs_Mc
## deseq_vs_dream 0.9911
## deseq_vs_ebseq 0.9795
## deseq_vs_edger 0.9958
## deseq_vs_limma 0.9825
## dream_vs_ebseq 0.9697
## dream_vs_edger 0.9933
## dream_vs_limma 0.9934
## ebseq_vs_edger 0.9844
## ebseq_vs_limma 0.9521
## edger_vs_limma 0.9847
type_table <- combine_de_tables(
type_de, keepers = tmrc2_type_keepers,
excel = glue("analyses/macrophage_de/de_tables/macrophage_type_comparison-v{ver}.xlsx"))## This function is intended to write xlsx files.
## It was passed an object of type DFrame and does not know what to do with it.
## Error in .setupMethodsTables(fdef, initialize = TRUE): no slot of name "group" for this object of class "derivedDefaultMethod"
## Error: object 'type_table' not found
#combined_to_tsv(type_table, celltype = "all")
type_sig <- extract_significant_genes(
type_table,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_sig-v{ver}.xlsx"))## Error: object 'type_table' not found
## Error: object 'type_sig' not found
type_highsig <- extract_significant_genes(
type_table, min_mean_exprs = high_expression, exprs_column = high_expression_column,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_highsig-v{ver}.xlsx"))## Error: object 'type_table' not found
## Error: object 'type_highsig' not found
type_lesssig <- extract_significant_genes(
type_table, lfc = 0.6,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_lesssig-v{ver}.xlsx"))## Error: object 'type_table' not found
## Error: object 'type_sig' not found
2.4.2.1 Combined factors of interest: celltype+zymodeme
Given the above explicit comparison of all samples comprising the two cell types, now let us look at the drug treatment+zymodeme status with all samples, macrophages and U937.
type_zymo_de <- all_pairwise(type_zymo, filter = TRUE, model_svs = "svaseq",
do_noiseq = FALSE,
extra_contrasts = type_zymo_extra)## Macrophages_none Macrophages_z22 Macrophages_z23 U937_none
## 8 23 23 2
## U937_z22 U937_z23
## 6 6
## antimony none
## 34 34
## Running normalize_se.
## Removing 9198 low-count genes (12283 remaining).
## Error in h(simpleError(msg, call)) :
## error in evaluating the argument 'x' in selecting a method for function 'colData': object 'se' not found
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## The contrast zymos is not in the results.
## If this is not an extra contrast, then this is an error.
## Warning in createContrastL(objFlt$formula, objFlt$data, L): Contrasts with only
## a single non-zero term are already evaluated by default.
## conditions
## Macrophages_none Macrophages_z22 Macrophages_z23 U937_none
## 8 23 23 2
## U937_z22 U937_z23
## 6 6
## conditions
## Macrophages_none Macrophages_z22 Macrophages_z23 U937_none
## 8 23 23 2
## U937_z22 U937_z23
## 6 6
## A pairwise differential expression with results from: basic, deseq, ebseq, edger, limma.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 15 comparisons.
type_zymo_table <- combine_de_tables(
type_zymo_de, keepers = tmrc2_typezymo_keepers,
excel = glue("analyses/macrophage_de/de_tables/macrophage_type_zymo_comparison-v{ver}.xlsx"))## coefficient limma did not find NA or zymos_vs_types.
## coefficient edger did not find conditionNA or conditionzymos_vs_types.
## coefficient limma did not find NA or zymos_vs_types.
## This function is intended to write xlsx files.
## It was passed an object of type DFrame and does not know what to do with it.
## Error in .setupMethodsTables(fdef, initialize = TRUE): no slot of name "group" for this object of class "derivedDefaultMethod"
#combined_to_tsv(type_zymo_table, celltype = "all")
type_zymo_sig <- extract_significant_genes(
type_zymo_table,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_zymo_sig-v{ver}.xlsx"))## Error: object 'type_zymo_table' not found
## Error: object 'type_zymo_sig' not found
type_zymo_highsig <- extract_significant_genes(
type_zymo_table, min_mean_exprs = high_expression, exprs_column = high_expression_column,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_zymo_highsig-v{ver}.xlsx"))## Error: object 'type_zymo_table' not found
type_zymo_lesssig <- extract_significant_genes(
type_zymo_table, lfc = 0.6,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_zymo_lesssig-v{ver}.xlsx"))## Error: object 'type_zymo_table' not found
## Error: object 'type_zymo_lesssig' not found
2.4.2.2 Combined factors of interest: celltype+drug
The ‘type_drug’ datastructure is the same as above, but the condition is created from the concatenation of the cell type and drug treatment.
type_drug_de <- all_pairwise(type_drug, filter = TRUE, model_svs = "svaseq",
model_fstring = "~ 0 + condition")## Macrophages_antimony Macrophages_none U937_antimony
## 27 27 7
## U937_none
## 7
## Running normalize_se.
## Removing 9198 low-count genes (12283 remaining).
## Error in h(simpleError(msg, call)) :
## error in evaluating the argument 'x' in selecting a method for function 'colData': object 'se' not found
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## Warning in createContrastL(objFlt$formula, objFlt$data, L): Contrasts with only
## a single non-zero term are already evaluated by default.
## conditions
## Macrophages_antimony Macrophages_none U937_antimony
## 27 27 7
## U937_none
## 7
## conditions
## Macrophages_antimony Macrophages_none U937_antimony
## 27 27 7
## U937_none
## 7
## conditions
## Macrophages_antimony Macrophages_none U937_antimony
## 27 27 7
## U937_none
## 7
## A pairwise differential expression with results from: basic, deseq, ebseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: svaseq.
## The primary analysis performed 6 comparisons.
type_drug_table <- combine_de_tables(
type_drug_de, keepers = tmrc2_typedrug_keepers,
excel = glue("analyses/macrophage_de/de_tables/macrophage_type_drug_comparison-v{ver}.xlsx"))## This function is intended to write xlsx files.
## It was passed an object of type DFrame and does not know what to do with it.
## Error in .setupMethodsTables(fdef, initialize = TRUE): no slot of name "group" for this object of class "derivedDefaultMethod"
## Error: object 'type_drug_table' not found
#combined_to_tsv(type_drug_table, celltype = "all")
type_drug_sig <- extract_significant_genes(
type_drug_table,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_drug_sig-v{ver}.xlsx"))## Error: object 'type_drug_table' not found
## Error: object 'type_drug_sig' not found
type_drug_highsig <- extract_significant_genes(
type_drug_table, min_mean_exprs = high_expression, exprs_column = high_expression_column,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_drug_highsig-v{ver}.xlsx"))## Error: object 'type_drug_table' not found
## Error: object 'type_drug_highsig' not found
type_drug_lesssig <- extract_significant_genes(
type_drug_table, lfc = 0.6,
excel = glue("analyses/macrophage_de/sig_tables/macrophage_type_drug_lesssig-v{ver}.xlsx"))## Error: object 'type_drug_table' not found
## Error: object 'type_drug_lesssig' not found