Skip to content

Instantly share code, notes, and snippets.

@Jfortin1
Last active August 10, 2022 17:20
Show Gist options
  • Save Jfortin1/3107cf2eda24da8a6dfd to your computer and use it in GitHub Desktop.
Save Jfortin1/3107cf2eda24da8a6dfd to your computer and use it in GitHub Desktop.
To remove sex chromosome probes from a 450k matrix
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)
ann <- getAnnotation(IlluminaHumanMethylation450kanno.ilmn12.hg19)
good.probes <- rownames(ann)[ann$chr=="chrX"]
matrix[rownames(matrix) %in% good.probes,]
}
makeY <- function(matrix){
require(IlluminaHumanMethylation450kanno.ilmn12.hg19)
ann <- getAnnotation(IlluminaHumanMethylation450kanno.ilmn12.hg19)
good.probes <- rownames(ann)[ann$chr=="chrY"]
matrix[rownames(matrix) %in% good.probes,]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment