I have a problem with using rbind
to combine VCF files using the library VariantAnnotation from Bioconductor.
I am reading two VCF files, when I try to combine them in a certain order with rbind
I'm getting an error. When I combine them in a different order, it works fine.
vcf.full <- rbind(vcf1, vcf2) ## Doesnt work
Error in as(from, to_class, strict = FALSE) : no method or default for coercing “CompressedCharacterList” to “DNAStringSetList”
vcf.full <- rbind(vcf2, vcf1) ## Work
header(vcf1)
class: VCFHeader
samples(503): NA06984 NA06989 ... NA20828 NA20832
meta(2): META contig
fixed(2): FILTER ALT
info(27): CIEND CIPOS ... EX_TARGET MULTI_ALLELIC
geno(1): GT
header(vcf2)
class: VCFHeader
samples(503): NA06984 NA06989 ... NA20828 NA20832
meta(2): META contig
fixed(2): FILTER ALT
info(27): CIEND CIPOS ... EX_TARGET MULTI_ALLELIC
geno(1): GT
dim(vcf1)
[1] 30 503
dim(vcf2)
[1] 149 503
The two VCF files seem identical. Any idea of why it happens? Or any suggestions on a different method to combine multiple VCF files using R?