Entering edit mode
mictadlo
▴
10
@mictadlo-10885
Last seen 4.8 years ago
Hi, The plotMD
get as title the whole file path. How would it be possible to have e.g. only the file name rather than the whole path as plot title?
library(edgeR)
# where are we?
basedir <- "~/projects/mel/Sp/"
setwd(basedir)
tayets <- read.delim("phenoSp.txt", stringsAsFactors=FALSE)
tayets
## ----group---------------------------------------------------------------
group <- paste(tayets$CellType, tayets$Status, sep=".")
group <- factor(group)
table(group)
cntdir <- paste(basedir, "Htseq_read_counts", sep="/")
pat <- "sorted.out"
files <- list.files(path = cntdir,
pattern = pat,
all.files = TRUE,
recursive = FALSE,
ignore.case = FALSE,
full.names = TRUE,
include.dirs = FALSE)
files
y <- readDGE(files, header=FALSE, group = group)
y
# Filtering to remove low counts
keep <- rowSums(cpm(y)>1) >= 2
table(keep)
y <- y[keep, , keep.lib.sizes=FALSE]
# Normalization for composition bias
y <- calcNormFactors(y)
y$samples
#Exploring differences between libraries
## ----mdsplot, fig.cap="The MDS plot of the data set. Samples are separated by the cell type in the first dimension, and by the mouse status in the second dimension."----
pch <- c(0,1,2,15,16,17)
colors <- rep(c("darkgreen", "red", "blue"), 2)
plotMDS(y, col=colors[group], pch=pch[group])
legend("topleft", legend=levels(group), pch=pch, col=colors, ncol=2)
## ----mdplot1, fig.cap="MD plot of log2-expression in sample 1 versus the average log2-expression across all other samples. Each point represents a gene, and the red line indicates a log-ratio of zero. The majority of points cluster around the red line."----
plotMD(y, column=1)
abline(h=0, col="red", lty=2, lwd=2)
Thank you in advance.
It worked with `colnames(y) <- gsub("\\.sorted", "", basename(colnames(y)))`.