# 1: Reading Raw Files (.idat)
- Create Target/csv/sample file
- TCGA (not a sample.txt or csv file)(https://sagebionetworks.jira.com/wiki/pages/viewpage.action?pageId=11206919&src=search)
- Download the data, Use .sdrf file provided with the downloaded data to make the targets file that facilitates data reading using minfi functions into R;
- For target file, the only important column is Basename that indicates where the files are for every patients if _Grn.idat or _Red.idat can be attached (find creat_target.pl)
- GEO
- ...
- Read .idat files
- library(minfi)
- targets <- read.table("target.txt", header=T, sep="\t")
- RGSet<-read.450k.exp(targets=targets)
- #Get the methylation matrix that will allow to extract methylated and unmethylated probes:
Mset.raw<-preprocessRaw(RGSet)
#
this
doesn't apply any normalization although the
package
has a few methods available including the methods implemented in GenomeStudio
# 2: DNA methylation data normalization
- Easy way:
- m<-getMeth(Mset.raw)
- u<-getUnmeth(Mset.raw)
mval<-log2((m+
0.01
)/(u+
0.01
)) #alpha=0.01
x<-apply(mval,
2
,function(x) which(is.na(x)))
beta_val<-m/(m+u) #alpha=0
- Complicated way (minfi + shinyMethyl)
- require(minfi)
- require(minfiData)
- phenoData <- pData(RGSet)
- phenoData[,1:6]
- manifest <- getManifest(RGSet)
- manifest
- head(getProbeInfo(manifest))
- typeIProbes <- getProbeInfo(manifest, type = "I")$Name
- head(typeIProbes)
- snpProbesI <- getProbeInfo(manifest, type = "SnpI")$Name
- snpProbesII <- getProbeInfo(manifest, type = "SnpI")$Name
- head(snpProbesI)
- Quality Control
- detP <- detectionP(RGSet)
- failed <- detP > 0.01
- head(failed, n=3)
- colMeans(failed)
- sum(rowMeans(failed)>0.5)
- MSet <- preprocessRaw(RGSet)
- MSet
- head(getMeth(MSet)[,1:3])
- head(getUnmeth(MSet)[,1:3])
- qc <- getQC(MSet)
- head(qc)
- plotQC(qc)
- densityPlot(RGSet, sampGroups = phenoData$Sample_Group, main= "Beta", xlab = "Beta")
- densityBeanPlot(RGSet, sampGroups = phenoData$Sample_Group)
- controlStripPlot(RGSet, controls="BISULFITE CONVERSION II")
- qcReport(RGSet, pdf= "qcReport.pdf")
- Starting with ShinyMethyl
- source("E:/AML/shinyMethyl-master/R/extractFromRGSet450k.R")
- extractedDataMinfiLab <- extractFromRGSet450k(RGSet,file = "extractedDataMinfiLab.Rda")
- source("/data/minfiLab/myRunApp.R")
- myRunApp(appDir = "/data/minfiLab/shinyMethyl")
- Proprocessing and normalization
- MSet.illumina <- preprocessIllumina(RGSet, bg.correct = TRUE,normalize = "controls")
- MSet.swan <- preprocessSWAN(RGSet)
- MethylSet and RatioSet
- getBeta(MSet, type = "Illumina")[1:4,1:3]
- getM(MSet)[1:4,1:3]
- ratioSet <- ratioConvert(MSet, what = "both", keepCN = TRUE)
- ratioSet
- Map to Genome
- gRatioSet <- mapToGenome(ratioSet, genomeBuild = "hg19", mergeManifest = TRUE)
- gRatioSet
- showClass("GenomicRatioSet")
- getBeta(gRatioSet)
- getM(gRatioSet)
- getCN(gRatioSet)
- sampleNames <- sampleNames(gRatioSet)
- probeNames <- featureNames(gRatioSet)
- pheno <- pData(gRatioSet)
- gRanges <- rowData(gRatioSet)
- head(gRanges, n= 3)
No comments:
Post a Comment