```r
  ## input variants
  require(VariantAnnotation)
  fl <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation")
  vcf <- readVcf(fl, "hg19")
  seqlevels(vcf) <- "chr22"
  ## known gene model
  require(TxDb.Hsapiens.UCSC.hg19.knownGene)
  coding <- locateVariants(rowData(vcf),
      TxDb.Hsapiens.UCSC.hg19.knownGene,
      CodingVariants())
  head(coding)
  ```
  
  ```
  ## GRanges with 6 ranges and 7 metadata columns:
  ##       seqnames               ranges strand | LOCATION   QUERYID      TXID
  ##          <Rle>            <IRanges>  <Rle> | <factor> <integer> <integer>
  ##   [1]    chr22 [50301422, 50301422]      - |   coding        24     75253
  ##   [2]    chr22 [50301476, 50301476]      - |   coding        25     75253
  ##   [3]    chr22 [50301488, 50301488]      - |   coding        26     75253
  ##   [4]    chr22 [50301494, 50301494]      - |   coding        27     75253
  ##   [5]    chr22 [50301584, 50301584]      - |   coding        28     75253
  ##   [6]    chr22 [50302962, 50302962]      - |   coding        57     75253
  ##           CDSID      GENEID       PRECEDEID        FOLLOWID
  ##       <integer> <character> <CharacterList> <CharacterList>
  ##   [1]    218562       79087                                
  ##   [2]    218562       79087                                
  ##   [3]    218562       79087                                
  ##   [4]    218562       79087                                
  ##   [5]    218562       79087                                
  ##   [6]    218563       79087                                
  ##   ---
  ##   seqlengths:
  ##    chr22
  ##       NA
  ```