I have some idat files to analyze, since I haven’t found a complete script for doing it I have wrote one by myself:
library(limma) # Files and experimental conditions targets <- readTargets("targets.txt") # I have two conditions "KO" and "WT" # Reading data idatfiles = dir(path="C:/Data", pattern = ".idat") bgxfile = dir(path = "C:/Data", pattern = ".bgx") data = read.idat(idatfiles, bgxfile) # Normalization and background adjustment data2 <- neqc(data) # Build the design matrix for the linear modelling function. f <- factor(targets$Condition, levels = unique(targets$Condition)) design <- model.matrix(~0 + f) colnames(design) <- levels(f) # Apply the intensity values to lmFit. fit <- lmFit(data2, design) # Create a contrast matrix. In this example, all combinations of contrasts can be set up as below. contrast.matrix <- makeContrasts("KO-WT", levels=design) # Apply this contrast matrix to the modeled data and compute statistics for the data. fit2 <- contrasts.fit(fit, contrast.matrix) fit2 <- eBayes(fit2) # Output the statistics for the dataset and write them to disk for further analysis. output <- topTable(fit2, adjust="BH", coef="KO-WT", genelist=data2$genes, number=Inf) write.table(output, file="Results.txt", sep="\t", quote=FALSE)
I have two questions, is it correct? Do you have any suggestion to improve it?
Thank you very much.