Created
May 8, 2023 15:50
-
-
Save adomingues/cbcd4c8f50d930e0edddbe439ba28b19 to your computer and use it in GitHub Desktop.
Re-analysis of a dataset which strange differential expressed genes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r } | |
library("recount3") | |
library("data.table") | |
library("magrittr") | |
library("DESeq2") | |
rse <- recount3::create_rse_manual( | |
project = "ERP010060", | |
project_home = "data_sources/sra", | |
organism = "human", | |
annotation = "gencode_v26", | |
type = "gene" | |
) | |
sample_info <- colData(rse) %>% | |
as.data.frame() %>% | |
setDT(keep.rownames="sample_id") %>% | |
.[, c("sample_id", "sra.experiment_attributes", "sra.sample_title")] %>% | |
.[, siRNA := gsub("Experimental Factor: RNA interference;;(.+)\\|Experimental Factor: stimulus;;(.+)\\|LIBRARY_STRAND;;first strand", "\\1", sra.experiment_attributes)] %>% | |
.[, siRNA := gsub(" antisense oligonucleotide", "", siRNA)] %>% | |
.[, stimulus := gsub("Experimental Factor: RNA interference;;(.+)\\|Experimental Factor: stimulus;;(.+)\\|LIBRARY_STRAND;;first strand", "\\2", sra.experiment_attributes)] %>% | |
.[, replicate := gsub(".+:Sample (\\d)", "\\1", sra.sample_title)] %>% | |
.[, replicate := ifelse(replicate == "", sample(.$replicate[!is.na(.$replicate)], 1), replicate)] %>% | |
.[, siRNA_stimulus := paste(siRNA, stimulus, sep = "_")] %>% | |
.[, c("sample_id", "siRNA", "stimulus", "replicate", "siRNA_stimulus")] %>% | |
as.data.frame() | |
rownames(sample_info) <- sample_info$sample_id | |
cnts <- assay(rse, "raw_counts") %>% | |
as.data.frame() %>% | |
setDT(keep.rownames="gene_id") %>% | |
.[ !like(gene_id, "_PAR_Y")] %>% | |
.[, gene_id := gsub("\\.\\w+$", "", gene_id)] %>% | |
as.matrix(rownames = "gene_id") | |
``` | |
```{r } | |
dds <- DESeqDataSetFromMatrix( | |
countData=cnts, | |
colData=sample_info, | |
design=~siRNA_stimulus | |
) | |
``` | |
```{r } | |
dds <- DESeq(dds) | |
res <- results(dds, name = "siRNA_stimulus_scrambled_KCl_vs_NEAT1_KCl") | |
res | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
plot 1
plot 2
plot 3