Skip to content

Instantly share code, notes, and snippets.

@Jfortin1
Created August 1, 2014 19:34
Show Gist options
  • Save Jfortin1/08721b4dd97dc9aaf069 to your computer and use it in GitHub Desktop.
Save Jfortin1/08721b4dd97dc9aaf069 to your computer and use it in GitHub Desktop.
To get the Beta values for the 65 SNP probes
# 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,]
U.II <- getRed(object)[getProbeInfo(object, type = "SnpII")$AddressA,]
snpProbesI.Green <- getProbeInfo(manifest, type = "SnpI")[getProbeInfo(manifest, type = "SnpI")$Color=="Grn",]
snpProbesI.Red <- getProbeInfo(manifest, type = "SnpI")[getProbeInfo(manifest, type = "SnpI")$Color=="Red",]
M.I.Red <- getRed(object)[snpProbesI.Red $AddressB,]
U.I.Red <- getRed(object)[snpProbesI.Red $AddressA,]
M.I.Green <- getGreen(object)[snpProbesI.Green$AddressB,]
U.I.Green <- getGreen(object)[snpProbesI.Green$AddressA,]
M <- rbind(M.II, M.I.Red, M.I.Green)
U <- rbind(U.II, U.I.Red, U.I.Green)
rownames(M) <- rownames(U) <- c(snpProbesII, snpProbesI.Red$Name, snpProbesI.Green$Name)
beta <- M/(U+M+100)
return(beta)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment