public Variant(Interval parent, VariantContext variant, Chromosome chromosome) : base(parent, variant.Chr, "", "+", variant.Start, variant.End, null) { Chromosome = chromosome; VariantContext = variant; ReferenceAllele = variant.Reference; ReferenceAlleleString = variant.Reference.BaseString; Genotype = variant.Genotypes.First(); // assumes just one sample GenotypeType = Genotype.Type; ReadDepth = Genotype.DP; FirstAlleleDepth = Genotype.AD == null ? -1 : Genotype.AD[0]; SecondAlleleDepth = Genotype.AD == null ? -1 : Genotype.AD[1]; FirstAllele = Genotype.GetAllele(0); FirstAlleleString = FirstAllele.BaseString; SecondAllele = Genotype.GetAllele(1); SecondAlleleString = SecondAllele.BaseString; CalculateType(); if (variant.Attributes.TryGetValue("ANN", out object snpEffAnnotationObj)) { if (snpEffAnnotationObj as string[] != null) { SnpEffAnnotations = (snpEffAnnotationObj as string[]).Select(x => new SnpEffAnnotation(this, x)).ToList(); } if (snpEffAnnotationObj as string != null) { SnpEffAnnotations = new List <SnpEffAnnotation> { new SnpEffAnnotation(this, snpEffAnnotationObj as string) }; } } }