In my previous installment (preprocessing.Rmd), I spun up some jobs on the cluster to examine these samples. In this document I will spend some time looking at them.
Half of the samples are GAS 5448 and half are NZ131. I have only so far mapped all samples against 5448, I will do NZ131 today.
## Returning a df with 14 columns and 1821 rows.
rownames(gas5448_gff) <- make.names(gas5448_gff[["locus_tag"]], unique = TRUE)
## Rekey to old_locus_tag here!
undef_idx <- is.na(gas5448_gff[["old_locus_tag"]])
new_locus_tags <- gas5448_gff[undef_idx, "locus_tag"]
gas5448_gff[["hybrid_tag"]] <- gas5448_gff[["old_locus_tag"]]
gas5448_gff[undef_idx, "hybrid_tag"] <- new_locus_tags
## Now I have a column named hybrid containing the old tag when available and new when not.
hybrid_ids <- gas5448_gff[["hybrid_tag"]]
nz131_microbes <- load_microbesonline_annotations(species = "Streptococcus pyogenes NZ131")## Found 1 entry.
## Streptococcus pyogenes NZ131, Firmicutes, yes, 2009-04-21, yes, 1, 0, 1791, 471876
## The microbesonline tsv has already been downloaded to reference/microbesonline_471876.tsv.
nz131_annot <- as.data.frame(nz131_microbes)
rownames(nz131_annot) <- make.names(nz131_annot[["sysName"]], unique = TRUE)
gas5005_microbes <- load_microbesonline_annotations(species = "MGAS5005")## Found 1 entry.
## Streptococcus pyogenes MGAS5005, Firmicutes, yes, 2005-08-25, yes, 1, 0, 1950, 293653
## The microbesonline tsv has already been downloaded to reference/microbesonline_293653.tsv.
s5005_annot <- as.data.frame(gas5005_microbes)
rownames(s5005_annot) <- make.names(s5005_annot[["sysName"]], unique = TRUE)
gas5005_go <- load_microbesonline_go(species = "MGAS5005", id_column = "sysName")## Found 1 entry.
## Streptococcus pyogenes MGAS5005, Firmicutes, yes, 2005-08-25, yes, 1, 0, 1950, 293653
## The species being downloaded is: Streptococcus pyogenes MGAS5005 and is being downloaded as 293653.tab.
## Found 1 entry.
## Streptococcus pyogenes NZ131, Firmicutes, yes, 2009-04-21, yes, 1, 0, 1791, 471876
## The species being downloaded is: Streptococcus pyogenes NZ131 and is being downloaded as 471876.tab.
The various mapping etc tools finished last night, let us collect the numbers from them here. The defaults should work well for pretty much everything, so I think I need fill in only the starting sample sheet.
sample_sheet <- gather_preprocessing_metadata("sample_sheets/all_samples.xlsx",
tag = "*locus_tag",
species = c("spyogenes_5448_v1", "spyogenes_nz131", "spyogenes_5005"))## Did not find the condition column in the sample sheet.
## Filling it in as undefined.
## Did not find the batch column in the sample sheet.
## Filling it in as undefined.
## Checking the state of the condition column.
## Checking the state of the batch column.
## Checking the condition factor.
## Writing new metadata to: sample_sheets/all_samples_modified.xlsx
## Deleting the file sample_sheets/all_samples_modified.xlsx before writing the tables.
## [1] "sampleid" "sampleidah"
## [3] "samplename" "read1fastqfile"
## [5] "read2fastqfile" "strain"
## [7] "media" "supplement"
## [9] "time" "replicate"
## [11] "condition" "batch"
## [13] "sampleid_backup" "trimomatic_input"
## [15] "trimomatic_output" "trimomatic_percent"
## [17] "fastqc_pct_gc" "kraken_bacterial_classified"
## [19] "kraken_bacterial_unclassified" "kraken_first_bacterial_species"
## [21] "kraken_first_bacterial_species_reads" "kraken_matrix_bacterial"
## [23] "hisat_genome_input_reads_spyogenes_5448_v1" "hisat_genome_input_reads_spyogenes_nz131"
## [25] "hisat_genome_input_reads_spyogenes_5005" "hisat_genome_single_concordant_spyogenes_5448_v1"
## [27] "hisat_genome_single_concordant_spyogenes_nz131" "hisat_genome_single_concordant_spyogenes_5005"
## [29] "hisat_genome_multi_concordant_spyogenes_5448_v1" "hisat_genome_multi_concordant_spyogenes_nz131"
## [31] "hisat_genome_multi_concordant_spyogenes_5005" "hisat_genome_single_all_spyogenes_5448_v1"
## [33] "hisat_genome_single_all_spyogenes_nz131" "hisat_genome_single_all_spyogenes_5005"
## [35] "hisat_genome_multi_all_spyogenes_5448_v1" "hisat_genome_multi_all_spyogenes_nz131"
## [37] "hisat_genome_multi_all_spyogenes_5005" "hisat_unmapped_spyogenes_5448_v1"
## [39] "hisat_unmapped_spyogenes_nz131" "hisat_unmapped_spyogenes_5005"
## [41] "hisat_genome_percent_log_spyogenes_5448_v1" "hisat_genome_percent_log_spyogenes_nz131"
## [43] "hisat_genome_percent_log_spyogenes_5005" "hisat_alignment_spyogenes_5448_v1"
## [45] "hisat_alignment_spyogenes_nz131" "hisat_alignment_spyogenes_5005"
## [47] "input_r1" "input_r2"
## [49] "hisat_count_table_spyogenes_5448_v1" "hisat_count_table_spyogenes_nz131"
## [51] "hisat_count_table_spyogenes_5005"
s5448_se <- create_se(sample_sheet[["new_meta"]],
file_column = "hisat_count_table_spyogenes_5448_v1",
gene_info = gas5448_gff) |>
subset_se(subset = "read1fastqfile!='Undetermined_S0_R1_001.fastq.gz'")## Reading the sample metadata.
## Checking the state of the condition column.
## Checking the state of the batch column.
## Checking the condition factor.
## The sample definitions comprises: 81 rows(samples) and 51 columns(metadata fields).
## Matched 1821 annotations and counts.
## Some annotations were lost in merging, setting them to 'undefined'.
## Saving the summarized experiment to 'se.rda'.
## The final summarized experiment has 1821 rows and 51 columns.
current_ids <- rowData(s5448_se)[, c("old_locus_tag", "hybrid_tag")]
new_ids <- current_ids[["hybrid_tag"]]
s5448_test <- set_genenames(s5448_se, new_ids)
rowData(s5448_test)[new_locus_tags, ]## DataFrame with 65 rows and 15 columns
## seqnames start end width strand source type
## <character> <integer> <integer> <integer> <character> <character> <character>
## SP5448_RS09810 NZ_CP008776 9529 9654 126 + EMBL/GenBank/SwissProt gene
## SP5448_RS09680 NZ_CP008776 80890 81729 840 + EMBL/GenBank/SwissProt gene
## SP5448_RS09815 NZ_CP008776 118729 118913 185 - EMBL/GenBank/SwissProt gene
## SP5448_RS09165 NZ_CP008776 149293 149460 168 - EMBL/GenBank/SwissProt gene
## SP5448_RS09685 NZ_CP008776 172549 172704 156 - EMBL/GenBank/SwissProt gene
## ... ... ... ... ... ... ... ...
## SP5448_RS09800 NZ_CP008776 1766607 1766938 332 - EMBL/GenBank/SwissProt gene
## SP5448_RS09935 NZ_CP008776 1776518 1776742 225 - EMBL/GenBank/SwissProt gene
## SP5448_RS08865 NZ_CP008776 1777786 1778697 912 + EMBL/GenBank/SwissProt gene
## SP5448_RS08870 NZ_CP008776 1778697 1779527 831 + EMBL/GenBank/SwissProt gene
## SP5448_RS09675 NZ_CP008776 1780602 1780883 282 - EMBL/GenBank/SwissProt gene
## score phase gene locus_tag old_locus_tag gene_synonym pseudo
## <character> <integer> <character> <character> <character> <character> <character>
## SP5448_RS09810 undefined 1 undefined SP5448_RS09810 undefined undefined undefined
## SP5448_RS09680 undefined 1 ispE SP5448_RS09680 undefined undefined _no_value
## SP5448_RS09815 undefined 1 undefined SP5448_RS09815 undefined undefined _no_value
## SP5448_RS09165 undefined 1 undefined SP5448_RS09165 undefined undefined undefined
## SP5448_RS09685 undefined 1 undefined SP5448_RS09685 undefined undefined _no_value
## ... ... ... ... ... ... ... ...
## SP5448_RS09800 undefined 1 undefined SP5448_RS09800 undefined undefined _no_value
## SP5448_RS09935 undefined 1 undefined SP5448_RS09935 undefined undefined _no_value
## SP5448_RS08865 undefined 1 undefined SP5448_RS08865 undefined undefined _no_value
## SP5448_RS08870 undefined 1 undefined SP5448_RS08870 undefined undefined _no_value
## SP5448_RS09675 undefined 1 undefined SP5448_RS09675 undefined undefined undefined
## hybrid_tag
## <character>
## SP5448_RS09810 SP5448_RS09810
## SP5448_RS09680 SP5448_RS09680
## SP5448_RS09815 SP5448_RS09815
## SP5448_RS09165 SP5448_RS09165
## SP5448_RS09685 SP5448_RS09685
## ... ...
## SP5448_RS09800 SP5448_RS09800
## SP5448_RS09935 SP5448_RS09935
## SP5448_RS08865 SP5448_RS08865
## SP5448_RS08870 SP5448_RS08870
## SP5448_RS09675 SP5448_RS09675
## Check that we got some of the hybrid locus tags as the new rownames of the data.
"SP5448_RS09345" %in% rownames(assay(s5448_se))## [1] TRUE
## DataFrame with 65 rows and 15 columns
## seqnames start end width strand source type
## <character> <integer> <integer> <integer> <character> <character> <character>
## SP5448_RS09810 NZ_CP008776 9529 9654 126 + EMBL/GenBank/SwissProt gene
## SP5448_RS09680 NZ_CP008776 80890 81729 840 + EMBL/GenBank/SwissProt gene
## SP5448_RS09815 NZ_CP008776 118729 118913 185 - EMBL/GenBank/SwissProt gene
## SP5448_RS09165 NZ_CP008776 149293 149460 168 - EMBL/GenBank/SwissProt gene
## SP5448_RS09685 NZ_CP008776 172549 172704 156 - EMBL/GenBank/SwissProt gene
## ... ... ... ... ... ... ... ...
## SP5448_RS09800 NZ_CP008776 1766607 1766938 332 - EMBL/GenBank/SwissProt gene
## SP5448_RS09935 NZ_CP008776 1776518 1776742 225 - EMBL/GenBank/SwissProt gene
## SP5448_RS08865 NZ_CP008776 1777786 1778697 912 + EMBL/GenBank/SwissProt gene
## SP5448_RS08870 NZ_CP008776 1778697 1779527 831 + EMBL/GenBank/SwissProt gene
## SP5448_RS09675 NZ_CP008776 1780602 1780883 282 - EMBL/GenBank/SwissProt gene
## score phase gene locus_tag old_locus_tag gene_synonym pseudo
## <character> <integer> <character> <character> <character> <character> <character>
## SP5448_RS09810 undefined 1 undefined SP5448_RS09810 undefined undefined undefined
## SP5448_RS09680 undefined 1 ispE SP5448_RS09680 undefined undefined _no_value
## SP5448_RS09815 undefined 1 undefined SP5448_RS09815 undefined undefined _no_value
## SP5448_RS09165 undefined 1 undefined SP5448_RS09165 undefined undefined undefined
## SP5448_RS09685 undefined 1 undefined SP5448_RS09685 undefined undefined _no_value
## ... ... ... ... ... ... ... ...
## SP5448_RS09800 undefined 1 undefined SP5448_RS09800 undefined undefined _no_value
## SP5448_RS09935 undefined 1 undefined SP5448_RS09935 undefined undefined _no_value
## SP5448_RS08865 undefined 1 undefined SP5448_RS08865 undefined undefined _no_value
## SP5448_RS08870 undefined 1 undefined SP5448_RS08870 undefined undefined _no_value
## SP5448_RS09675 undefined 1 undefined SP5448_RS09675 undefined undefined undefined
## hybrid_tag
## <character>
## SP5448_RS09810 SP5448_RS09810
## SP5448_RS09680 SP5448_RS09680
## SP5448_RS09815 SP5448_RS09815
## SP5448_RS09165 SP5448_RS09165
## SP5448_RS09685 SP5448_RS09685
## ... ...
## SP5448_RS09800 SP5448_RS09800
## SP5448_RS09935 SP5448_RS09935
## SP5448_RS08865 SP5448_RS08865
## SP5448_RS08870 SP5448_RS08870
## SP5448_RS09675 SP5448_RS09675
all_combined_factor <- paste0(colData(s5448_se)[["strain"]], "_",
colData(s5448_se)[["media"]], "_",
colData(s5448_se)[["supplement"]], "_",
colData(s5448_se)[["time"]])
colData(s5448_se)[["combined"]] <- all_combined_factor
s5448_se <- set_conditions(s5448_se, all_combined_factor) |>
set_batches("replicate")## The numbers of samples by condition are:
##
## nz131_C_DMSO_t120m nz131_C_DMSO_t90m nz131_C_Heme_t120m nz131_C_Heme_t90m
## 4 4 4 4
## nz131_RPMI_DMSO_t120m nz131_RPMI_DMSO_t90m nz131_RPMI_Heme_t120m nz131_RPMI_Heme_t90m
## 4 4 4 4
## s5448_C_DMSO_t120m s5448_C_DMSO_t90m s5448_C_Heme_t120m s5448_C_Heme_t90m
## 4 4 4 4
## s5448_RPMI_DMSO_t120m s5448_RPMI_DMSO_t90m s5448_RPMI_Heme_t120m s5448_RPMI_Heme_t90m
## 4 4 4 4
## s5448AP_C_DMSO_t120m s5448AP_C_DMSO_t90m s5448AP_C_Heme_t120m s5448AP_C_Heme_t90m
## 4 4 4 4
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 20 20 20 20
combined_strain_supplement_media <- paste0(colData(s5448_se)[["strain"]], "_",
colData(s5448_se)[["media"]], "_",
colData(s5448_se)[["supplement"]])
colData(s5448_se)[["str_sup_med"]] <- combined_strain_supplement_media
combined_strain_supplement <- paste0(colData(s5448_se)[["strain"]], "_",
colData(s5448_se)[["supplement"]])
colData(s5448_se)[["str_sup"]] <- combined_strain_supplement
combined_media_supplement <- paste0(colData(s5448_se)[["media"]], "_",
colData(s5448_se)[["supplement"]])
colData(s5448_se)[["med_sup"]] <- combined_media_supplement
combined_strain_media <- paste0(colData(s5448_se)[["strain"]], "_",
colData(s5448_se)[["media"]])
colData(s5448_se)[["str_med"]] <- combined_strain_media
notime_factor <- paste0(colData(s5448_se)[["strain"]], "_",
colData(s5448_se)[["media"]], "_",
colData(s5448_se)[["supplement"]])
colData(s5448_se)[["notime"]] <- notime_factor
s5448_se <- set_conditions(s5448_se, notime_factor) %>%
set_batches("strain")## The numbers of samples by condition are:
##
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 8 8 8 8 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## nz131 s5448 s5448AP
## 32 32 16
## Warning: attributes are not identical across measure variables; they will be dropped
## Warning: The `size` argument of `element_rect()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## ℹ The deprecated feature was likely used in the ggsankey package.
## Please report the issue at <https://github.com/davidsjoberg/ggsankey/issues>.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
## A sankey plot describing the metadata of 80 samples,
## including 38 out of 0 nodes and traversing metadata factors:
## strain, media, supplement, time.
nz131_se <- create_se(sample_sheet[["new_meta"]],
file_column = "hisat_count_table_spyogenes_nz131",
gene_info = nz131_annot) |>
subset_se(subset = "read1fastqfile!='Undetermined_S0_R1_001.fastq.gz'")## Reading the sample metadata.
## Checking the state of the condition column.
## Checking the state of the batch column.
## Checking the condition factor.
## The sample definitions comprises: 81 rows(samples) and 51 columns(metadata fields).
## Matched 1788 annotations and counts.
## Some annotations were lost in merging, setting them to 'undefined'.
## Saving the summarized experiment to 'se.rda'.
## The final summarized experiment has 1788 rows and 51 columns.
all_combined_factor <- paste0(colData(nz131_se)[["strain"]], "_",
colData(nz131_se)[["media"]], "_",
colData(nz131_se)[["supplement"]], "_",
colData(nz131_se)[["time"]])
colData(nz131_se)[["combined"]] <- all_combined_factor
nz131_se <- set_conditions(nz131_se, all_combined_factor) |>
set_batches("replicate")## The numbers of samples by condition are:
##
## nz131_C_DMSO_t120m nz131_C_DMSO_t90m nz131_C_Heme_t120m nz131_C_Heme_t90m
## 4 4 4 4
## nz131_RPMI_DMSO_t120m nz131_RPMI_DMSO_t90m nz131_RPMI_Heme_t120m nz131_RPMI_Heme_t90m
## 4 4 4 4
## s5448_C_DMSO_t120m s5448_C_DMSO_t90m s5448_C_Heme_t120m s5448_C_Heme_t90m
## 4 4 4 4
## s5448_RPMI_DMSO_t120m s5448_RPMI_DMSO_t90m s5448_RPMI_Heme_t120m s5448_RPMI_Heme_t90m
## 4 4 4 4
## s5448AP_C_DMSO_t120m s5448AP_C_DMSO_t90m s5448AP_C_Heme_t120m s5448AP_C_Heme_t90m
## 4 4 4 4
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 20 20 20 20
combined_strain_supplement_media <- paste0(colData(nz131_se)[["strain"]], "_",
colData(nz131_se)[["media"]], "_",
colData(nz131_se)[["supplement"]])
colData(nz131_se)[["str_sup_med"]] <- combined_strain_supplement_media
combined_strain_supplement <- paste0(colData(nz131_se)[["strain"]], "_",
colData(nz131_se)[["supplement"]])
colData(nz131_se)[["str_sup"]] <- combined_strain_supplement
combined_media_supplement <- paste0(colData(nz131_se)[["media"]], "_",
colData(nz131_se)[["supplement"]])
colData(nz131_se)[["med_sup"]] <- combined_media_supplement
combined_strain_media <- paste0(colData(nz131_se)[["strain"]], "_",
colData(nz131_se)[["media"]])
colData(nz131_se)[["str_med"]] <- combined_strain_media
notime_factor <- paste0(colData(nz131_se)[["strain"]], "_",
colData(nz131_se)[["media"]], "_",
colData(nz131_se)[["supplement"]])
colData(nz131_se)[["notime"]] <- notime_factor
nz131_se <- set_conditions(nz131_se, notime_factor) |>
set_batches("strain")## The numbers of samples by condition are:
##
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 8 8 8 8 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## nz131 s5448 s5448AP
## 32 32 16
## Warning: attributes are not identical across measure variables; they will be dropped
## A sankey plot describing the metadata of 80 samples,
## including 38 out of 0 nodes and traversing metadata factors:
## strain, media, supplement, time.
s5005_se <- create_se(sample_sheet[["new_meta"]],
file_column = "hisat_count_table_spyogenes_5005",
gene_info = s5005_annot) |>
subset_se(subset = "read1fastqfile!='Undetermined_S0_R1_001.fastq.gz'")## Reading the sample metadata.
## Checking the state of the condition column.
## Checking the state of the batch column.
## Checking the condition factor.
## The sample definitions comprises: 81 rows(samples) and 51 columns(metadata fields).
## Matched 1926 annotations and counts.
## Some annotations were lost in merging, setting them to 'undefined'.
## Saving the summarized experiment to 'se.rda'.
## The final summarized experiment has 1926 rows and 51 columns.
all_combined_factor <- paste0(colData(s5005_se)[["strain"]], "_",
colData(s5005_se)[["media"]], "_",
colData(s5005_se)[["supplement"]], "_",
colData(s5005_se)[["time"]])
colData(s5005_se)[["combined"]] <- all_combined_factor
s5005_se <- set_conditions(s5005_se, all_combined_factor) %>%
set_batches("replicate")## The numbers of samples by condition are:
##
## nz131_C_DMSO_t120m nz131_C_DMSO_t90m nz131_C_Heme_t120m nz131_C_Heme_t90m
## 4 4 4 4
## nz131_RPMI_DMSO_t120m nz131_RPMI_DMSO_t90m nz131_RPMI_Heme_t120m nz131_RPMI_Heme_t90m
## 4 4 4 4
## s5448_C_DMSO_t120m s5448_C_DMSO_t90m s5448_C_Heme_t120m s5448_C_Heme_t90m
## 4 4 4 4
## s5448_RPMI_DMSO_t120m s5448_RPMI_DMSO_t90m s5448_RPMI_Heme_t120m s5448_RPMI_Heme_t90m
## 4 4 4 4
## s5448AP_C_DMSO_t120m s5448AP_C_DMSO_t90m s5448AP_C_Heme_t120m s5448AP_C_Heme_t90m
## 4 4 4 4
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 20 20 20 20
combined_strain_supplement_media <- paste0(colData(s5005_se)[["strain"]], "_",
colData(s5005_se)[["media"]], "_",
colData(s5005_se)[["supplement"]])
colData(s5005_se)[["str_sup_med"]] <- combined_strain_supplement_media
combined_strain_supplement <- paste0(colData(s5005_se)[["strain"]], "_",
colData(s5005_se)[["supplement"]])
colData(s5005_se)[["str_sup"]] <- combined_strain_supplement
combined_media_supplement <- paste0(colData(s5005_se)[["media"]], "_",
colData(s5005_se)[["supplement"]])
colData(s5005_se)[["med_sup"]] <- combined_media_supplement
combined_strain_media <- paste0(colData(s5005_se)[["strain"]], "_",
colData(s5005_se)[["media"]])
colData(s5005_se)[["str_med"]] <- combined_strain_media
notime_factor <- paste0(colData(s5005_se)[["strain"]], "_",
colData(s5005_se)[["media"]], "_",
colData(s5005_se)[["supplement"]])
colData(s5005_se)[["notime"]] <- notime_factor
s5005_se <- set_conditions(s5005_se, notime_factor) %>%
set_batches("strain")## The numbers of samples by condition are:
##
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 8 8 8 8 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## nz131 s5448 s5448AP
## 32 32 16
## Warning: attributes are not identical across measure variables; they will be dropped
## A sankey plot describing the metadata of 80 samples,
## including 38 out of 0 nodes and traversing metadata factors:
## strain, media, supplement, time.
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## The colors used in the expressionset are: #1B9E77, #666666, #749829, #97722D, #9B58A5, #A16864, #AE6D1C, #BBA90B, #C9930D, #D8367D.
## Library sizes of 80 samples,
## ranging from 6,404,095 to 14,677,058.
## Scale for colour is already present.
## Adding another scale for colour, which will replace the existing scale.
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## ℹ The deprecated feature was likely used in the hpgltools package.
## Please report the issue to the authors.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
## A non-zero genes plot of 80 samples.
## These samples have an average 9.99 CPM coverage and 1720 genes observed, ranging from 1603 to
## 1788.
## Library sizes of 80 samples,
## ranging from 2,750,171 to 6,761,550.
## Scale for colour is already present.
## Adding another scale for colour, which will replace the existing scale.
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.
## A non-zero genes plot of 80 samples.
## These samples have an average 4.455 CPM coverage and 1756 genes observed, ranging from 1629 to
## 1832.
all_norm <- normalize_se(s5448_se, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 78 low-count genes (1743 remaining).
## transform_counts: Found 66 values equal to 0, adding 1 to the matrix.
## When the standard median metric was plotted, the values observed range
## from 0.620222557208161 to 1 with quartiles at 0.829081601486688 and 0.857840773958452.
## A heatmap of pairwise sample distances ranging from:
## 7.21728178266138 to 109.040180364468.
## A heatmap of pairwise sample correlations ranging from:
## 0.620222557208161 to 0.998335182704652.
## The result of performing a fast_svd dimension reduction.
## The x-axis is PC1 and the y-axis is PC2
## Colors are defined by nz131_C_DMSO, nz131_C_Heme, nz131_RPMI_DMSO, nz131_RPMI_Heme, s5448_C_DMSO, s5448_C_Heme, s5448_RPMI_DMSO, s5448_RPMI_Heme, s5448AP_C_DMSO, s5448AP_C_Heme
## Shapes are defined by nz131, s5448, s5448AP.
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
all_norm <- normalize_se(s5005_se, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 147 low-count genes (1779 remaining).
## transform_counts: Found 149 values equal to 0, adding 1 to the matrix.
## When the standard median metric was plotted, the values observed range
## from 0.635239149672034 to 1 with quartiles at 0.837362595172608 and 0.86447623539625.
## A heatmap of pairwise sample distances ranging from:
## 9.33785378750048 to 111.414435894631.
## A heatmap of pairwise sample correlations ranging from:
## 0.635239149672034 to 0.99743582963528.
## The result of performing a fast_svd dimension reduction.
## The x-axis is PC1 and the y-axis is PC2
## Colors are defined by nz131_C_DMSO, nz131_C_Heme, nz131_RPMI_DMSO, nz131_RPMI_Heme, s5448_C_DMSO, s5448_C_Heme, s5448_RPMI_DMSO, s5448_RPMI_Heme, s5448AP_C_DMSO, s5448AP_C_Heme
## Shapes are defined by nz131, s5448, s5448AP.
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
I think some samples may warrant removal: KMSL60, KMSL67, KMSL18
exclude_ids <- c("KMSL60", "KMSL67", "KMSL18")
exclude_idx <- ! sampleNames(all_norm) %in% exclude_ids
exclude_samples <- sampleNames(all_norm)[exclude_idx]
s5448_se <- subset_se(s5448_se, ids = exclude_samples)
s5005_se <- subset_se(s5005_se, ids = exclude_samples)
nz131_se <- subset_se(nz131_se, ids = exclude_samples)Strange, I am going to assume the nz131/5448 split is the problem?
nz131_idx <- colData(s5448_se)[["strain"]] == "nz131"
nz131_se <- s5448_se[, nz131_idx]
nz_ids <- colnames(assay(s5448_se))[nz131_idx]
nz131_se <- subset_se(s5448_se, ids = nz_ids)
s5448_idx <- colData(s5448_se)[["strain"]] == "s5448"
s5448_only <- s5448_se[, s5448_idx]
s5005_only <- s5005_se[, s5448_idx]
nz131_norm <- normalize_se(nz131_se, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 129 low-count genes (1692 remaining).
## transform_counts: Found 3 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 nz131_C_DMSO, nz131_C_Heme, nz131_RPMI_DMSO, nz131_RPMI_Heme
## Shapes are defined by nz131.
s5448_norm <- normalize_se(s5448_se, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 34 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 nz131_C_DMSO, nz131_C_Heme, nz131_RPMI_DMSO, nz131_RPMI_Heme, s5448_C_DMSO, s5448_C_Heme, s5448_RPMI_DMSO, s5448_RPMI_Heme, s5448AP_C_DMSO, s5448AP_C_Heme
## Shapes are defined by nz131, s5448, s5448AP.
s5005_norm <- normalize_se(s5005_se, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 150 low-count genes (1776 remaining).
## transform_counts: Found 156 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 nz131_C_DMSO, nz131_C_Heme, nz131_RPMI_DMSO, nz131_RPMI_Heme, s5448_C_DMSO, s5448_C_Heme, s5448_RPMI_DMSO, s5448_RPMI_Heme, s5448AP_C_DMSO, s5448AP_C_Heme
## Shapes are defined by nz131, s5448, s5448AP.
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
## Warning in MASS::cov.trob(data[, vars], wt = weight * nrow(data)): Probable convergence failure
Note, variance partition requires a somewhat more strict filter than I use for many other tasks. Given the peculiarity of what I am seeing, I might choose to use this stricter dataset.
## The model of ~ strain + time + supplement + media has 6 levels and rank 6
##
filt_se <- vp[["modified_input"]]
vp_5005 <- simple_varpart(s5005_se, fstring = "~ strain + time + supplement + media")## The model of ~ strain + time + supplement + media has 6 levels and rank 6
##
Variance partition says that media is the winner, let us look at that first. I am guessing that the other factors will not provide interesting plots unless we go nuts and use sva.
## The numbers of samples by condition are:
##
## C RPMI
## 46 31
## Setting colors with no pre-defined colors, using the Dark2 palette.
media_norm <- normalize_se(media_se, filter = TRUE, convert = "cpm",
norm = "quant", transform = "log2")## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 34 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 C, RPMI
## Shapes are defined by nz131, s5448, s5448AP.
media_nb <- normalize_se(media_se, filter = TRUE, convert = "cpm",
batch = "svaseq", transform = "log2")## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 324 values less than 0.
## transform_counts: Found 324 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 C, RPMI
## Shapes are defined by nz131, s5448, s5448AP.
## The numbers of samples by condition are:
##
## DMSO Heme
## 38 39
## Setting colors with no pre-defined colors, using the Dark2 palette.
supplement_norm <- normalize_se(supplement_se, filter = TRUE, convert = "cpm",
norm = "quant", transform = "log2")## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 34 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 DMSO, Heme
## Shapes are defined by nz131, s5448, s5448AP.
supplement_nb <- normalize_se(supplement_se, filter = TRUE, convert = "cpm",
batch = "svaseq", transform = "log2")## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 126 values less than 0.
## transform_counts: Found 126 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 DMSO, Heme
## Shapes are defined by nz131, s5448, s5448AP.
Time is the big loser in this.
## The numbers of samples by condition are:
##
## t120m t90m
## 37 40
## Setting colors with no pre-defined colors, using the Dark2 palette.
time_norm <- normalize_se(time_se, filter = TRUE, convert = "cpm",
norm = "quant", transform = "log2")## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 34 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 t120m, t90m
## Shapes are defined by nz131, s5448, s5448AP.
time_nb <- normalize_se(time_se, filter = TRUE, convert = "cpm",
batch = "svaseq", transform = "log2")## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 116 values less than 0.
## transform_counts: Found 116 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 t120m, t90m
## Shapes are defined by nz131, s5448, s5448AP.
## The numbers of samples by condition are:
##
## C_DMSO C_Heme RPMI_DMSO RPMI_Heme
## 23 23 15 16
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## nz131 s5448 s5448AP
## 30 31 16
med_sup_norm <- normalize(med_sup_se, filter = TRUE, convert = "cpm",
norm = "quant", transform = "log2")## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 34 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 C_DMSO, C_Heme, RPMI_DMSO, RPMI_Heme
## Shapes are defined by nz131, s5448, s5448AP.
med_sup_nb <- normalize(med_sup_se, filter = TRUE, convert = "cpm",
batch = "svaseq", transform = "log2")## Removing 83 low-count genes (1738 remaining).
## transform_counts: Found 314 values less than 0.
## transform_counts: Found 314 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 C_DMSO, C_Heme, RPMI_DMSO, RPMI_Heme
## Shapes are defined by nz131, s5448, s5448AP.
Thinking… let us first just lump all samples together and see what happens?
all_supplement_keepers <- list(
"heme_vs_dmso" = c("Heme", "DMSO"))
## This adds replicate to the model because model_batch defaults to TRUE
all_supplement_de <- all_pairwise(supplement_se)## DMSO Heme
## 38 39
## nz131 s5448 s5448AP
## 30 31 16
## Basic step 0/3: Filtering data.
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 7698 entries to zero.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## DMSO Heme
## 38 39
## conditions
## DMSO Heme
## 38 39
## conditions
## DMSO Heme
## 38 39
all_supplement_table <- combine_de_tables(
all_supplement_de,
keepers = all_supplement_keepers,
excel = glue("excel/heme_vs_dmso_all_conditions_batch_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
all_supplement_sig <- extract_significant_genes(
all_supplement_table,
excel = glue("excel/heme_vs_dmso_all_conditions_batch_sig-v{ver}.xlsx"))
all_supplement_sva_de <- all_pairwise(supplement_se, model_batch = "svaseq", filter = TRUE)## DMSO Heme
## 38 39
## nz131 s5448 s5448AP
## 30 31 16
## Removing 83 low-count genes (1738 remaining).
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 7698 entries to zero.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## DMSO Heme
## 38 39
## conditions
## DMSO Heme
## 38 39
## conditions
## DMSO Heme
## 38 39
all_supplement_sva_table <- combine_de_tables(
all_supplement_sva_de,
keepers = all_supplement_keepers,
excel = glue("excel/heme_vs_dmso_all_conditions_sva_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
all_supplement_sva_sig <- extract_significant_genes(
all_supplement_sva_table,
excel = glue("excel/heme_vs_dmso_all_conditions_sva_sig-v{ver}.xlsx"))TODO
## Error:
## ! object 'set_se' not found
media_strain_keepers <- list(
"Heme_vs_DMSO_inC" = c("CHeme", "CDMSO"),
"Heme_vs_DMSO_inR" = c("RPMIHeme", "RPMIDMSO"))
filt_se <- set_batches(filt_se, fact = "replicate")## The number of samples by batch are:
##
## r1 r2 r3 r4
## 20 19 19 19
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## r1 r2 r3 r4
## 20 19 19 19
## Basic step 0/3: Filtering data.
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 7698 entries to zero.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## A pairwise differential expression with results from: basic, deseq, ebseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: Existing surrogate matrix.
## The primary analysis performed 45 comparisons.
exc_table <- combine_de_tables(
exc_de, keepers = strain_supplement_keepers,
excel = glue("excel/gas_heme_vs_dmso_batch-v{ver}.xlsx"))## Error in `h()`:
## ! error in evaluating the argument 'keepers' in selecting a method for function 'extract_keepers': object 'strain_supplement_keepers' not found
## Error:
## ! object 'exc_table' not found
exc_sig <- extract_significant_genes(
exc_table,
excel = glue("excel/gas_heme_vs_dmso_batch_sig-v{ver}.xlsx"))## Error:
## ! object 'exc_table' not found
## Error:
## ! object 'exc_sig' not found
strain_supplement_keepers <- list(
"AP_C_HD" = c("s5448APCHeme", "s5448APCDMSO"),
"NZ_C_HD" = c("nz131CHeme", "nz131CDMSO"),
"G5448_C_HD" = c("s5448CHeme", "s5448CDMSO"),
"NZ_R_HD" = c("nz131RPMIHeme", "nz131RPMIDMSO"),
"G5448_R_HD" = c("s5448RPMIHeme", "s5448RPMIDMSO"))
filt_se <- set_batches(filt_se, fact = "replicate")## The number of samples by batch are:
##
## r1 r2 r3 r4
## 20 19 19 19
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## r1 r2 r3 r4
## 20 19 19 19
## Basic step 0/3: Filtering data.
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 7698 entries to zero.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## A pairwise differential expression with results from: basic, deseq, ebseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: Existing surrogate matrix.
## The primary analysis performed 45 comparisons.
exc_table <- combine_de_tables(
exc_de, keepers = strain_supplement_keepers,
excel = glue("excel/gas_heme_vs_dmso_batch-v{ver}.xlsx"))## The keepers has no elements in the coefficients.
## Here are the keepers: s5448APCHeme, s5448APCDMSO, nz131CHeme, nz131CDMSO, s5448CHeme, s5448CDMSO, nz131RPMIHeme, nz131RPMIDMSO, s5448RPMIHeme, s5448RPMIDMSO
## Here are the coefficients: s5448AP_C_Heme, s5448AP_C_DMSO, s5448AP_C_Heme, s5448_RPMI_Heme, s5448AP_C_DMSO, s5448_RPMI_Heme, s5448AP_C_Heme, s5448_RPMI_DMSO, s5448AP_C_DMSO, s5448_RPMI_DMSO, s5448_RPMI_Heme, s5448_RPMI_DMSO, s5448AP_C_Heme, s5448_C_Heme, s5448AP_C_DMSO, s5448_C_Heme, s5448_RPMI_Heme, s5448_C_Heme, s5448_RPMI_DMSO, s5448_C_Heme, s5448AP_C_Heme, s5448_C_DMSO, s5448AP_C_DMSO, s5448_C_DMSO, s5448_RPMI_Heme, s5448_C_DMSO, s5448_RPMI_DMSO, s5448_C_DMSO, s5448_C_Heme, s5448_C_DMSO, s5448AP_C_Heme, nz131_RPMI_Heme, s5448AP_C_DMSO, nz131_RPMI_Heme, s5448_RPMI_Heme, nz131_RPMI_Heme, s5448_RPMI_DMSO, nz131_RPMI_Heme, s5448_C_Heme, nz131_RPMI_Heme, s5448_C_DMSO, nz131_RPMI_Heme, s5448AP_C_Heme, nz131_RPMI_DMSO, s5448AP_C_DMSO, nz131_RPMI_DMSO, s5448_RPMI_Heme, nz131_RPMI_DMSO, s5448_RPMI_DMSO, nz131_RPMI_DMSO, s5448_C_Heme, nz131_RPMI_DMSO, s5448_C_DMSO, nz131_RPMI_DMSO, nz131_RPMI_Heme, nz131_RPMI_DMSO, s5448AP_C_Heme, nz131_C_Heme, s5448AP_C_DMSO, nz131_C_Heme, s5448_RPMI_Heme, nz131_C_Heme, s5448_RPMI_DMSO, nz131_C_Heme, s5448_C_Heme, nz131_C_Heme, s5448_C_DMSO, nz131_C_Heme, nz131_RPMI_Heme, nz131_C_Heme, nz131_RPMI_DMSO, nz131_C_Heme, s5448AP_C_Heme, nz131_C_DMSO, s5448AP_C_DMSO, nz131_C_DMSO, s5448_RPMI_Heme, nz131_C_DMSO, s5448_RPMI_DMSO, nz131_C_DMSO, s5448_C_Heme, nz131_C_DMSO, s5448_C_DMSO, nz131_C_DMSO, nz131_RPMI_Heme, nz131_C_DMSO, nz131_RPMI_DMSO, nz131_C_DMSO, nz131_C_Heme, nz131_C_DMSO
## Error in `extract_keepers()`:
## ! Unable to find the set of contrasts to keep, fix this and try again.
## Error:
## ! object 'exc_table' not found
exc_sig <- extract_significant_genes(
exc_table,
excel = glue("excel/gas_heme_vs_dmso_batch_sig-v{ver}.xlsx"))## Error:
## ! object 'exc_table' not found
## Error:
## ! object 'exc_sig' not found
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 20 19 19 19
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## r1 r2 r3 r4
## 20 19 19 19
## Basic step 0/3: Filtering data.
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 8561 entries to zero.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## conditions
## nz131_C_DMSO nz131_C_Heme nz131_RPMI_DMSO nz131_RPMI_Heme s5448_C_DMSO s5448_C_Heme
## 8 7 7 8 7 8
## s5448_RPMI_DMSO s5448_RPMI_Heme s5448AP_C_DMSO s5448AP_C_Heme
## 8 8 8 8
## A pairwise differential expression with results from: basic, deseq, ebseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: Existing surrogate matrix.
## The primary analysis performed 45 comparisons.
s5005_exc_table <- combine_de_tables(
s5005_exc_de, keepers = strain_supplement_keepers,
excel = glue("excel/s5005_gas_heme_vs_dmso_batch-v{ver}.xlsx"))## The keepers has no elements in the coefficients.
## Here are the keepers: s5448APCHeme, s5448APCDMSO, nz131CHeme, nz131CDMSO, s5448CHeme, s5448CDMSO, nz131RPMIHeme, nz131RPMIDMSO, s5448RPMIHeme, s5448RPMIDMSO
## Here are the coefficients: s5448AP_C_Heme, s5448AP_C_DMSO, s5448AP_C_Heme, s5448_RPMI_Heme, s5448AP_C_DMSO, s5448_RPMI_Heme, s5448AP_C_Heme, s5448_RPMI_DMSO, s5448AP_C_DMSO, s5448_RPMI_DMSO, s5448_RPMI_Heme, s5448_RPMI_DMSO, s5448AP_C_Heme, s5448_C_Heme, s5448AP_C_DMSO, s5448_C_Heme, s5448_RPMI_Heme, s5448_C_Heme, s5448_RPMI_DMSO, s5448_C_Heme, s5448AP_C_Heme, s5448_C_DMSO, s5448AP_C_DMSO, s5448_C_DMSO, s5448_RPMI_Heme, s5448_C_DMSO, s5448_RPMI_DMSO, s5448_C_DMSO, s5448_C_Heme, s5448_C_DMSO, s5448AP_C_Heme, nz131_RPMI_Heme, s5448AP_C_DMSO, nz131_RPMI_Heme, s5448_RPMI_Heme, nz131_RPMI_Heme, s5448_RPMI_DMSO, nz131_RPMI_Heme, s5448_C_Heme, nz131_RPMI_Heme, s5448_C_DMSO, nz131_RPMI_Heme, s5448AP_C_Heme, nz131_RPMI_DMSO, s5448AP_C_DMSO, nz131_RPMI_DMSO, s5448_RPMI_Heme, nz131_RPMI_DMSO, s5448_RPMI_DMSO, nz131_RPMI_DMSO, s5448_C_Heme, nz131_RPMI_DMSO, s5448_C_DMSO, nz131_RPMI_DMSO, nz131_RPMI_Heme, nz131_RPMI_DMSO, s5448AP_C_Heme, nz131_C_Heme, s5448AP_C_DMSO, nz131_C_Heme, s5448_RPMI_Heme, nz131_C_Heme, s5448_RPMI_DMSO, nz131_C_Heme, s5448_C_Heme, nz131_C_Heme, s5448_C_DMSO, nz131_C_Heme, nz131_RPMI_Heme, nz131_C_Heme, nz131_RPMI_DMSO, nz131_C_Heme, s5448AP_C_Heme, nz131_C_DMSO, s5448AP_C_DMSO, nz131_C_DMSO, s5448_RPMI_Heme, nz131_C_DMSO, s5448_RPMI_DMSO, nz131_C_DMSO, s5448_C_Heme, nz131_C_DMSO, s5448_C_DMSO, nz131_C_DMSO, nz131_RPMI_Heme, nz131_C_DMSO, nz131_RPMI_DMSO, nz131_C_DMSO, nz131_C_Heme, nz131_C_DMSO
## Error in `extract_keepers()`:
## ! Unable to find the set of contrasts to keep, fix this and try again.
## Error:
## ! object 's5005_exc_table' not found
s5005_exc_sig <- extract_significant_genes(
s5005_exc_table,
excel = glue("excel/s5005_gas_heme_vs_dmso_batch_sig-v{ver}.xlsx"))## Error:
## ! object 's5005_exc_table' not found
## Error:
## ! object 's5005_exc_sig' not found
Spencer dropped by and asked if we could revisit this dataset in order to compare the heme and dmso samples from each timepoint. I have all of our previous analyses working; but it will take me a minute to see what to do for this query. If I understood correctly, I should compare the two supplements for the t120m and t90m separately.
One additional piece of logic, perhaps restrict this to the samples which are in C media.
t120m_supplement_5005_se <- subset_se(s5005_se, subset = "time=='t120m'") |>
subset_se(subset = "media=='C'") |>
set_conditions(fact = "supplement") |>
set_batches(fact = "replicate")## The numbers of samples by condition are:
##
## DMSO Heme
## 11 11
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 6 5 6 5
t90m_supplement_5005_se <- subset_se(s5005_se, subset = "time=='t90m'") |>
subset_se(subset = "media=='C'") |>
set_conditions(fact = "supplement") |>
set_batches(fact = "replicate")## The numbers of samples by condition are:
##
## DMSO Heme
## 12 12
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 6 6 6 6
t120m_supplement_5005_de <- all_pairwise(t120m_supplement_5005_se, model_svs = "svaseq", filter = TRUE)## DMSO Heme
## 11 11
## r1 r2 r3 r4
## 6 5 6 5
## Removing 193 low-count genes (1733 remaining).
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 1739 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## DMSO Heme
## 11 11
## conditions
## DMSO Heme
## 11 11
## conditions
## DMSO Heme
## 11 11
t120m_supplement_5005_table <- combine_de_tables(t120m_supplement_5005_de, excel = glue("excel/t120m_supplement_s5005_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
t90m_supplement_5005_de <- all_pairwise(t90m_supplement_5005_se, model_svs = "svaseq", filter = TRUE)## DMSO Heme
## 12 12
## r1 r2 r3 r4
## 6 6 6 6
## Removing 193 low-count genes (1733 remaining).
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 1109 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## DMSO Heme
## 12 12
## conditions
## DMSO Heme
## 12 12
## conditions
## DMSO Heme
## 12 12
t90m_supplement_5005_table <- combine_de_tables(t90m_supplement_5005_de, excel = glue("excel/t90m_supplement_s5005_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
t120m_supplement_5448_se <- subset_se(s5448_se, subset = "time=='t120m'") |>
subset_se(subset = "media=='C'") |>
subset_se(subset = "strain=='s5448'") |>
set_conditions(fact = "supplement") |>
set_batches(fact = "replicate")## The numbers of samples by condition are:
##
## DMSO Heme
## 3 4
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 2 1 2 2
t90m_supplement_5448_se <- subset_se(s5448_se, subset = "time=='t90m'") |>
subset_se(subset = "media=='C'") |>
subset_se(subset = "strain=='s5448'") |>
set_conditions(fact = "supplement") |>
set_batches(fact = "replicate")## The numbers of samples by condition are:
##
## DMSO Heme
## 4 4
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 2 2 2 2
t120m_supplement_5448_de <- all_pairwise(t120m_supplement_5448_se, model_svs = "svaseq", filter = TRUE)## DMSO Heme
## 3 4
## r1 r2 r3 r4
## 2 1 2 2
## Removing 143 low-count genes (1678 remaining).
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 55 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## the design formula contains one or more numeric variables with integer values,
## specifying a model with increasing fold change for higher values.
## did you mean for this to be a factor? if so, first convert
## this variable to a factor using the factor() function
## the design formula contains one or more numeric variables with integer values,
## specifying a model with increasing fold change for higher values.
## did you mean for this to be a factor? if so, first convert
## this variable to a factor using the factor() function
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## DMSO Heme
## 3 4
## conditions
## DMSO Heme
## 3 4
## Warning: Zero sample variances detected, have been offset away from zero
## Warning: Zero sample variances detected, have been offset away from zero
## conditions
## DMSO Heme
## 3 4
t120m_supplement_5448_table <- combine_de_tables(t120m_supplement_5448_de, excel = glue("excel/t120m_supplement_s5448_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
t90m_supplement_5448_de <- all_pairwise(t90m_supplement_5448_se, model_svs = "svaseq", filter = TRUE)## DMSO Heme
## 4 4
## r1 r2 r3 r4
## 2 2 2 2
## Removing 147 low-count genes (1674 remaining).
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 87 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## DMSO Heme
## 4 4
## conditions
## DMSO Heme
## 4 4
## conditions
## DMSO Heme
## 4 4
t90m_supplement_5448_table <- combine_de_tables(t90m_supplement_5448_de, excel = glue("excel/t90m_supplement_s5448_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
t120m_supplement_5448AP_se <- subset_se(s5448AP_se, subset = "time=='t120m'") |>
subset_se(subset = "media=='C'") |>
subset_se(subset = "strain=='s5448AP'") |>
set_conditions(fact = "supplement") |>
set_batches(fact = "replicate")## Error in `h()`:
## ! error in evaluating the argument 'exp' in selecting a method for function 'set_batches': error in evaluating the argument 'exp' in selecting a method for function 'set_conditions': error in evaluating the argument 'x' in selecting a method for function 'colData': error in evaluating the argument 'x' in selecting a method for function 'colData': error in evaluating the argument 'x' in selecting a method for function 'colData': object 's5448AP_se' not found
t90m_supplement_5448AP_se <- subset_se(s5448AP_se, subset = "time=='t90m'") |>
subset_se(subset = "media=='C'") |>
subset_se(subset = "media=='s5448AP'") |>
set_conditions(fact = "supplement") |>
set_batches(fact = "replicate")## Error in `h()`:
## ! error in evaluating the argument 'exp' in selecting a method for function 'set_batches': error in evaluating the argument 'exp' in selecting a method for function 'set_conditions': error in evaluating the argument 'x' in selecting a method for function 'colData': error in evaluating the argument 'x' in selecting a method for function 'colData': error in evaluating the argument 'x' in selecting a method for function 'colData': object 's5448AP_se' not found
t120m_supplement_5448AP_de <- all_pairwise(t120m_supplement_5448AP_se, model_svs = "svaseq", filter = TRUE)## Error in `h()`:
## ! error in evaluating the argument 'x' in selecting a method for function 'colData': object 't120m_supplement_5448AP_se' not found
t120m_supplement_5448AP_table <- combine_de_tables(t120m_supplement_5448AP_de, excel = glue("excel/t120m_supplement_s5448AP_table-v{ver}.xlsx"))## Error:
## ! object 't120m_supplement_5448AP_de' not found
t90m_supplement_5448AP_de <- all_pairwise(t90m_supplement_5448AP_se, model_svs = "svaseq", filter = TRUE)## Error in `h()`:
## ! error in evaluating the argument 'x' in selecting a method for function 'colData': object 't90m_supplement_5448AP_se' not found
t90m_supplement_5448AP_table <- combine_de_tables(t90m_supplement_5448AP_de, excel = glue("excel/t90m_supplement_s5448AP_table-v{ver}.xlsx"))## Error:
## ! object 't90m_supplement_5448AP_de' not found
t120m_supplement_nz131_se <- subset_se(nz131_se, subset = "time=='t120m'") |>
subset_se(subset = "media=='C'") |>
subset_se(subset = "strain=='nz131'") |>
set_conditions(fact = "supplement") |>
set_batches(fact = "replicate")## The numbers of samples by condition are:
##
## DMSO Heme
## 4 3
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 2 2 2 1
t90m_supplement_nz131_se <- subset_se(nz131_se, subset = "time=='t90m'") |>
subset_se(subset = "media=='C'") |>
subset_se(subset = "strain=='nz131'") |>
set_conditions(fact = "supplement") |>
set_batches(fact = "replicate")## The numbers of samples by condition are:
##
## DMSO Heme
## 4 4
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 2 2 2 2
t120m_supplement_nz131_de <- all_pairwise(t120m_supplement_nz131_se, model_svs = "svaseq", filter = TRUE)## DMSO Heme
## 4 3
## r1 r2 r3 r4
## 2 2 2 1
## Removing 176 low-count genes (1645 remaining).
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 59 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## DMSO Heme
## 4 3
## conditions
## DMSO Heme
## 4 3
## conditions
## DMSO Heme
## 4 3
t120m_supplement_nz131_table <- combine_de_tables(t120m_supplement_nz131_de, excel = glue("excel/t120m_supplement_snz131_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
t90m_supplement_nz131_de <- all_pairwise(t90m_supplement_nz131_se, model_svs = "svaseq", filter = TRUE)## DMSO Heme
## 4 4
## r1 r2 r3 r4
## 2 2 2 2
## Removing 175 low-count genes (1646 remaining).
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 40 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## DMSO Heme
## 4 4
## conditions
## DMSO Heme
## 4 4
## conditions
## DMSO Heme
## 4 4
t90m_supplement_nz131_table <- combine_de_tables(t90m_supplement_nz131_de, excel = glue("excel/t90m_supplement_snz131_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
Spencer sent along the following query:
I wanted to follow up with you on our talk earlier today. Kevin and I wanted to see the significantly differentially expressed genes across strains in different media, i.e., one dataset of the differentially expressed genes in C-media and another of the differentially expressed genes in mRPMI. Also, we realized that for the NZ131 batch data sets, we were seeing locus tags for 5448 instead of those for NZ131. Thanks for your help!
There are a couple things going on here: (a) I later mapped all the samples with my recent nz131 assembly and have not yet performed the analysis using those results. (b) I have only analyzed the original set of contrasts. Let us take a moment to amend this.
I will combine the gff file and microbesonline data.
## Found 1 entry.
## Streptococcus pyogenes NZ131, Firmicutes, yes, 2009-04-21, yes, 1, 0, 1791, 471876
## The microbesonline tsv has already been downloaded to reference/microbesonline_471876.tsv.
## Returning a df with 34 columns and 3698 rows.
## Warning: non-unique values when setting 'row.names': 'Spy49_0001', 'Spy49_0002', 'Spy49_0003',
## 'Spy49_0004', 'Spy49_0005', 'Spy49_0006', 'Spy49_0008', 'Spy49_0009', 'Spy49_0010', 'Spy49_0011',
## 'Spy49_0012', 'Spy49_0013', 'Spy49_0014', 'Spy49_0015', 'Spy49_0016', 'Spy49_0017', 'Spy49_0018',
## 'Spy49_0019', 'Spy49_0020', 'Spy49_0021', 'Spy49_0022', 'Spy49_0023', 'Spy49_0024', 'Spy49_0025',
## 'Spy49_0026c', 'Spy49_0027', 'Spy49_0028', 'Spy49_0029', 'Spy49_0030', 'Spy49_0031', 'Spy49_0032',
## 'Spy49_0033', 'Spy49_0035', 'Spy49_0036', 'Spy49_0037', 'Spy49_0038', 'Spy49_0039', 'Spy49_0040',
## 'Spy49_0044', 'Spy49_0045', 'Spy49_0046', 'Spy49_0048', 'Spy49_0049', 'Spy49_0050', 'Spy49_0052',
## 'Spy49_0053', 'Spy49_0054', 'Spy49_0055', 'Spy49_0056', 'Spy49_0057', 'Spy49_0058', 'Spy49_0059',
## 'Spy49_0060', 'Spy49_0061', 'Spy49_0062', 'Spy49_0064', 'Spy49_0065', 'Spy49_0066', 'Spy49_0067',
## 'Spy49_0068', 'Spy49_0069', 'Spy49_0070', 'Spy49_0071', 'Spy49_0072', 'Spy49_0073', 'Spy49_0074',
## 'Spy49_0075', 'Spy49_0078', 'Spy49_0079', 'Spy49_0080', 'Spy49_0081', 'Spy49_0082', 'Spy49_0083c',
## 'Spy49_0084', 'Spy49_0086', 'Spy49_0087', 'Spy49_0088', 'Spy49_0089', 'Spy49_0090', 'Spy49_0091',
## 'Spy49_0092', 'Spy49_0093', 'Spy49_0094', 'Spy49_0095', 'Spy49_0096', 'Spy49_0097', 'Spy49_0098',
## 'Spy49_0099', 'Spy49_0100', 'Spy49_0101', 'Spy49_0103', 'Spy49_0104', 'Spy49_0105', 'Spy49_0107',
## 'Spy49_0108c', 'Spy49_0109c', 'Spy49_0110c', 'Spy49_0111', 'Spy49_0112', 'Spy49_0113', 'Spy49_0114',
## 'Spy49_0116', 'Spy49_0117', 'Spy49_0118', 'Spy49_0119', 'Spy49_0120c', 'Spy49_0121', 'Spy49_0122c',
## 'Spy49_0123', 'Spy49_0124', 'Spy49_0125', 'Spy49_0126c', 'Spy49_0127', 'Spy49_0128', 'Spy49_0129',
## 'Spy49_0130', 'Spy49_0131', 'Spy49_0132', 'Spy49_0133', 'Spy49_0134', 'Spy49_0135', 'Spy49_0136',
## 'Spy49_0137', 'Spy49_0138c', 'Spy49_0139c', 'Spy49_0141', 'Spy49_0142', 'Spy49_0143', 'Spy49_0144',
## 'Spy49_0145', 'Spy49_0146', 'Spy49_0147', 'Spy49_0148', 'Spy49_0149c', 'Spy49_0150c', 'Spy49_0151',
## 'Spy49_0152', 'Spy49_0153', 'Spy49_0154', 'Spy49_0155', 'Spy49_0156', 'Spy49_0157', 'Spy49_0158',
## 'Spy49_0159', 'Spy49_0160', 'Spy49_0161', 'Spy49_0162', 'Spy49_0163', 'Spy49_0164', 'Spy49_0165',
## 'Spy49_0166', 'Spy49_0167', 'Spy49_0168', 'Spy49_0169', 'Spy49_0170c', 'Spy49_0173c', 'Spy49_0176',
## 'Spy49_0178c', 'Spy49_0180c', 'Spy49_0181', 'Spy49_0182', 'Spy49_0183', 'Spy49_0184', 'Spy49_0185',
## 'Spy49_0186c', 'Spy49_0187', 'Spy49_0188', 'Spy49_0189c', 'Spy49_0190', 'Spy49_0191c', 'Spy49_0192c',
## 'Spy49_0193', 'Spy49_0194', 'Spy49_0195', 'Spy49_0198', 'Spy49_0199', 'Spy49_0200', 'Spy49_0201',
## 'Spy49_0202', 'Spy49_0203', 'Spy49_0204', 'Spy49_0205', 'Spy49_0206', 'Spy49_0207', 'Spy49_0208',
## 'Spy49_0209', 'Spy49_0210', 'Spy49_0211', 'Spy49_0212', 'Spy49_0213', 'Spy49_0214', 'Spy49_0215',
## 'Spy49_0216', 'Spy49_0217', 'Spy49_0218c', 'Spy49_0219', 'Spy49_0220', 'Spy49_0221', 'Spy49_0223',
## 'Spy49_0224', 'Spy49_0225', 'Spy49_0226', 'Spy49_0227', 'Spy49_0228', 'Spy49_0229', 'Spy49_0230',
## 'Spy49_0231', 'Spy49_0233', 'Spy49_0234', 'Spy49_0235c', 'Spy49_0236c', 'Spy49_0237c', 'Spy49_0238',
## 'Spy49_0239', 'Spy49_0240', 'Spy49_0241', 'Spy49_0242', 'Spy49_0243', 'Spy49_0244', 'Spy49_0245',
## 'Spy49_0246', 'Spy49_0247', 'Spy49_0248c', 'Spy49_0249', 'Spy49_0250', 'Spy49_0251', 'Spy49_0252',
## 'Spy49_0253', 'Spy49_0254c', 'Spy49_0256', 'Spy49_0257', 'Spy49_0258', 'Spy49_0259', 'Spy49_0260',
## 'Spy49_0261', 'Spy49_0262', 'Spy49_0263', 'Spy49_0264', 'Spy49_0265', 'Spy49_0266', 'Spy49_0268',
## 'Spy49_0269', 'Spy49_0270', 'Spy49_0271c', 'Spy49_0272', 'Spy49_0273c', 'Spy49_0274c', 'Spy49_0275',
## 'Spy49_0276', 'Spy49_0277', 'Spy49_0278', 'Spy49_0279', 'Spy49_0280', 'Spy49_0281', 'Spy49_0282',
## 'Spy49_0283', 'Spy49_0284', 'Spy49_0285', 'Spy49_0286', 'Spy49_0287', 'Spy49_0288', 'Spy49_0289',
## 'Spy49_0290', 'Spy49_0291', 'Spy49_0292c', 'Spy49_0293', 'Spy49_0294', 'Spy49_0295', 'Spy49_0296',
## 'Spy49_0297', 'Spy49_0298', 'Spy49_0299', 'Spy49_0300', 'Spy49_0301', 'Spy49_0302', 'Spy49_0303',
## 'Spy49_0304', 'Spy49_0305', 'Spy49_0306', 'Spy49_0307', 'Spy49_0308', 'Spy49_0309', 'Spy49_0310',
## 'Spy49_0311', 'Spy49_0312', 'Spy49_0313', 'Spy49_0314', 'Spy49_0315', 'Spy49_0316', 'Spy49_0317c',
## 'Spy49_0318', 'Spy49_0319c', 'Spy49_0320', 'Spy49_0322', 'Spy49_0323', 'Spy49_0325', 'Spy49_0326',
## 'Spy49_0327', 'Spy49_0328', 'Spy49_0329', 'Spy49_0330', 'Spy49_0331', 'Spy49_0332c', 'Spy49_0333',
## 'Spy49_0334c', 'Spy49_0335', 'Spy49_0336', 'Spy49_0337', 'Spy49_0338', 'Spy49_0339', 'Spy49_0340',
## 'Spy49_0341', 'Spy49_0342c', 'Spy49_0343', 'Spy49_0344', 'Spy49_0345c', 'Spy49_0346c', 'Spy49_0347',
## 'Spy49_0348', 'Spy49_0349c', 'Spy49_0350c', 'Spy49_0351c', 'Spy49_0352c', 'Spy49_0353c', 'Spy49_0354c',
## 'Spy49_0355c', 'Spy49_0356c', 'Spy49_0357c', 'Spy49_0358c', 'Spy49_0359c', 'Spy49_0360c', 'Spy49_0361c',
## 'Spy49_0362c', 'Spy49_0363c', 'Spy49_0364c', 'Spy49_0365c', 'Spy49_0366c', 'Spy49_0367c', 'Spy49_0368c',
## 'Spy49_0369', 'Spy49_0370', 'Spy49_0371', 'Spy49_0372', 'Spy49_0373', 'Spy49_0374', 'Spy49_0375',
## 'Spy49_0376', 'Spy49_0377', 'Spy49_0378', 'Spy49_0379', 'Spy49_0380c', 'Spy49_0381', 'Spy49_0382',
## 'Spy49_0383', 'Spy49_0384c', 'Spy49_0385', 'Spy49_0386c', 'Spy49_0387', 'Spy49_0388', 'Spy49_0390',
## 'Spy49_0391', 'Spy49_0392', 'Spy49_0394', 'Spy49_0395', 'Spy49_0396', 'Spy49_0398', 'Spy49_0399',
## 'Spy49_0400', 'Spy49_0401', 'Spy49_0402', 'Spy49_0403', 'Spy49_0404', 'Spy49_0405c', 'Spy49_0406',
## 'Spy49_0407c', 'Spy49_0408c', 'Spy49_0409', 'Spy49_0410', 'Spy49_0411', 'Spy49_0412', 'Spy49_0413',
## 'Spy49_0414c', 'Spy49_0415', 'Spy49_0416', 'Spy49_0417', 'Spy49_0418', 'Spy49_0419', 'Spy49_0420',
## 'Spy49_0421', 'Spy49_0422', 'Spy49_0423', 'Spy49_0424', 'Spy49_0425c', 'Spy49_0426c', 'Spy49_0427c',
## 'Spy49_0428c', 'Spy49_0429c', 'Spy49_0430c', 'Spy49_0431c', 'Spy49_0432', 'Spy49_0433', 'Spy49_0434',
## 'Spy49_0435', 'Spy49_0436', 'Spy49_0437', 'Spy49_0438', 'Spy49_0439', 'Spy49_0440', 'Spy49_0441',
## 'Spy49_0442', 'Spy49_0444', 'Spy49_0445', 'Spy49_0446', 'Spy49_0447', 'Spy49_0448', 'Spy49_0449c',
## 'Spy49_0450', 'Spy49_0451', 'Spy49_0453', 'Spy49_0454', 'Spy49_0455', 'Spy49_0456', 'Spy49_0457',
## 'Spy49_0458', 'Spy49_0459', 'Spy49_0460', 'Spy49_0461c', 'Spy49_0462c', 'Spy49_0463c', 'Spy49_0464c',
## 'Spy49_0465', 'Spy49_0466', 'Spy49_0467', 'Spy49_0468', 'Spy49_0469', 'Spy49_0470c', 'Spy49_0471',
## 'Spy49_0473', 'Spy49_0474', 'Spy49_0475', 'Spy49_0476', 'Spy49_0477c', 'Spy49_0478c', 'Spy49_0479',
## 'Spy49_0480', 'Spy49_0481', 'Spy49_0482', 'Spy49_0483c', 'Spy49_0484', 'Spy49_0485', 'Spy49_0487',
## 'Spy49_0488c', 'Spy49_0489c', 'Spy49_0490', 'Spy49_0491', 'Spy49_0493', 'Spy49_0494', 'Spy49_0495',
## 'Spy49_0496', 'Spy49_0497', 'Spy49_0498', 'Spy49_0499', 'Spy49_0500', 'Spy49_0501', 'Spy49_0502c',
## 'Spy49_0503c', 'Spy49_0504', 'Spy49_0505c', 'Spy49_0506c', 'Spy49_0507c', 'Spy49_0508c', 'Spy49_0509',
## 'Spy49_0510', 'Spy49_0511c', 'Spy49_0512c', 'Spy49_0513', 'Spy49_0514', 'Spy49_0515', 'Spy49_0516',
## 'Spy49_0517c', 'Spy49_0518c', 'Spy49_0519c', 'Spy49_0520c', 'Spy49_0521', 'Spy49_0522', 'Spy49_0523c',
## 'Spy49_0524c', 'Spy49_0525c', 'Spy49_0526c', 'Spy49_0527c', 'Spy49_0528c', 'Spy49_0529c', 'Spy49_0530',
## 'Spy49_0531', 'Spy49_0532', 'Spy49_0533', 'Spy49_0534', 'Spy49_0535', 'Spy49_0536', 'Spy49_0537',
## 'Spy49_0538', 'Spy49_0539c', 'Spy49_0540', 'Spy49_0541', 'Spy49_0543', 'Spy49_0544', 'Spy49_0545',
## 'Spy49_0546', 'Spy49_0547', 'Spy49_0548', 'Spy49_0549', 'Spy49_0550', 'Spy49_0551', 'Spy49_0552c',
## 'Spy49_0554c', 'Spy49_0555', 'Spy49_0556', 'Spy49_0557', 'Spy49_0558', 'Spy49_0559', 'Spy49_0560',
## 'Spy49_0561', 'Spy49_0562c', 'Spy49_0563', 'Spy49_0564c', 'Spy49_0565c', 'Spy49_0566c', 'Spy49_0567',
## 'Spy49_0568', 'Spy49_0569', 'Spy49_0570', 'Spy49_0572', 'Spy49_0573', 'Spy49_0574', 'Spy49_0575',
## 'Spy49_0576', 'Spy49_0577', 'Spy49_0578', 'Spy49_0579', 'Spy49_0580', 'Spy49_0581', 'Spy49_0582',
## 'Spy49_0583', 'Spy49_0584', 'Spy49_0585', 'Spy49_0586', 'Spy49_0587', 'Spy49_0588', 'Spy49_0589',
## 'Spy49_0590', 'Spy49_0591', 'Spy49_0592', 'Spy49_0593', 'Spy49_0594', 'Spy49_0596', 'Spy49_0597',
## 'Spy49_0598', 'Spy49_0599', 'Spy49_0600', 'Spy49_0601', 'Spy49_0602c', 'Spy49_0603', 'Spy49_0604',
## 'Spy49_0605', 'Spy49_0606', 'Spy49_0607c', 'Spy49_0608', 'Spy49_0609', 'Spy49_0610', 'Spy49_0611',
## 'Spy49_0612', 'Spy49_0613', 'Spy49_0614', 'Spy49_0615',
## Error in `.rowNamesDF<-`:
## ! duplicate 'row.names' are not allowed
nz_annot <- merge(nz_annot_gff, nz_annot, by.x = "locus_tag", by.y = "sysName", all.x = TRUE)
nz_go <- load_microbesonline_go(table_df = nz_annot, species = "NZ131", id_column = "locus_tag")## Found 1 entry.
## Streptococcus pyogenes NZ131, Firmicutes, yes, 2009-04-21, yes, 1, 0, 1791, 471876
rownames(nz_annot) <- make.names(nz_annot[["locus_tag"]], unique = TRUE)
nz_se <- create_se(sample_sheet[["new_meta"]], gene_info = nz_annot,
file_column = "hisat_count_table_spyogenes_nz131") |>
subset_se(subset = "read1fastqfile!='Undetermined_S0_R1_001.fastq.gz'")## Reading the sample metadata.
## Checking the state of the condition column.
## Checking the state of the batch column.
## Checking the condition factor.
## The sample definitions comprises: 81 rows(samples) and 51 columns(metadata fields).
## Matched 1788 annotations and counts.
## Some annotations were lost in merging, setting them to 'undefined'.
## Saving the summarized experiment to 'se.rda'.
## The final summarized experiment has 1788 rows and 51 columns.
I am not completely certain from the email if they want to do this comparison across strains, or only among the two strains separately. For the moment I will assume the latter.
only_nz <- subset_se(nz_se, subset = "strain=='nz131'") |>
set_conditions(fact = "media") |>
set_batches(fact = "replicate")## The numbers of samples by condition are:
##
## C RPMI
## 16 16
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## r1 r2 r3 r4
## 8 8 8 8
## Error in `plot_meta_sankey()`:
## ! unused argument (fstring = "~ media + supplement + time")
nz_norm <- normalize_se(only_nz, transform = "log2", convert = "cpm",
filter = TRUE, norm = "quant")## Removing 79 low-count genes (1709 remaining).
## transform_counts: Found 8 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 C, RPMI
## Shapes are defined by r1, r2, r3, r4.
## A heatmap of pairwise sample correlations ranging from:
## 0.714162506751895 to 0.998091329506267.
We might want to exclude those two weirdo samples? #60 and #67
With that exception, the difference in media is quite stark, so let us do a simple de using it
## C RPMI
## 16 16
## r1 r2 r3 r4
## 8 8 8 8
## Removing 79 low-count genes (1709 remaining).
## Basic step 0/3: Normalizing data.
## Basic step 0/3: Converting data.
## I think this is failing? SummarizedExperiment
## Basic step 0/3: Transforming data.
## Setting 2751 entries to zero.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## conditions
## C RPMI
## 16 16
## conditions
## C RPMI
## 16 16
## conditions
## C RPMI
## 16 16
## A pairwise differential expression with results from: basic, deseq, ebseq, edger, limma, noiseq.
## This used a surrogate/batch estimate from: Existing surrogate matrix.
## The primary analysis performed 1 comparisons.
## The logFC agreement among the methods follows:
## RPMI_vs_C
## basic_vs_deseq 0.8930
## basic_vs_dream 0.9259
## basic_vs_ebseq 0.9029
## basic_vs_edger 0.9095
## basic_vs_limma 0.9823
## basic_vs_noiseq 0.9419
## deseq_vs_dream 0.9887
## deseq_vs_ebseq 0.8746
## deseq_vs_edger 0.9978
## deseq_vs_limma 0.9140
## deseq_vs_noiseq 0.9090
## dream_vs_ebseq 0.9054
## dream_vs_edger 0.9934
## dream_vs_limma 0.9407
## dream_vs_noiseq 0.9365
## ebseq_vs_edger 0.9003
## ebseq_vs_limma 0.8936
## ebseq_vs_noiseq 0.9906
## edger_vs_limma 0.9258
## edger_vs_noiseq 0.9309
## limma_vs_noiseq 0.9282
contrast <- list("C_vs_RPMI" = c("C", "RPMI"))
nz_media_table <- combine_de_tables(
nz_media_de, keepers = contrast,
excel = glue("excel/nz_samples_media_table-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 RPMI_vs_C-inverted 319 326 325 362 348 311
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## ℹ The deprecated feature was likely used in the UpSetR package.
## Please report the issue to the authors.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## ℹ The deprecated feature was likely used in the UpSetR package.
## Please report the issue to the authors.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
## Plot describing unique/shared genes in a differential expression table.
nz_media_sig <- extract_significant_genes(
nz_media_table,
excel = glue("excel/nz_samples_media_sig-v{ver}.xlsx"))
nz_media_sig## 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
## C_vs_RPMI 319 326
## gas5005_go, nz131_go
## nz131_annot, s5005_annot
go_db <- as.data.frame(nz131_go)
colnames(go_db) <- c("ID", "GO")
goseq_input <- nz_media_sig[["deseq"]][["ups"]][["C_vs_RPMI"]]
nz131_media_goseq_up <- simple_goseq(goseq_input, go_db = go_db,
length_db = nz131_lengths,
excel = "excel/nz131_media_goseq_up.xlsx")## Found 239 go_db genes and 319 length_db genes out of 319.
## Testing that go categories are defined.
## Removing undefined categories.
## Gathering synonyms.
## Gathering category definitions.
goseq_input <- nz_media_sig[["deseq"]][["downs"]][["C_vs_RPMI"]]
nz131_media_goseq_down <- simple_goseq(goseq_input, go_db = go_db,
length_db = nz131_lengths,
excel = "excel/nz131_media_goseq_down.xlsx")## Found 181 go_db genes and 326 length_db genes out of 326.
## Testing that go categories are defined.
## Removing undefined categories.
## Gathering synonyms.
## Gathering category definitions.
## Deleting the file excel/nz131_media_goseq_down.xlsx before writing the tables.
## We want to try pathway analyses for:
##strain_supplement_keepers <- list(
## "AP_C_HD" = c("s5448APCHeme", "s5448APCDMSO"),
## "NZ_C_HD" = c("nz131CHeme", "nz131CDMSO"), ### Me!
## "G5448_C_HD" = c("s5448CHeme", "s5448CDMSO"), ## Me!
## "NZ_R_HD" = c("nz131RPMIHeme", "nz131RPMIDMSO"),
## "G5448_R_HD" = c("s5448RPMIHeme", "s5448RPMIDMSO"))
path_input <- s5005_exc_table[["data"]][["NZ_C_HD"]]## Error:
## ! object 's5005_exc_table' not found
from_list <- c("_Spy_")
to_list <- c("_Spy")
test_nz_c_hd = simple_pathview(path_input, species = "spz", indir = "pathview_in",
outdir = "nz_c_hd_pathview", filenames = "pathname",
from_list = from_list, to_list = to_list,
fc_column = "deseq_logfc", id_column = NULL)## Error:
## ! object 'path_input' not found
## Error:
## ! object 's5005_exc_table' not found
from_list <- c("_Spy_")
to_list <- c("_Spy")
test_g5448_c_hd = simple_pathview(path_input, species = "spz", indir = "pathview_in",
outdir = "g5448_c_hd_pathview", filenames = "pathname",
from_list = from_list, to_list = to_list,
fc_column = "deseq_logfc", id_column = NULL)## Error:
## ! object 'path_input' not found