Skip to content
Snippets Groups Projects
Commit c8dde0f0 authored by Vincent  LAVILLE's avatar Vincent LAVILLE
Browse files

Update extraction_1KG.R

parent 64d8bf10
No related branches found
No related tags found
No related merge requests found
......@@ -129,6 +129,9 @@ get_vcf <- function(chrom, start, end, pop = NA, path = "", web = TRUE) {
vcf <- utils::read.delim(
text = gsub("##", "!", txt), header = TRUE, comment.char = "!", stringsAsFactors = FALSE)
# Discard multi-allelic markers.
vcf <- vcf[grep(",", vcf$ALT, invert = TRUE), ]
# Throw error if SNP not found
if (nrow(vcf) < 1) {
msg <- paste("SNP ", chrom, ":", start, "-", end, " not found", sep = "")
......@@ -140,10 +143,7 @@ get_vcf <- function(chrom, start, end, pop = NA, path = "", web = TRUE) {
# Assign the standard column names and sample identifiers.
colnames(vcf)[1] <- "CHROM"
# Discard multi-allelic markers.
vcf <- vcf[grep(",", vcf$ALT, invert = TRUE), ]
# Select the genotype columns that belong to a particular population.
# Select the genotype columns that belong to a particular population.
if (pop %in% pops) {
vcf <- vcf[,c(rep(TRUE, 9), pops == pop)]
} else if (pop %in% superpops) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment