4
$\begingroup$

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?

$\endgroup$
0
1
$\begingroup$

Answer from @Kozolovska, converted from comment:

Found the problem, some of ALT were structural variant, so the list of vcf2@info$ALT was a charterer list and not a 'DNAStringSetList' after removing that variant it worked. Thanks.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.