Description Usage Arguments Value Examples

View source: R/makeCpGranges.R

Cluster CpGs together in regions based on proximity

1 | ```
makeCpGregions(observations, chr, pos, maxGap = 500, minCpG = 2)
``` |

`observations` |
Vector of corresponding observed T-value for each CpG, must be ordered in the same way as chr and pos |

`chr` |
Vector of chromosome location for each CpG |

`pos` |
Vector giving base pair position for each CpG If unsorted, use order(chr,pos) to sort the genomic positions within each chromosome. |

`maxGap` |
Maximum allowed base pair gap within a cluster. Default is set to 500. |

`minCpG` |
Minimum number of CpGs allowed in each region to be considered. Default is set to at least 2 CpGs within each region. |

The suplied observations ordered into into a GRangesList object.
To be parsed further into `dmrscan`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
data(DMRScan.methylationData) ## Load methylation data from chromosome 22
data(DMRScan.phenotypes) ## Load phenotype (end-point for methylation data)
## Test for an association between phenotype and Methylation
testStatistics <- apply(DMRScan.methylationData,1,function(x,y)
summary(glm(y ~ x, family = binomial(link = "logit")))$coefficients[2,3],
y = DMRScan.phenotypes)
## Set chromosomal position to each test-statistic
pos<- data.frame(matrix(as.integer(unlist(strsplit(names(testStatistics),
split="chr|[.]"))), ncol = 3, byrow = TRUE))[,-1]
## Set clustering features
minCpG <- 3 ## Minimum number of CpGs in a tested cluster
## Maxium distance (in base-pairs) within a cluster before it is
## broken up into two seperate cluster
maxGap <- 750
regions <- makeCpGregions(observations = testStatistics, chr = pos[,1],
pos = pos[,2], maxGap = maxGap, minCpG = minCpG)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.