This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extract.portion <- function(file, chr, start, end, verbose = TRUE){ | |
rl <- IRanges::RangesList(IRanges::IRanges(start=start, end=end)) | |
names(rl) <- chr | |
portion <- import(file, as="Rle",format = "bw", selection = BigWigSelection(rl)) | |
portion <- portion[chr] | |
portion <- as.numeric(portion[[chr]]) | |
portion | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getPCS <- function(matrix, ncomp=2){ | |
require(mixOmics) | |
nipals(matrix, ncomp = ncomp)$p | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
makeAutosomal <- function(matrix){ | |
require(IlluminaHumanMethylation450kanno.ilmn12.hg19) | |
ann <- getAnnotation(IlluminaHumanMethylation450kanno.ilmn12.hg19) | |
good.probes <- rownames(ann)[-which(ann$chr=="chrX" | ann$chr=="chrY")] | |
matrix[rownames(matrix) %in% good.probes,] | |
} | |
makeX <- function(matrix){ | |
require(IlluminaHumanMethylation450kanno.ilmn12.hg19) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# object must be an RGChannelSet object from the minfi package | |
getSnpBeta <- function(object){ | |
require(minfi) | |
minfi:::.isRG(object) | |
manifest <- getManifest(object) | |
snpProbesII <- getProbeInfo(manifest, type = "SnpII")$Name | |
M.II <- getGreen(object)[getProbeInfo(object, type = "SnpII")$AddressA,] |
NewerOlder