## Adjusted p-value cutoff when working on the inclusion sets.
adjp_cutoff <- 0.1
default_fstring <- "~ 0 + condition"
## Allow 10 GO categories to be displayed when plotting.
go_categories <- 14
## Allow groups higher up in the tree for clusterProfiler results.
go_level <- 2
label_column <- "mgi_symbol" ## Set the column used to extract gene symbols rather than ENSG.....
## LogFC cutoff when working on the inclusion sets.
lfc_cutoff <- 0.1
## Increase the maximum allowed group size when working with clusterProfiler
## This should bring out some of the more general groups like 'cellbody'
max_groupsize <- 2000
## Speed up clusterProfiler by choosing the correct keytypes
orgdb_from <- "ENSEMBLTRANS"
## MA plot point outlines
outline <- FALSE
sample_sheet <- "sample_sheets/20240606_only_umd_sequenced_modified.xlsx"This document is a copy of the iprgc_analyses_202408.Rmd document, with a few important differences:
With that in mind, the goal is to repeat our gene-level analyses, but using the transcript quantifications derived from featureCounts. This is in response to a review who suggested that some genes have potentially interesting and variable transcripts. That is a simple enough query to address, so let us see what we get!
I would like to improve this document by comparing/contrasting the methodologies performed by other groups and those performed by me in it. I never fully appreciated the suite of computational methods applied by previous groups when examining TRAP data; I instead simply followed Theresa’s notebook without considering other possibilities.
I therefore spent a little time stepping through her thesis and pulling out the relevant papers in the hopes of learning these various methods. I should therefore be able soon to compare/contrast the various methods employed by other labs in addition to copying Theresa’s logic.
The following block assumes the full tree of preprocessed data with the logs from the trimmer, mapping, umi deduplication, counting, etc. As a result it cannot work in the container which has only the various count tables.
As a result, I am including a copy of this sheet after running the following block in my working tree. I suppose for the moment you will have to trust that it worked. (for right now, when testing out this container, I am just sending the R working directory to my tree for this block, then moving it back.
I will need to manually edit one column though, the symlink column from Theresa has a series of paths which do not work in the container.
umi_spec <- make_rnaseq_spec(umi = TRUE)
iprgc_2022_meta <- gather_preprocessing_metadata("sample_sheets/20240606_only_umd_sequenced.xlsx",
spec = umi_spec, species = "mm39_112", verbose = TRUE,
basedir = "preprocessing/umd_sequenced")
colnames(iprgc_2022_meta[["new_meta"]])
head(iprgc_2022_meta[["new_meta"]])msigdb <- "reference/msigdb_v2024.1.Mm.db"
msig_data <- NULL
make_transparent <- function() {
ggplot2::theme(
panel.background = element_rect(fill = 'transparent'),
plot.background = element_rect(fill = 'transparent', color = NA),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.background = element_rect(fill = 'transparent'),
legend.box.background = element_rect(fill = 'transparent'))
}I used salmon/featurecounts/etc with CDS/mRNA features on our compute cluster and used the above gather function to add a column to the metadata containing the filenames produced. The following reads that column and creates a tarball of the files. One thing I need to do: modify that to accept a vetor of columns so I can easily collect r1+r2 and stuff like that.
As the name suggests, these are mRNA counts following the deduplication marking and removal from the initial hisat alignments via umitools.
## all the input files are already xz compressed
mrna_counts <- tar_meta_column(sample_sheet, column = "umi_dedup_mrna_count", compress = NULL)I will figure out if I can leave mSigDB M2 in this image; if not, then any analyses depending on those gene sets will fail.
m2_gsc <- try(load_gmt_signatures(signatures = msigdb,
signature_category = "M2"), silent = TRUE)
## I do not think I have permission to load the msigdb in the container
## So, if this fails, just load it from GSVAData, oh wait no, GSVAdata is human.
if ("try-error" %in% class(m2_gsc)) {
warning("Unable to load the M2 MsigDB data.")
}I am pulling this from Theresa’s anxontrapR_pipeline.Rmd, primarily because it looks similar to the other documents, but was modified more recently. I will change it slightly, primarily because I grabbed a new mmusculus assembly and therefore I will pull the mmusculus annotations from a specific biomart (Smedley et al. (2009)) archive that should match it.
A note from the future: multiple ensembl archive servers have been taken offline since last I ran this. Let us see if Feb. 2023 still works.
In the recent past, ensembl queries have become inconsistent, failing much more often than ever in the past. I do not think this is the fault of ensembl; but I think I need a fallback mechanism for collecting annotation information.
In the case of ensembl, it should be trivial (but less fun) to use a combination of the locally installed orgdb and txdb databases.
This does open a risk that the set of genes with annotations will be different depending on when the container is run due to differences between the orgdb/txdb instance and the Feb 2023 biomart. I am not sure there is much I can do about that except to bundle the set of annotations I downloaded in the container – since load_biomart_annotations() does save a rda copy of its download.
ok, I did both. If you, dear reader, wish to download your own annotations, and ensembl is having troubles, the following should work without a problem; in addition the rda annotations are in /data of the container and should get loaded.
tx_gene_map <- data.frame()
##mm_annot <- try(load_biomart_annotations(species = "mmusculus", year = "2023", month = "02", overwrite = TRUE))
mm_annot <- try(load_biomart_annotations(species = "mmusculus", archive = FALSE,
symbol_columns = label_column))## The biomart annotations file already exists, loading from it.
mm_tx_annot <- mm_annot[["annotation"]]
## yeah, the ID tag in my gff file has transcript: as a prefix, so the featureCounts outputs
## includes it... I will fix that inpost.
rownames(mm_tx_annot) <- paste0("transcript:", mm_tx_annot[["ensembl_transcript_id"]])
#mm_orgdb <- load_orgdb_annotations(
# orgdb = "Mus.musculus", keytype = "ACCNUM",
# fields = c("TXNAME", "TXTYPE", "TXCHROM", "TXSTART", "TXEND", "TXID", "TXSTRAND", "MGID"))color_choices <- list(
"all" = list(
"p08_het_dlgn" = "#E7298A",
"p15_het_dlgn" = "#E7298A",
"p08_het_retina" = "#238B45",
"p15_het_retina" = "#238B45",
"p08_het_scn" = "#4292C6",
"p15_het_scn" = "#4292C6",
"p08_ko_dlgn" = "#C994C7",
"p15_ko_dlgn" = "#C994C7",
"p08_ko_retina" = "#74c476",
"p15_ko_retina" = "#74c476",
"p08_ko_scn" = "#9BCAE1",
"p15_ko_scn" = "#9BCAE1",
"p08_wt_dlgn" = "#980043",
"p15_wt_dlgn" = "#980043",
"p08_wt_retina" = "#004008",
"p15_wt_retina" = "#004008",
"p08_wt_scn" = "#08519C",
"p15_wt_scn" = "#08519C",
"p60_wt_dlgn" = "#333333",
"p60_wt_retina" = "#222222",
"p60_wt_scn" = "#111111"),
"geno_loc" = list(
"het_dlgn" = "#E7298A",
"het_retina" = "#238B45",
"het_scn" = "#4292C6",
"ko_dlgn" = "#C994C7",
"ko_retina" = "#74c476",
"ko_scn" = "#9BCAE1",
"wt_dlgn" = "#980043",
"wt_retina" = "#004008",
"wt_scn" = "#08519C"),
"location" = list(
"retina" = "#004008",
"dlgn" = "#980043",
"scn" = "#08519C"),
"genotype" = list(
"wt" = "#74c476",
"het" = "#238B45",
"ko" = "#006D2C"),
"time" = list(
"p08" = "#5E104B",
"p15" = "#4E9231"))
colors <- color_choices[["geno_loc"]]
time_colors <- list(
"p08_het_dlgn" = "#E7298A",
"p15_het_dlgn" = "#8a1852",
"p08_het_retina" = "#238B45",
"p15_het_retina" = "#155329",
"p08_het_scn" = "#4292C6",
"p15_het_scn" = "#275776",
"p08_ko_dlgn" = "#C994C7",
"p15_ko_dlgn" = "#785877",
"p08_ko_retina" = "#74C476",
"p15_ko_retina" = "#457546",
"p08_ko_scn" = "#9BCAE1",
"p15_ko_scn" = "#5d7987")This perhaps deserves a little bit of explanation: the process for using UMIs goes as follows:
I therefore invoked featureCounts on the umi deduplicated bam alignments (found in column ‘umi_dedup_output_bam’ BP in my copy of the automagically generated sample sheet) using the requisite mm38 gff file with transcript as the feature type and ID as the tag.
Oh, that reminds me, I need to re-key the annotations to use that and I might need to check that the IDs do or do not have a prefix like ‘transcript:’ or whatever…
mm38_hisat_tx <- create_se(sample_sheet, gene_info = mm_tx_annot,
file_column = "umi_dedup_mrna_count") |>
set_conditions(fact = "geno_loc_atb") |>
set_batches(fact = "time_atb") |>
set_colors(color_choices[["geno_loc"]])## 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: 69 rows(samples) and 54 columns(metadata fields).
## Warning in create_se(sample_sheet, gene_info = mm_tx_annot, file_column = "umi_dedup_mrna_count"): Some samples were removed when cross
## referencing the samples against the count data.
## Matched 65810 annotations and counts.
## Some annotations were lost in merging, setting them to 'undefined'.
## The final summarized experiment has 65883 rows and 54 columns.
## The numbers of samples by condition are:
##
## het_dlgn het_retina het_scn ko_dlgn ko_retina ko_scn wt_dlgn wt_retina wt_scn
## 7 7 7 6 6 6 11 11 7
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## p08 p15 p60
## 31 34 3
## class: SummarizedExperiment
## dim: 65883 68
## metadata(7): notes title ... study researcher
## assays(1): ''
## rownames(65883): transcript:ENSMUST00000000001 transcript:ENSMUST00000000003 ... transcript:ENSMUST00020183811
## transcript:ENSMUST00020183812
## rowData names(12): ensembl_gene_id ensembl_transcript_id ... end_position mgi_symbol
## colnames(68): iprgc_62 iprgc_63 ... iprgc_129 iprgc_130
## colData names(55): rownames sampleid ... umi_dedup_mrna_count color
## Now that we created the data structure with IDs that include the transcript: prefix,
## remove it...
new_ids <- gsub(x = rownames(assay(mm38_hisat_tx)), pattern = "^transcript:", replacement = "")
rownames(mm38_hisat_tx) <- new_ids
rownames(mm_tx_annot) <- gsub(x = rownames(mm_tx_annot), pattern = "^transcript:", replacement = "")
all_fact <- paste0(colData(mm38_hisat_tx)[["time_atb"]], "_",
colData(mm38_hisat_tx)[["geno_loc_atb"]])
colData(mm38_hisat_tx)[["time_geno_loc"]] <- all_fact
dim(assay(mm38_hisat_tx))## [1] 65883 68
## iprgc_62 iprgc_63 iprgc_64 iprgc_65 iprgc_66 iprgc_67 iprgc_68 iprgc_69 iprgc_70 iprgc_71 iprgc_72 iprgc_73 iprgc_74
## ENSMUST00000000001 27 22 169 202 53 42 16 183 22 29 40 34 181
## ENSMUST00000000003 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000010 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000028 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000033 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000049 0 0 0 0 0 0 0 1 0 0 0 0 0
## iprgc_75 iprgc_76 iprgc_77 iprgc_78 iprgc_79 iprgc_80 iprgc_81 iprgc_82 iprgc_83 iprgc_84 iprgc_85 iprgc_86 iprgc_87
## ENSMUST00000000001 201 311 27 70 187 62 17 74 82 322 33 259 40
## ENSMUST00000000003 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000010 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000028 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000033 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000049 0 2 0 0 0 0 0 1 0 0 0 0 0
## iprgc_88 iprgc_89 iprgc_90 iprgc_91 iprgc_92 iprgc_93 iprgc_94 iprgc_95 iprgc_96 iprgc_97 iprgc_98 iprgc_99 iprgc_100
## ENSMUST00000000001 74 160 577 344 67 30 31 53 141 51 140 247 97
## ENSMUST00000000003 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000010 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000028 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000033 0 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000049 0 0 1 0 0 0 0 0 0 0 0 0 0
## iprgc_101 iprgc_102 iprgc_104 iprgc_105 iprgc_106 iprgc_107 iprgc_108 iprgc_109 iprgc_110 iprgc_111 iprgc_112 iprgc_113
## ENSMUST00000000001 199 78 68 159 140 57 175 529 79 107 149 76
## ENSMUST00000000003 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000010 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000028 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000033 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000049 0 0 0 0 0 0 0 0 0 0 0 0
## iprgc_114 iprgc_115 iprgc_116 iprgc_117 iprgc_118 iprgc_119 iprgc_120 iprgc_121 iprgc_122 iprgc_123 iprgc_124 iprgc_125
## ENSMUST00000000001 214 413 259 480 434 231 451 332 249 41 56 158
## ENSMUST00000000003 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000010 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000028 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000033 0 0 0 0 0 0 0 0 0 0 0 0
## ENSMUST00000000049 0 0 0 0 0 0 0 0 0 0 0 0
## iprgc_126 iprgc_127 iprgc_128 iprgc_129 iprgc_130
## ENSMUST00000000001 68 147 64 42 132
## ENSMUST00000000003 0 0 0 0 0
## ENSMUST00000000010 0 0 0 0 0
## ENSMUST00000000028 0 0 0 0 0
## ENSMUST00000000033 0 0 0 0 0
## ENSMUST00000000049 0 0 0 0 1
A neat little change I just made: when null set the y-intercept to the mean percentage of units observed (transcripts in this case).
## The following samples have less than 42823.95 features.
## [1] "iprgc_62" "iprgc_63" "iprgc_64" "iprgc_65" "iprgc_66" "iprgc_67" "iprgc_68" "iprgc_69" "iprgc_70" "iprgc_71" "iprgc_72"
## [12] "iprgc_73" "iprgc_74" "iprgc_75" "iprgc_76" "iprgc_77" "iprgc_78" "iprgc_79" "iprgc_80" "iprgc_81" "iprgc_82" "iprgc_83"
## [23] "iprgc_84" "iprgc_85" "iprgc_86" "iprgc_87" "iprgc_88" "iprgc_89" "iprgc_90" "iprgc_91" "iprgc_92" "iprgc_93" "iprgc_94"
## [34] "iprgc_95" "iprgc_96" "iprgc_97" "iprgc_98" "iprgc_99" "iprgc_100" "iprgc_101" "iprgc_102" "iprgc_104" "iprgc_105" "iprgc_106"
## [45] "iprgc_107" "iprgc_108" "iprgc_109" "iprgc_110" "iprgc_111" "iprgc_112" "iprgc_113" "iprgc_114" "iprgc_115" "iprgc_116" "iprgc_117"
## [56] "iprgc_118" "iprgc_119" "iprgc_120" "iprgc_121" "iprgc_122" "iprgc_123" "iprgc_124" "iprgc_125" "iprgc_126" "iprgc_127" "iprgc_128"
## [67] "iprgc_129" "iprgc_130"
## 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.
tx_libsize <- plot_libsize(mm38_hisat_tx)
pp(file = "01diagnostic_images_tx/quantsize_unfiltered.pdf", image = tx_libsize[["plot"]])## The following samples have less than 42823.95 features.
## [1] "iprgc_62" "iprgc_63" "iprgc_64" "iprgc_65" "iprgc_66" "iprgc_67" "iprgc_68" "iprgc_69" "iprgc_70" "iprgc_71" "iprgc_72"
## [12] "iprgc_73" "iprgc_74" "iprgc_75" "iprgc_76" "iprgc_77" "iprgc_81" "iprgc_82" "iprgc_83" "iprgc_84" "iprgc_85" "iprgc_86"
## [23] "iprgc_87" "iprgc_88" "iprgc_89" "iprgc_90" "iprgc_91" "iprgc_92" "iprgc_93" "iprgc_94" "iprgc_95" "iprgc_96" "iprgc_97"
## [34] "iprgc_98" "iprgc_99" "iprgc_100" "iprgc_101" "iprgc_102" "iprgc_104" "iprgc_105" "iprgc_106" "iprgc_107" "iprgc_108" "iprgc_109"
## [45] "iprgc_110" "iprgc_111" "iprgc_112" "iprgc_113" "iprgc_114" "iprgc_115" "iprgc_116" "iprgc_117" "iprgc_118" "iprgc_119" "iprgc_120"
## [56] "iprgc_121" "iprgc_122" "iprgc_123" "iprgc_124" "iprgc_125" "iprgc_126" "iprgc_127" "iprgc_128" "iprgc_129" "iprgc_130"
## 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.
## Not putting labels on the plot.
tx_norm <- normalize(mm38_hisat_tx, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)## Removing 52535 low-count genes (13348 remaining).
## transform_counts: Found 118930 values equal to 0, adding 1 to the matrix.
tx_norm_pca <- plot_pca(tx_norm)
pp(file = "01diagnostic_images_tx/tx_norm_pca.pdf", image = tx_norm_pca[["plot"]])tx_loc_geno <- set_conditions(mm38_hisat_tx, fact = "location_atb",
colors = color_choices[["location"]]) |>
set_batches(fact = "genotype_atb")## The numbers of samples by condition are:
##
## dlgn retina scn
## 23 23 19
## The number of samples by batch are:
##
## het ko wt
## 21 18 26
At different times, it appears to me that Theresa has preferred slightly different normalization methods, primarily a mix of TMM and quantile.
Thus I will use different suffix letters to denote various normalizations employed, and if they turn out the same I will pick one arbitrarily.
loc_geno_nq <- normalize(tx_loc_geno, transform = "log2", convert = "cpm",
filter = TRUE, norm = "quant")## Removing 52535 low-count genes (13348 remaining).
## transform_counts: Found 118930 values equal to 0, adding 1 to the matrix.
location_genotype_pca <- plot_pca(loc_geno_nq)
pp(file = "01diagnostic_images_tx/location_genotype_norm_pca.pdf", image = location_genotype_pca[["plot"]])loc_geno_nt <- normalize(tx_loc_geno, transform = "log2", convert = "cpm",
filter = TRUE, norm = "tmm")## Removing 52535 low-count genes (13348 remaining).
## transform_counts: Found 224721 values equal to 0, adding 1 to the matrix.
location_genotype_tmm_pca <- plot_pca(loc_geno_nt)
pp(file = "01diagnostic_images_tx/location_genotype_tmm_pca.pdf", image = location_genotype_tmm_pca[["plot"]])sample_sankey <- plot_meta_sankey(tx_loc_geno, color_choices = color_choices,
factors = c("genotype_atb", "location_atb", "time_atb"))## 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.
Re-purpose these expression plots to examine one Opn4 transcript. This will by some necessity be arbitrary.
It is at this moment that I realized (as I am almost certain I told myself when I started) using the hisat-derived tx counts is wrong because hisat->featureCounts has no good way to allocate multi-hits to multiple transcripts and will therefore discount them. If I want to do this in any sort of reliable way, I really need to re-extract the deduplicate reads from the umitools bam file and run salmon/kallisto. This is somewhat annoying because the various tools I have for extract bam reads really hate the way umitools formats the bam file and freak out. I can force it, but I think I will lose a potentially significant number of reads, let us go look…
(If you with to follow along, go back to the preprocessing document which I should have included in the singularity container) I will do one of the following:
I am not sure right now which I want to do. I kind of like the idea of having deduplicated fastq files so that I can try some other stuff with them (kraken, for example)
## ggstatsplot has appeared and disappeared a few times from cran recently,
## I am not sure if it will work therefore, so figured I should disable this block
## for the moment.
## I did a search at ensembl for the various opn4 transcript IDs:
## ENSMUST00000022331, ENSMUST00000168444, ENSMUST00000226806
ids <- c("ENSMUST00000022331", "ENSMUST00000168444", "ENSMUST00000226806")
ids %in% rownames(loc_geno_nt)
ids <- c("ENSMUST00000022331", "ENSMUST00000168444")
opn4_exprs <- data.frame(combined = colData(loc_geno_nt)[["geno_loc_atb"]],
location = colData(loc_geno_nt)[["location_atb"]],
genotype = colData(loc_geno_nt)[["genotype_atb"]],
opn = assay(loc_geno_nt)[ids[1], ])
groupedstats::grouped_summary(opn4_exprs, location, opn)
opn4_location <- ggstatsplot::ggbetweenstats(data = opn4_exprs, x = location, y = opn)
pp(file = "images_tx/ggbetween_location.pdf")
opn4_location
plotted <- dev.off()
opn4_locationok, so I plotted the question a bit differently, but got the same answer.
Here is the text of Theresa’s notebook following this analysis:
“Ugh oh, looks like there is at least one retina KO sample that has some melanopsin expression in it. Turns out ipRGC_07 is a bad egg which is supposed to be a KO but has melanopsin expression. It’s friends which were pooled from the same mice are iprgc_06 and iprgc_08, so we need to exclude all these samples.”
I am also seeing some knockout expression with some caveats: I do not have the affected samples in my dataset (iprgc_07) and the levels I am seeing are quite low – I will look in IGV to double check, but I strongly suspect that these are some piddly reads near the UTRs.
Onward!
Theresa’s first pca was of log2 cpm values. I might add quantile/tmm to this?
tx_location <- set_conditions(mm38_hisat_tx, fact = "location_atb") |>
set_batches(fact = "genotype_atb") |>
set_colors(color_choices[["location"]])## The numbers of samples by condition are:
##
## dlgn retina scn
## 23 23 19
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## het ko wt
## 21 18 26
tx_location_norm <- normalize(tx_location, filter = TRUE, norm = "quant",
transform = "log2", convert = "cpm")## Removing 52535 low-count genes (13348 remaining).
## transform_counts: Found 118930 values equal to 0, adding 1 to the matrix.
tx_location_pca <- plot_pca(tx_location_norm)
pp(file = "01diagnostic_images_tx/tx_location_norm_pca.pdf")
tx_location_pca## The result of performing a fast_svd dimension reduction.
## The x-axis is PC1 and the y-axis is PC2
## Colors are defined by dlgn, retina, scn
## Shapes are defined by het, ko, wt.
## png
## 2
## The result of performing a fast_svd dimension reduction.
## The x-axis is PC1 and the y-axis is PC2
## Colors are defined by dlgn, retina, scn
## Shapes are defined by het, ko, wt.
Once again we see that samples iprgc_66 and iprgc_130 are likely actually DLGN and not SCN. I am therefore going to add a column to the sample sheet noting this, and remove them from the expressionset.
I will thus replot the data after removing those two. If we want to see what it looks like with the re-attributed locations, we can do so.
Theresa has a nice change to the PCA plotter in which she sets the alpha channel as an additional visual queue for a metadata factor…
mm38_hisat_tx <- subset_se(mm38_hisat_tx, subset="sampleid!='iprgc_130'") |>
subset_se(subset="sampleid!='iprgc_66'")
tx_location <- set_conditions(mm38_hisat_tx, fact = "location_atb") |>
set_batches(fact = "genotype_atb") |>
set_colors(color_choices[["location"]])## The numbers of samples by condition are:
##
## dlgn retina scn
## 23 23 17
## Setting colors with no pre-defined colors, using the Dark2 palette.
## The number of samples by batch are:
##
## het ko wt
## 20 18 25
tx_location_norm <- normalize(tx_location, filter = TRUE, norm = "quant",
transform = "log2", convert = "cpm")## Removing 52544 low-count genes (13339 remaining).
## transform_counts: Found 112002 values equal to 0, adding 1 to the matrix.
filtered_location_pca <- plot_pca(tx_location_norm)
pp(file = "02filtered_images_tx/filtered_location_pca.pdf")## Warning in pp(file = "02filtered_images_tx/filtered_location_pca.pdf"): The directory: 02filtered_images_tx does not exist, will attempt to
## create it.
## The result of performing a fast_svd dimension reduction.
## The x-axis is PC1 and the y-axis is PC2
## Colors are defined by dlgn, retina, scn
## Shapes are defined by het, ko, wt.
removed_sankey <- plot_meta_sankey(tx_location, color_choices = color_choices,
factors = c("genotype_atb", "location_atb", "time_atb"))## Warning: attributes are not identical across measure variables; they will be dropped
## NULL
## A sankey plot describing the metadata of 63 samples,
## including 30 out of 0 nodes and traversing metadata factors:
## genotype_atb, location_atb, time_atb.
Here is Theresa’s text, recall once again that I do not have some of these older samples (iprgc_62):
PC1 vs PC2 identifies retina vs axon is still the main component of variation. We do see though that in the PC2 direction, we see with the new samples added, we don’t see separation based on axonal targets (dLGN vs SCN). In the PC1 vs PC3 plot, we see that it’s PC3 where we start to see variation correlated with axonal compartment. Let’s look at PC1 vs PC2 colored by batch (when they were processed/sequenced) to see if that is what is contributing so much variation in PC2.
Side note: ipRGC 62 seems like an odd ball. This seems to me like it should have been a dLGN P08 sample. Is there any possibility this got mislabeled early on? I went back and double checked to see if all my processing is correct and it indeed was labeled an SCN P15 from the time I got the samples, and it is indeed.
I now switched to Theresa’s document ‘WORKING_axonTRAP…’ and will start pulling sections from it. I am reasonably certain I have reasonably similar sample distributions, so I presume I can invoke similar/identical calls for DESeq and friends.
In the block immediately before the DE analyses, Theresa created a subset expressionset of only p08 retinas. Thus this initial DE I assume will be used to subtract for the SCN/DLGN analyses that follow. (I guess I could read ahead and find out, but no! I want to be a blank slate)
Theresa’s primary workflow makes heavy use of DESeq2 (Love et al. (2014)) and sva ((leekSVAPackageRemoving2012?)). In some(most?) of Theresa’s invocations of the all_pairwise() function, she excludes the other methods that it performs. In this workbook, I left those methods on, thus we can evaluate the relative performance DESeq2 vs. some (all? I may have disabled EBSeq/dream because they were taking too long) of the following:
mm38_p8_retina <- subset_se(mm38_hisat_tx, subset = "time_atb=='p08' & location_atb=='retina'")
mm_normal_p8_ret_de <- all_pairwise(mm38_p8_retina, model_svs = "svaseq",
model_fstring = "~ 0 + condition", filter = TRUE)## het_retina ko_retina wt_retina
## 3 3 5
## Removing 56421 low-count genes (9462 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 5313 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## conditions
## het_retina ko_retina wt_retina
## 3 3 5
## conditions
## het_retina ko_retina wt_retina
## 3 3 5
## conditions
## het_retina ko_retina wt_retina
## 3 3 5
## 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 3 comparisons.
There seems to be a discrepency with previous iterations of this. Let us simplify to just doing deseq and find what is causing it. In my previous iteration, I got 3632 genes in the unique(c()) or het+ko.
deseq_only <- deseq_pairwise(mm38_p8_retina, model_svs = "svaseq",
model_fstring = default_fstring, filter = TRUE)## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
deseq_hetkeeper_tx <- deseq_only$all_tables$wt_retina_vs_het_retina |>
filter(logFC <= -0.25 & adj.P.Val <= 0.05)
deseq_kokeeper_tx <- deseq_only$all_tables$wt_retina_vs_ko_retina |>
filter(logFC <= -0.25 & adj.P.Val <= 0.05)
deseq_keepertx <- unique(c(rownames(deseq_hetkeeper_tx),
rownames(deseq_kokeeper_tx)))
length(deseq_keepertx)## [1] 1806
deseq_pair_hetkeeper_tx <- mm_normal_p8_ret_de$deseq$all_tables$wt_retina_vs_het_retina |>
filter(logFC <= -0.25 & adj.P.Val <= 0.05)
deseq_pair_kokeeper_tx <- mm_normal_p8_ret_de$deseq$all_tables$wt_retina_vs_ko_retina |>
filter(logFC <= -0.25 & adj.P.Val <= 0.05)
deseq_pair_keepertx <- unique(c(rownames(deseq_pair_hetkeeper_tx),
rownames(deseq_pair_kokeeper_tx)))
length(deseq_pair_keepertx)## [1] 1806
The following invocation performed by Theresa filters the wt/het comparison for only those genes which increased by at least 0.25 logFC with a significant adjusted p-value. I assume that this is to use the wt samples as a translational control for the ket/ko comparisons; I am therefore thinking that for my purposes, I will therefore separate the contrasts from all_pairwise do this in a stepwise fashion…
The block of code immediately following Theresa’s all_pairwise() invocation is a little confusing for me and warrants some explanation by me to me in the hopes that I do not misunderstand what is happening and the goals therein.
I think I can safely assume that the goal here is to pull out the IDs which increased in het with respect to wild type; even if by a small margin, as long as it is statistically significant vis a vis the adjusted p-value.
I am going to perform what I think is the same thing in a slightly different fashion so that I can share a copy of the results with whomever is interested. I will also repeat Theresa’s invocation and prove to myself that I understood and got the same answer.
wt_het_keeper <- list("het_vs_wt" = c("het_retina", "wt_retina"))
het_wt_table <- combine_de_tables(
mm_normal_p8_ret_de, keepers = wt_het_keeper, label_column = label_column,
excel = "03theresa_comparison_excel_tx/het_retina_control.xlsx")## Looking for subscript invalid names, end of extract_keepers.
wanted_sig <- extract_significant_genes(
het_wt_table, lfc = 0.25, according_to = "deseq",
excel = "03theresa_comparison_excel_tx/het_retina_control-sig.xlsx")
wanted_het_increased <- wanted_sig[["deseq"]][["ups"]][["het_vs_wt"]]
increased_het_genes <- rownames(wanted_het_increased)Here are Theresa’s next lines:
mm_de_normal_p8_ret <- mm_normal_p8_ret_de
hetkeeper_tx <- mm_de_normal_p8_ret$deseq$all_tables$wt_retina_vs_het_retina |>
filter(logFC <= -0.25 & adj.P.Val <= 0.05)
kokeeper_tx <- mm_de_normal_p8_ret$deseq$all_tables$wt_retina_vs_ko_retina |>
filter(logFC <= -0.25 & adj.P.Val <= 0.05)
keepertx <- unique(c(rownames(hetkeeper_tx),
rownames(kokeeper_tx)))
## We know a priori that Opn4 is ENSMUSG00000021799
## I do not expect to see it in this set, it should be higher in wt
## retina vs ko retina by a significant margin.
## "ENSMUSG00000021799" %in% keepertx
## Oooohhh but it _is_ higher in het vs. wt, as we saw in
## the violin plot earlier.I think Rashmi made a compelling point which illustrates why we likely should expect the expression of Opn4 to significantly higher in the heterozygotes vs wild-type:
This makes me wonder if any normalization methods exist which do something like multiply the values by some value related to the proportion of observed genes; and/or if this is a good/bad/indifferent idea.
Also, just a note for me to remember: RPL22, not RPS22, for some reason I keep thinking the small subunit.
hetkeeper_tx <- mm_normal_p8_ret_de$deseq$all_tables$wt_retina_vs_het_retina |>
filter(logFC <= -0.25 & adj.P.Val <= 0.05)
testthat::expect_true(nrow(hetkeeper_tx) == length(increased_het_genes))
taa_keepers <- sort(rownames(hetkeeper_tx))
atb_keepers <- sort(increased_het_genes)
testthat::expect_equal(taa_keepers, atb_keepers)Yay! I can read! Now let us repeat for the KO vs wt
wt_ko_keeper <- list("ko_vs_wt" = c("ko_retina", "wt_retina"))
ko_wt_table <- combine_de_tables(
mm_normal_p8_ret_de, keepers = wt_ko_keeper, label_column = label_column,
excel = "03theresa_comparison_excel_tx/ko_retina_control.xlsx")## Looking for subscript invalid names, end of extract_keepers.
wanted_sig <- extract_significant_genes(
ko_wt_table, lfc = 0.25, according_to = "deseq",
excel = "03theresa_comparison_excel_tx/ko_retina_control-sig.xlsx")
wanted_ko_increased <- wanted_sig[["deseq"]][["ups"]][["ko_vs_wt"]]
increased_ko_genes <- rownames(wanted_ko_increased)The next thing performed in Theresa’s document is a unique(concatenation of these two gene groups), thus sucking up every gene which was significantly higher in either the knockout or heterzyous samples with respect to wild-type.
This was followed by a couple of merge operations of a little bit of the annotation data; I am not sure I understand the goal yet…
Here is her code. I copied the annotation ‘mgi_symbol’ column to ‘external_gene_name’ so that I need not change any of her code. I am assuming this is the appropriate column of interest, I do not know this for certain, but it seems quite likely.
While I am at it, here is the set_sig_limma() function from Theresa’s helpers.R
set_sig_limma <- function(limma_tbl, factors = NULL) {
if (is.null(factors)) {
#set significance for plotting colors
limma_tbl$Significance <- NA
limma_tbl[abs(limma_tbl$logFC) < 1 | limma_tbl$adj.P.Val > .05, "Significance"] <- "Not \nEnriched"
limma_tbl[limma_tbl$logFC >= 1 & limma_tbl$adj.P.Val <= .05, ][["Significance"]] <- "Disease \nUpregulated"
limma_tbl[limma_tbl$logFC <= -1 & limma_tbl$adj.P.Val <= .05, ][["Significance"]] <- "Disease \nDownregulated"
limma_tbl$Significance <- factor(limma_tbl$Significance, levels = c("Upregulated", "Downregulated", "Not \nEnriched"))
} else {
limma_tbl$Significance <- NA
limma_tbl[abs(limma_tbl$logFC) < 1 | limma_tbl$adj.P.Val > .05, "Significance"] <- "Not \nEnriched"
if(nrow(limma_tbl[limma_tbl$logFC >= 1 & limma_tbl$adj.P.Val <= .05, ]) != 0) {
limma_tbl[limma_tbl$logFC >= 1 & limma_tbl$adj.P.Val <= .05, ][["Significance"]] <- factors[1]
}
if (nrow(limma_tbl[limma_tbl$logFC <= -1 & limma_tbl$adj.P.Val <= .05, ]) != 0) {
limma_tbl[limma_tbl$logFC <= -1 & limma_tbl$adj.P.Val <= .05, ][["Significance"]] <- factors[2]
}
limma_tbl$Significance <- factor(limma_tbl$Significance, levels = c(factors, "Not \nEnriched"))
}
return(limma_tbl)
}mm_tx_annot[["external_gene_name"]] <- mm_tx_annot[["mgi_symbol"]]
keepertx <- unique(c(rownames(hetkeeper_tx), rownames(kokeeper_tx)))
length(keepertx)## [1] 1806
annots_to_merge <- mm_tx_annot |>
select(ensembl_transcript_id, external_gene_name) |>
filter(ensembl_transcript_id %in%
rownames(mm_de_normal_p8_ret$deseq$all_tables$ko_retina_vs_het_retina)) |>
distinct()
mm_de_normal_p8_ret[["deseq"]][["all_tables"]][["ko_retina_vs_het_retina"]] <- merge(
mm_de_normal_p8_ret$deseq$all_tables$ko_retina_vs_het_retina, annots_to_merge,
by.x = "row.names", by.y = "row.names", all.x = TRUE)
df <- mm_de_normal_p8_ret$deseq$all_tables$ko_retina_vs_het_retina |>
dplyr::mutate(logFC = -logFC) |>
set_sig_limma(factors = c("Het Enriched", "KO Enriched"))My version of the above task makes use of the excludes option of combine_de_tabes. Given the set of unique gene IDs increased in the het/ko, I can ask to exlude anything not in that set. I could also have more parsimoniously directly excluded any gene ID increased in the wt samples. But, Theresa already provided the code to do the former, so it will be less typing/opportunity for silly mistakes to just do that.
both_increased_genes <- unique(c(increased_het_genes, increased_ko_genes))
## arbitrairly grab all genes from one of my data structures.
all_genes <- rownames(assay(mm38_hisat_tx))
exclude_idx <- all_genes %in% both_increased_genes
summary(exclude_idx)## Mode FALSE TRUE
## logical 64077 1806
exclude_increased_genes <- all_genes[exclude_idx]
retina_keepers <- list(
"het_vs_wt" = c("het_retina", "wt_retina"),
"ko_vs_wt" = c("ko_retina", "wt_retina"),
"ko_vs_het" = c("ko_retina", "het_retina"))
## A reminder to myself: there is also a parameter 'wanted_genes'
## which does effectively the same thing as excludes in this context;
## excludes was originally written to allow flexible, keyword-based
## exclusion.
p8_retina_tables <- combine_de_tables(
mm_normal_p8_ret_de, keepers = retina_keepers,
wanted_genes = both_increased_genes, label_column = label_column,
excel = glue("03theresa_comparison_excel_tx/p8_retina_kept_tx_increased_in_wt_tables-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
p8_retina_sig <- extract_significant_genes(
p8_retina_tables, according_to = "deseq",
excel = glue("03theresa_comparison_excel_tx/p8_retina_kept_genes_increased_in_wt_sig-v{ver}.xlsx"))
opposite_p8_retina_tables <- combine_de_tables(
mm_normal_p8_ret_de, keepers = retina_keepers,
excludes = both_increased_genes, label_column = label_column,
excel = glue("03theresa_comparison_excel_tx/p8_retina_removed_genes_increased_in_wt_tables-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
The following is a copy/paste from Theresa containing the remaining tasks she performed and will provide the template for implementation of the final tasks.
This picks up with the lines from her notebook immediately following the invocation of ‘set_sig_limma(factors = c(“Het Enriched” …’.
For all of the remaining blocks I will copy in her code, turn off its evaluation, run the blocks manually, compare them to her notebook output, then enable each block as I ensure I understand it.
I will likely therefore introduce some small formatting changes and add some additional GSEA/enrichment tasks once the non-specific filtering is complete.
df <- df |>
filter(Row.names %in% keepertx)
labels_ups <- df |>
filter(adj.P.Val <= 0.05 & abs(logFC) > 1) |>
arrange(logFC) |>
head(n = 9)
labels_downs <- df |>
filter(adj.P.Val <= 0.05 & abs(logFC) > 1) |>
arrange(-logFC) |>
head(n = 11)
labels <- rbind(labels_ups, labels_downs)
res_tbl <- df
DEplot <- ggplot(res_tbl, aes(x = logFC, y = -log10(adj.P.Val), label = external_gene_name)) +
geom_point(aes(colour = Significance), size = 4) +
geom_vline(xintercept = c(-1, 1)) +
geom_hline(yintercept = -log10(0.05)) +
theme_classic(base_size = 20) +
xlab("log2(FC)") +
ylab("-log10(p-value)") +
theme(legend.position = "right") +
scale_color_manual(values = c("#F8766D", "#00BFC4", "Grey")) +
geom_label_repel(
data = filter(df,
## c('s5_het_dlgn', 's5_het_ret', 's5_het_scn')),
external_gene_name %in% labels$external_gene_name),
## nudge_x = -0.5,
nudge_y = 3, max.overlaps = 15) +
xlim(c(-3, 6))
pp(file = "03theresa_comparison_images_tx/p08_retina_DE_1312024.pdf")
DEplot## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_label_repel()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_label_repel()`).
## Deleting the file excel_tx/retinahet_vs_retinako_WTfiltered.xlsx before writing the tables.
## write_xlsx() wrote excel_tx/retinahet_vs_retinako_WTfiltered.xlsx.
## The cursor is on sheet first, row: 1809 column: 14.
## [1] 15
## [1] 47
regulated_genes <- res_tbl |>
filter(adj.P.Val <= 0.05) |>
arrange(logFC) |>
select(Row.names, logFC, adj.P.Val, external_gene_name, Significance) |>
filter(abs(logFC) >= 1)
## gsea_result_ko <- gost(query = ko_genes$external_gene_name,
## organism = "mmusculus",
## evcodes = TRUE,
## ordered_query = TRUE)
gsea_result_het <- gost(query = het_enriched$external_gene_name,
organism = "mmusculus",
evcodes = TRUE,
ordered_query = TRUE)
##gsea_result_alldysregulated <- gost(query = alldysregulated_genes$external_gene_name,
## organism = "mmusculus",
## evcodes = TRUE,
## ordered_query = TRUE)I have a function in my package which seeks to make gProfiler queries a bit more complete and easy. Let us see how similar the result is…
rownames(alldysregulated_genes) <- alldysregulated_genes[["Row.names"]]
alldysregulated_genes[["Row.names"]] <- NULL
het_gp <- simple_gprofiler(rownames(alldysregulated_genes),
species = "mmusculus",
excel = glue("excel_tx/het_gprofiler-v{ver}.xlsx"))
het_gp
enrichplot::dotplot(het_gp[["BP_enrich"]])
gp_pair <- enrichplot::pairwise_termsim(het_gp[["BP_enrich"]])
enrichplot::emapplot(gp_pair)
enrichplot::ssplot(gp_pair)
enrichplot::treeplot(gp_pair)
upsetplot(het_gp[["BP_enrich"]])
enrichplot::dotplot(het_gp[["REAC_enrich"]])
gp_pair <- enrichplot::pairwise_termsim(het_gp[["REAC_enrich"]])
enrichplot::emapplot(gp_pair)
enrichplot::ssplot(gp_pair)
enrichplot::treeplot(gp_pair)
upsetplot(het_gp[["REAC_enrich"]])I make a somewhat arbitrary distinction between the concepts of over-enrichment analyses and GSEA: the former (as performed by gprofiler) (Raudvere et al. (2019)) seeks to find groups of genes overrepresented in GO/reactome/etc. These groups of genes are taken exclusively from the top-n/bottom-n genes with respect to fold-change between conditions of interest; in this case most different than wt in the p08 retina ko or het samples.
With that in mind, I can invoke a similar function using the full table of DE results to get what I call the GSEA result using clusterProfiler (Yu (n.d.)). In the following block I will use the ‘all_cprofiler’ function on the data structures named ‘p8_retina_tables’ and ‘opposite_p8_retina_tables’ in order to get these GSEA results for each contrast performed (het/wt, ko/wt, het/ko). I will follow that up with ‘all_gprofiler’ which does the same, but uses gProfiler’s enrichment analyses (it will therefore include what we just looked at).
p08_retina_all_cp <- all_cprofiler(
p8_retina_sig, p8_retina_tables, orgdb = "org.Mm.eg.db", orgdb_from = orgdb_from,
excel = "03theresa_comparison_excel_tx/cprofiler_p08_retina.xlsx")## There are 238 genes deemed significant out of 721.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.32% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 5 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## no term enriched under specific pvalueCutoff...
## Reading KEGG annotation online: "https://rest.kegg.jp/link/mmu/pathway"...
## Reading KEGG annotation online: "https://rest.kegg.jp/list/pathway/mmu"...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.34% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Loading required package: org.Mm.eg.db
## Loading required package: AnnotationDbi
## Loading required package: stats4
## Loading required package: BiocGenerics
## Loading required package: generics
##
## Attaching package: 'generics'
## The following object is masked from 'package:dplyr':
##
## explain
## The following objects are masked from 'package:base':
##
## as.difftime, as.factor, as.ordered, intersect, is.element, setdiff, setequal, union
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:hpgltools':
##
## conditions, conditions<-, IQR, mad, sd, var
## The following object is masked from 'package:dplyr':
##
## combine
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval, evalq, Filter,
## Find, get, grep, grepl, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
## Position, rank, rbind, Reduce, rownames, sapply, saveRDS, table, tapply, unique, unsplit, which.max, which.min
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with 'browseVignettes()'. To cite Bioconductor, see 'citation("Biobase")',
## and for packages 'citation("pkgname")'.
##
## Attaching package: 'Biobase'
## The following objects are masked from 'package:hpgltools':
##
## exprs<-, notes, pData<-, sampleNames<-
## Loading required package: IRanges
## Loading required package: S4Vectors
##
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:dplyr':
##
## first, rename
## The following object is masked from 'package:utils':
##
## findMatches
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
##
## Attaching package: 'IRanges'
## The following objects are masked from 'package:dplyr':
##
## collapse, desc, slice
##
## Attaching package: 'AnnotationDbi'
## The following object is masked from 'package:dplyr':
##
## select
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.32% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.32% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.32% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 1 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## leading edge analysis...
## done...
## Deleting the file 03theresa_comparison_excel_tx/cprofiler_p08_retina_het_vs_wt_up.xlsx before writing the tables.
## There are 2 genes deemed significant out of 721.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.32% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 4 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 94215,20322,11522,70757,74147,435802
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.34% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 18597,11848,16971,56453,17423,53897
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.32% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.32% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 2297,399744,4300,10613,2629,400986
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.32% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 1 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## leading edge analysis...
## done...
## Deleting the file 03theresa_comparison_excel_tx/cprofiler_p08_retina_het_vs_wt_down.xlsx before writing the tables.
## There are insufficient significant results to plot.
## There are 266 genes deemed significant out of 721.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 6 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.9% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : For some of the pathways the P-values were likely overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 8 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 03theresa_comparison_excel_tx/cprofiler_p08_retina_ko_vs_wt_up.xlsx before writing the tables.
## There are 7 genes deemed significant out of 721.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.82% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 03theresa_comparison_excel_tx/cprofiler_p08_retina_ko_vs_het_up.xlsx before writing the tables.
## There are 27 genes deemed significant out of 721.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.82% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 03theresa_comparison_excel_tx/cprofiler_p08_retina_ko_vs_het_down.xlsx before writing the tables.
## Starting: het_vs_wt_up.
## Starting: ko_vs_wt_up.
## Starting: ko_vs_het_up.
pp(file = "03theresa_comparison_images_tx/gsea_p08_retina_ko_vs_het_top_hit.pdf")
p08_topn_gsea[["GO_ko_vs_het_up"]][[1]]
dev.off()## png
## 2
pp(file = "03theresa_comparison_images_tx/gsea_p08_retina_het_vs_wt_top_hit.pdf")
p08_topn_gsea[["GO_het_vs_wt_up"]][[1]]## Error in `p08_topn_gsea[["GO_het_vs_wt_up"]][[1]]`:
## ! subscript out of bounds
## png
## 2
#gsea_ko <- gsea_result_ko[["result"]] |>
# select(term_name, p_value, term_size, intersection_size, recall, source, intersection) |>
# arrange(desc(recall)) |>
# head(n = 10)
# gsea_plots_ko <- ggplot(gsea_ko, aes(x = recall, y = reorder(term_name, recall), fill = p_value)) +
# geom_bar(stat = "identity")+
# scale_fill_continuous(low = "blue", high = "red") +
# theme_bw()+
# ylab("") +
# xlab("GSEA Score")
gsea_het <- gsea_result_het[["result"]] |>
dplyr::select(term_name, p_value, term_size, intersection_size, recall, source, intersection) |>
arrange(desc(recall)) |>
head(n = 10)
gsea_plots_het <- ggplot(gsea_het, aes(x = recall, y = reorder(term_name, recall), fill = p_value)) +
geom_bar(stat = "identity") +
scale_fill_continuous(low = "blue", high = "red") +
theme_bw() +
ylab("") +
xlab("Over Representation Score")
pp(file = "03theresa_comparison_images_tx/GSEA_p08_axontrap_retinahet_upregulated_vs_retinako.pdf")
gsea_plots_het
plotted <- dev.off()
gsea_plots_hetIt is only now that I realized we are splitting the data by location for each set of comparisons. I think that, left to my own devices, I would prefer to keep the input data structure intact, perform the somewhat larger number of contrasts, and then split up the results. Ideally this will slightly improve the fidelity of the results returned by DESeq2 and friends. But, I will run the state of Theresa’s notebook with as few changes as possible first, then add this.
I am going to skip this PCA plot for a couple of reasons: I already did a superset of it, and the subset Theresa performed is not valid given the set of samples included in my sample sheet, and figuring out the actually corresponding subset will take me forever… In addition, I want to use my mm38_hisat_tx for everything…
scn_samples <- subset_se(mm38_hisat_tx,
subset = "location_atb == 'scn'") |>
set_batches(fact = "location_atb") |>
set_conditions(fact = "genotype_atb", colors = color_choices[["genotype"]])## The number of samples by batch are:
##
## scn
## 17
## The numbers of samples by condition are:
##
## het ko wt
## 6 6 5
scn_norm <- normalize(scn_samples, filter = TRUE, convert = "cpm",
transform = "log2", batch = "svaseq")## Removing 54027 low-count genes (11856 remaining).
## transform_counts: Found 11723 values less than 0.
## transform_counts: Found 11723 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 het, ko, wt
## Shapes are defined by scn.
Theresa’s next operation was to perform libsize/nonzero plots. I already did the pre/post deduplication nonzero, here is the analagous libsize.
v2 is pre-deduplication and v3 is post.
post_filter_nonzero <- plot_quantreads(mm38_hisat_tx, text = FALSE)
pp(file = "01diagnostic_images_tx/post_all_filteres_nonzero.pdf")
post_filter_nonzero[["plot"]]
plotted <- dev.off()
post_filter_nonzero## Library sizes of 63 samples,
## ranging from 333,226 to 2,996,801.
Theresa also produced a density/sample plot, that might prove quite useful for these due to their significantly larger variance across samples (due to deduplication).
pp(file = "01diagnostic_images_tx/sample_density.pdf")
mm38_density <- plot_density(loc_geno_nt)
mm38_density[["plot"]] +
theme(legend.position = "none")
plot_boxplot(loc_geno_nt)## Plot describing the gene distribution from a dataset.
## png
## 2
## Plot describing the gene distribution from a dataset.
## png
## 2
## Plot describing the gene distribution from a dataset.
There is some difference across sample densities, but it is not too crazytown.
At this point in the document I read ahead a bit and came to the conclusion that it repeats the above logic of taking the union of wt comparisons to remove genes from the appropriate het/ko or p15/p08 or location comparisons. This seems quite reasonable to me, but I would prefer to not separate all the data, so I will attempt to duplicate and slightly streamline this logic on the full dataset. Thus I am going to skip down to the end and attempt to implement this.
I want to have an invocation of all_pairwise() which uses all samples, in the following block I will set that up using a set of ‘keepers’ which will be named by time, location, then 2 letters for the numerator/denominator: w for WT, h for het, d for delta; thus “p08_retina_hw” is comparing the het/wt for the p08 retina samples.
If they are of interest, I will have a separate set which follows the same convention with names like “p08_ko_sr” to compare p08 deltas with SCN as the numerator and retina as the denominator.
The most peculiar aspect of this analysis resides in the choices around choosing which genes to consider when comparing the genotypes/locations/times. The general idea is pretty clear: find the genes which are non-specifically being pulled down in the WT samples and either exclude or discount them. The various potential methods for performing this are confusing:
Theresa’s current worksheet implements a version of 1b in which she separated the various input gene sets to define the exclusion genes. I am going to repeat this, but leave the starting data structure intact.
In this first iteration, I will do that by creating a simplified model of the data which combines the time/genotype/location and using sva. In my next iteration I will use a full statistical model containing each of those factors (and probably also using sva).
Note: my color choices are kind of garbage.
In addition, the exclusion dataset is the same as the analysis dataset, it is really only the contrasts which will be different.
tx_pairwise_input <- set_conditions(mm38_hisat_tx, fact = "time_geno_loc",
colors = color_choices[["all"]])## The numbers of samples by condition are:
##
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Warning in set_colors(meta, colors = colors, color_column = color_column, : This list does not match the samples nor conditions.
## This function is intended to set the colors of a dataset.
## It was passed an object of type data.frame and does not know what to do.
all_cond_gene_heatmap_start <- normalize(tx_pairwise_input, filter = "simple",
length_column = "cds_length",
convert = "rpkm", transform = "log2")## Removing 50190 low-count genes (15693 remaining).
## About to perform a RPKM conversion where NA lengths are set to: 1000.
## There appear to be 8 genes without a length.
## Setting the elements with NA length to 1000.
## transform_counts: Found 354582 values equal to 0, adding 1 to the matrix.
## The factor p08_het_dlgn has 3 rows.
## The factor p08_het_retina has 3 rows.
## The factor p08_het_scn has 3 rows.
## The factor p08_ko_dlgn has 3 rows.
## The factor p08_ko_retina has 3 rows.
## The factor p08_ko_scn has 3 rows.
## The factor p08_wt_dlgn has 5 rows.
## The factor p08_wt_retina has 5 rows.
## The factor p08_wt_scn has 3 rows.
## The factor p15_het_dlgn has 4 rows.
## The factor p15_het_retina has 4 rows.
## The factor p15_het_scn has 3 rows.
## The factor p15_ko_dlgn has 3 rows.
## The factor p15_ko_retina has 3 rows.
## The factor p15_ko_scn has 3 rows.
## The factor p15_wt_dlgn has 5 rows.
## The factor p15_wt_retina has 5 rows.
## The factor p15_wt_scn has 2 rows.
all_cond_mtrx <- all_cond_gene_heatmap_input[["medians"]]
color_order <- colnames(all_cond_mtrx)
na_idx <- is.na(all_cond_mtrx)
all_cond_mtrx[na_idx] <- 0
variances <- matrixStats::rowVars(as.matrix(all_cond_mtrx))
variant_genes <- variances > 6.2
input_mtrx <- all_cond_mtrx[variant_genes, ]
cond_colors <- get_colors_by_condition(tx_pairwise_input, levels = color_order)
dim(input_mtrx)## [1] 146 18
pp(file = "04inclusion_comparisons_tx/top_104_variant_rpkm_genes_heatmap.pdf")
gplots::heatmap.2(as.matrix(input_mtrx), scale = "none", trace = "none",
ColSideColors = cond_colors)
dev.off()## png
## 2
Rashmi suggested we should do the above plot after subtracting the wt counts. This is a good idea, but it will have to wait until we finish the current set.
In the following few blocks I will set up the various comparisons of interest. Starting with the set of genes to exclude because they were observed to bind non-specifically in the wt samples.
In each exclusion I will have the contrast first followed by the pair of contrasts which will be used to define the gene set to exclude.
Put slightly differently, for every term of interest I will create a contrast with the wt as numerator and the desired term as denominator, then pull out the genes increased in wt.
inclusions <- list(
## I like alphabetizing things, start with dlgn
"p15_het_dlgn" = c("p15_het_dlgn", "p15_wt_dlgn"),
"p08_het_dlgn" = c("p08_het_dlgn", "p08_wt_dlgn"),
"p15_ko_dlgn" = c("p15_ko_dlgn", "p15_wt_dlgn"),
"p08_ko_dlgn" = c("p08_ko_dlgn", "p08_wt_dlgn"),
## Then retinas
"p15_het_retina" = c("p15_het_retina", "p15_wt_retina"),
"p08_het_retina" = c("p08_het_retina", "p08_wt_retina"),
"p15_ko_retina" = c("p15_ko_retina", "p15_wt_retina"),
"p08_ko_retina" = c("p08_ko_retina", "p08_wt_retina"),
## Then scn
"p15_het_scn" = c("p15_het_scn", "p15_wt_scn"),
"p08_het_scn" = c("p08_het_scn", "p08_wt_scn"),
"p15_ko_scn" = c("p15_ko_scn", "p15_wt_scn"),
"p08_ko_scn" = c("p08_ko_scn", "p08_wt_scn"))For each location/genotype of interest, let us compare p15/p08
time_keepers <- list(
## DLGN
"t_het_dlgn" = c("p15_het_dlgn", "p08_het_dlgn"),
"t_ko_dlgn" = c("p15_ko_dlgn", "p08_ko_dlgn"),
## Retina
"t_het_retina" = c("p15_het_retina", "p08_het_retina"),
"t_ko_retina" = c("p15_ko_retina", "p08_ko_retina"),
## SCN
"t_het_scn" = c("p15_het_scn", "p08_het_scn"),
"t_ko_scn" = c("p15_ko_scn", "p08_ko_scn"))Compare locations and keep time/genotype consistent. I will use the location initials to define numerator/denominator.
location_keepers <- list(
## dlgn/retina
"dr_p08_het" = c("p08_het_dlgn", "p08_het_retina"),
"dr_p15_het" = c("p15_het_dlgn", "p15_het_retina"),
"dr_p08_ko" = c("p08_ko_dlgn", "p08_ko_retina"),
"dr_p15_ko" = c("p15_ko_dlgn", "p15_ko_retina"),
## scn/retina
"sr_p08_het" = c("p08_het_scn", "p08_het_retina"),
"sr_p15_het" = c("p15_het_scn", "p15_het_retina"),
"sr_p08_ko" = c("p08_ko_scn", "p08_ko_retina"),
"sr_p15_ko" = c("p15_ko_scn", "p15_ko_retina"),
## dlgn/scn
"ds_p08_het" = c("p08_het_dlgn", "p08_het_scn"),
"ds_p15_het" = c("p15_het_dlgn", "p15_het_scn"),
"ds_p08_ko" = c("p08_ko_dlgn", "p08_ko_scn"),
"ds_p15_ko" = c("p15_ko_dlgn", "p15_ko_scn"))Compare ko/het while keeping time/location constant. Similarly, use the initials to denote numerator/denominator, which will always be kh.
genotype_keepers <- list(
## DLGN
"kh_p08_dlgn" = c("p08_ko_dlgn", "p08_het_dlgn"),
"kh_p15_dlgn" = c("p15_ko_dlgn", "p15_het_dlgn"),
## Retina
"kh_p08_retina" = c("p08_ko_retina", "p08_het_retina"),
"kh_p15_retina" = c("p15_ko_retina", "p15_het_retina"),
## SCN
"kh_p08_scn" = c("p08_ko_scn", "p08_het_scn"),
"kh_p15_scn" = c("p15_ko_scn", "p15_het_scn"))My all_pairwise() function now has a parameter which allows me to choose which contrasts to perform instead of literally doing every possible comparison. That is well suited for these operations:
In a container, the following appears to fail with:
“error code 1 from Lapack routine ‘dgesdd’”
Running it manually outside the container results in it working without error. I assume therefore that the problem lies in the compilation flags of LAPACK in the container.
Note: This problem was fixed by removing some parallelization.
inclusion_de <- all_pairwise(
tx_pairwise_input, filter = "simple", model_fstring = default_fstring,
keepers = inclusions, model_svs = "svaseq")## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 50190 low-count genes (15693 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 393901 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## 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 12 comparisons.
inclusion_tables <- combine_de_tables(
inclusion_de, keepers = inclusions, label_column = label_column,
excel = glue("04inclusion_comparisons_tx/inclusion_tables-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 p15_het_dlgn_vs_p15_wt_dlgn 316 428 384 497 436 586
## 2 p08_het_dlgn_vs_p08_wt_dlgn 40 116 73 144 149 134
## 3 p15_ko_dlgn_vs_p15_wt_dlgn 566 652 623 785 540 668
## 4 p08_ko_dlgn_vs_p08_wt_dlgn 179 271 171 337 244 495
## 5 p15_het_retina_vs_p15_wt_retina 89 28 143 56 56 23
## 6 p08_het_retina_vs_p08_wt_retina 275 113 325 197 182 57
## 7 p15_ko_retina_vs_p15_wt_retina 31 8 100 44 21 10
## 8 p08_ko_retina_vs_p08_wt_retina 288 88 337 156 183 50
## 9 p15_het_scn_vs_p15_wt_scn 3 4 47 25 43 172
## 10 p08_het_scn_vs_p08_wt_scn 2 1 43 34 37 23
## 11 p15_ko_scn_vs_p15_wt_scn 1 3 38 37 246 208
## 12 p08_ko_scn_vs_p08_wt_scn 1 2 62 29 75 70
## 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 at <https://github.com/hms-dbmi/UpSetR/issues>.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## 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 at <https://github.com/hms-dbmi/UpSetR/issues>.
## 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.
## 202603: I successfully recapitulated previous non-container result.
inclusion_sig <- extract_significant_genes(
inclusion_tables, lfc = lfc_cutoff, p = adjp_cutoff, according_to = "deseq",
excel = glue("04inclusion_comparisons_tx/inclusion_sig-v{ver}.xlsx"))
inclusion_sig## A set of genes deemed significant according to deseq.
## The parameters defining significant were:
## LFC cutoff: 0.1 adj P cutoff: 0.1
## deseq_up deseq_down
## p15_het_dlgn 1004 1041
## p08_het_dlgn 178 318
## p15_ko_dlgn 1341 1267
## p08_ko_dlgn 517 488
## p15_het_retina 213 100
## p08_het_retina 537 343
## p15_ko_retina 66 16
## p08_ko_retina 573 265
## p15_het_scn 6 6
## p08_het_scn 11 8
## p15_ko_scn 2 3
## p08_ko_scn 7 5
202505: A strange thing happened here in this iteration: the plot of the significant genes is the exact same as the previous iteration; but the table of numbers of genes looks different.
For example, the previous table showed: p15_het_dlgn with 2067 up and 2381 down. The plot shows exactly that; but the new table shows 607 up and 1229 down. Let us check the actual data structure and see what is up?
I think I get it: when we do the extract_significant_genes above, we explicitly set a non-standard p-value and logFC because we are explicitly attempting to use a very loose definition of the set of genes which are in greater abundance than their most similar wild-type. However, when I create the barplot of significant genes; those values are explicitly set to 0,1,2 logFCs and p-value 0.05. Therefore, what I need to do, in order to check consistency, is to repeat this call but with the default FC/p values and see what the numbers look like.
test_inclusion <- extract_significant_genes(
inclusion_tables, according_to = "deseq", excel = "excel_tx/default_inclusion_sig.xlsx")## Deleting the file excel_tx/default_inclusion_sig.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
## p15_het_dlgn 316 428
## p08_het_dlgn 40 116
## p15_ko_dlgn 566 652
## p08_ko_dlgn 179 271
## p15_het_retina 89 28
## p08_het_retina 275 113
## p15_ko_retina 31 8
## p08_ko_retina 288 88
## p15_het_scn 3 4
## p08_het_scn 2 1
## p15_ko_scn 1 3
## p08_ko_scn 1 2
Yeah, I think this makes sense; what I need to do: change the significant bar plot so that it uses the lfc cutoff argument as the second of its 3 cutoffs. That should ensure that these numbers are consistent across analyses and parameters provided.
## [1] 1004 72
test_all_up <- inclusion_tables$data$p15_het_dlgn[["deseq_logfc"]] > 0.1 &
inclusion_tables$data$p15_het_dlgn[["deseq_adjp"]] <= 0.1
summary(test_all_up)## Mode FALSE TRUE
## logical 14689 1004
Ohh, I get it, when I was testing this out manually, I set the logFC to 1.0 instead of the very minimal 0.1 we have been using for this!
Rashmi asked to see the comparisons against wt; I will name each file xw to show that it is x vs wt. for whatever other parameters are being examined. It is likely that some colors will be wrong because this is my first time creating these plots and we are doing them manually.
allc <- color_choices[["all"]]
table_name <- "p15_het_dlgn"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p15_het_dlgn"
denom <- "p15_wt_dlgn"
hw_p15_dlgn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/hw_p15_dlgn_volcano.pdf", width = 9, height = 9)
hw_p15_dlgn_volcano[["plot"]]
plotted <- dev.off()
hw_p15_dlgn_volcano[["plot"]]hw_p15_dlgn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/hw_p15_dlgn_ma.pdf", width = 9, height = 9)
hw_p15_dlgn_ma[["plot"]]
plotted <- dev.off()
hw_p15_dlgn_ma[["plot"]]table_name <- "p08_het_dlgn"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p08_het_dlgn"
denom <- "p08_wt_dlgn"
hw_p08_dlgn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/hw_p08_dlgn_volcano.pdf", width = 9, height = 9)
hw_p08_dlgn_volcano[["plot"]]
plotted <- dev.off()
hw_p08_dlgn_volcano[["plot"]]hw_p08_dlgn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/hw_p08_dlgn_ma.pdf", width = 9, height = 9)
hw_p08_dlgn_ma[["plot"]]
plotted <- dev.off()
hw_p08_dlgn_ma[["plot"]]table_name <- "p15_ko_dlgn"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p15_ko_dlgn"
denom <- "p15_wt_dlgn"
kw_p15_dlgn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/kw_p15_dlgn_volcano.pdf", width = 9, height = 9)
kw_p15_dlgn_volcano[["plot"]]
plotted <- dev.off()
kw_p15_dlgn_volcano[["plot"]]kw_p15_dlgn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/kw_p15_dlgn_ma.pdf", width = 9, height = 9)
kw_p15_dlgn_ma[["plot"]]
plotted <- dev.off()
kw_p15_dlgn_ma[["plot"]]HERE
table_name <- "p08_ko_dlgn"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p08_ko_dlgn"
denom <- "p08_wt_dlgn"
kw_p08_dlgn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/kw_p08_dlgn_volcano.pdf", width = 9, height = 9)
kw_p08_dlgn_volcano[["plot"]]
plotted <- dev.off()
kw_p08_dlgn_volcano[["plot"]]kw_p08_dlgn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/kw_p08_dlgn_ma.pdf", width = 9, height = 9)
kw_p08_dlgn_ma[["plot"]]
plotted <- dev.off()
kw_p08_dlgn_ma[["plot"]]table_name <- "p15_het_retina"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p15_het_retina"
denom <- "p15_wt_retina"
hw_p15_retina_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/hw_p15_retina_volcano.pdf", width = 9, height = 9)
hw_p15_retina_volcano[["plot"]]
plotted <- dev.off()
hw_p15_retina_volcano[["plot"]]hw_p15_retina_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/hw_p15_retina_ma.pdf", width = 9, height = 9)
hw_p15_retina_ma[["plot"]]
plotted <- dev.off()
hw_p15_retina_ma[["plot"]]table_name <- "p08_het_retina"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p08_het_retina"
denom <- "p08_wt_retina"
hw_p08_retina_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/hw_p08_retina_volcano.pdf", width = 9, height = 9)
hw_p08_retina_volcano[["plot"]]
plotted <- dev.off()
hw_p08_retina_volcano[["plot"]]hw_p08_retina_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/hw_p08_retina_ma.pdf", width = 9, height = 9)
hw_p08_retina_ma[["plot"]]
plotted <- dev.off()
hw_p08_retina_ma[["plot"]]table_name <- "p15_ko_retina"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p15_ko_retina"
denom <- "p15_wt_retina"
kw_p15_retina_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/kw_p15_retina_volcano.pdf", width = 9, height = 9)
kw_p15_retina_volcano[["plot"]]
plotted <- dev.off()
kw_p15_retina_volcano[["plot"]]kw_p15_retina_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/kw_p15_retina_ma.pdf", width = 9, height = 9)
kw_p15_retina_ma[["plot"]]
plotted <- dev.off()
kw_p15_retina_ma[["plot"]]table_name <- "p08_ko_retina"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p08_ko_retina"
denom <- "p08_wt_retina"
kw_p08_retina_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/kw_p08_retina_volcano.pdf", width = 9, height = 9)
kw_p08_retina_volcano[["plot"]]
plotted <- dev.off()
kw_p08_retina_volcano[["plot"]]kw_p08_retina_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/kw_p08_retina_ma.pdf", width = 9, height = 9)
kw_p08_retina_ma[["plot"]]
plotted <- dev.off()
kw_p08_retina_ma[["plot"]]table_name <- "p15_het_scn"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p15_het_scn"
denom <- "p15_wt_scn"
hw_p15_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/hw_p15_scn_volcano.pdf", width = 9, height = 9)
hw_p15_scn_volcano[["plot"]]
plotted <- dev.off()
hw_p15_scn_volcano[["plot"]]hw_p15_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/hw_p15_scn_ma.pdf", width = 9, height = 9)
hw_p15_scn_ma[["plot"]]
plotted <- dev.off()
hw_p15_scn_ma[["plot"]]table_name <- "p08_het_scn"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p08_het_scn"
denom <- "p08_wt_scn"
hw_p08_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/hw_p08_scn_volcano.pdf", width = 9, height = 9)
hw_p08_scn_volcano[["plot"]]
plotted <- dev.off()
hw_p08_scn_volcano[["plot"]]hw_p08_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/hw_p08_scn_ma.pdf", width = 9, height = 9)
hw_p08_scn_ma[["plot"]]
plotted <- dev.off()
hw_p08_scn_ma[["plot"]]table_name <- "p15_ko_scn"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p15_ko_scn"
denom <- "p15_wt_scn"
kw_p15_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/kw_p15_scn_volcano.pdf", width = 9, height = 9)
kw_p15_scn_volcano[["plot"]]
plotted <- dev.off()
kw_p15_scn_volcano[["plot"]]kw_p15_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/kw_p15_scn_ma.pdf", width = 9, height = 9)
kw_p15_scn_ma[["plot"]]
plotted <- dev.off()
kw_p15_scn_ma[["plot"]]table_name <- "p08_ko_scn"
table <- inclusion_tables[["data"]][[table_name]]
num <- "p08_ko_scn"
denom <- "p08_wt_scn"
kw_p08_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = allc[[denom]], color_high = allc[[num]],
label_column = "mgi_symbol", label = 10, alpha = 1.0,
size = 4)
pp(file = "05inclusion_volcano_ma_tx/kw_p08_scn_volcano.pdf", width = 9, height = 9)
kw_p08_scn_volcano[["plot"]]
plotted <- dev.off()
kw_p08_scn_volcano[["plot"]]kw_p08_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = allc[[denom]], color_high = allc[[num]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = 10)
pp(file = "05inclusion_volcano_ma_tx/kw_p08_scn_ma.pdf", width = 9, height = 9)
kw_p08_scn_ma[["plot"]]
plotted <- dev.off()
kw_p08_scn_ma[["plot"]]See the shared/unique genes in these sets.
inclusion_upsets <- upsetr_sig(inclusion_sig)
inclusion_intersects <- write_upset_groups(
inclusion_upsets, excel = "04inclusion_comparison_tx/inclusion_gene_groups.xlsx")## Deleting the file 04inclusion_comparison_tx/inclusion_gene_groups.xlsx before writing the tables.
Now, using that function, pull out the gene IDs of genes we do not trust because they were too high in wt for every contrast we are likely to perform.
The following was a modified version of the inclusion function which is somewhat more restrictive.
extract_inclusions_strict <- function(inclusion_sig, inclusion_tables, inclusions, keepers,
all_genes, according_to = "deseq", which = "ups") {
retlist <- list()
table_names <- names(inclusion_sig[[according_to]][[which]])
for (c_num in seq_along(keepers)) {
contrast <- names(keepers)[c_num]
numerator_name <- keepers[[c_num]][1]
denominator_name <- keepers[[c_num]][2]
## In my new branch I cleaned up the sanitizer function for contrasts so this is not needed.
## The following two lines are no longer needed because of the cleanups I performed.
##numerator_name <- gsub(x = numerator_name, pattern = "(het|ko|wt)", replacement = "_\\1_")
##denominator_name <- gsub(x = denominator_name, pattern = "(het|ko|wt)", replacement = "_\\1_")
numerator_table <- inclusion_sig[[according_to]][[which]][[numerator_name]]
numerator_genes <- rownames(numerator_table)
denominator_table <- inclusion_sig[[according_to]][[which]][[denominator_name]]
denominator_genes <- rownames(denominator_table)
df_columns <- paste0("deseq_", c("logfc", "adjp", "den"))
included_num <- inclusion_tables[["data"]][[numerator_name]][, df_columns]
colnames(included_num) <- c("numerator_vs_wt_logfc", "numerator_vs_wt_adjp", "num_wt_mean_exprs")
included_den <- inclusion_tables[["data"]][[denominator_name]][, df_columns]
colnames(included_den) <- c("denominator_vs_wt_logfc", "denominator_vs_wt_adjp", "den_wt_mean_exprs")
## I think this is where things went wrong,
## compare this modified line to the original to prove it.
included_df <- merge(included_num, included_den, by = "row.names")
## Previously, I did not specify the merge action, all = FALSE by default.
## This then will result in a difference in the rows observed
## included_df <- merge(included_num, included_den, by = "row.names", all = FALSE)
rownames(included_df) <- included_df[["Row.names"]]
included_df[["Row.names"]] <- NULL
concatenated_genes <- c(numerator_genes, denominator_genes)
both_gene_idx <- duplicated(concatenated_genes)
genes_in_both <- concatenated_genes[both_gene_idx]
message("The set of unique genes higher in ", numerator_name,
" vs. wt is ", length(numerator_genes), ".")
message("The set of unique genes higher in ", denominator_name,
" vs. wt is ", length(denominator_genes), ".")
message("The intersection of them is ", length(genes_in_both), " genes.")
include_name <- paste0("inc_", contrast)
include_idx <- all_genes %in% genes_in_both
include_genes <- all_genes[include_idx]
df_name <- paste0("df_", contrast)
retlist[[df_name]] <- included_df
written_inclusion <- write_xlsx(
data = included_df,
excel = glue("07included_strict_genes_excel_tx/{include_name}-v{ver}.xlsx"))
retlist[[include_name]] <- include_genes
retlist[[contrast]] <- include_genes
}
return(retlist)
}This is the pre-202505 version of this function.
extract_inclusions <- function(inclusion_sig, inclusion_tables, inclusions, keepers, all_genes,
according_to = "deseq", which = "ups") {
retlist <- list()
table_names <- names(inclusion_sig[[according_to]][[which]])
for (c_num in seq_along(keepers)) {
contrast <- names(keepers)[c_num]
numerator_name <- keepers[[c_num]][1]
denominator_name <- keepers[[c_num]][2]
## In my new branch I cleaned up the sanitizer function for contrasts so this is not needed.
## The following two lines are no longer needed because of the cleanups I performed.
##numerator_name <- gsub(x = numerator_name, pattern = "(het|ko|wt)", replacement = "_\\1_")
##denominator_name <- gsub(x = denominator_name, pattern = "(het|ko|wt)", replacement = "_\\1_")
numerator_table <- inclusion_sig[[according_to]][[which]][[numerator_name]]
numerator_genes <- rownames(numerator_table)
denominator_table <- inclusion_sig[[according_to]][[which]][[denominator_name]]
denominator_genes <- rownames(denominator_table)
df_columns <- paste0("deseq_", c("logfc", "adjp", "den"))
included_num <- inclusion_tables[["data"]][[numerator_name]][, df_columns]
colnames(included_num) <- c("numerator_vs_wt_logfc", "numerator_vs_wt_adjp", "num_wt_mean_exprs")
included_den <- inclusion_tables[["data"]][[denominator_name]][, df_columns]
colnames(included_den) <- c("denominator_vs_wt_logfc", "denominator_vs_wt_adjp", "den_wt_mean_exprs")
included_df <- merge(included_num, included_den, by = "row.names")
rownames(included_df) <- included_df[["Row.names"]]
included_df[["Row.names"]] <- NULL
include_genes <- unique(c(numerator_genes, denominator_genes))
message("The set of unique genes higher in ", numerator_name,
" vs. wt is ", length(numerator_genes), ".")
message("The set of unique genes higher in ", denominator_name,
" vs. wt is ", length(denominator_genes), ".")
message("The unique union of them is ", length(include_genes), " genes.")
include_name <- paste0("inc_", contrast)
include_idx <- all_genes %in% include_genes
include_genes <- all_genes[include_idx]
df_name <- paste0("df_", contrast)
retlist[[df_name]] <- included_df
written_inclusion <- write_xlsx(data = included_df,
excel = glue("included_genes_tx/{include_name}-v{ver}.xlsx"))
retlist[[include_name]] <- include_genes
retlist[[contrast]] <- include_genes
}
return(retlist)
}Here is the full set of gene IDs
In the following blocks I am including the union of genes observed higher than wt in either of the numerator or denominator for each contrast.
time_inclusions <- extract_inclusions(inclusion_sig, inclusion_tables, inclusions,
time_keepers, all_genes)## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The unique union of them is 1045 genes.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The unique union of them is 1596 genes.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The unique union of them is 605 genes.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The unique union of them is 592 genes.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The unique union of them is 17 genes.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The unique union of them is 8 genes.
location_inclusions <- extract_inclusions(inclusion_sig, inclusion_tables, inclusions,
location_keepers, all_genes)## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The unique union of them is 693 genes.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The unique union of them is 1145 genes.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The unique union of them is 1015 genes.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The unique union of them is 1391 genes.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The unique union of them is 548 genes.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The unique union of them is 219 genes.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The unique union of them is 577 genes.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The unique union of them is 67 genes.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The unique union of them is 189 genes.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The unique union of them is 1010 genes.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The unique union of them is 520 genes.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The unique union of them is 1342 genes.
genotype_inclusions <- extract_inclusions(inclusion_sig, inclusion_tables, inclusions,
genotype_keepers, all_genes)## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The unique union of them is 589 genes.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The unique union of them is 1457 genes.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The unique union of them is 756 genes.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The unique union of them is 230 genes.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The unique union of them is 17 genes.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The unique union of them is 7 genes.
time_inclusions_strict <- extract_inclusions_strict(inclusion_sig, inclusion_tables, inclusions,
time_keepers, all_genes)## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The intersection of them is 137 genes.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The intersection of them is 262 genes.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The intersection of them is 145 genes.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The intersection of them is 47 genes.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The intersection of them is 0 genes.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The intersection of them is 1 genes.
location_inclusions_strict <- extract_inclusions_strict(inclusion_sig, inclusion_tables, inclusions,
location_keepers, all_genes)## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The intersection of them is 22 genes.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The intersection of them is 72 genes.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The intersection of them is 75 genes.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The intersection of them is 16 genes.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The intersection of them is 0 genes.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The intersection of them is 0 genes.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The intersection of them is 3 genes.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The intersection of them is 1 genes.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The intersection of them is 0 genes.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The intersection of them is 0 genes.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The intersection of them is 4 genes.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The intersection of them is 1 genes.
genotype_inclusions_strict <- extract_inclusions_strict(inclusion_sig, inclusion_tables, inclusions,
genotype_keepers, all_genes)## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The intersection of them is 106 genes.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The intersection of them is 888 genes.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The intersection of them is 354 genes.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The intersection of them is 49 genes.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The intersection of them is 1 genes.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The intersection of them is 1 genes.
Up above Theresa performed a 0.25 log2FC and 0.05 adjp filter which provided a set of 2,640 genes observed higher in the p08 het retinas vs. wt retinas. I should see that in this inclusion_sig data structure.
There is an important caveat though: in Theresa’s filter above, she did a DE of only the retina samples but I did all samples. I expected that this would result in basically the same result (I actually assumed I would get a few more genes), but instead it appears to have retrieved a significantly smaller number of genes (about 1/2, happily they pretty much all appear in the previous filter). As a result, I am going to try relaxing my constraints slightly to see if I can recapitulate her filter (which would match Theresa’s later filter, though I guess that in turn will lead to a smaller set of genes compared to her later, relaxed 0.1 filter).
comparison <- inclusion_sig[["deseq"]][["ups"]][["p08_het_retina"]]
comp <- list(
"taa" = taa_keepers,
"new" = rownames(comparison))
test_comparison <- Vennerable::Venn(comp)
Vennerable::plot(test_comparison)I want to have a little function which, given a contrast of interest, will extract the gene sets which should be included/excluded given the above.
write_all_cp <- function(all_cp, prefix = "12", suffix = "") {
all_written <- list()
for (g in seq_len(length(all_cp))) {
name <- names(all_cp)[g]
datum <- all_cp[[name]]
filename <- glue("{prefix}enrichment_excel_tx/{name}_cprofiler{suffix}-v{ver}.xlsx")
written <- sm(write_cp_data(datum, excel = filename))
all_written[[g]] <- written
}
return(all_written)
}
write_all_gp <- function(all_gp, prefix = "13", suffix = "") {
all_written <- list()
for (g in seq_len(length(all_gp))) {
name <- names(all_gp)[g]
datum <- all_gp[[name]]
filename <- glue("{prefix}enrichment_excel_tx/{name}_gprofiler{suffix}-v{ver}.xlsx")
written <- sm(write_gprofiler_data(datum, excel = filename))
all_written[[g]] <- written
}
return(all_written)
}
write_all_en <- function(all_en, prefix = "14", suffix = "") {
all_written <- list()
for (e in seq_len(length(all_en))) {
name <- names(all_en)[e]
datum <- all_en[[name]]
filename <- glue("{prefix}enrichment_excel_tx/{name}_enricher{suffix}-v{ver}.xlsx")
written <- sm(write_enricher_data(datum, excel = filename))
all_written[[e]] <- written
}
return(all_written)
}Now, using that function, pull out the gene IDs of genes we do not trust because they were too high in wt for every contrast we are likely to perform.
all_genes <- rownames(assay(tx_pairwise_input))
time_inclusions <- extract_inclusions(inclusion_sig, inclusion_tables, inclusions,
time_keepers, all_genes)## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The unique union of them is 1045 genes.
## Deleting the file included_genes_tx/inc_t_het_dlgn-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The unique union of them is 1596 genes.
## Deleting the file included_genes_tx/inc_t_ko_dlgn-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The unique union of them is 605 genes.
## Deleting the file included_genes_tx/inc_t_het_retina-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The unique union of them is 592 genes.
## Deleting the file included_genes_tx/inc_t_ko_retina-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The unique union of them is 17 genes.
## Deleting the file included_genes_tx/inc_t_het_scn-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The unique union of them is 8 genes.
## Deleting the file included_genes_tx/inc_t_ko_scn-v20260812.xlsx before writing the tables.
location_inclusions <- extract_inclusions(inclusion_sig, inclusion_tables, inclusions,
location_keepers, all_genes)## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The unique union of them is 693 genes.
## Deleting the file included_genes_tx/inc_dr_p08_het-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The unique union of them is 1145 genes.
## Deleting the file included_genes_tx/inc_dr_p15_het-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The unique union of them is 1015 genes.
## Deleting the file included_genes_tx/inc_dr_p08_ko-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The unique union of them is 1391 genes.
## Deleting the file included_genes_tx/inc_dr_p15_ko-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The unique union of them is 548 genes.
## Deleting the file included_genes_tx/inc_sr_p08_het-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The unique union of them is 219 genes.
## Deleting the file included_genes_tx/inc_sr_p15_het-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The unique union of them is 577 genes.
## Deleting the file included_genes_tx/inc_sr_p08_ko-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The unique union of them is 67 genes.
## Deleting the file included_genes_tx/inc_sr_p15_ko-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The unique union of them is 189 genes.
## Deleting the file included_genes_tx/inc_ds_p08_het-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The unique union of them is 1010 genes.
## Deleting the file included_genes_tx/inc_ds_p15_het-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The unique union of them is 520 genes.
## Deleting the file included_genes_tx/inc_ds_p08_ko-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The unique union of them is 1342 genes.
## Deleting the file included_genes_tx/inc_ds_p15_ko-v20260812.xlsx before writing the tables.
genotype_inclusions <- extract_inclusions(inclusion_sig, inclusion_tables, inclusions,
genotype_keepers, all_genes)## The set of unique genes higher in p08_ko_dlgn vs. wt is 517.
## The set of unique genes higher in p08_het_dlgn vs. wt is 178.
## The unique union of them is 589 genes.
## Deleting the file included_genes_tx/inc_kh_p08_dlgn-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_dlgn vs. wt is 1341.
## The set of unique genes higher in p15_het_dlgn vs. wt is 1004.
## The unique union of them is 1457 genes.
## Deleting the file included_genes_tx/inc_kh_p15_dlgn-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p08_ko_retina vs. wt is 573.
## The set of unique genes higher in p08_het_retina vs. wt is 537.
## The unique union of them is 756 genes.
## Deleting the file included_genes_tx/inc_kh_p08_retina-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_retina vs. wt is 66.
## The set of unique genes higher in p15_het_retina vs. wt is 213.
## The unique union of them is 230 genes.
## Deleting the file included_genes_tx/inc_kh_p15_retina-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p08_ko_scn vs. wt is 7.
## The set of unique genes higher in p08_het_scn vs. wt is 11.
## The unique union of them is 17 genes.
## Deleting the file included_genes_tx/inc_kh_p08_scn-v20260812.xlsx before writing the tables.
## The set of unique genes higher in p15_ko_scn vs. wt is 2.
## The set of unique genes higher in p15_het_scn vs. wt is 6.
## The unique union of them is 7 genes.
## Deleting the file included_genes_tx/inc_kh_p15_scn-v20260812.xlsx before writing the tables.
genotype_de <- all_pairwise(tx_pairwise_input, filter = TRUE, model_fstring = default_fstring,
keepers = genotype_keepers, model_svs = "svaseq")## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 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 250859 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## 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.
location_de <- all_pairwise(tx_pairwise_input, filter = TRUE, model_fstring = default_fstring,
keepers = location_keepers, model_svs = "svaseq")## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 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 250859 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## 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 12 comparisons.
time_de <- all_pairwise(tx_pairwise_input, filter = TRUE, model_fstring = default_fstring,
keepers = time_keepers, model_svs = "svaseq")## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 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 250859 entries to zero.
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## 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.
It is near here when the computer sometimes fails with no more tempfiles. In another window I am messing with tempfile() in R to try to understand where it is going off the rails…
I will start with the tables and no inclusions so I can check my work.
In this first block I will explain a little more thoroughly what is going on:
genotype_tables_full <- combine_de_tables(
genotype_de, keepers = genotype_keepers, label_column = label_column,
fancy = TRUE,
excel = glue("08full_contrasts_excel_tx/genotype_full_tables-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 p08_ko_dlgn_vs_p08_het_dlgn 27 11 57 45 35 46
## 2 p15_ko_dlgn_vs_p15_het_dlgn 35 1 69 16 35 11
## 3 p08_ko_retina_vs_p08_het_retina 9 2 30 30 3 2
## 4 p15_ko_retina_vs_p15_het_retina 3 6 30 41 1 4
## 5 p08_ko_scn_vs_p08_het_scn 5 19 43 88 32 20
## 6 p15_ko_scn_vs_p15_het_scn 4 18 29 57 9 6
## Plot describing unique/shared genes in a differential expression table.
genotype_sig_full <- extract_significant_genes(
genotype_tables_full, according_to = "deseq",
excel = glue("08full_contrasts_excel_tx/genotype_full_sig-v{ver}.xlsx"))
genotype_sig_full## 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
## kh_p08_dlgn 27 11
## kh_p15_dlgn 35 1
## kh_p08_retina 9 2
## kh_p15_retina 3 6
## kh_p08_scn 5 19
## kh_p15_scn 4 18
In this run, we will search the full set of genes, next we will only do the inclusions.
genotype_full_gp <- all_gprofiler(genotype_sig_full, species = "mmusculus",
excel = "09full_contrasts_enrich_tx/genotype_full_gprofiler.xlsx")
genotype_full_cp <- all_cprofiler(genotype_sig_full, genotype_tables_full,
orgdb = "org.Mm.eg.db", go_level = go_level, organism = "mouse",
orgdb_from = orgdb_from, max_groupsize = max_groupsize,
excel = "09full_contrasts_enrich_tx/genotype_full_cprofiler.xlsx")## There are 7 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.68% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.68% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.68% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.68% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p08_dlgn_up.xlsx before writing the tables.
## There are 2 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.68% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 18642,94284,19063,73458,26897,69080
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.68% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.68% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.68% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p08_dlgn_down.xlsx before writing the tables.
## There are 17 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.24% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some pathways, in reality P-values are less than
## 1e-10. You can set the `eps` argument to zero for better estimation.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.04% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.24% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.24% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.24% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p15_dlgn_up.xlsx before writing the tables.
## Error in sig_genes_namedf[[orgdb_to]] : subscript out of bounds
## There are 3 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.81% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p08_retina_up.xlsx before writing the tables.
## dimensionality reduction failed with provided drfun; falling back to stats::cmdscale.
## Error in sig_genes_namedf[[orgdb_to]] : subscript out of bounds
## There are 2 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.57% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p15_retina_up.xlsx before writing the tables.
## dimensionality reduction failed with provided drfun; falling back to stats::cmdscale.
## There are 2 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.57% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 83699,91860,57169,6300,1281,196968
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (8.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p15_retina_down.xlsx before writing the tables.
## There are 1 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.21% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 13808,232449,75731,433182,68801,14635
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.48% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 319625,20980,12499,56690,212555,20511
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.21% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## No gene sets have size between 5 and 2000 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.21% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.21% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p08_scn_up.xlsx before writing the tables.
## There are 2 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.21% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.48% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.21% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.21% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (9.21% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p08_scn_down.xlsx before writing the tables.
## Error in sig_genes_namedf[[orgdb_to]] : subscript out of bounds
## There are 7 genes deemed significant out of 4708.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.55% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.81% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.55% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.55% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.55% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file 09full_contrasts_enrich_tx/genotype_full_cprofiler_kh_p15_scn_down.xlsx before writing the tables.
genotype_full_upset <- upsetr_sig(genotype_sig_full)
genotype_full_intersects <- write_upset_groups(genotype_full_upset,
excel = "09full_contrasts_intersections_tx/genotype_full_gene_groups.xlsx")## Deleting the file 09full_contrasts_intersections_tx/genotype_full_gene_groups.xlsx before writing the tables.
Now separate the various genotype tables and perform the inclusions of the genes with relatively low wt values.
genotype_tables <- list()
genotype_sig <- list()
genotype_gp <- list()
genotype_cp <- list()
genotype_en <- list()
for (k in seq_along(genotype_keepers)) {
name <- names(genotype_keepers)[k]
message("Examining ", name)
keeper <- genotype_keepers[name]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- genotype_inclusions[[include_df_name]]
includes <- genotype_inclusions[[include_name]]
summary(rownames(genotype_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
include_filename <- glue("10genotype_contrasts_excel_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("10genotype_contrasts_excel_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
genotype_tables[[name]] <- combine_de_tables(
genotype_de, extra_annot = include_df,
keepers = keeper, label_column = label_column,
excel = include_filename, wanted_genes = includes)
print(genotype_tables[[name]])
genotype_sig[[name]] <- extract_significant_genes(
genotype_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(genotype_sig[[name]])
num_rows <- nrow(genotype_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(genotype_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows >= 10) {
message("Performing gprofiler/clusterProfiler.")
genotype_gp[[name]] <- all_gprofiler(genotype_sig[[name]], species = "mmusculus")
genotype_cp[[name]] <- all_cprofiler(
genotype_sig[[name]], genotype_tables[[name]],
orgdb = "org.Mm.eg.db", orgdb_from = orgdb_from,
go_level = go_level, max_groupsize = max_groupsize, organism = "mouse")
#if (!is.null(get0("m2_gsc"))) {
# genotype_en[[name]] <- all_enricher(genotype_sig[[name]], gsc = m2_gsc,
# orgdb = "org.Mm.eg.db", from = "ENSEMBL", to = "SYMBOL")
#}
gp_written <- write_all_gp(genotype_gp[[name]], prefix = "11")
cp_written <- write_all_cp(genotype_cp[[name]], prefix = "11")
#en_written <- write_all_en(genotype_en[[name]])
} else {
warning("There are less than 10 genes up and down in the ", name, " comparison.")
message("There are less than 10 genes up and down in the ", name, " comparison.")
}
}## Examining kh_p08_dlgn
## 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 p08_ko_dlgn_vs_p08_het_dlgn 22 1 21 0 8 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.
## 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
## kh_p08_dlgn 22 1
## There are 23 significant up and down genes.
## Performing gprofiler/clusterProfiler.
## There are 5 genes deemed significant out of 291.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.37% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.38% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.37% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.37% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.37% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_kh_p08_dlgn_up.xlsx before writing the tables.
## Error in sig_genes_namedf[[orgdb_to]] : subscript out of bounds
## Examining kh_p15_dlgn
## 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 p15_ko_dlgn_vs_p15_het_dlgn 33 0 48 0 2 0
## Only kh_p15_dlgn_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p15_dlgn 33 0
## There are 33 significant up and down genes.
## Performing gprofiler/clusterProfiler.
## There are 17 genes deemed significant out of 616.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.11% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.16% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.11% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 2 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.11% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some pathways, in reality P-values are less than
## 1e-10. You can set the `eps` argument to zero for better estimation.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.11% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 1 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_kh_p15_dlgn_up.xlsx before writing the tables.
## Examining kh_p08_retina
## 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 p08_ko_retina_vs_p08_het_retina 5 1 6 1 2 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.
## 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
## kh_p08_retina 5 1
## There are 6 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p08_retina comparison.
## There are less than 10 genes up and down in the kh_p08_retina comparison.
## Examining kh_p15_retina
## 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 p15_ko_retina_vs_p15_het_retina 2 5 2 10 0 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.
## 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
## kh_p15_retina 2 5
## There are 7 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p15_retina comparison.
## There are less than 10 genes up and down in the kh_p15_retina comparison.
## Examining kh_p08_scn
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 17.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p08_ko_scn_vs_p08_het_scn 0 4 1 4 0 1
## Only kh_p08_scn_down has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p08_scn 0 4
## There are 4 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p08_scn comparison.
## There are less than 10 genes up and down in the kh_p08_scn comparison.
## Examining kh_p15_scn
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 7.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p15_ko_scn_vs_p15_het_scn 0 4 0 3 0 0
## Only kh_p15_scn_down has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p15_scn 0 4
## There are 4 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p15_scn comparison.
## There are less than 10 genes up and down in the kh_p15_scn comparison.
Plot the results separately.
for (k in seq_along(genotype_keepers)) {
name <- names(genotype_keepers)[k]
message("Examining ", name)
keeper <- genotype_keepers[name]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- genotype_inclusions[[include_df_name]]
includes <- genotype_inclusions[[include_name]]
summary(rownames(genotype_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
num_rows <- nrow(genotype_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(genotype_sig[[name]][["deseq"]][["downs"]][[name]])
nrow(genotype_sig[[name]][["deseq"]][["ups"]][[name]])
nrow(genotype_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
## #1 is up and #2 is down, avoiding typeos here.
num_objects <- length(genotype_cp[[name]])
if (num_objects == 0) {
warning("Something went wrong in all_cprofiler.")
} else {
upp <- which(grepl(x = names(genotype_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(genotype_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- genotype_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- genotype_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- genotype_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig)
mf_tree_up_filename <- glue("12clusterProfiler_plots_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("12clusterProfiler_plots_tx/{name}_up_mf_sig_bar.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("12clusterProfiler_plots_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("12clusterProfiler_plots_tx/{name}_up_cc_sig_bar.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("12clusterProfiler_plots_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("12clusterProfiler_plots_tx/{name}_up_bp_sig_bar.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- genotype_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- genotype_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- genotype_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("12clusterProfiler_plots_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("12clusterProfiler_plots_tx/{name}_down_mf_sig_bar.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_down_filename <- glue("12clusterProfiler_plots_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("12clusterProfiler_plots_tx/{name}_down_cc_sig_bar.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("12clusterProfiler_plots_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, cateogories = go_categories)
bp_bar_down_filename <- glue("12clusterProfiler_plots_tx/{name}_down_bp_sig_bar.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
}
}## Examining kh_p08_dlgn
## There are 23 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in pp(file = mf_tree_up_filename): The directory: 12clusterProfiler_plots_tx does not exist, will attempt to create it.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining kh_p15_dlgn
## There are 33 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining kh_p08_retina
## There are 6 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining kh_p15_retina
## There are 7 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining kh_p08_scn
## There are 4 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining kh_p15_scn
## There are 4 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
A few specific plots of interest: Colenso asked to label a few genes for the knockout/het p08_retinas, p08_scn, and p08_dlgn: either the top-15 or all significant. I am pretty sure if I tell it 15 and there are not that many, it will just do the significant? Let us find out!
table_name <- "kh_p08_retina"
table_input <- genotype_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
interesting <- c("Opn4", "Gm9008", "Lrr1", "Cnbd1")
kh_p08_retina_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = colors[["het_retina"]], color_high = colors[["ko_retina"]],
label_column = "mgi_symbol", label = interesting, alpha = 1.0,
outline = outline, size = 4)## Warning in ggrepel::geom_text_repel(data = df_subset, nudge_x = nudge_x, : Ignoring unknown parameters: `outline`
## Warning in pp(file = "13genotype_ma_volcano_tx/kh_p08_retina_volcano.pdf", : The directory: 13genotype_ma_volcano_tx does not exist, will
## attempt to create it.
kh_p08_retina_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_retina"]], color_high = colors[["het_retina"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", outline = outline,
label = interesting)
pp(file = "13genotype_ma_volcano_tx/kh_p08_retina_ma.pdf", width = 9, height = 9)
kh_p08_retina_ma[["plot"]]
plotted <- dev.off()
kh_p08_retina_ma[["plot"]]I am going to make an executive decision for this plot, 15 is too many and makes it crazy cluttered.
table_name <- "kh_p08_scn"
table_input <- genotype_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
interesting_genes <- c("Fign", "Nrn1", "Dpysl2", "Actb", "Fgf9", "Otx2", "Sec23",
"Ncam1", "Map4", "Sec22b", "Nlgn3", "Marcks", "Cd47",
"Dpysl3", "Lin7c", "Cadm1", "Snx12", "Rhoa", "Inpp5f",
"Atg12", "Set", "Gsk3b", "Pdcd4", "Gabra2", "Tmco1", "Anapc16")
kh_p08_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq
_adjp",
label_column = "mgi_symbol", label = interesting_genes, size = 4, alpha = 1.0,
outline = outline, color_low = colors[["ko_scn"]], color_high = colors[["het_scn"]])## Error in `plot_volcano_condition_de()`:
## ! Column: deseq
## _adjp is not in the table.
pp(file = "13genotype_ma_volcano_tx/kh_p08_scn_volcano.pdf", width = 9, height = 9)
kh_p08_scn_volcano[["plot"]]## Error:
## ! object 'kh_p08_scn_volcano' not found
## Error:
## ! object 'kh_p08_scn_volcano' not found
## why in the crap is it double-labelling!?
## My MA plotter isn't as smart as the volcano plotter, the genes are:
kh_p08_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_scn"]], color_high = colors[["het_scn"]],
outline = outline, p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes)
pp(file = "13genotype_ma_volcano_tx/kh_p08_scn_ma.pdf", width = 9, height = 9)
kh_p08_scn_ma[["plot"]]
plotted <- dev.off()
kh_p08_scn_ma[["plot"]]table_name <- "kh_p08_scn"
table_input <- genotype_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
interesting_genes <- c(
"Anapc16", "Gabra2", "Tmco1", "Sod2", "Fgf9", "Pdcd4", "Rhoa", "Gsk3b", "Foxp1",
"Ncam1", "Marcks", "Fign", "Dpysl3", "Inpp5f", "Cadm1", "Map4", "Ugcg", "Elovl4",
"Elavl1", "Cfl2", "Tnnt1", "Gnb1", "Impact", "Nrn1", "Nlgn3", "Actb", "Cd47",
"Sec22b", "Slc17a7", "Vglut1", "Actb", "B4galt5", "Foxp1", "Otx2", "Lin7c",
"Snx12", "Atg12", "Set")
kh_p08_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_scn"]], color_high = colors[["het_scn"]],
outline = outline, label_column = "mgi_symbol", label = interesting_genes, size = 4, alpha = 1.0)## Warning in ggrepel::geom_text_repel(data = df_subset, nudge_x = nudge_x, : Ignoring unknown parameters: `outline`
pp(file = "13genotype_ma_volcano_tx/kh_p08_scn_volcano_v2.pdf", width = 9, height = 9)
kh_p08_scn_volcano[["plot"]]
plotted <- dev.off()
kh_p08_scn_volcano[["plot"]]## why in the crap is it double-labelling!?
## My MA plotter isn't as smart as the volcano plotter, the genes are:
kh_p08_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_scn"]], color_high = colors[["het_scn"]],
outline = outline, p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes)
pp(file = "13genotype_ma_volcano_tx/kh_p08_scn_ma_v2.pdf", width = 9, height = 9)
kh_p08_scn_ma[["plot"]]
plotted <- dev.off()
kh_p08_scn_ma[["plot"]]table_name <- "kh_p08_dlgn"
table_input <- genotype_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
kh_p08_dlgn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_dlgn"]], color_high = colors[["het_dlgn"]],
outline = outline, label_column = "mgi_symbol", label = 10, size = 4, alpha = 1.0)## Warning in ggrepel::geom_text_repel(data = df_subset, nudge_x = nudge_x, : Ignoring unknown parameters: `outline`
pp(file = "13genotype_ma_volcano_tx/kh_p08_dlgn_volcano.pdf", width = 9, height = 9)
kh_p08_dlgn_volcano[["plot"]]
plotted <- dev.off()
kh_p08_dlgn_volcano[["plot"]]## My MA plotter isn't as smart as the volcano plotter, the genes are:
kh_p08_dlgn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_dlgn"]], color_high = colors[["het_dlgn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = 10, outline = outline)
pp(file = "13genotype_ma_volcano_tx/kh_p08_dlgn_ma.pdf", width = 9, height = 9)
kh_p08_dlgn_ma[["plot"]]
plotted <- dev.off()
kh_p08_dlgn_ma[["plot"]]When last I ran this manually, it did not double-label, hopefully that remains true in the container.
table_name <- "kh_p15_retina"
table_input <- genotype_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
interesting <- c("Opn4", "Gm9008", "Lrr1", "Cnbd1")
kh_p15_retina_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp", fill = "black",
color_low = colors[["ko_retina"]], color_high = colors[["het_retina"]],
label_column = "mgi_symbol", label = interesting, alpha = 1.0,
outline = outline, size = 4)## Warning in ggrepel::geom_text_repel(data = df_subset, nudge_x = nudge_x, : Ignoring unknown parameters: `outline`
pp(file = "13genotype_ma_volcano_tx/kh_p15_retina_volcano.pdf", width = 9, height = 9)
kh_p15_retina_volcano[["plot"]]
plotted <- dev.off()
kh_p15_retina_volcano[["plot"]]## why in the crap is it double-labelling!?
## My MA plotter isn't as smart as the volcano plotter, the genes are:
kh_p15_retina_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_retina"]], color_high = colors[["het_retina"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting, outline = outline)
pp(file = "13genotype_ma_volcano_tx/kh_p15_retina_ma.pdf", width = 9, height = 9)
kh_p15_retina_ma[["plot"]]
plotted <- dev.off()
kh_p15_retina_ma[["plot"]]table_name <- "kh_p15_scn"
table_input <- genotype_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
interesting_genes <- c("Fign", "Nrn1", "Dpysl2", "Actb", "Fgf9", "Otx2", "Sec23",
"Ncam1", "Map4", "Sec22b", "Nlgn3", "Marcks", "Cd47",
"Dpysl3", "Lin7c", "Cadm1", "Snx12", "Rhoa", "Inpp5f",
"Atg12", "Set", "Gsk3b", "Pdcd4", "Gabra2", "Tmco1", "Anapc16")
kh_p15_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
label_column = "mgi_symbol", size = 4, alpha = 1.0,
outline = outline, color_low = colors[["ko_scn"]], color_high = colors[["het_scn"]])
pp(file = "13genotype_ma_volcano_tx/kh_p15_scn_volcano.pdf", width = 9, height = 9)
kh_p15_scn_volcano[["plot"]]
plotted <- dev.off()
kh_p15_scn_volcano[["plot"]]kh_p15_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_scn"]], color_high = colors[["het_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "13genotype_ma_volcano_tx/kh_p15_scn_ma.pdf", width = 9, height = 9)
kh_p15_scn_ma[["plot"]]
plotted <- dev.off()
kh_p15_scn_ma[["plot"]]Round 2 with a separate gene set.
table_name <- "kh_p15_scn"
table_input <- genotype_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
interesting_genes <- c(
"Anapc16", "Gabra2", "Tmco1", "Sod2", "Fgf9", "Pdcd4", "Rhoa", "Gsk3b", "Foxp1",
"Ncam1", "Marcks", "Fign", "Dpysl3", "Inpp5f", "Cadm1", "Map4", "Ugcg", "Elovl4",
"Elavl1", "Cfl2", "Tnnt1", "Gnb1", "Impact", "Nrn1", "Nlgn3", "Actb", "Cd47",
"Sec22b", "Slc17a7", "Vglut1", "Actb", "B4galt5", "Foxp1", "Otx2", "Lin7c",
"Snx12", "Atg12", "Set")
kh_p15_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_scn"]], color_high = colors[["het_scn"]],
outline = outline, label_column = "mgi_symbol", label = interesting_genes, size = 4, alpha = 1.0)## Warning in ggrepel::geom_text_repel(data = df_subset, nudge_x = nudge_x, : Ignoring unknown parameters: `outline`
pp(file = "13genotype_ma_volcano_tx/kh_p15_scn_volcano_v2.pdf", width = 9, height = 9)
kh_p15_scn_volcano[["plot"]]
plotted <- dev.off()
kh_p15_scn_volcano[["plot"]]kh_p15_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_scn"]], color_high = colors[["het_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "13genotype_ma_volcano_tx/kh_p15_scn_ma_v2.pdf", width = 9, height = 9)
kh_p15_scn_ma[["plot"]]
plotted <- dev.off()
kh_p15_scn_ma[["plot"]]table_name <- "kh_p15_dlgn"
table_input <- genotype_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
kh_p15_dlgn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_dlgn"]], color_high = colors[["het_dlgn"]],
outline = outline, label_column = "mgi_symbol", label = 10, size = 4, alpha = 1.0)## Warning in ggrepel::geom_text_repel(data = df_subset, nudge_x = nudge_x, : Ignoring unknown parameters: `outline`
pp(file = "13genotype_ma_volcano_tx/kh_p15_dlgn_volcano.pdf", width = 9, height = 9)
kh_p15_dlgn_volcano[["plot"]]
plotted <- dev.off()
kh_p15_dlgn_volcano[["plot"]]## My MA plotter isn't as smart as the volcano plotter, the genes are:
kh_p15_dlgn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_dlgn"]], color_high = colors[["het_dlgn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = 10, outline = outline)
pp(file = "13genotype_ma_volcano_tx/kh_p15_dlgn_ma.pdf", width = 9, height = 9)
kh_p15_dlgn_ma[["plot"]]
plotted <- dev.off()
kh_p15_dlgn_ma[["plot"]]A query from Rashmi:
“I was discussing with Dr. Speer about the dLGN data and we found mostly retinal genes in dLGN Het/KO or time point comparison. Please check if those are not retina samples.”
I checked the samples etc and everything looks ok to me; perhaps I can use the results to look at this question in another way:
I will therefore load the p08_het_dlgn/p08_ko_dlgn table and compare it to the p08_het_retina/p08_ko_retina table directly. I think that if these turn out to be identical, then the hypothesis suggested by this query is correct.
Note, in order to do this, I must use the full tables, not the post-inclusion tables because I cannot guarantee that they will have identical gene IDs.
retina_table <- genotype_tables_full[["data"]][["kh_p08_retina"]]
dlgn_table <- genotype_tables_full[["data"]][["kh_p08_dlgn"]]
retina_subset <- retina_table[, c("ensembl_gene_id", "deseq_logfc")]
colnames(retina_subset) <- c("ID", "retina_logfc")
dlgn_subset <- dlgn_table[, c("ensembl_gene_id", "deseq_logfc")]
colnames(dlgn_subset) <- c("ID", "dlgn_logfc")
merged <- merge(retina_subset, dlgn_subset, by = "ID")
rownames(merged) <- make.names(merged[["ID"]], unique = TRUE)
merged[["ID"]] <- NULL
plotted <- plot_linear_scatter(merged)## Warning in plot_linear_scatter(merged): Model type robust failed, falling back to a default lm.
## Warning in pp(file = "images_tx/kh_p08_retina_vs_dlgn_deseq_logfc_values.png"): The directory: images_tx does not exist, will attempt to
## create it.
## png
## 2
Rashmi asked if we could also do the p15 for this comparison:
retina_table <- genotype_tables_full[["data"]][["kh_p15_retina"]]
dlgn_table <- genotype_tables_full[["data"]][["kh_p15_dlgn"]]
retina_subset <- retina_table[, c("ensembl_gene_id", "deseq_logfc")]
colnames(retina_subset) <- c("ID", "retina_logfc")
dlgn_subset <- dlgn_table[, c("ensembl_gene_id", "deseq_logfc")]
colnames(dlgn_subset) <- c("ID", "dlgn_logfc")
merged <- merge(retina_subset, dlgn_subset, by = "ID")
rownames(merged) <- make.names(merged[["ID"]], unique = TRUE)
merged[["ID"]] <- NULL
plotted <- plot_linear_scatter(merged)## Warning in plot_linear_scatter(merged): Model type robust failed, falling back to a default lm.
## png
## 2
genotype_strict_tables <- list()
genotype_strict_sig <- list()
genotype_strict_gp <- list()
genotype_strict_cp <- list()
genotype_strict_en <- list()
for (k in seq_along(genotype_keepers)) {
name <- names(genotype_keepers)[k]
message("Examining ", name)
keeper <- genotype_keepers[name]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_strict_df <- genotype_inclusions_strict[[include_df_name]]
includes_strict <- genotype_inclusions_strict[[include_name]]
summary(rownames(genotype_sig_full[["deseq"]][["ups"]][[name]]) %in% includes_strict)
include_filename <- glue("14genotype_strict_contrasts_excel_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("14genotype_strict_contrasts_excel_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
genotype_strict_tables[[name]] <- combine_de_tables(
genotype_de, extra_annot = include_strict_df,
keepers = keeper, label_column = label_column,
excel = include_filename, wanted_genes = includes_strict)
print(genotype_strict_tables[[name]])
genotype_strict_sig[[name]] <- extract_significant_genes(
genotype_strict_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(genotype_strict_sig[[name]])
num_rows <- nrow(genotype_strict_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(genotype_strict_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows >= 10) {
message("Performing gprofiler/clusterProfiler.")
genotype_strict_gp[[name]] <- all_gprofiler(genotype_strict_sig[[name]], species = "mmusculus")
genotype_strict_cp[[name]] <- all_cprofiler(
genotype_strict_sig[[name]], genotype_strict_tables[[name]],
orgdb = "org.Mm.eg.db", go_level = go_level,
orgdb_from = orgdb_from, max_groupsize = max_groupsize, organism = "mouse")
#if (!is.null(get0("m2_gsc"))) {
# genotype_strict_en[[name]] <- all_enricher(genotype_strict_sig[[name]], gsc = m2_gsc,
# orgdb = "org.Mm.eg.db", from = "ENSEMBL", to = "SYMBOL")
#}
gp_written <- write_all_gp(genotype_strict_gp[[name]], prefix = "15", suffix = "strict")
cp_written <- write_all_cp(genotype_strict_cp[[name]], prefix = "15", suffix = "strict")
#en_written <- write_all_en(genotype_strict_en[[name]])
} else {
warning("There are less than 10 genes up and down in the ", name, " comparison.")
message("There are less than 10 genes up and down in the ", name, " comparison.")
}
}## Examining kh_p08_dlgn
## 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 p08_ko_dlgn_vs_p08_het_dlgn 1 0 1 0 1 0
## Only kh_p08_dlgn_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p08_dlgn 1 0
## There are 1 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p08_dlgn comparison.
## There are less than 10 genes up and down in the kh_p08_dlgn comparison.
## Examining kh_p15_dlgn
## 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 p15_ko_dlgn_vs_p15_het_dlgn 0 0 0 0 0 0
## Only has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p15_dlgn 0 0
## There are 0 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p15_dlgn comparison.
## There are less than 10 genes up and down in the kh_p15_dlgn comparison.
## Examining kh_p08_retina
## 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 p08_ko_retina_vs_p08_het_retina 1 0 1 0 0 0
## Only kh_p08_retina_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p08_retina 1 0
## There are 1 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p08_retina comparison.
## There are less than 10 genes up and down in the kh_p08_retina comparison.
## Examining kh_p15_retina
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 49.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p15_ko_retina_vs_p15_het_retina 0 0 0 0 0 0
## Only has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p15_retina 0 0
## There are 0 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p15_retina comparison.
## There are less than 10 genes up and down in the kh_p15_retina comparison.
## Examining kh_p08_scn
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 1.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p08_ko_scn_vs_p08_het_scn 0 0 0 0 0 0
## Only has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p08_scn 0 0
## There are 0 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p08_scn comparison.
## There are less than 10 genes up and down in the kh_p08_scn comparison.
## Examining kh_p15_scn
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 1.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p15_ko_scn_vs_p15_het_scn 0 0 0 0 0 0
## Only has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## kh_p15_scn 0 0
## There are 0 significant up and down genes.
## Warning: There are less than 10 genes up and down in the kh_p15_scn comparison.
## There are less than 10 genes up and down in the kh_p15_scn comparison.
for (k in seq_along(genotype_keepers)) {
name <- names(genotype_keepers)[k]
message("Examining ", name)
keeper <- genotype_keepers[name]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_strict_df <- genotype_inclusions_strict[[include_df_name]]
includes_strict <- genotype_inclusions_strict[[include_name]]
summary(rownames(genotype_sig_full[["deseq"]][["ups"]][[name]]) %in% includes_strict)
num_rows <- nrow(genotype_strict_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(genotype_strict_sig[[name]][["deseq"]][["downs"]][[name]])
nrow(genotype_strict_sig[[name]][["deseq"]][["ups"]][[name]])
nrow(genotype_strict_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
## #1 is up and #2 is down, avoiding typeos here.
num_objects <- length(genotype_strict_cp[[name]])
if (num_objects == 0) {
warning("Something went wrong in all_cprofiler.")
} else {
upp <- which(grepl(x = names(genotype_strict_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(genotype_strict_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- genotype_strict_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- genotype_strict_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- genotype_strict_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_up_filename <- glue("16clusterProfiler_plots_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("16clusterProfiler_plots_tx/{name}_up_mf_sig_bar.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("16clusterProfiler_plots_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("16clusterProfiler_plots_tx/{name}_up_cc_sig_bar.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("16clusterProfiler_plots_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("16clusterProfiler_plots_tx/{name}_up_bp_sig_bar.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- genotype_strict_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- genotype_strict_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- genotype_strict_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("16clusterProfiler_plots_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("16clusterProfiler_plots_tx/{name}_down_mf_sig_bar.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_down_filename <- glue("16clusterProfiler_plots_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("16clusterProfiler_plots_tx/{name}_down_cc_sig_bar.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("16clusterProfiler_plots_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, cateogories = go_categories)
bp_bar_down_filename <- glue("16clusterProfiler_plots_tx/{name}_down_bp_sig_bar.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
}
}## Examining kh_p08_dlgn
## There are 1 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining kh_p15_dlgn
## There are 0 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining kh_p08_retina
## There are 1 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining kh_p15_retina
## There are 0 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining kh_p08_scn
## There are 0 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining kh_p15_scn
## There are 0 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
Given this stricter filter, I think no genes pass in the genome comparisons.
We will now repeat the above tasks seeking location differences instead of genotype; essentially I copy/pasted the above with s/genotype/location/g.
location_tables_full <- combine_de_tables(
location_de, keepers = location_keepers, label_column = label_column,
excel = glue("17full_location_contrasts_tx/location_full_tables-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 p08_het_dlgn_vs_p08_het_retina 1138 1074 1324 1127 1027 976
## 2 p15_het_dlgn_vs_p15_het_retina 1001 1314 1149 1479 969 1110
## 3 p08_ko_dlgn_vs_p08_ko_retina 960 914 1087 996 824 994
## 4 p15_ko_dlgn_vs_p15_ko_retina 882 1107 1042 1187 787 888
## 5 p08_het_scn_vs_p08_het_retina 1410 1414 1685 1516 1312 1239
## 6 p15_het_scn_vs_p15_het_retina 1383 1460 1641 1643 1362 1371
## 7 p08_ko_scn_vs_p08_ko_retina 1181 1184 1391 1265 1117 1103
## 8 p15_ko_scn_vs_p15_ko_retina 939 1135 1156 1346 976 1018
## 9 p08_het_dlgn_vs_p08_het_scn 443 483 513 612 402 478
## 10 p15_het_dlgn_vs_p15_het_scn 1127 1422 1231 1619 1268 1421
## 11 p08_ko_dlgn_vs_p08_ko_scn 446 483 501 573 529 746
## 12 p15_ko_dlgn_vs_p15_ko_scn 1237 1303 1427 1448 1267 1329
## Plot describing unique/shared genes in a differential expression table.
location_sig_full <- extract_significant_genes(
location_tables_full, according_to = "deseq",
excel = glue("17full_location_contrasts_tx/location_full_sig-v{ver}.xlsx"))
location_sig_full## 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
## dr_p08_het 1138 1074
## dr_p15_het 1001 1314
## dr_p08_ko 960 914
## dr_p15_ko 882 1107
## sr_p08_het 1410 1414
## sr_p15_het 1383 1460
## sr_p08_ko 1181 1184
## sr_p15_ko 939 1135
## ds_p08_het 443 483
## ds_p15_het 1127 1422
## ds_p08_ko 446 483
## ds_p15_ko 1237 1303
location_full_upset <- upsetr_sig(location_sig_full)
location_full_intersects <- write_upset_groups(
location_full_upset,
excel = "excel/17full_location_contrasts_tx/location_full_gene_groups.xlsx")location_tables <- list()
location_sig <- list()
location_gp <- list()
location_cp <- list()
for (k in seq_along(location_keepers)) {
name <- names(location_keepers)[k]
message("Examining ", name)
keeper <- location_keepers[name]
includes <- location_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- location_inclusions[[include_df_name]]
includes <- location_inclusions[[include_name]]
summary(rownames(location_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
include_filename <- glue("18location_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("18location_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
location_tables[[name]] <- combine_de_tables(
location_de, extra_annot = include_df,
keepers = keeper, label_column = label_column,
excel = include_filename, wanted_genes = includes)
print(location_tables[[name]])
location_sig[[name]] <- extract_significant_genes(
location_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(location_sig[[name]])
num_rows <- nrow(location_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(location_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows > 10) {
location_gp[[name]] <- all_gprofiler(location_sig[[name]], species = "mmusculus")
location_cp[[name]] <- all_cprofiler(
location_sig[[name]], location_tables[[name]],
orgdb = "org.Mm.eg.db", go_level = go_level, orgdb_from = orgdb_from,
max_groupsize = max_groupsize, organism = "mouse")
cp_written <- write_all_cp(location_cp[[name]], prefix = "19")
gp_written <- write_all_gp(location_gp[[name]], prefix = "19")
}
}## Examining dr_p08_het
## 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 p08_het_dlgn_vs_p08_het_retina 110 96 124 90 109 81
## `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.
## 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
## dr_p08_het 110 96
## There are 206 significant up and down genes.
## There are 48 genes deemed significant out of 310.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_dr_p08_het_up.xlsx before writing the tables.
## There are 44 genes deemed significant out of 310.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.27% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Examining dr_p15_het
## 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 p15_het_dlgn_vs_p15_het_retina 253 55 276 55 216 53
## `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.
## 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
## dr_p15_het 253 55
## There are 308 significant up and down genes.
## There are 91 genes deemed significant out of 495.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.22% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.22% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.22% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.22% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_dr_p15_het_up.xlsx before writing the tables.
## There are 23 genes deemed significant out of 495.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.22% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.22% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.22% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.22% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Examining dr_p08_ko
## 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 p08_ko_dlgn_vs_p08_ko_retina 258 67 276 67 210 72
## `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.
## 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
## dr_p08_ko 258 67
## There are 325 significant up and down genes.
## There are 122 genes deemed significant out of 440.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.6% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_dr_p08_ko_up.xlsx before writing the tables.
## There are 28 genes deemed significant out of 440.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.6% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Examining dr_p15_ko
## 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 p15_ko_dlgn_vs_p15_ko_retina 334 96 359 100 281 93
## `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.
## 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
## dr_p15_ko 334 96
## There are 430 significant up and down genes.
## There are 125 genes deemed significant out of 598.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.52% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : For some of the pathways the P-values were likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some pathways, in reality P-values are less than
## 1e-10. You can set the `eps` argument to zero for better estimation.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.52% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.52% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.52% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_dr_p15_ko_up.xlsx before writing the tables.
## There are 38 genes deemed significant out of 598.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.52% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some pathways, in reality P-values are less than
## 1e-10. You can set the `eps` argument to zero for better estimation.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.59% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.52% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.52% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : For some pathways, in reality P-values are less than 1e-10. You can set the `eps` argument to zero for better estimation.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.52% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Examining sr_p08_het
## 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 p08_het_scn_vs_p08_het_retina 80 111 90 105 85 100
## `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.
## 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
## sr_p08_het 80 111
## There are 191 significant up and down genes.
## There are 31 genes deemed significant out of 224.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_sr_p08_het_up.xlsx before writing the tables.
## There are 50 genes deemed significant out of 224.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.45% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Examining sr_p15_het
## 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 p15_het_scn_vs_p15_het_retina 24 69 26 64 23 70
## `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.
## 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
## sr_p15_het 24 69
## There are 93 significant up and down genes.
## There are 9 genes deemed significant out of 86.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Deleting the file excel/all_cp_sr_p15_het_up.xlsx before writing the tables.
## There are 29 genes deemed significant out of 86.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Examining sr_p08_ko
## 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 p08_ko_scn_vs_p08_ko_retina 112 76 122 71 114 60
## `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.
## 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
## sr_p08_ko 112 76
## There are 188 significant up and down genes.
## There are 51 genes deemed significant out of 219.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_sr_p08_ko_up.xlsx before writing the tables.
## There are 32 genes deemed significant out of 219.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.46% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Examining sr_p15_ko
## 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 p15_ko_scn_vs_p15_ko_retina 11 20 10 20 11 16
## `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.
## 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
## sr_p15_ko 11 20
## There are 31 significant up and down genes.
## There are 6 genes deemed significant out of 28.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Deleting the file excel/all_cp_sr_p15_ko_up.xlsx before writing the tables.
## There are 6 genes deemed significant out of 28.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Examining ds_p08_het
## 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 p08_het_dlgn_vs_p08_het_scn 39 6 39 7 32 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.
## 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
## ds_p08_het 39 6
## There are 45 significant up and down genes.
## There are 23 genes deemed significant out of 103.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.91% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.94% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.91% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.91% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.91% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_ds_p08_het_up.xlsx before writing the tables.
## There are 1 genes deemed significant out of 103.
## There are 1 entries which match the search string: Mus musculus.
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.91% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : For some of the pathways the P-values were likely overestimated. For such pathways log2err is set to NA.
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 11677,268756,257633,230163,56752,72141
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.94% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 12865,74769,18477,67331,17717,16816
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.91% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## No gene sets have size between 5 and 2000 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.91% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (2.91% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Examining ds_p15_het
## 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 p15_het_dlgn_vs_p15_het_scn 611 2 610 3 558 2
## `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.
## 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
## ds_p15_het 611 2
## There are 613 significant up and down genes.
## There are 272 genes deemed significant out of 441.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 1 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.76% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.67% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_ds_p15_het_up.xlsx before writing the tables.
## Error in sig_genes_namedf[[orgdb_to]] : subscript out of bounds
## Examining ds_p08_ko
## 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 p08_ko_dlgn_vs_p08_ko_scn 115 3 112 3 87 6
## `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.
## 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
## ds_p08_ko 115 3
## There are 118 significant up and down genes.
## There are 59 genes deemed significant out of 257.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 1 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_ds_p08_ko_up.xlsx before writing the tables.
## There are 2 genes deemed significant out of 257.
## There are 1 entries which match the search string: Mus musculus.
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 57874,235674,74205,75578,74559,71336
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 72900,59015,74325,67727,117147,100017
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## No gene sets have size between 5 and 2000 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.39% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Examining ds_p15_ko
## 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 p15_ko_dlgn_vs_p15_ko_scn 755 2 796 1 641 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.
## 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
## ds_p15_ko 755 2
## There are 757 significant up and down genes.
## There are 321 genes deemed significant out of 577.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.03% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 6 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.14% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : All values in the stats vector are greater than zero and
## scoreType is "std", maybe you should switch to scoreType = "pos".
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.03% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.03% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.03% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_ds_p15_ko_up.xlsx before writing the tables.
## Error in sig_genes_namedf[[orgdb_to]] : subscript out of bounds
Print out all the plots in a separate block.
for (k in seq_along(location_keepers)) {
name <- names(location_keepers)[k]
message("Examining ", name)
keeper <- location_keepers[name]
includes <- location_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- location_inclusions[[include_df_name]]
includes <- location_inclusions[[include_name]]
summary(rownames(location_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
num_rows <- nrow(location_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(location_sig[[name]][["deseq"]][["downs"]][[name]])
nrow(location_sig[[name]][["deseq"]][["ups"]][[name]])
nrow(location_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
num_objects <- length(location_cp[[name]])
if (num_objects == 0) {
warning("Something went wrong in all_cprofiler.")
} else {
upp <- which(grepl(x = names(location_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(location_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- location_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- location_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- location_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_mf_sig_bar.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_cc_sig_bar.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("19clusterProfiler_plots_tx/{name}_up_bp_sig_bar.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- location_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- location_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- location_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_mf_sig_bar.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = 12)
cc_tree_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_cc_sig_bar.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_down_filename <- glue("19clusterProfiler_plots_tx/{name}_down_bp_sig_bar.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
}
}## Examining dr_p08_het
## There are 206 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in pp(file = mf_tree_up_filename): The directory: 19clusterProfiler_plots_tx does not exist, will attempt to create it.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining dr_p15_het
## There are 308 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining dr_p08_ko
## There are 325 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in max(idx1, idx2): no non-missing arguments to max; returning -Inf
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in max(idx1, idx2): no non-missing arguments to max; returning -Inf
## NULL
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining dr_p15_ko
## There are 430 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining sr_p08_het
## There are 191 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining sr_p15_het
## There are 93 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining sr_p08_ko
## There are 188 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining sr_p15_ko
## There are 31 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining ds_p08_het
## There are 45 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining ds_p15_het
## There are 613 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining ds_p08_ko
## There are 118 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining ds_p15_ko
## There are 757 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
Colenso sent a specific query of interest, comparing SCN vs. Retinas at p08 in the heterozygotes including a set of genes of particular interest. Perhaps I can use some of these as markers to quality control my work in the future?
Here are the genes:
Opn4, Eomes, Trpc7, Oprm1, Nr4a3, Tbx20, Irx6, AW551984, Pcdh19, Adcyap1, Baiap3, Chl1, Grin3a, Igf1, Gria1, Grin2d, Grin3a, Chrna6, Chrna3, Htr5a, Htr2a, Htr7, Irx4, PlxnC1, Sema6d, Sema4f, Sema4a, Sema6b, Lrrc4b, Lrrc58, Lrrc3b, Wnt4, Wnt9b, Ctxn3, Tenm1, Gna14, Rgs4, Rgs6, Rgs5
table_input <- location_tables[["sr_p08_het"]]
table_name <- "sr_p08_het"
table <- table_input[["data"]][[table_name]]
interesting_genes <- c("Opn4", "Eomes", "Trpc7", "Oprm1", "Nr4a3", "Tbx20",
"Irx6", "AW551984", "Pcdh19", "Adcyap1r1", "Baiap3",
"Chl1", "Grin3a", "Igf1", "Gria1", "Grin2d", "Grin3a",
"Chrna6", "Chrna3", "Htr5a", "Htr2a", "Htr7", "Irx4",
"PlxnC1", "Sema6d", "Sema4f", "Sema4a", "Sema6b", "Lrrc4b",
"Lrrc58", "Lrrc3b", "Wnt4", "Wnt9b", "Ctxn3", "Tenm1", "Gna14",
"Rgs4", "Rgs6", "Rgs5", "Pou4f2", "Chrnb3", "Bcan")
sr_p08_het_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4)
pp(file = "20location_ma_volcano_tx/sr_p08_het_volcano.pdf", width = 9, height = 9)## Warning in pp(file = "20location_ma_volcano_tx/sr_p08_het_volcano.pdf", : The directory: 20location_ma_volcano_tx does not exist, will
## attempt to create it.
sr_p08_het_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "20location_ma_volcano_tx/sr_p08_het_ma.pdf", width = 9, height = 9)
sr_p08_het_ma[["plot"]]
plotted <- dev.off()
sr_p08_het_ma[["plot"]]table_input <- location_tables[["sr_p08_ko"]]
table_name <- "sr_p08_ko"
table <- table_input[["data"]][[table_name]]
sr_p08_ko_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4)
pp(file = "20location_ma_volcano_tx/sr_p08_ko_volcano.pdf", width = 9, height = 9)
sr_p08_ko_volcano[["plot"]]
plotted <- dev.off()
sr_p08_ko_volcano[["plot"]]sr_p08_ko_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "20location_ma_volcano_tx/sr_p08_ko_ma.pdf", width = 9, height = 9)
sr_p08_ko_ma[["plot"]]
plotted <- dev.off()
sr_p08_ko_ma[["plot"]]table_input <- location_tables[["sr_p15_het"]]
table_name <- "sr_p15_het"
table <- table_input[["data"]][[table_name]]
interesting_genes <- c("Opn4", "Eomes", "Trpc7", "Oprm1", "Nr4a3", "Tbx20",
"Irx6", "AW551984", "Pcdh19", "Adcyap1r1", "Baiap3",
"Chl1", "Grin3a", "Igf1", "Gria1", "Grin2d", "Grin3a",
"Chrna6", "Chrna3", "Htr5a", "Htr2a", "Htr7", "Irx4",
"PlxnC1", "Sema6d", "Sema4f", "Sema4a", "Sema6b", "Lrrc4b",
"Lrrc58", "Lrrc3b", "Wnt4", "Wnt9b", "Ctxn3", "Tenm1", "Gna14",
"Rgs4", "Rgs6", "Rgs5", "Pou4f2", "Chrnb3", "Bcan")
sr_p15_het_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4)
pp(file = "20location_ma_volcano_tx/sr_p15_het_volcano.pdf", width = 9, height = 9)
sr_p15_het_volcano[["plot"]]
plotted <- dev.off()
sr_p15_het_volcano[["plot"]]sr_p15_het_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "20location_ma_volcano_tx/sr_p15_het_ma.pdf", width = 9, height = 9)
sr_p15_het_ma[["plot"]]
plotted <- dev.off()
sr_p15_het_ma[["plot"]]table_input <- location_tables[["sr_p15_ko"]]
table_name <- "sr_p15_ko"
table <- table_input[["data"]][[table_name]]
sr_p15_ko_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "20location_ma_volcano_tx/sr_p15_ko_volcano.pdf", width = 12, height = 12)
sr_p15_ko_volcano[["plot"]]
plotted <- dev.off()
sr_p15_ko_volcano[["plot"]]sr_p15_ko_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "20location_ma_volcano_tx/sr_p15_ko_ma.pdf", width = 9, height = 9)
sr_p15_ko_ma[["plot"]]
plotted <- dev.off()
sr_p15_ko_ma[["plot"]]Let us see if any Ensembl gene IDs and/or MGI IDs are shared in the worksheet location_sr_p08_ko_including_wt_0.1_decreased_sig up/down.
test_table_up <- location_sig[["sr_p08_ko"]][["deseq"]][["ups"]][[1]]
test_table_down <- location_sig[["sr_p08_ko"]][["deseq"]][["downs"]][[1]]
query <- list("up" = rownames(test_table_up),
"down" = rownames(test_table_down))
query_upset <- UpSetR::fromList(query)
UpSetR::upset(query_upset)## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
query <- list("up" = test_table_up[["mgi_symbol"]],
"down" = test_table_down[["mgi_symbol"]])
query_upset <- UpSetR::fromList(query)
UpSetR::upset(query_upset)## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
location_strict_tables <- list()
location_strict_sig <- list()
location_strict_gp <- list()
location_strict_cp <- list()
for (k in seq_along(location_keepers)) {
name <- names(location_keepers)[k]
message("Examining ", name)
keeper <- location_keepers[name]
includes <- location_inclusions_strict[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- location_inclusions_strict[[include_df_name]]
includes <- location_inclusions_strict[[include_name]]
found_includes <- rownames(location_sig_full[["deseq"]][["ups"]][[name]]) %in% includes
summary(found_includes)
if (sum(found_includes) == 0) {
next
}
include_filename <- glue("21location_strict_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("21location_strict_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
location_strict_tables[[name]] <- combine_de_tables(
location_de, extra_annot = include_df,
keepers = keeper, label_column = label_column,
excel = include_filename, wanted_genes = includes)
print(location_strict_tables[[name]])
location_strict_sig[[name]] <- extract_significant_genes(
location_strict_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(location_strict_sig[[name]])
num_rows <- nrow(location_strict_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(location_strict_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows > 10) {
location_strict_gp[[name]] <- all_gprofiler(location_strict_sig[[name]], species = "mmusculus")
location_strict_cp[[name]] <- all_cprofiler(
location_strict_sig[[name]], location_strict_tables[[name]],
orgdb = "org.Mm.eg.db", go_level = go_level, orgdb_from = orgdb_from,
max_groupsize = max_groupsize, organism = "mouse")
cp_written <- write_all_cp(location_strict_cp[[name]], prefix = "22", suffix = "strict")
gp_written <- write_all_gp(location_strict_gp[[name]], prefix = "22", suffix = "strict")
}
}## Examining dr_p08_het
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 22.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p08_het_dlgn_vs_p08_het_retina 6 2 6 1 6 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.
## 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
## dr_p08_het 6 2
## There are 8 significant up and down genes.
## Examining dr_p15_het
## 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 p15_het_dlgn_vs_p15_het_retina 19 1 21 1 17 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.
## 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
## dr_p15_het 19 1
## There are 20 significant up and down genes.
## There are 9 genes deemed significant out of 28.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## No gene sets have size between 5 and 2000 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Deleting the file excel/all_cp_dr_p15_het_up.xlsx before writing the tables.
## There are 1 genes deemed significant out of 28.
## There are 1 entries which match the search string: Mus musculus.
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 217698,170768,22236,66646,74419,72094
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Deleting the file excel/all_cp_dr_p15_het_down.xlsx before writing the tables.
## Examining dr_p08_ko
## 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 p08_ko_dlgn_vs_p08_ko_retina 36 1 38 1 27 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.
## 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
## dr_p08_ko 36 1
## There are 37 significant up and down genes.
## There are 17 genes deemed significant out of 34.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Deleting the file excel/all_cp_dr_p08_ko_up.xlsx before writing the tables.
## There are 1 genes deemed significant out of 34.
## There are 1 entries which match the search string: Mus musculus.
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 11522,18641,224530,230639,16591,171281
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 14079,11761,18719,19223,27377,100042295
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Deleting the file excel/all_cp_dr_p08_ko_down.xlsx before writing the tables.
## Examining dr_p15_ko
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 16.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p15_ko_dlgn_vs_p15_ko_retina 5 0 6 0 3 0
## Only dr_p15_ko_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## dr_p15_ko 5 0
## There are 5 significant up and down genes.
## Examining sr_p08_het
## Examining sr_p15_het
## Examining sr_p08_ko
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 3.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p08_ko_scn_vs_p08_ko_retina 2 0 2 0 2 0
## Only sr_p08_ko_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## sr_p08_ko 2 0
## There are 2 significant up and down genes.
## Examining sr_p15_ko
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 1.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p15_ko_scn_vs_p15_ko_retina 1 0 1 0 1 0
## Only sr_p15_ko_up has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## sr_p15_ko 1 0
## There are 1 significant up and down genes.
## Examining ds_p08_het
## Examining ds_p15_het
## Examining ds_p08_ko
## Examining ds_p15_ko
Print out all the plots in a separate block.
for (k in seq_along(location_keepers)) {
name <- names(location_keepers)[k]
message("Examining ", name)
keeper <- location_keepers[name]
includes <- location_inclusions_strict[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- location_inclusions_strict[[include_df_name]]
includes <- location_inclusions_strict[[include_name]]
summary(rownames(location_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
num_rows <- nrow(location_strict_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(location_strict_sig[[name]][["deseq"]][["downs"]][[name]])
nrow(location_strict_sig[[name]][["deseq"]][["ups"]][[name]])
nrow(location_strict_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
num_objects <- length(location_strict_cp[[name]])
if (num_objects == 0) {
warning("Something went wrong in all_cprofiler.")
} else {
upp <- which(grepl(x = names(location_strict_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(location_strict_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- location_strict_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- location_strict_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- location_strict_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_mf_sig_bar.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_cc_sig_bar.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("23clusterProfiler_plots_tx/{name}_up_bp_sig_bar.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- location_strict_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- location_strict_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- location_strict_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_mf_sig_bar.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = 12)
cc_tree_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_cc_sig_bar.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_down_filename <- glue("23clusterProfiler_plots_tx/{name}_down_bp_sig_bar.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
}
}## Examining dr_p08_het
## There are 8 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining dr_p15_het
## There are 20 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in pp(file = mf_tree_up_filename): The directory: 23clusterProfiler_plots_tx does not exist, will attempt to create it.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining dr_p08_ko
## There are 37 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining dr_p15_ko
## There are 5 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining sr_p08_het
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining sr_p15_het
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining sr_p08_ko
## There are 2 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining sr_p15_ko
## There are 1 significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining ds_p08_het
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining ds_p15_het
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining ds_p08_ko
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
## Examining ds_p15_ko
## There are significant up and down genes.
## Warning: Something went wrong in all_cprofiler.
Colenso sent a specific query of interest, comparing SCN vs. Retinas at p08 in the heterozygotes including a set of genes of particular interest. Perhaps I can use some of these as markers to quality control my work in the future?
Here are the genes:
Opn4, Eomes, Trpc7, Oprm1, Nr4a3, Tbx20, Irx6, AW551984, Pcdh19, Adcyap1, Baiap3, Chl1, Grin3a, Igf1, Gria1, Grin2d, Grin3a, Chrna6, Chrna3, Htr5a, Htr2a, Htr7, Irx4, PlxnC1, Sema6d, Sema4f, Sema4a, Sema6b, Lrrc4b, Lrrc58, Lrrc3b, Wnt4, Wnt9b, Ctxn3, Tenm1, Gna14, Rgs4, Rgs6, Rgs5
table_input <- location_strict_tables[["sr_p08_het"]]
table_name <- "sr_p08_het"
table <- table_input[["data"]][[table_name]]
interesting_genes <- c("Opn4", "Eomes", "Trpc7", "Oprm1", "Nr4a3", "Tbx20",
"Irx6", "AW551984", "Pcdh19", "Adcyap1r1", "Baiap3",
"Chl1", "Grin3a", "Igf1", "Gria1", "Grin2d", "Grin3a",
"Chrna6", "Chrna3", "Htr5a", "Htr2a", "Htr7", "Irx4",
"PlxnC1", "Sema6d", "Sema4f", "Sema4a", "Sema6b", "Lrrc4b",
"Lrrc58", "Lrrc3b", "Wnt4", "Wnt9b", "Ctxn3", "Tenm1", "Gna14",
"Rgs4", "Rgs6", "Rgs5", "Pou4f2", "Chrnb3", "Bcan")
sr_p08_het_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4)## Error in `plot_volcano_condition_de()`:
## ! Column: deseq_logfc is not in the table.
## Warning in pp(file = "24location_ma_volcano_strict_tx/sr_p08_het_volcano.pdf", : The directory: 24location_ma_volcano_strict_tx does not
## exist, will attempt to create it.
sr_p08_het_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["het_retina"]], color_high = colors[["het_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)## The column: mgi_symbol is not in the data, using rownames.
## Warning in max(newdf[["avg"]]): no non-missing arguments to max; returning -Inf
## Warning in plot_ma_condition_de(table, table_name, expr_col = "deseq_basemean", : NAs introduced by coercion
## Error in `[[<-.data.frame`:
## ! replacement has 1 row, data has 0
pp(file = "24location_ma_volcano_strict_tx/sr_p08_het_ma.pdf", width = 9, height = 9)
sr_p08_het_ma[["plot"]]
plotted <- dev.off()
sr_p08_het_ma[["plot"]]table_input <- location_strict_tables[["sr_p08_ko"]]
table_name <- "sr_p08_ko"
table <- table_input[["data"]][[table_name]]
sr_p08_ko_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4)
pp(file = "24location_ma_volcano_strict_tx/sr_p08_ko_volcano.pdf", width = 9, height = 9)
sr_p08_ko_volcano[["plot"]]
plotted <- dev.off()
sr_p08_ko_volcano[["plot"]]sr_p08_ko_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "24location_ma_volcano_strict_tx/sr_p08_ko_ma.pdf", width = 9, height = 9)
sr_p08_ko_ma[["plot"]]
plotted <- dev.off()
sr_p08_ko_ma[["plot"]]table_input <- location_tables[["sr_p15_ko"]]
table_name <- "sr_p15_ko"
table <- table_input[["data"]][[table_name]]
sr_p15_ko_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "24location_ma_volcano_strict_tx/sr_p15_ko_volcano.pdf", width = 12, height = 12)
sr_p15_ko_volcano[["plot"]]
plotted <- dev.off()
sr_p15_ko_volcano[["plot"]]sr_p15_ko_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = colors[["ko_retina"]], color_high = colors[["ko_scn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "24location_ma_volcano_strict_tx/sr_p15_ko_ma.pdf", width = 9, height = 9)
sr_p15_ko_ma[["plot"]]
plotted <- dev.off()
sr_p15_ko_ma[["plot"]]time_tables_full <- combine_de_tables(
time_de, keepers = time_keepers,
label_column = label_column,
excel = glue("25full_contrasts_time_tx/full_tables-v{ver}.xlsx"))## Looking for subscript invalid names, end of extract_keepers.
time_sig_full <- extract_significant_genes(
time_tables_full, according_to = "deseq",
excel = glue("25full_contrasts_time_tx/full_sig-v{ver}.xlsx"))time_tables <- list()
time_sig <- list()
time_gp <- list()
time_cp <- list()
for (k in seq_along(time_keepers)) {
name <- names(time_keepers)[k]
message("Examining ", name)
keeper <- time_keepers[name]
includes <- time_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- time_inclusions[[include_df_name]]
includes <- time_inclusions[[include_name]]
summary(rownames(time_sig_full[["deseq"]][["ups"]][[name]]) %in% includes)
include_filename <- glue("26time_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("26time_contrasts_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
time_tables[[name]] <- combine_de_tables(
time_de, extra_annot = include_df,
keepers = keeper, label_column = label_column,
excel = include_filename, wanted_genes = includes)
print(time_tables[[name]])
time_sig[[name]] <- extract_significant_genes(
time_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(time_sig[[name]])
num_rows <- nrow(time_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(time_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows > 10) {
time_gp[[name]] <- all_gprofiler(time_sig[[name]], species = "mmusculus")
gp_written <- write_all_gp(time_gp[[name]])
time_cp[[name]] <- all_cprofiler(
time_sig[[name]], time_tables[[name]], orgdb = "org.Mm.eg.db", organism = "mouse",
orgdb_from = orgdb_from, go_level = go_level, max_groupsize = max_groupsize)
cp_written <- write_all_cp(time_cp[[name]], prefix = "27")
gp_written <- write_all_gp(time_gp[[name]], prefix = "27")
}
}## Examining t_het_dlgn
## 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 p15_het_dlgn_vs_p08_het_dlgn 281 9 255 9 197 8
## `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.
## 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
## t_het_dlgn 281 9
## There are 290 significant up and down genes.
## There are 113 genes deemed significant out of 461.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 4 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.3% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : For some of the pathways the P-values were likely overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_het_dlgn_up.xlsx before writing the tables.
## There are 4 genes deemed significant out of 461.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 4 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.3% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : For some of the pathways the P-values were likely overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.25% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_het_dlgn_down.xlsx before writing the tables.
## Examining t_ko_dlgn
## 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 p15_ko_dlgn_vs_p08_ko_dlgn 357 89 390 87 338 73
## `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.
## 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
## t_ko_dlgn 357 89
## There are 446 significant up and down genes.
## There are 158 genes deemed significant out of 697.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 25 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.9% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_ko_dlgn_up.xlsx before writing the tables.
## There are 49 genes deemed significant out of 697.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 23 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.9% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (1.87% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_ko_dlgn_down.xlsx before writing the tables.
## Examining t_het_retina
## 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 p15_het_retina_vs_p08_het_retina 30 103 30 116 24 102
## `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.
## 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
## t_het_retina 30 103
## There are 133 significant up and down genes.
## There are 17 genes deemed significant out of 248.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_het_retina_up.xlsx before writing the tables.
## There are 38 genes deemed significant out of 248.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_het_retina_down.xlsx before writing the tables.
## Examining t_ko_retina
## 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 p15_ko_retina_vs_p08_ko_retina 12 136 11 143 9 134
## `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.
## 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
## t_ko_retina 12 136
## There are 148 significant up and down genes.
## There are 6 genes deemed significant out of 227.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_ko_retina_up.xlsx before writing the tables.
## There are 45 genes deemed significant out of 227.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.88% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_ko_retina_down.xlsx before writing the tables.
## Examining t_het_scn
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 17.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p15_het_scn_vs_p08_het_scn 0 1 0 1 0 1
## Only t_het_scn_down has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## t_het_scn 0 1
## There are 1 significant up and down genes.
## Examining t_ko_scn
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 8.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p15_ko_scn_vs_p08_ko_scn 0 0 0 0 0 0
## Only has information, cannot create an UpSet.
## Plot describing unique/shared genes in a differential expression table.
## NULL
## 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
## t_ko_scn 0 0
## There are 0 significant up and down genes.
Send the plots separately.
for (k in seq_along(time_keepers)) {
name <- names(time_keepers)[k]
message("Examining ", name)
keeper <- time_keepers[name]
includes <- time_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- time_inclusions[[include_df_name]]
includes <- time_inclusions[[include_name]]
num_rows <- nrow(time_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(time_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
num_objects <- length(time_cp[[name]])
if (num_objects == 0) {
warning("Something failed in all_cprofiler.")
} else {
upp <- which(grepl(x = names(time_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(time_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- time_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- time_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- time_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_mf_sig_bar.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_cc_sig_bar.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("28clusterProfiler_plots_tx/{name}_up_bp_sig_bar.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- time_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- time_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- time_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_mf_sig_bar.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_cc_sig_bar.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_down_filename <- glue("28clusterProfiler_plots_tx/{name}_down_bp_sig_bar.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
}
}## Examining t_het_dlgn
## There are 290 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in pp(file = mf_tree_up_filename): The directory: 28clusterProfiler_plots_tx does not exist, will attempt to create it.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining t_ko_dlgn
## There are 446 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining t_het_retina
## There are 133 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining t_ko_retina
## There are 148 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining t_het_scn
## There are 1 significant up and down genes.
## Warning: Something failed in all_cprofiler.
## Examining t_ko_scn
## There are 0 significant up and down genes.
## Warning: Something failed in all_cprofiler.
table_name <- "t_het_dlgn"
table_input <- time_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
t_het_dlgn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "29time_ma_volcano_tx/t_het_dlgn_volcano.pdf", width = 12, height = 12)## Warning in pp(file = "29time_ma_volcano_tx/t_het_dlgn_volcano.pdf", width = 12, : The directory: 29time_ma_volcano_tx does not exist, will
## attempt to create it.
t_het_dlgn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "29time_ma_volcano_tx/t_het_dlgn_ma.pdf", width = 9, height = 9)
t_het_dlgn_ma[["plot"]]
plotted <- dev.off()
t_het_dlgn_ma[["plot"]]table_name <- "t_ko_dlgn"
table_input <- time_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
t_ko_dlgn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "29time_ma_volcano_tx/t_ko_dlgn_volcano.pdf", width = 12, height = 12)
t_ko_dlgn_volcano[["plot"]]
plotted <- dev.off()
t_ko_dlgn_volcano[["plot"]]t_ko_dlgn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "29time_ma_volcano_tx/t_ko_dlgn_ma.pdf", width = 9, height = 9)
t_ko_dlgn_ma[["plot"]]
plotted <- dev.off()
t_ko_dlgn_ma[["plot"]]table_name <- "t_het_retina"
table_input <- time_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
t_het_retina_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = time_colors[["p08_het_retina"]], color_high = time_colors[["p15_het_retina"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "29time_ma_volcano_tx/t_het_retina_volcano.pdf", width = 12, height = 12)
t_het_retina_volcano[["plot"]]
plotted <- dev.off()
t_het_retina_volcano[["plot"]]t_het_retina_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = time_colors[["p08_het_retina"]], color_high = time_colors[["p15_het_retina"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "29time_ma_volcano_tx/t_het_retina_ma.pdf", width = 9, height = 9)
t_het_retina_ma[["plot"]]
plotted <- dev.off()
t_het_retina_ma[["plot"]]table_name <- "t_ko_retina"
table_input <- time_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
t_ko_retina_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "29time_ma_volcano_tx/t_ko_retina_volcano.pdf", width = 12, height = 12)
t_ko_retina_volcano[["plot"]]
plotted <- dev.off()
t_ko_retina_volcano[["plot"]]t_ko_retina_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "29time_ma_volcano_tx/t_ko_retina_ma.pdf", width = 9, height = 9)
t_ko_retina_ma[["plot"]]
plotted <- dev.off()
t_ko_retina_ma[["plot"]]table_name <- "t_het_scn"
table_input <- time_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
t_het_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "29time_ma_volcano_tx/t_het_scn_volcano.pdf", width = 12, height = 12)
t_het_scn_volcano[["plot"]]
plotted <- dev.off()
t_het_scn_volcano[["plot"]]t_het_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "29time_ma_volcano_tx/t_het_scn_ma.pdf", width = 9, height = 9)
t_het_scn_ma[["plot"]]
plotted <- dev.off()
t_het_scn_ma[["plot"]]table_name <- "t_ko_scn"
table_input <- time_tables[[table_name]]
table <- table_input[["data"]][[table_name]]
t_ko_scn_volcano <- plot_volcano_condition_de(
table, table_name, fc_col = "deseq_logfc", p_col = "deseq_adjp",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
label_column = "mgi_symbol", label = interesting_genes, alpha = 1.0,
size = 4, min.segment.length = 0, point.padding = 0.2)
pp(file = "29time_ma_volcano_tx/t_ko_scn_volcano.pdf", width = 12, height = 12)
t_ko_scn_volcano[["plot"]]
plotted <- dev.off()
t_ko_scn_volcano[["plot"]]t_ko_scn_ma <- plot_ma_condition_de(
table, table_name, expr_col = "deseq_basemean", fc_col = "deseq_logfc",
color_low = time_colors[["p08_het_dlgn"]], color_high = time_colors[["p15_het_dlgn"]],
p_col = "deseq_adjp", label_column = "mgi_symbol", label = interesting_genes, outline = outline)
pp(file = "29time_ma_volcano_tx/t_ko_scn_ma.pdf", width = 9, height = 9)
t_ko_scn_ma[["plot"]]
plotted <- dev.off()
t_ko_scn_ma[["plot"]]time_strict_tables <- list()
time_strict_sig <- list()
time_strict_gp <- list()
time_strict_cp <- list()
time_strict_en <- list()
for (k in seq_along(time_keepers)) {
name <- names(time_keepers)[k]
message("Examining ", name)
keeper <- time_keepers[name]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- time_inclusions_strict[[include_df_name]]
includes <- time_inclusions_strict[[include_name]]
found_includes <- rownames(time_sig_full[["deseq"]][["ups"]][[name]]) %in% includes
summary(found_includes)
if (sum(found_includes) == 0) {
next
}
include_filename <- glue("30time_strict_contrasts_excel_tx/{name}_including_wt_{lfc_cutoff}_decreased_table-v{ver}.xlsx")
include_sig_filename <- glue("30time_strict_contrasts_excel_tx/{name}_including_wt_{lfc_cutoff}_decreased_sig-v{ver}.xlsx")
time_strict_tables[[name]] <- combine_de_tables(
time_de, extra_annot = include_df,
keepers = keeper, label_column = label_column,
excel = include_filename, wanted_genes = includes)
print(time_strict_tables[[name]])
time_strict_sig[[name]] <- extract_significant_genes(
time_strict_tables[[name]], according_to = "deseq",
excel = include_sig_filename)
print(time_strict_sig[[name]])
num_rows <- nrow(time_strict_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(time_strict_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
if (num_rows >= 10) {
message("Performing gprofiler/clusterProfiler.")
time_strict_gp[[name]] <- all_gprofiler(time_strict_sig[[name]], species = "mmusculus")
time_strict_cp[[name]] <- all_cprofiler(
time_strict_sig[[name]], time_strict_tables[[name]],
orgdb = "org.Mm.eg.db", go_level = go_level, orgdb_from = orgdb_from,
max_groupsize = max_groupsize, organism = "mouse")
#if (!is.null(get0("m2_gsc"))) {
# time_strict_en[[name]] <- all_enricher(time_strict_sig[[name]], gsc = m2_gsc,
# orgdb = "org.Mm.eg.db", from = "ENSEMBL", to = "SYMBOL")
#}
gp_written <- write_all_gp(time_strict_gp[[name]], prefix = "31", suffix = "strict")
cp_written <- write_all_cp(time_strict_cp[[name]], prefix = "31", suffix = "strict")
#en_written <- write_all_en(time_strict_en[[name]])
} else {
warning("There are less than 10 genes up and down in the ", name, " comparison.")
message("There are less than 10 genes up and down in the ", name, " comparison.")
}
}## Examining t_het_dlgn
## 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 p15_het_dlgn_vs_p08_het_dlgn 17 1 16 1 9 2
## `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.
## 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
## t_het_dlgn 17 1
## There are 18 significant up and down genes.
## Performing gprofiler/clusterProfiler.
## There are 15 genes deemed significant out of 78.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.85% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 2 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.9% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.85% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.85% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.85% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_het_dlgn_up.xlsx before writing the tables.
## There are 1 genes deemed significant out of 78.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.85% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : There were 3 pathways for which P-values were not
## calculated properly due to unbalanced (positive and negative) gene-level statistic values. For such pathways pval, padj, NES, log2err are set
## to NA. You can try to increase the value of the argument nPermSimple (for example set it nPermSimple = 10000)
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 67834,75731,12894,11364,226265,16591
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.9% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.85% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## No gene sets have size between 5 and 2000 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.85% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 81689,6790,23560,928,81787,51639
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (3.85% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_het_dlgn_down.xlsx before writing the tables.
## dimensionality reduction failed with provided drfun; falling back to stats::cmdscale.
## Examining t_ko_dlgn
## 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 p15_ko_dlgn_vs_p08_ko_dlgn 19 3 20 3 16 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.
## 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
## t_ko_dlgn 19 3
## There are 22 significant up and down genes.
## Performing gprofiler/clusterProfiler.
## There are 15 genes deemed significant out of 137.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_ko_dlgn_up.xlsx before writing the tables.
## There are 3 genes deemed significant out of 137.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize = minSize, : For some of the pathways the P-values were likely
## overestimated. For such pathways log2err is set to NA.
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## Deleting the file excel/all_cp_t_ko_dlgn_down.xlsx before writing the tables.
## Examining t_het_retina
## 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 p15_het_retina_vs_p08_het_retina 10 11 10 12 8 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.
## 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
## t_het_retina 10 11
## There are 21 significant up and down genes.
## Performing gprofiler/clusterProfiler.
## There are 4 genes deemed significant out of 57.
## There are 1 entries which match the search string: Mus musculus.
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Deleting the file excel/all_cp_t_het_retina_up.xlsx before writing the tables.
## There are 2 genes deemed significant out of 57.
## There are 1 entries which match the search string: Mus musculus.
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## No gene sets have size between 5 and 500 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## --> No gene can be mapped....
## --> Expected input gene ID: 11532,14120,69080,71336,230639,70757
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 76898,13844,19088,16561,56356,320685
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## No gene sets have size between 5 and 2000 ...
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## leading edge analysis...
## done...
## --> No gene can be mapped....
## --> Expected input gene ID: 3006,23256,64689,91445,440686,9325
## --> return NULL...
## using 'fgsea' for GSEA analysis, please cite Korotkevich et al (2019).
## preparing geneSet collections...
## GSEA analysis...
## no term enriched under specific pvalueCutoff...
## Deleting the file excel/all_cp_t_het_retina_down.xlsx before writing the tables.
## Examining t_ko_retina
## Looking for subscript invalid names, end of extract_keepers.
## The result table is too small for meaningful comparisons.
## The first table has only: 47.
## A set of combined differential expression results.
## table deseq_sigup deseq_sigdown edger_sigup edger_sigdown limma_sigup limma_sigdown
## 1 p15_ko_retina_vs_p08_ko_retina 3 3 3 3 2 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.
## 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
## t_ko_retina 3 3
## There are 6 significant up and down genes.
## Warning: There are less than 10 genes up and down in the t_ko_retina comparison.
## There are less than 10 genes up and down in the t_ko_retina comparison.
## Examining t_het_scn
## Examining t_ko_scn
Send the plots separately.
for (k in seq_along(time_keepers)) {
name <- names(time_keepers)[k]
message("Examining ", name)
keeper <- time_keepers[name]
includes <- time_inclusions[[name]]
include_name <- paste0("inc_", name)
include_df_name <- paste0("df_", name)
include_df <- time_inclusions[[include_df_name]]
includes <- time_inclusions[[include_name]]
num_rows <- nrow(time_sig[[name]][["deseq"]][["ups"]][[name]]) +
nrow(time_sig[[name]][["deseq"]][["downs"]][[name]])
message("There are ", num_rows, " significant up and down genes.")
num_objects <- length(time_cp[[name]])
if (num_objects == 0) {
warning("Something failed in all_cprofiler.")
} else {
upp <- which(grepl(x = names(time_cp[[name]]), pattern = "_up$"))
downp <- which(grepl(x = names(time_cp[[name]]), pattern = "_down$"))
if (length(upp) > 0) {
mf_sig <- time_cp[[name]][[upp]][["go_data"]][["MF_enrich"]]
cc_sig <- time_cp[[name]][[upp]][["go_data"]][["CC_enrich"]]
bp_sig <- time_cp[[name]][[upp]][["go_data"]][["BP_enrich"]]
mf_plots_up <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_up_filename <- glue("32cp_trees_tx/{name}_up_mf_sig_tree.pdf")
pp(file = mf_tree_up_filename)
try(print(mf_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_up_filename <- glue("32cp_bar_tx/{name}_up_mf_sig_bar.pdf")
pp(file = mf_bar_up_filename)
try(print(mf_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_up <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_up_filename <- glue("32cp_trees_tx/{name}_up_cc_sig_tree.pdf")
pp(file = cc_tree_up_filename)
try(print(cc_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_up_filename <- glue("32cp_bar_tx/{name}_up_cc_sig_bar.pdf")
pp(file = cc_bar_up_filename)
try(print(cc_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_up_filename <- glue("32cp_trees_tx/{name}_up_bp_sig_tree.pdf")
pp(file = bp_tree_up_filename)
try(print(bp_plots_up[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_up <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_up_filename <- glue("32cp_bar_tx/{name}_up_bp_sig_bar.pdf")
pp(file = bp_bar_up_filename)
try(print(bp_plots_up[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
if (length(downp) > 0) {
mf_sig <- time_cp[[name]][[downp]][["go_data"]][["MF_enrich"]]
cc_sig <- time_cp[[name]][[downp]][["go_data"]][["CC_enrich"]]
bp_sig <- time_cp[[name]][[downp]][["go_data"]][["BP_enrich"]]
mf_plots_down <- plot_enrichresult(mf_sig, showCategory = go_categories)
mf_tree_down_filename <- glue("32cp_trees_tx/{name}_down_mf_sig_tree.pdf")
pp(file = mf_tree_down_filename)
try(print(mf_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
mf_bar_down_filename <- glue("32cp_bar_tx/{name}_down_mf_sig_bar.pdf")
pp(file = mf_bar_down_filename)
try(print(mf_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
cc_plots_down <- plot_enrichresult(cc_sig, showCategory = go_categories)
cc_tree_down_filename <- glue("32cp_trees_tx/{name}_down_cc_sig_tree.pdf")
pp(file = cc_tree_down_filename)
try(print(cc_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
cc_bar_down_filename <- glue("32cp_bar_tx/{name}_down_cc_sig_bar.pdf")
pp(file = cc_bar_down_filename)
try(print(cc_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_tree_down_filename <- glue("32cp_trees_tx/{name}_down_bp_sig_tree.pdf")
pp(file = bp_tree_down_filename)
try(print(bp_plots_down[["tree"]]), silent = TRUE)
plotted <- dev.off()
bp_plots_down <- plot_enrichresult(bp_sig, showCategory = go_categories)
bp_bar_down_filename <- glue("32cp_bar_tx/{name}_down_bp_sig_bar.pdf")
pp(file = bp_bar_down_filename)
try(print(bp_plots_down[["bar"]]), silent = TRUE)
plotted <- dev.off()
}
}
}## Examining t_het_dlgn
## There are 290 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in pp(file = mf_tree_up_filename): The directory: 32cp_trees_tx does not exist, will attempt to create it.
## Warning in pp(file = mf_bar_up_filename): The directory: 32cp_bar_tx does not exist, will attempt to create it.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining t_ko_dlgn
## There are 446 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining t_het_retina
## There are 133 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining t_ko_retina
## There are 148 significant up and down genes.
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Examining t_het_scn
## There are 1 significant up and down genes.
## Warning: Something failed in all_cprofiler.
## Examining t_ko_scn
## There are 0 significant up and down genes.
## Warning: Something failed in all_cprofiler.
In conversation with Colenso, he spoke about a series of contrasts which would be interesting to attempt in order to query the changes across both locations and genotypes and/or both locations and time, thus:
(p08_het_scn / p08_het_retina) / (p08_ko_scn / p08_ko_retina)
as an example. We can definitely do these, but they do not work for all methods employed (I think they work best with limma and edgeR).
Lets find out!
scn_extra <- glue("\\
p08het = (conditionp08_het_scn - conditionp08_het_retina), \\
p08ko = (conditionp08_ko_scn - conditionp08_ko_retina), \\
p08het_vs_p08ko = (conditionp08_het_scn - conditionp08_het_retina) - (conditionp08_ko_scn - conditionp08_ko_retina), \\
p15het = (conditionp15_het_scn - conditionp15_het_retina), \\
p15ko = (conditionp15_ko_scn - conditionp15_ko_retina), \\
p15het_vs_p15ko = (conditionp15_het_scn - conditionp15_het_retina) - (conditionp15_ko_scn - conditionp15_ko_retina)")
scn_translatome_de_keepers <- list(
"p08het" = c("p08_het_scn", "p08_het_retina"),
"p08ko" = c("p08_ko_scn", "p08_ko_retina"),
"p15het" = c("p15_het_scn", "p15_het_retina"),
"p15ko" = c("p15_ko_scn", "p15_ko_retina"))
scn_translatome_keepers <- list(
"p08het" = c("p08_het_scn", "p08_het_retina"),
"p08ko" = c("p08_ko_scn", "p08_ko_retina"),
"p08_scn_translatome" = c("p08het", "p08ko"),
"p15het" = c("p15_het_scn", "p15_het_retina"),
"p15ko" = c("p15_ko_scn", "p15_ko_retina"),
"p15_scn_translatome" = c("p15het", "p15ko"))
filt <- normalize(tx_pairwise_input, filter = TRUE)## Removing 52544 low-count genes (13339 remaining).
limma_test <- limma_pairwise(filt,
keepers = scn_translatome_de_keepers,
model_fstring = "~ 0 + condition",
model_svs = FALSE, extra_contrastrs = scn_extra)## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
edger_test <- edger_pairwise(filt,
keepers = scn_translatome_de_keepers,
model_fstring = "~ 0 + condition",
model_svs = FALSE, extra_contrasts = scn_extra)## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
scn_translatome_de <- all_pairwise(tx_pairwise_input, filter = TRUE,
keepers = scn_translatome_de_keepers,
model_svs = FALSE,
model_fstring = "~ 0 + condition",
do_basic = FALSE, do_dream = FALSE,
do_noiseq = FALSE, do_ebseq = FALSE,
extra_contrasts = scn_extra)## Warning in all_pairwise(tx_pairwise_input, filter = TRUE, keepers = scn_translatome_de_keepers, : This will likely fail because of how the
## keepers and extra contrasts are evaluated.
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 remaining).
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## The contrast condition_NA_vs_p08het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p08ko is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_p08ko_vs_p08het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p15het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p15ko is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_p15ko_vs_p15het is not in the results.
## If this is not an extra contrast, then this is an error.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The basic results are not of class
## hpgltools::basic_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The dream results are not of class
## hpgltools::dream_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The ebseq results are not of class
## hpgltools::ebseq_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The noiseq results are not of class
## hpgltools::noiseq_pairwise.
scn_combined_test <- combine_de_tables(
scn_translatome_de, keepers = scn_translatome_keepers,
excel = glue("33translatome_xlsx_tx/test_scn_translatome_unfiltered_nosva-v{ver}.xlsx"))## coefficient edger did not find conditionp08ko or conditionp08het.
## coefficient limma did not find p08ko or p08het.
## coefficient edger did not find conditionp15ko or conditionp15het.
## coefficient limma did not find p15ko or p15het.
## Looking for subscript invalid names, end of extract_keepers.
scn_translatome_de_sva <- all_pairwise(tx_pairwise_input, filter = TRUE,
keepers = scn_translatome_de_keepers,
model_svs = "svaseq",
model_fstring = "~ 0 + condition",
do_basic = FALSE, do_dream = FALSE,
do_noiseq = FALSE, do_ebseq = FALSE,
extra_contrasts = scn_extra)## Warning in all_pairwise(tx_pairwise_input, filter = TRUE, keepers = scn_translatome_de_keepers, : This will likely fail because of how the
## keepers and extra contrasts are evaluated.
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 remaining).
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## The contrast condition_NA_vs_p08het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p08ko is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_p08ko_vs_p08het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p15het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p15ko is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_p15ko_vs_p15het is not in the results.
## If this is not an extra contrast, then this is an error.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The basic results are not of class
## hpgltools::basic_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The dream results are not of class
## hpgltools::dream_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The ebseq results are not of class
## hpgltools::ebseq_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The noiseq results are not of class
## hpgltools::noiseq_pairwise.
scn_combined_test_sva <- combine_de_tables(
scn_translatome_de_sva, keepers = scn_translatome_keepers,
excel = glue("33translatome_xlsx_tx/test_scn_translatome_unfiltered_sva-v{ver}.xlsx"))## coefficient edger did not find conditionp08ko or conditionp08het.
## coefficient limma did not find p08ko or p08het.
## coefficient edger did not find conditionp15ko or conditionp15het.
## coefficient limma did not find p15ko or p15het.
## Looking for subscript invalid names, end of extract_keepers.
p08_scn_combined_deseq <- subtract_deseq_results(
first_table = scn_combined_test[["data"]][["p08het"]],
second_table = scn_combined_test[["data"]][["p08ko"]],
first_lfc = "deseq_logfc", second_lfc = "deseq_logfc",
first_p = "deseq_adjp", second_p = "deseq_adjp",
first_name = "het", second_name = "ko",
excel = glue("33translatome_xlsx_tx/translatome_p08_scn_combined_deseq-v{ver}.xlsx"))## Error in `subtract_deseq_results()`:
## ! could not find function "subtract_deseq_results"
p15_scn_combined_deseq <- subtract_deseq_results(
first_table = scn_combined_test[["data"]][["p15het"]],
second_table = scn_combined_test[["data"]][["p15ko"]],
first_lfc = "deseq_logfc", second_lfc = "deseq_logfc",
first_p = "deseq_adjp", second_p = "deseq_adjp",
first_name = "het", second_name = "ko",
excel = glue("34translatome_deseqsub_xlsx_tx/translatome_p15_scn_combined_deseq-v{ver}.xlsx"))## Error in `subtract_deseq_results()`:
## ! could not find function "subtract_deseq_results"
p08_dlgn_extra <- "p08het_vs_p08ko = (conditionp08_het_dlgn - conditionp08_het_retina) - (conditionp08_ko_dlgn - conditionp08_ko_retina)"
p08_dlgn_translatome_de_keepers <- list(
"p08het" = c("p08_het_dlgn", "p08_het_retina"),
"p08ko" = c("p08_ko_dlgn", "p08_ko_retina"))
p08_dlgn_translatome_keepers <- list(
"p08_het_dlgn_vs_retina" = c("p08_het_dlgn", "p08_het_retina"),
"p08_ko_dlgn_vs_retina" = c("p08_ko_dlgn", "p08_ko_retina"),
"p08_dlgn_translatome" = c("p08het", "p08ko"))
p08_dlgn_translatome_de <- all_pairwise(tx_pairwise_input, filter = TRUE,
keepers = p08_dlgn_translatome_de_keepers,
model_svs = FALSE,
model_fstring = "~ 0 + condition",
do_basic = FALSE, do_dream = FALSE,
do_noiseq = FALSE, do_ebseq = FALSE,
extra_contrasts = p08_dlgn_extra)## Warning in all_pairwise(tx_pairwise_input, filter = TRUE, keepers = p08_dlgn_translatome_de_keepers, : This will likely fail because of how
## the keepers and extra contrasts are evaluated.
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 remaining).
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## The contrast condition_p08ko_vs_p08het is not in the results.
## If this is not an extra contrast, then this is an error.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The basic results are not of class
## hpgltools::basic_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The dream results are not of class
## hpgltools::dream_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The ebseq results are not of class
## hpgltools::ebseq_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The noiseq results are not of class
## hpgltools::noiseq_pairwise.
p08_dlgn_combined_test <- combine_de_tables(
p08_dlgn_translatome_de, keepers = p08_dlgn_translatome_keepers,
label_column = label_column,
excel = glue("33translatome_xlsx_tx/test_p08_dlgn_translatome_unfiltered_nosva-v{ver}.xlsx"))## coefficient edger did not find conditionp08ko or conditionp08het.
## coefficient limma did not find p08ko or p08het.
## Looking for subscript invalid names, end of extract_keepers.
p08_dlgn_translatome_de_sva <- all_pairwise(tx_pairwise_input, filter = TRUE,
keepers = p08_dlgn_translatome_de_keepers,
model_svs = "svaseq",
model_fstring = "~ 0 + condition",
do_basic = FALSE, do_dream = FALSE,
do_noiseq = FALSE, do_ebseq = FALSE,
extra_contrasts = p08_dlgn_extra)## Warning in all_pairwise(tx_pairwise_input, filter = TRUE, keepers = p08_dlgn_translatome_de_keepers, : This will likely fail because of how
## the keepers and extra contrasts are evaluated.
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 remaining).
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## The contrast condition_p08ko_vs_p08het is not in the results.
## If this is not an extra contrast, then this is an error.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The basic results are not of class
## hpgltools::basic_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The dream results are not of class
## hpgltools::dream_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The ebseq results are not of class
## hpgltools::ebseq_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The noiseq results are not of class
## hpgltools::noiseq_pairwise.
p08_dlgn_combined_test_sva <- combine_de_tables(
p08_dlgn_translatome_de_sva, keepers = p08_dlgn_translatome_keepers,
label_column = label_column,
excel = glue("33translatome_xlsx_tx/test_p08_dlgn_translatome_unfiltered_sva-v{ver}.xlsx"))## coefficient edger did not find conditionp08ko or conditionp08het.
## coefficient limma did not find p08ko or p08het.
## Looking for subscript invalid names, end of extract_keepers.
time_scn_extra <- glue("\\
p15het = (conditionp15_het_scn - conditionp15_het_retina), \\
p08het = (conditionp08_het_scn - conditionp08_het_retina), \\
p15het_vs_p08het = (conditionp15_het_scn - conditionp15_het_retina) - (conditionp08_het_scn - conditionp08_het_retina),
p15ko = (conditionp15_ko_scn - conditionp15_ko_retina), \\
p08ko = (conditionp08_ko_scn - conditionp08_ko_retina), \\
p15ko_vs_p08ko = (conditionp15_ko_scn - conditionp15_ko_retina) - (conditionp08_ko_scn - conditionp08_ko_retina)")
time_scn_translatome_de_keepers <- list(
"p15het" = c("p15_het_scn", "p15_het_retina"),
"p08het" = c("p08_het_scn", "p08_het_retina"),
"p15ko" = c("p15_ko_scn", "p15_ko_retina"),
"p08ko" = c("p08_ko_scn", "p08_ko_retina"))
time_scn_translatome_keepers <- list(
"p15het" = c("p15_het_scn", "p15_het_retina"),
"p08het" = c("p08_het_scn", "p08_het_retina"),
"p15ko" = c("p15_ko_scn", "p15_ko_retina"),
"p08ko" = c("p08_ko_scn", "p08_ko_retina"),
"p15_het_sc_vs_retina" = c("p15_het_scn", "p15_het_retina"),
"p08_het_sc_vs_retina" = c("p08_het_scn", "p08_het_retina"),
"scn_het_translatome" = c("p15het", "p08het"),
"scn_ko_translatome" = c("p15ko", "p08ko"))
time_scn_translatome_de <- all_pairwise(tx_pairwise_input, filter = TRUE,
keepers = time_scn_translatome_de_keepers,
model_svs = FALSE,
model_fstring = "~ 0 + condition",
do_basic = FALSE, do_dream = FALSE,
do_noiseq = FALSE, do_ebseq = FALSE,
extra_contrasts = time_scn_extra)## Warning in all_pairwise(tx_pairwise_input, filter = TRUE, keepers = time_scn_translatome_de_keepers, : This will likely fail because of how
## the keepers and extra contrasts are evaluated.
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 remaining).
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## The contrast condition_NA_vs_p15het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p08het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_p08het_vs_p15het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p15ko is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p08ko is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_p08ko_vs_p15ko is not in the results.
## If this is not an extra contrast, then this is an error.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The basic results are not of class
## hpgltools::basic_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The dream results are not of class
## hpgltools::dream_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The ebseq results are not of class
## hpgltools::ebseq_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The noiseq results are not of class
## hpgltools::noiseq_pairwise.
time_scn_translatome_test <- combine_de_tables(
time_scn_translatome_de,
keepers = time_scn_translatome_keepers,
label_column = label_column,
excel = glue("33translatome_xlsx_tx/test_time_scn_translatome_unfiltered_nosva-v{ver}.xlsx"))## coefficient edger did not find conditionp08het or conditionp15het.
## coefficient limma did not find p08het or p15het.
## coefficient edger did not find conditionp08ko or conditionp15ko.
## coefficient limma did not find p08ko or p15ko.
## Looking for subscript invalid names, end of extract_keepers.
time_scn_translatome_de_sva <- all_pairwise(tx_pairwise_input, filter = TRUE,
keepers = time_scn_translatome_de_keepers,
model_svs = "svaseq",
model_fstring = "~ 0 + condition",
do_basic = FALSE, do_dream = FALSE,
do_noiseq = FALSE, do_ebseq = FALSE,
extra_contrasts = time_scn_extra)## Warning in all_pairwise(tx_pairwise_input, filter = TRUE, keepers = time_scn_translatome_de_keepers, : This will likely fail because of how
## the keepers and extra contrasts are evaluated.
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Removing 52544 low-count genes (13339 remaining).
## This received a matrix of SVs.
## converting counts to integer mode
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## This contrast put the denominator first.
## The contrast condition_NA_vs_p15het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p08het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_p08het_vs_p15het is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p15ko is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_NA_vs_p08ko is not in the results.
## If this is not an extra contrast, then this is an error.
## The contrast condition_p08ko_vs_p15ko is not in the results.
## If this is not an extra contrast, then this is an error.
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## conditions
## p08_het_dlgn p08_het_retina p08_het_scn p08_ko_dlgn p08_ko_retina p08_ko_scn p08_wt_dlgn p08_wt_retina p08_wt_scn
## 3 3 3 3 3 3 5 5 3
## p15_het_dlgn p15_het_retina p15_het_scn p15_ko_dlgn p15_ko_retina p15_ko_scn p15_wt_dlgn p15_wt_retina p15_wt_scn
## 4 4 3 3 3 3 5 5 2
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The basic results are not of class
## hpgltools::basic_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The dream results are not of class
## hpgltools::dream_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The ebseq results are not of class
## hpgltools::ebseq_pairwise.
## Warning in correlate_de_tables(results, annot_df = annot_df, extra_contrasts = extra_contrasts): The noiseq results are not of class
## hpgltools::noiseq_pairwise.
time_scn_translatome_test_sva <- combine_de_tables(
time_scn_translatome_de_sva,
keepers = time_scn_translatome_keepers,
label_column = label_column,
excel = glue("33translatome_xlsx_tx/test_time_scn_translatome_unfiltered_sva-v{ver}.xlsx"))## coefficient edger did not find conditionp08het or conditionp15het.
## coefficient limma did not find p08het or p15het.
## coefficient edger did not find conditionp08ko or conditionp15ko.
## coefficient limma did not find p08ko or p15ko.
## Looking for subscript invalid names, end of extract_keepers.
Next step: Perform the retina filter; need to think about the proper union/intersection of the retina/x expression values
In the previous block, we are making 2 global comparisons, here is one of them:
(p15hetscn/p15hetret)/(p08hetscn/p08hetret)
I therefore want to extract the most logical set of genes higher in some/all of these conditions with respect to the corresponding wt conditions. Previously, in section ‘Extract genes included for each set of contrasts’, I attempted to perform this operation for 2 specific wt conditions. When this was performed, it took the unique(union) of the two sets. Thus it stands to reason that I want to take the unique(union) of all 4 in this instance? e.g.:
(p15hetscn > p15wtscn) | (p15hetret > p15wtret) | (p08hetscn > p08wtscn) | (p08hetret > p08wtret)
I kind of think it should be:
((p15hetscn > p15wtscn) | (p15hetret > p15wtret)) & ((p08hetscn > p08wtscn) | (p08hetret > p08wtret))
gross, perhaps I should just do this manually, given that there are only a few putative translatomes to query?
In a fashion similar to how Hector handled the effect of phagocytosis with Laura and Najib a long time ago, I propose to do a simple subtraction of the results of our two contrasts which comprise the translatome query (I was thinking about this last week, thus the inclusion of them in the de tables above). Similarly to the phagocytosis effect, I will simply take the worst posible adjusted p-value. I will repeat this with limma/EdgeR and see how similar the final results are to what those methods provide in the (a/b)/(c/d) comparisons. I am reasonably certain that DESeq2’s results() function has the ability to perform these odd contrasts, but I have never figured out how; perhaps I will use this as a chance to revisit that…
Let us test this idea with the p08 dlgn query, which seeks to compare:
(p08_het_dlgn / p08_het_retina) / (p08_ko_dlgn / p08_ko_retina)
These are maintained in the de_table with the names ‘p08_het_dlgn_vs_retina’ and ‘p08_ko_dlgn_vs_retina’
p08_dlgn_combined_deseq <- subtract_deseq_results(
first_table = p08_dlgn_combined_test[["data"]][["p08_het_dlgn_vs_retina"]],
second_table = p08_dlgn_combined_test[["data"]][["p08_ko_dlgn_vs_retina"]],
first_lfc = "deseq_logfc", second_lfc = "deseq_logfc",
first_p = "deseq_adjp", second_p = "deseq_adjp",
first_name = "het", second_name = "ko",
excel = glue("34translatome_deseqsub_xlsx_tx/translatome_p08_dlgn_combined_deseq-v{ver}.xlsx"))## Error in `subtract_deseq_results()`:
## ! could not find function "subtract_deseq_results"
See how similar these results are to those obtained from limma/edger.
test_columns <- c("edger_logfc", "limma_logfc", "edger_adjp", "limma_adjp")
test_df <- p08_dlgn_combined_test[["data"]][["p08_dlgn_translatome"]][, test_columns]
test_df <- merge(test_df, p08_dlgn_combined_deseq, by = "row.names")## Error in `h()`:
## ! error in evaluating the argument 'y' in selecting a method for function 'merge': object 'p08_dlgn_combined_deseq' not found
rownames(test_df) <- test_df[["Row.names"]]
test_df[["Row.names"]] <- NULL
cor.test(test_df[["limma_logfc"]], test_df[["het_vs_ko_logfc"]])## Error in `cor.test.default()`:
## ! 'y' must be a numeric vector
## Error in `cor.test.default()`:
## ! 'y' must be a numeric vector
## Error in `h()`:
## ! error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': undefined columns selected
## NULL
## Error in `h()`:
## ! error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': undefined columns selected
## NULL
## So, using the maximum p-value is a complete failure; but the extreme similarities
## between this and edgeR suggest to me that it is likely possible to use the results
## from edgeR without concern (or limma for that matter, it was also extremely similar)
## Or I can spend a little time and collect the numbers on each side of the division
## and calculate a t statistic myself.I have on hand
I have gene sets up above which define the genes suitable for each of these pieces. There are only 5 comparisons, let us step through them.
The data for this contrast resides in scn_combined_test\(data\)p08_scn_translatome or the same slot of scn_combined_test_sva
Thus, the inclusion_sig portions to extract are found in: inclusion_sig[[“deseq”]][[“ups”]], and are named exactly as written above!
p08_het_vs_ko_translatome_unfilt <- scn_combined_test[["data"]][["p08_scn_translatome"]]
num_union <- unique(c(rownames(inclusion_sig[["deseq"]][["ups"]][["p08_het_scn"]]),
rownames(inclusion_sig[["deseq"]][["ups"]][["p08_het_retina"]])))
length(num_union)## [1] 548
den_union <- unique(c(rownames(inclusion_sig[["deseq"]][["ups"]][["p08_ko_scn"]]),
rownames(inclusion_sig[["deseq"]][["ups"]][["p08_ko_retina"]])))
length(den_union)## [1] 577
## [1] 770
both_inter_idx <- num_union %in% den_union
both_inter <- num_union[both_inter_idx]
length(both_inter)## [1] 355
keeper <- list("p08_scn_translatome" = c("p08het", "p08ko"))
p08_scn_translatome_union_filtered <- combine_de_tables(
scn_translatome_de, keepers = keeper,
label_column = label_column,
excel = glue("35translatome_union_tx/p08_scn_translatome_union_filtered_nosva-v{ver}.xlsx"),
wanted_genes = both_union)## coefficient edger did not find conditionp08ko or conditionp08het.
## coefficient limma did not find p08ko or p08het.
## Looking for subscript invalid names, end of extract_keepers.
p08_scn_translatome_inter_filtered <- combine_de_tables(
scn_translatome_de, keepers = keeper,
label_column = label_column,
excel = glue("35translatome_union_tx/p08_scn_translatome_intersect_filtered_nosva-v{ver}.xlsx"),
wanted_genes = both_inter)## coefficient edger did not find conditionp08ko or conditionp08het.
## coefficient limma did not find p08ko or p08het.
## Looking for subscript invalid names, end of extract_keepers.
p08_scn_translatome_union_filtered_sva <- combine_de_tables(
scn_translatome_de_sva, keepers = keeper,
label_column = label_column,
excel = glue("35translatome_union_tx/p08_scn_translatome_union_filtered_sva-v{ver}.xlsx"),
wanted_genes = both_union)## coefficient edger did not find conditionp08ko or conditionp08het.
## coefficient limma did not find p08ko or p08het.
## Looking for subscript invalid names, end of extract_keepers.
p08_scn_translatome_union_filtered <- combine_de_tables(
scn_translatome_de, keepers = keeper,
label_column = label_column,
excel = glue("35translatome_union_tx/p08_scn_translatome_intersect_filtered_sva-v{ver}.xlsx"),
wanted_genes = both_inter)## coefficient edger did not find conditionp08ko or conditionp08het.
## coefficient limma did not find p08ko or p08het.
## Looking for subscript invalid names, end of extract_keepers.
Here is a snippet from Rashmi which expresses nicely the DE-result comparisons she is most interested:
Since, I want to know the number of DEG expressed in Retina, SCN and dLGN with respect to genotype, Location and time. I prepared the venn diagram for these comparison:
Since I was interested in understanding the change in local translatome according to Location for different developmental time points for Het and KO. Hence, I tried to generate a venn diagram for Location (Ret and SCN) at developmental time points P8 and P15 for genotype het and KO. So the venn diagram / upset plot will be for location where some genes will be shared/unique for P8_Ret_het, P8_SCN_Het, P15_Ret_HET, P15_SCN_HET. We can prepare an upset plot for P8_Ret_KO, P8_SCN_KO, P15_Ret_KO and P15_SCN_KO also. Or can generate an upset plot by combining both P8_Ret_het, P8_SCN_Het, P15_Ret_HET and P15_SCN_HET and P8_Ret_KO, P8_SCN_KO, P15_Ret_KO and P15_SCN_KO.
Ok, let us see if I can implement this, starting with the genotype query
## The appropriate data structure is 'genotype_tables',
## and the tables of interest are:
table_names <- c("kh_p08_retina", "kh_p15_retina", "kh_p08_scn",
"kh_p15_scn", "kh_p08_dlgn", "kh_p15_dlgn")
table_names %in% names(genotype_sig)## [1] TRUE TRUE TRUE TRUE TRUE TRUE
newsig <- genotype_sig[[1]]
for (sig in 2:length(table_names)) {
name <- table_names[sig]
newsig[["deseq"]][["ups"]][[name]] <- genotype_sig[[name]][["deseq"]][["ups"]][[name]]
newsig[["deseq"]][["downs"]][[name]] <- genotype_sig[[name]][["deseq"]][["downs"]][[name]]
}
genotype_upsetr <- upsetr_sig(newsig)## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
genotype_upset_written <- write_upset_groups(genotype_upsetr, excel = "36upset_genotype_tx/genotype_upset_groups.xlsx")
genotype_upsetr[["all_plot"]]pp(file = "36upset_genotype_tx/test_genotype_upset.pdf")
print(genotype_upsetr[["all_plot"]])
plotted <- dev.off()Now let us try the location-specific comparisons
## The appropriate data structure is 'genotype_tables',
## and the tables of interest are:
table_names <- c("sr_p08_het", "sr_p08_ko")
table_names %in% names(location_sig)## [1] TRUE TRUE
location_upset_input <- list()
first_table <- table_names[1]
newsig <- location_sig[[first_table]]
for (sig in 2:length(table_names)) {
name <- table_names[sig]
newsig[["deseq"]][["ups"]][[name]] <- location_sig[[name]][["deseq"]][["ups"]][[name]]
newsig[["deseq"]][["downs"]][[name]] <- location_sig[[name]][["deseq"]][["downs"]][[name]]
}
location_upsetr <- upsetr_sig(newsig)
location_upset_written <- write_upset_groups(location_upsetr, excel = "36upset_genotype_tx/sr_p08_hetko_upset_groups.xlsx")
location_upsetr[["all_plot"]]pp(file = "36upset_genotype_tx/test_location_sr_p08_hetko_upset.pdf")
print(location_upsetr[["all_plot"]])
plotted <- dev.off()I am reasonably certain that Rashmi would like a table of the genes shared among increased scn ko and het in the above plot along with the increased retina (e.g. the 269 and 103 gene sets).
## [1] TRUE TRUE
location_upset_input <- list()
first_table <- table_names[1]
newsig <- location_sig[[first_table]]
for (sig in 2:length(table_names)) {
name <- table_names[sig]
newsig[["deseq"]][["ups"]][[name]] <- location_sig[[name]][["deseq"]][["ups"]][[name]]
newsig[["deseq"]][["downs"]][[name]] <- location_sig[[name]][["deseq"]][["downs"]][[name]]
}
location_upsetr <- upsetr_sig(newsig)
location_upset_written <- write_upset_groups(location_upsetr, excel = "36upset_genotype_tx/sr_p15_hetko_upset_groups.xlsx")
location_upsetr[["all_plot"]]## Error:
## ! object 'scn_retina_p15_upset_result' not found
## The appropriate data structure is 'genotype_tables',
## and the tables of interest are:
table_names <- c("dr_p08_het", "dr_p08_ko")
location_upset_input <- list()
first_table <- table_names[1]
newsig <- location_sig[[first_table]]
for (sig in 2:length(table_names)) {
name <- table_names[sig]
newsig[["deseq"]][["ups"]][[name]] <- location_sig[[name]][["deseq"]][["ups"]][[name]]
newsig[["deseq"]][["downs"]][[name]] <- location_sig[[name]][["deseq"]][["downs"]][[name]]
}
location_upsetr <- upsetr_sig(newsig)
location_upset_written <- write_upset_groups(location_upsetr, excel = "3upset_genotype_tx/dr_p08_hetko_upset_groups.xlsx")
location_upsetr[["all_plot"]]## The appropriate data structure is 'genotype_tables',
## and the tables of interest are:
table_names <- c("dr_p15_het", "dr_p15_ko")
location_upset_input <- list()
first_table <- table_names[1]
newsig <- location_sig[[first_table]]
for (sig in 2:length(table_names)) {
name <- table_names[sig]
newsig[["deseq"]][["ups"]][[name]] <- location_sig[[name]][["deseq"]][["ups"]][[name]]
newsig[["deseq"]][["downs"]][[name]] <- location_sig[[name]][["deseq"]][["downs"]][[name]]
}
location_upsetr <- upsetr_sig(newsig)
location_upset_written <- write_upset_groups(location_upsetr, excel = "37upset_location_tx/dr_p15_hetko_upset_groups.xlsx")
location_upsetr[["all_plot"]]table_names <- c("ds_p08_het", "ds_p08_ko")
location_upset_input <- list()
first_table <- table_names[1]
newsig <- location_sig[[first_table]]
for (sig in 2:length(table_names)) {
name <- table_names[sig]
newsig[["deseq"]][["ups"]][[name]] <- location_sig[[name]][["deseq"]][["ups"]][[name]]
newsig[["deseq"]][["downs"]][[name]] <- location_sig[[name]][["deseq"]][["downs"]][[name]]
}
location_upsetr <- upsetr_sig(newsig)
location_upset_written <- write_upset_groups(location_upsetr, excel = "37upset_location_tx/ds_p08_hetko_upset_groups.xlsx")
location_upsetr[["all_plot"]]table_names <- c("ds_p15_het", "ds_p15_ko")
location_upset_input <- list()
first_table <- table_names[1]
newsig <- location_sig[[first_table]]
for (sig in 2:length(table_names)) {
name <- table_names[sig]
newsig[["deseq"]][["ups"]][[name]] <- location_sig[[name]][["deseq"]][["ups"]][[name]]
newsig[["deseq"]][["downs"]][[name]] <- location_sig[[name]][["deseq"]][["downs"]][[name]]
}
location_upsetr <- upsetr_sig(newsig)## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
location_upset_written <- write_upset_groups(location_upsetr, excel = "37upset_location_tx/ds_p15_hetko_upset_groups.xlsx")
location_upsetr[["all_plot"]]msigdb <- "reference/msigdb_v2024.1.Mm.db"
if (file.exists(msigdb)) {
tx_h_gsva <- simple_gsva(tx_pairwise_input, orgdb = "org.Mm.eg.db", signature_category = "mh",
signatures = msigdb, id_source = "fdata",
required_id = "mgi_symbol")
tx_h_gsva
tx_h_gsva_sig <- get_sig_gsva_categories(
tx_h_gsva, excel = "38msigdb_tx/gsva_sig_hallmark_categories.xlsx")
tx_h_gsva_sig
tx_m1_gsva <- simple_gsva(tx_pairwise_input, orgdb = "org.Mm.eg.db", signature_category = "m1",
signatures = msigdb, id_source = "fdata",
required_id = "mgi_symbol")
tx_m1_gsva
tx_m1_gsva_sig <- get_sig_gsva_categories(
tx_m1_gsva, excel = "38msigdb_tx/gsva_sig_positional_categories.xlsx")
tx_m1_gsva_sig
tx_m2_gsva <- simple_gsva(tx_pairwise_input, orgdb = "org.Mm.eg.db", signature_category = "m2",
signatures = msigdb, id_source = "fdata",
required_id = "mgi_symbol")
tx_m2_gsva
tx_m2_gsva_sig <- get_sig_gsva_categories(
tx_m2_gsva, excel = "38msigdb_tx/gsva_sig_curated_categories.xlsx")
tx_m2_gsva_sig
tx_m3_gsva <- simple_gsva(tx_pairwise_input, orgdb = "org.Mm.eg.db", signature_category = "m3",
signatures = msigdb, id_source = "fdata",
required_id = "mgi_symbol")
tx_m3_gsva
tx_m3_gsva_sig <- get_sig_gsva_categories(
tx_m3_gsva, excel = "38msigdb_tx/gsva_sig_regulatory_categories.xlsx")
tx_m3_gsva_sig
tx_m5_gsva <- simple_gsva(tx_pairwise_input, orgdb = "org.Mm.eg.db", signature_category = "m5",
signatures = msigdb, id_source = "fdata",
required_id = "mgi_symbol")
tx_m5_gsva
tx_m5_gsva_sig <- get_sig_gsva_categories(
tx_m5_gsva, excel = "38msigdb_tx/gsva_sig_ontology_categories.xlsx")
tx_m5_gsva_sig
tx_m8_gsva <- simple_gsva(tx_pairwise_input, orgdb = "org.Mm.eg.db", signature_category = "m8",
signatures = msigdb, id_source = "fdata",
required_id = "mgi_symbol")
tx_m8_gsva
tx_m8_gsva_sig <- get_sig_gsva_categories(
tx_m8_gsva, excel = "38msigdb_tx/gsva_sig_celltype_categories.xlsx")
tx_m8_gsva_sig
}## gsva requires the annotation field to be filled in. Setting it to orgdb given.
## Converting the rownames() of the SummarizedExperiment to mgi_symbol.
## Error in `simple_gsva()`:
## ! I do not understand this ID source.
Up above I created a fairly large set of enrichment/GSEA analyses. Let us pull some of the most interesting results here and look at them.
Here are the specific queries from Rashmi:
Let us take a moment and see for which contrasts I acquired results:
I need to make a little summary for clusterprofiler too so that I can easily see how many hits there are for each contrast.
## Length Class Mode
## kh_p08_dlgn_up 22 hpgltools::simple_gprofiler list
## kh_p08_dlgn_down 25 hpgltools::simple_gprofiler list
## kh_p15_dlgn_up 28 hpgltools::simple_gprofiler list
## kh_p08_scn_down 24 hpgltools::simple_gprofiler list
## kh_p15_scn_down 26 hpgltools::simple_gprofiler list
## [1] "kh_p08_dlgn_up"
## BP CC CORUM HP KEGG MF REAC TF WP
## 0 1 0 0 0 0 0 1 0
## [1] "kh_p08_dlgn_down"
## BP CC CORUM HP KEGG MF REAC TF WP
## 3 2 0 1 1 0 0 2 0
## [1] "kh_p15_dlgn_up"
## BP CC CORUM HP KEGG MF REAC TF WP
## 51 29 1 90 1 7 5 3 0
## [1] "kh_p08_scn_down"
## BP CC CORUM HP KEGG MF REAC TF WP
## 2 7 0 0 0 2 0 1 0
## [1] "kh_p15_scn_down"
## BP CC CORUM HP KEGG MF REAC TF WP
## 10 2 0 0 1 4 1 0 1
## Length Class Mode
## kh_p08_dlgn_up 20 hpgltools::simple_clusterprofiler list
## kh_p15_dlgn_up 20 hpgltools::simple_clusterprofiler list
## kh_p08_retina_up 20 hpgltools::simple_clusterprofiler list
## kh_p15_retina_up 20 hpgltools::simple_clusterprofiler list
## kh_p08_scn_up 20 hpgltools::simple_clusterprofiler list
## kh_p15_scn_down 20 hpgltools::simple_clusterprofiler list
## [1] "kh_p08_dlgn_up"
## NULL
## [1] "kh_p15_dlgn_up"
## NULL
## [1] "kh_p08_retina_up"
## NULL
## [1] "kh_p15_retina_up"
## NULL
## [1] "kh_p08_scn_up"
## NULL
## [1] "kh_p15_scn_down"
## NULL
This contrast, even before filtering away the high-wt genes, only has 8 genes in the set of up and down genes combined. As a result, my function which performs gProfiler/clusterProfiler skips it, and also skips the p15 het/ko for retina samples.
This has a bunch more genes: 51 up and 128 down. Unfortunately, gProfiler sees no significant over-representation in the up category of genes. The down category has
The up/down sets from clusterProfiler have enrich_go, gse_go, and go_data to look at.
## NULL
## BP CC CORUM HP KEGG MF REAC TF WP
## 2 7 0 0 0 2 0 1 0
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## dimensionality reduction failed with provided drfun; falling back to stats::cmdscale.
## NULL
Perhaps I should just ask the question: for which categories did I get results back?
## Length Class Mode
## kh_p08_dlgn_up 22 hpgltools::simple_gprofiler list
## kh_p08_dlgn_down 25 hpgltools::simple_gprofiler list
## kh_p15_dlgn_up 28 hpgltools::simple_gprofiler list
## kh_p08_scn_down 24 hpgltools::simple_gprofiler list
## kh_p15_scn_down 26 hpgltools::simple_gprofiler list
kh_p08_dlgn_up: No significant gProfiler results. kh_p15_dlgn_up: Significant BP, HP, KEGG, MF, REAC, TF kh_p08_scn_up: No significant gProfiler results. kh_p08_scn_down: Significant BP, MiRNA, MF, TF kh_p15_scn_down: Significant BP, MF
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
Enriched groups: BP, KEGG, MF, TF, CC
## Length Class Mode
## BP 0 data.frame list
## CC 16 data.frame list
## CORUM 0 data.frame list
## HP 0 data.frame list
## KEGG 16 data.frame list
## MF 16 data.frame list
## REAC 0 data.frame list
## TF 16 data.frame list
## WP 0 data.frame list
## input 78 data.frame list
## CC_enrich 1 enrichResult S4
## KEGG_enrich 1 enrichResult S4
## MF_enrich 1 enrichResult S4
## TF_enrich 1 enrichResult S4
## num_genes 1 -none- numeric
## interactive_plots 4 -none- list
## num_hits 9 -none- numeric
## gost_plots 4 -none- list
## gost_links 4 -none- list
## significant 4 -none- list
## excel 1 written_gprofiler numeric
## pvalue_plots 2 -none- list
## species 1 -none- character
## threshold 1 -none- numeric
plots <- plot_enrichresult(location_gp[["sr_p08_het"]][["sr_p08_het_up"]][["BP_enrich"]])
plots[["dot"]]## NULL
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Error in `if (nrow(gse) < topn) ...`:
## ! argument is of length zero
plots <- plot_enrichresult(location_gp[["sr_p15_ko"]][["sr_p15_ko_up"]][["BP_enrich"]])
plots[["dot"]]## NULL
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## dimensionality reduction failed with provided drfun; falling back to stats::cmdscale.
plots <- plot_enrichresult(location_gp[["sr_p15_het"]][["sr_p15_het_up"]][["BP_enrich"]])
plots[["dot"]]## NULL
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
Ups: significant results for BP, MF, TF Downs: BP, MF, REAC, TF, WP
plots <- plot_enrichresult(time_gp[["t_het_retina"]][["t_het_retina_up"]][["BP_enrich"]])
plots[["dot"]]## NULL
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
Up: BP, MiRNA, MF Down: BP, MF, REAC, TF
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
## Warning in (function (model, data, ...) : Arguments in `...` must be used.
## ✖ Problematic argument:
## • by = "Count"
## ℹ Did you misspell an argument name?
Neither of the SCN gProfiler queries provided any results.
pander::pander(sessionInfo())
message(paste0("This is hpgltools commit: ", get_git_commit()))
message(paste0("Saving to ", savefile))
tmp <- sm(saveme(filename = savefile))