Answers.Body: <p><em>Answer from @Kozolovska, converted from comment:</em></p>
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-04T04:27:14.133Z
Answers.LastActivityDate: 2021-07-04T04:27:14.133Z
Answers.UserDisplayName: gringer
Body: <p>I have a problem with using <code>rbind</code> to combine VCF files using the library <a href="https://bioconductor.org/packages/VariantAnnotation" rel="nofollow noreferrer">VariantAnnotation</a> from Bioconductor.</p>
  <p>I am reading two VCF files, when I try to combine them in a certain order with <code>rbind</code> I'm getting an error. When I combine them in a different order, it works fine.</p>
  <pre><code>vcf.full &lt;- rbind(vcf1, vcf2) ## Doesnt work 
  </code></pre>
  <blockquote>
  <p>Error in as(from, to_class, strict = FALSE) :    no method or default
  for coercing “CompressedCharacterList” to “DNAStringSetList”</p>
  </blockquote>
  <pre><code>vcf.full &lt;- 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
  </code></pre>
  <p>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?</p>
  
Tags: <r><vcf>
Title: Combine VCF files
ThreadText: # Combine VCF files
  
  (Asked by: username_0 on 2018-08-16)
  
  I have a problem with using `rbind` to combine VCF files using the library [VariantAnnotation](https://bioconductor.org/packages/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?
  
  **Tags:** r, vcf
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-04. Score: 1
  
  *Answer from @username_0, 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.
  
  
  ---
  
  