Skip to content

Instantly share code, notes, and snippets.

@adomingues
Created May 8, 2023 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adomingues/cbcd4c8f50d930e0edddbe439ba28b19 to your computer and use it in GitHub Desktop.
Save adomingues/cbcd4c8f50d930e0edddbe439ba28b19 to your computer and use it in GitHub Desktop.
Re-analysis of a dataset which strange differential expressed genes
```{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
```
@adomingues
Copy link
Author

plot 1

image

plot 2

image

plot 3

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment