Closed mattbareno closed 2 years ago
Hi, I think you need to tell write.vcf()
to use the mask.
write.vcf(x = chrom, file = "filtered.vcf.gz", mask = TRUE, APPEND = FALSE)
Does that give you the desired behavior? Brian
This resolved the issue, thank you very much
Hello, i'm attempting to filter a vcf for quality, depth, maf and so on... I was following the steps laid out here https://pubmed.ncbi.nlm.nih.gov/27401132/ I followed the tutorial for a proof of concept with the following code in R: `library(vcfR)
library(pinfsc50)
vcf_file <- system.file('extdata','pinf_sc50.vcf.gz',package = 'pinfsc50')
vcf <- read.vcfR(vcf_file)
chrom <- create.chromR(name='Supercontig',vcf=vcf)
chrom <- masker(chrom, min_QUAL=0, min_DP=350,max_DP=650, min_MQ=59.5,max_MQ=60.5)
chrom <- proc.chromR(chrom)
chromoqc(chrom, dp.alpha=20)
chrom@vcf <- chrom@vcf[chrom@var.info$mask,]
write.vcf(x = chrom, file = "filtered.vcf.gz", mask = FALSE, APPEND = FALSE) `
And successfully generated a filtered vcf. However, when i load that filtered vcf into R again and analyse, it still has the same amount of variants. When i look at the things i supposedly filtered, they still remain (ie, there are variants with Mappingq quality < 59.5.
Is there some step i'm missing here or some other way to do this? Thank you very much!