## ----style, echo = FALSE, results = 'asis'------------------------------- BiocStyle::markdown() ## ----lkone--------------------------------------------------------------- suppressPackageStartupMessages(library(geuvStore)) prst = partialRegistry() prst ## ----lktwo,cache=TRUE---------------------------------------------------- library(gQTLBase) # prstore = ciseStore(prst, addProbeMap=TRUE, addRangeMap=TRUE) prstore = makeGeuvStore() prstore ## ----lookup1------------------------------------------------------------- head( extractByProbes(prstore, probeids=c("ENSG00000183814.10", "ENSG00000174827.9")) ) ## ----lookup2------------------------------------------------------------- head( extractByRanges(prstore, GRanges("1", IRanges(146000000, width=1e6))) ) ## ----doapp--------------------------------------------------------------- lens = storeApply(prstore, length) summary(unlist(lens)) ## ----echo=FALSE,eval=FALSE----------------------------------------------- # # /udd/stvjc/VM/GEUVADIS/SEPT_2014/FLAT_1M/CHANNING_SGE/newflat.R # # library(BatchJobs) # # gtpath = function (chrdigit, useS3 = FALSE) # { # tmplate = "/proj/rerefs/reref00/EBI/GEUVADIS/VCF/GEUVADIS.chr%%N%%.PH1PH2_465.IMPFRQFILT_BIALLELIC_PH.annotv2.genotypes.vcf.gz" # if (useS3) # tmplate = "http://1000genomes.s3.amazonaws.com/release/20110521/ALL.chr%%N%%.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz" # gsub("%%N%%", chrdigit, tmplate) # } # # # flatReg = makeRegistry("flatReg", file.dir="flatStore", # seed=123, packages=c("GenomicRanges", # "GGtools", "VariantAnnotation", "Rsamtools", # "geuvPack", "GenomeInfoDb")) # # # # chunkGenes = function(chrint, chunk.size=10) { # cat(chrint) # stopifnot(is(chrint, "integer")) # library(geuvPack) # if (!exists("geuFPKM")) data(geuFPKM) # seqlevelsStyle(geuFPKM) = "NCBI" # snps indexed this way too # curgenes = rownames( geuFPKM[ which(seqnames(geuFPKM)==chrint), ] ) # glist = chunk( curgenes, chunk.size=chunk.size ) # lapply(glist, function(x) list(chr=chrint, genes=x) ) # } # # gettests = function( chunk, useS3=FALSE ) { # library(VariantAnnotation) # snpsp = gtpath( chunk$chr, useS3=useS3) # tf = TabixFile( snpsp ) # library(geuvPack) # if (!exists("geuFPKM")) data(geuFPKM) # seqlevelsStyle(geuFPKM) = "NCBI" # clipped = clipPCs(regressOut(geuFPKM, ~popcode), 1:10) # set.seed(54321) # ans = cisAssoc( clipped[ chunk$genes, ], tf, cisradius=1000000, lbmaf=0.01 ) # metadata(ans)$prepString = "clipPCs(regressOut(geuFPKM, ~popcode), 1:10)" # ans # } # # autosomes = as.integer(1:22) # genechunks = lapply(autosomes, chunkGenes, chunk.size=10) # # flatlist = unlist(genechunks, recursive=FALSE) # # batchMap(flatReg, gettests, flatlist) # # submitJobs(flatReg, 1:2) #