Skip to content

Instantly share code, notes, and snippets.

@rvalieris
Last active June 20, 2018 18:17
Show Gist options
  • Save rvalieris/e8dc4c40068a6593f1f4bb19e41ad50c to your computer and use it in GitHub Desktop.
Save rvalieris/e8dc4c40068a6593f1f4bb19e41ad50c to your computer and use it in GitHub Desktop.
parallel genCountMatrixFromVcf
library(signeR)
library(VariantAnnotation)
library(BSgenome.Hsapiens.UCSC.hg19)
library(BiocParallel)
register(MulticoreParam(workers=5)) # use 5 cores
vcf = readVcf("a.vcf")
split_vcf = split(vcf,ceiling(seq_along(vcf)/1000)) # split vcf into chunks of 1000 rows
split_r = bplapply(split_vcf, function(p){genCountMatrixFromVcf(BSgenome.Hsapiens.UCSC.hg19, p)})
result_matrix = Reduce('+', split_r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment