HI
How to sum the gene-wise counts in edge R for differential genes comparing 2 groups. Looking for two-group comparison with n=2 in each group. I'm new to R literally struck. suggestion please.
The tabulate matrix looks some thing like this
temp Test Sample GeneI Gene2 Gene2 Gene3 ....Genen
t80 T1 1 55
t80 T1 2 89
t80 T1 3 54
t80 T1 4 453
t80 T1 5 50
t80 T1 6 32
t80 T2 7 45
t80 T2 8 45
t80 T2 9 50
t80 T2 10 54
t80 T2 11 45
t80 T2 12 15
t8 T3 13 43
t8 T3 14 25
t8 T3 15 404
t8 T3 16 385
t8 T3 17 51
t8 T3 18 32
t8 T4 19 454
t8 T4 20 395
t8 T4 21 53
t8 T4 22 35
t8 T4 23 96
t8 T4 24 87
Code
library(edgeR)
matrix.dge <- DGEList(matrix)
head(matrix.dge)
sumgenes <- sumTechReps(matrix.dge,ID=colnames(matrix.dge))
head(sumgenes)
sumcounts <- sumgenes$counts
nrow(sumcounts)
head(sumcounts)
tail(sumcounts)
The result seems to be same after applying sumTechReps function
Rpolicastro - I love seeing your tidyverse-esque responses on here. I always end up learning something new from ya. Quick question though. Whenever you create a sample data.frame, you always use this framework:
Any reason on why you use this rather than using the tibble() function or even data.frame()?
Thanks, glad to hear my code snippets are helping people!
The format you see is the result of the
dput
function being run on a data.frame. It's a way to share a longer data.frame (or most other types of R objects) in a slightly more condensed format. I usually wouldn't use dput in my actual code, just as a way to share example data on some place like biostars or stack overflow.Thanks for the informative code.