Closed lukaskon closed 2 years ago
Is it possible that you do not have variants for some of your chromosomes? If your reference had 18 chromosomes you should see that in the meta region. But that does not mean you have variants for all of those chromosomes. If no variants were called for two of your chromosomes, or your filtering removed them, you'll only have variants for 16 chromosomes. Something like the following may help.
library(vcfR)
#>
#> ***** *** vcfR *** *****
#> This is vcfR 1.12.0.9999
#> browseVignettes('vcfR') # Documentation
#> citation('vcfR') # Citation
#> ***** ***** ***** *****
data("vcfR_test")
vcfR_test@meta <- c(
vcfR_test@meta[1:5],
c("##contig=<ID=1,length=4109373>",
"##contig=<ID=2,length=3341473>",
"##contig=<ID=3,length=3226611>",
"##contig=<ID=4,length=2468882>",
"##contig=<ID=5,length=2959378>",
"##contig=<ID=6,length=2725906>",
"##contig=<ID=7,length=2652353>",
"##contig=<ID=8,length=2617329>",
"##contig=<ID=9,length=2547566>",
"##contig=<ID=10,length=2419276>",
"##contig=<ID=11,length=2359939>",
"##contig=<ID=12,length=2352958>",
"##contig=<ID=13,length=2257609>",
"##contig=<ID=14,length=2138025>",
"##contig=<ID=15,length=2027721>",
"##contig=<ID=16,length=1969743>",
"##contig=<ID=17,length=247158>",
"##contig=<ID=18,length=208766>"),
vcfR_test@meta[6:18]
)
# Your 18 plus one.
length(grep("contig", vcfR_test@meta))
#> [1] 19
length(unique(getCHROM(vcfR_test)))
#> [1] 1
Created on 2022-03-08 by the reprex package (v2.0.1)
Does this address your issue?
I should have checked the meta region, thank you! That was exactly it.
When I try to read in my filtered vcf file, it only recognizes 16 of the 18 chromosomes. I unzipped and checked with head(filtered.vcf) and it says it has 18. Any idea what the reason for this would be? Size related? Happy to provide any additional information.
If I ignore and create a chrom object: