Hi there,
I'm using EdgeR to analyze my RNAseq data. I have 2 questions: 1) It seems normLibSizes() does similar job as calcNormFactors (I've checked). What difference do they make, and under what situation?
2) I've got a MDS graph with colored labels on the plot. But I wanted to make a MDS plot showing colored shapes (i.e., dots and squares) with a label legend.
My metadata would look like:
sample var time
JB0-1 JB 0h
JB0-2 JB 0h
JB0-3 JB 0h
JB10-1 JB 10h
JB10-2 JB 10h
JB10-3 JB 10h
...
LP0-1 LF 0h
LP0-2 LF 0h
LP0-3 LF 0h
LP10-1 LF 10h
LP10-2 LF 10h
LP10-3 LF 10h
...
Your kind help will be highly appreciated!
Jay
x <- read.csv(file="JB_LF.csv", header = TRUE, row.names = 1)
x <- as.matrix(x) # coerce to be matrix
# data has 2 var (LB vs LP) on 9 timepoints (0~8) with 3 reps)
group <- scan(text="JB0 ... JB8 ... LP0 ... LP8", what="")
group <- factor(group)
y <- DGEList(counts=x, group=group)
y$samples
# filter out genes with low counts
keep <- filterByExpr(y, group=group)
y_filter <- y[keep, , keep.lib.sizes=FALSE]
# TMM
y_filter_norm <- calcNormFactors(y_filter)
y_filter_norm$samples
# calculate CPM
cpm_counts<-cpm(y_filter_TMM, normalized.lib.sizes = T)
write.csv(cpm_counts, file = "JB_LF_NormCPM_filter.csv")
# plot MDS
col <- as.numeric(group)
plotMDS(cpm_counts, col = col)
Thank you so much! Your advice on becoming good at R is definitely true!