Class: BioInterchange::Genomics::VCFFeature

Inherits:
GFF3Feature
  • Object
show all
Defined in:
lib/biointerchange/genomics/vcf_feature.rb

Overview

Represents a single genomic feature of a VCF file.

Constant Summary

Constants inherited from GFF3Feature

GFF3Feature::NEGATIVE, GFF3Feature::NOT_STRANDED, GFF3Feature::POSITIVE, GFF3Feature::UNKNOWN

Instance Method Summary collapse

Methods inherited from GFF3Feature

#attributes, #end_coordinate, #phase, #score, #sequence_id, #source, #start_coordinate, #strand, #type

Constructor Details

#initialize(chromosome, position, id, reference_bases, alternative_alleles, quality_score, filters, info = {}, samples = []) ⇒ VCFFeature

Creates a new feature representation. A feature is described on one line of the VCF file.

chromosome

an identifier that determines the chromosome on which the feature resides

position

the feature locus on the chromosome

id

a unique identifier of the feature

reference_bases

reference alleles of the feature

alternative_alleles

alternative alleles of the feature (non-reference alleles)

quality_score

phred-scaled quality score for the assertions concerning reference-/alternative-alleles

filters

list of VCF filters that a feature has failed

info

a map of additional attributes associated with the feature

samples

sample information specific to the described feature



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/biointerchange/genomics/vcf_feature.rb', line 17

def initialize(chromosome, position, id, reference_bases, alternative_alleles, quality_score, filters, info = {}, samples = [])
  # Fill in phase, which is always omitted in GVF features (after 'strand', before 'attributes'):
  # Translations to somewhat fit the existing GFF3/GVF model (GFF3/GVF left, VCF right):
  #
  #   sequence_id -> chromosome
  #   source -> nil
  #   type -> nil
  #   start_coordinate -> position
  #   end_coordinate -> position
  #   score -> quality_score
  #   strand -> nil
  #   phase -> nil
  #   attributes -> info
  #
  # Parameters that do not map directly to super's parameters are placed in `info`
  # with a space as prefix. For example, `reference_bases` becomes the key
  # ` reference_bases` in `info`.
  info[' id'] = [ id ] if id
  info[' reference_bases'] = [ reference_bases ]
  info[' alternative_alleles'] = alternative_alleles
  info[' filters'] = filters
  info[' samples'] = samples

  super(chromosome, nil, nil, position, position, quality_score, BioInterchange::Genomics::GFF3Feature::POSITIVE, nil, info)
end