Last active
July 10, 2018 14:24
-
-
Save gogleva/3e28b38d1358f34fa932a63fc43df52c to your computer and use it in GitHub Desktop.
deg analysis function template
This file contains 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
################# | |
counts1 | |
counts2 | |
counts3 | |
analyse_DEG <- function(dataset, hpi){ | |
#0 pre-filter sample table | |
sampletable <- SampleTable %>% | |
select(timepoint == hpi) | |
#1 prepare ddsmat object | |
ddsmat <- DESeqDataSetFromMatrix(countData = dataset, | |
colData = sampletable, | |
design = ~ treatment) | |
#2 filter low count out | |
ddsmat <- ddsmat[ rowSums(counts(ddsmat)) > 1, ] | |
#3 dif expression analysis | |
dds <- DESeq(ddsmat) | |
#4 result genes in df format | |
resdf <- as.tibble(results(dds)) | |
#5 filter df with results | |
#6 do smth else ... | |
} | |
### calling function: | |
res_14 <- analyse_DEG(counts1, '14_hpi') | |
res_24 <- analyse_DEG(counts2, '24_hpi') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment