## ------------------------------------------------------------------------ 库(hiAnnotator ) ## ------------------------------------------------------------------------ 数据(网站)# #网站对象没有一个启动和停止列表示基因组范围,因此soloStart参数必须是真实的或将抛出的错误!alldata。rd <- makeGRanges(sites, soloStart = TRUE) data(genes) ##添加冻结填充GRanges对象的SeqInfo插槽。基因。rd < makeGRanges(基因,冻结= " hg18 ") ## ---- eval = FALSE ------------------------------------------------------- # refflat < - getUCSCtable(“refflat”、“RefSeq基因”)# < makeGRanges (refflat基因 ) ## ------------------------------------------------------------------------ nearestGenes < getNearestFeature (alldata。理查德·道金斯,基因。rd, "NearestGene") head(nearestGenes) # nearestGenes <- getNearestFeature(alldata.rd,基因。rd,"NearestGene", parallel=TRUE) ##获取最近的5'基因nearestGenes <- getNearestFeature(alldata. txt)理查德·道金斯,基因。rd, "NearestGene", side = "5p") head(nearestGenes) ## get nearest 3' genes nearestGenes <- getNearestFeature(alldata. gene, side = "5p . gene ")理查德·道金斯,基因。rd, "NearestGene", side = "3p") head(nearestGenes) ## get midpoint of genes nearestGenes <- getNearestFeature(alldata。理查德·道金斯,基因。rd, "NearestGene", side = "midpoint") head(nearestGenes) ###获得两个最近的上游和下游基因相对查询nearestTwoGenes <- get2NearestFeature(alldata. txt)理查德·道金斯,基因。rd, "NearestGene") head(nearestTwoGenes) ## ------------------------------------------------------------------------ geneCounts <- getFeatureCounts(alldata.rd, genes.rd, "NumOfGene") head(geneCounts) # geneCounts <- getFeatureCounts(alldata.rd, genes.rd, "NumOfGene", parallel=TRUE) ## ---- eval=FALSE, echo=TRUE---------------------------------------------- # geneCounts <- getFeatureCounts(alldata.rd, genes.rd, "NumOfGene", # doInChunks = TRUE, chunkSize = 100) # head(geneCounts) # # geneCounts <- getFeatureCountsBig(alldata.rd, genes.rd, "NumOfGene") # head(geneCounts) ## ------------------------------------------------------------------------ ## Shows which feature(s) a position was found in. InGenes <- getSitesInFeature(alldata.rd, genes.rd, "InGene") head(InGenes) ## Simply shows TRUE/FALSE InGenes <- getSitesInFeature(alldata.rd, genes.rd, "InGene", asBool = TRUE) head(InGenes) # InGenes <- getSitesInFeature(alldata.rd, genes.rd, "InGene", asBool=TRUE, parallel=TRUE) ## ---- eval=FALSE, echo=TRUE---------------------------------------------- # doAnnotation(annotType = "within", alldata.rd, genes.rd, "InGene") # doAnnotation(annotType = "counts", alldata.rd, genes.rd, "NumOfGene") # doAnnotation(annotType = "countsBig", alldata.rd, genes.rd, "ChipSeqCounts") # doAnnotation(annotType = "nearest", alldata.rd, genes.rd, "NearestGene") # doAnnotation(annotType = "twoNearest", alldata.rd, genes.rd, "TwoNearestGenes") # geneCheck <- function(x, wanted) { x$isWantedGene <- x$InGene %in% wanted; # return(x) } # doAnnotation(annotType = "within", alldata.rd, genes.rd, "InGene", # postProcessFun = geneCheck, # postProcessFunArgs = list("wanted" = c("FOXJ3", "SEPT9", "RPTOR")) ) ## ---- eval=TRUE, echo=TRUE----------------------------------------------- res <- doAnnotation(annotType = "within", alldata.rd, genes.rd, "InGene", asBool = TRUE) plotdisFeature(res, "virus", "InGene") res <- doAnnotation(annotType = "nearest", alldata.rd, genes.rd, "NearestGene", side = '5p') plotdisFeature(res, "virus", "X5pNearestGeneDist") data(sites.ctrl) sites$type <- "expr" sites <- rbind(sites,sites.ctrl) alldata.rd <- makeGRanges(sites, soloStart = TRUE) res <- doAnnotation(annotType = "within", alldata.rd, genes.rd, "InGene", asBool = TRUE) plotdisFeature(res, "virus", "InGene") plotdisFeature(res, "virus", "InGene", typeRatio = TRUE) ## ----par_examples, eval=FALSE, echo=TRUE--------------------------------- # ## Example 1: library(doSMP) # w <- startWorkers(2) # registerDoSMP(w) # getNearestFeature(..., parallel = TRUE) # # ## Example 2: library(doMC) # registerDoMC(2) # getNearestFeature(..., parallel = TRUE) # # ## Example 3: library(doSNOW) # cl <- makeCluster(2, type = "SOCK") # registerDoSNOW(cl) # getNearestFeature(..., parallel = TRUE) # # ## Example 4: library(doParallel) # cl <- makeCluster(2) # registerDoParallel(cl) # getNearestFeature(..., parallel = TRUE)