From cec668788e94cc416ef060d33ca83e9da305f220 Mon Sep 17 00:00:00 2001
From: Vincent  LAVILLE <vincent.laville@pasteur.fr>
Date: Thu, 10 Jan 2019 13:04:07 +0100
Subject: [PATCH] Update url and fix bugs

---
 R/extraction_1KG.R | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/R/extraction_1KG.R b/R/extraction_1KG.R
index 4a13e6e..9cd11a6 100644
--- a/R/extraction_1KG.R
+++ b/R/extraction_1KG.R
@@ -111,8 +111,8 @@ get_vcf <- function(chrom, start, end, pop = NA, path = "", web = TRUE) {
         # These are variants filtered by Brian Browning, the developer of BEAGLE.
         data_url = paste(sep = "",
                          "http://tabix.iobio.io/?cmd=-h%20%27",
-                         "http://bochet.gcc.biostat.washington.edu/beagle/1000_Genomes_phase3_v5a/",
-                         "individual_chromosomes/chr", chrom, ".1kg.phase3.v5a.vcf.gz",
+                         "http://bochet.gcc.biostat.washington.edu/beagle/1000_Genomes_phase3_v5a/b37.vcf/",
+                         "chr", chrom, ".1kg.phase3.v5a.vcf.gz",
                          "%27%20", chrom, ":", start, "-", end
         )
         # Download the data from the server.
@@ -161,7 +161,7 @@ get_vcf <- function(chrom, start, end, pop = NA, path = "", web = TRUE) {
     
     # Convert the genotypes to a numeric matrix.
     retval$geno <- t(apply(retval$geno, 1, function(row) {
-        as.numeric(do.call(cbind, strsplit(row, "|", fixed = TRUE)))
+        as.numeric(do.call(cbind, strsplit(unlist(row), "[/|]")))
     }))
     
     rownames(retval$geno) <- retval$meta$ID
-- 
GitLab