public void ParseVcfLine_NonInformativeAlleles_Alone_NotFiltered()
        {
            const string vcfLine1 = "chr1	13133	.	T	<*>	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";
            const string vcfLine2 = "chr1	13133	.	T	*	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";
            const string vcfLine3 = "chr1	13133	.	T	<M>	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";

            var refMinorProvider = new Mock <IRefMinorProvider>();
            var seqProvider      = ParserTestUtils.GetSequenceProvider(13133, "T", 'A', ChromosomeUtilities.RefNameToChromosome);
            var variantFactory   = new VariantFactory(seqProvider);

            var position1 = AnnotationUtilities.ParseVcfLine(vcfLine1, refMinorProvider.Object, variantFactory, seqProvider.RefNameToChromosome);
            var position2 = AnnotationUtilities.ParseVcfLine(vcfLine2, refMinorProvider.Object, variantFactory, seqProvider.RefNameToChromosome);
            var position3 = AnnotationUtilities.ParseVcfLine(vcfLine3, refMinorProvider.Object, variantFactory, seqProvider.RefNameToChromosome);

            var annotatedVariants1 = Annotator.GetAnnotatedVariants(position1.Variants);
            var annotatedVariants2 = Annotator.GetAnnotatedVariants(position2.Variants);
            var annotatedVariants3 = Annotator.GetAnnotatedVariants(position3.Variants);

            // SimplePositions unchanged
            Assert.Equal("<*>", position1.AltAlleles[0]);
            Assert.Equal("*", position2.AltAlleles[0]);
            Assert.Equal("<M>", position3.AltAlleles[0]);

            // Variants not filtered
            Assert.Equal("<*>", annotatedVariants1[0].Variant.AltAllele);
            Assert.Equal("*", annotatedVariants2[0].Variant.AltAllele);
            Assert.Equal("<M>", annotatedVariants3[0].Variant.AltAllele);
        }
        public void ParseVcfLine_NonInformativeAlleles_WithNormalAllele_NotFiltered()
        {
            const string vcfLine1 = "chr1	13133	.	T	<*>,G	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";
            const string vcfLine2 = "chr1	13133	.	T	*,C	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";
            const string vcfLine3 = "chr1	13133	.	T	<M>,A	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";
            const string vcfLine4 = "chr1	13133	.	T	A,<NON_REF>	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";

            var refMinorProvider    = new Mock <IRefMinorProvider>();
            var seqProvider         = ParserTestUtils.GetSequenceProvider(13133, "T", 'A', ChromosomeUtilities.RefNameToChromosome);
            var refNameToChromosome = seqProvider.RefNameToChromosome;

            var variantFactory = new VariantFactory(seqProvider);

            var position1 = AnnotationUtilities.ParseVcfLine(vcfLine1, refMinorProvider.Object, variantFactory, refNameToChromosome);
            var position2 = AnnotationUtilities.ParseVcfLine(vcfLine2, refMinorProvider.Object, variantFactory, refNameToChromosome);
            var position3 = AnnotationUtilities.ParseVcfLine(vcfLine3, refMinorProvider.Object, variantFactory, refNameToChromosome);
            var position4 = AnnotationUtilities.ParseVcfLine(vcfLine4, refMinorProvider.Object, variantFactory, refNameToChromosome);

            var annotatedVariants1 = Annotator.GetAnnotatedVariants(position1.Variants);
            var annotatedVariants2 = Annotator.GetAnnotatedVariants(position2.Variants);
            var annotatedVariants3 = Annotator.GetAnnotatedVariants(position3.Variants);
            var annotatedVariants4 = Annotator.GetAnnotatedVariants(position4.Variants);

            // SimplePositions
            Assert.Equal(new[] { "<*>", "G" }, position1.AltAlleles);
            Assert.Equal(new[] { "*", "C" }, position2.AltAlleles);
            Assert.Equal(new[] { "<M>", "A" }, position3.AltAlleles);
            Assert.Equal(new[] { "A", "<NON_REF>" }, position4.AltAlleles);

            // Variants
            Assert.Equal(new[] { "<*>", "G" }, annotatedVariants1.Select(x => x.Variant.AltAllele).ToArray());
            Assert.Equal(new[] { "*", "C" }, annotatedVariants2.Select(x => x.Variant.AltAllele).ToArray());
            Assert.Equal(new[] { "<M>", "A" }, annotatedVariants3.Select(x => x.Variant.AltAllele).ToArray());
            Assert.Equal(new[] { "A", "<NON_REF>" }, annotatedVariants4.Select(x => x.Variant.AltAllele).ToArray());
        }
Beispiel #3
0
        public void GetNextPosition()
        {
            const string vcfLine = "chr1	13133	.	T	C	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";
            var          lines   = new[]
            {
                "##fileformat=VCFv4.1", "##FILTER=<ID=PASS,Description=\"All filters passed\">", "##fileDate=20160920",
                "#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NHL-16", vcfLine
            };

            AddLines(lines);

            var       refMinorProvider = new Mock <IRefMinorProvider>();
            var       seqProvider      = ParserTestUtils.GetSequenceProvider(13133, "T", 'A', ChromosomeUtilities.RefNameToChromosome);
            IPosition observedResult;

            using (var reader = FileUtilities.GetStreamReader(_ms))
                using (var vcfReader = VcfReader.Create(reader, reader, seqProvider, refMinorProvider.Object, new NullRecomposer(), new NullVcfFilter(), _vidCreator, null))
                {
                    observedResult = vcfReader.GetNextPosition();
                }

            var expectedResult = new Position(ChromosomeUtilities.Chr1, 13133, 13133, "T", new[] { "C" }, 36, new[] { "PASS" }, null,
                                              null, null, vcfLine.Split('\t'), new[] { false }, false);

            Assert.NotNull(observedResult);
            Assert.Equal(expectedResult.End, observedResult.End);
            Assert.Equal(expectedResult.AltAlleles, observedResult.AltAlleles);
            Assert.Equal(expectedResult.Filters, observedResult.Filters);
            Assert.Equal(expectedResult.Quality, observedResult.Quality);
            Assert.Equal(expectedResult.VcfFields, observedResult.VcfFields);
        }
Beispiel #4
0
        public void ParseVcfLine_line_with_only_NonRef_is_refMinor()
        {
            const string vcfLine = "1	10628385	.	C	<NON_REF>	.	LowGQX;HighDPFRatio	END=10628385;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:24:9:18";

            var chromosome       = new Chromosome("chr1", "1", 0);
            var refMinorProvider = new Mock <IRefMinorProvider>();

            refMinorProvider.Setup(x => x.GetGlobalMajorAllele(chromosome, 10628385)).Returns("T");
            var seqProvider = ParserTestUtils.GetSequenceProvider(10628385, "C", 'A',
                                                                  new Dictionary <string, IChromosome> {
                ["1"] = chromosome
            });
            var refNameToChromosome = seqProvider.RefNameToChromosome;

            var variantFactory = new VariantFactory(seqProvider);


            var position          = AnnotationUtilities.ParseVcfLine(vcfLine, refMinorProvider.Object, variantFactory, refNameToChromosome);
            var annotatedVariants = Annotator.GetAnnotatedVariants(position.Variants);

            Assert.Equal("C", position.RefAllele);
            Assert.Equal(new[] { "<NON_REF>" }, position.AltAlleles);
            Assert.Equal("T", position.Variants[0].RefAllele);
            Assert.Equal("C", position.Variants[0].AltAllele);

            // Variants
            Assert.Equal(new[] { "C" }, annotatedVariants.Select(x => x.Variant.AltAllele).ToArray());
        }
        public void GetAllPositions()
        {
            var seqProvider = ParserTestUtils.GetSequenceProvider(10329, "AC", 'A', _chromDict);
            var positions   = PreLoadUtilities.GetPositions(GetVcfStream(), null, seqProvider);

            Assert.Equal(2, positions.Count);
            Assert.Equal(4, positions[Chrom1].Count);
            Assert.Equal(4, positions[Chrom2].Count);
        }
        public void GetPositions_inRange()
        {
            var chromosome      = new Chromosome("chr1", "1", 0);
            var annotationRange = new GenomicRange(new GenomicPosition(chromosome, 10019), new GenomicPosition(chromosome, 10290));
            var seqProvider     = ParserTestUtils.GetSequenceProvider(10329, "AC", 'A', _chromDict);
            var positions       = PreLoadUtilities.GetPositions(GetVcfStream(), annotationRange, seqProvider);

            Assert.Single(positions);
            Assert.Equal(3, positions[Chrom1].Count);
        }
Beispiel #7
0
        public void GetPositions_inRange()
        {
            var annotationRange = new GenomicRange(new GenomicPosition(ChromosomeUtilities.Chr1, 10019), new GenomicPosition(ChromosomeUtilities.Chr1, 10290));
            var seqProvider     = ParserTestUtils.GetSequenceProvider(10329, "AC", 'A', ChromosomeUtilities.RefNameToChromosome);

            (var positions, _) = PreLoadUtilities.GetPositions(GetVcfStream(), annotationRange, seqProvider, null);

            Assert.Single(positions);
            Assert.Equal(3, positions[ChromosomeUtilities.Chr1].Count);
        }
Beispiel #8
0
        public void ValidateVcfHeader_ExceptionThrown_NoChromHeaderLine()
        {
            var headers = new[] { "##fileformat=VCFv4.1", "##FILTER=<ID=PASS,Description=\"All filters passed\">", "##fileDate=20160920" };

            AddLines(headers);
            var seqProvider = ParserTestUtils.GetSequenceProvider(1000, "A", 'T', _refNameToChromosome);
            var reader      = FileUtilities.GetStreamReader(_ms);

            Assert.Throws <UserErrorException>(() => VcfReader.Create(reader, reader, seqProvider, null, null, new NullVcfFilter()));
        }
Beispiel #9
0
        public void CheckContigId_IncorrectAutoAndSexChromLength_ThrowException(string contigLine)
        {
            var headers = new[] { "##fileformat=VCFv4.1", contigLine, "#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT"};

            AddLines(headers);
            var seqProvider = ParserTestUtils.GetSequenceProvider(1000, "A", 'T', _refNameToChromosome);

            using (var reader = FileUtilities.GetStreamReader(_ms))
                Assert.Throws <UserErrorException>(() => VcfReader.Create(reader, reader, seqProvider, null, null, new NullVcfFilter()));
        }
Beispiel #10
0
        public void ValidateVcfHeader_ExceptionThrown_NoFileFormat()
        {
            var headers = new[] { "##Some comments", "#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NHL-16	NHL-17"};

            AddLines(headers);
            var seqProvider = ParserTestUtils.GetSequenceProvider(1000, "A", 'T', _refNameToChromosome);
            var reader      = FileUtilities.GetStreamReader(_ms);

            Assert.Throws <UserErrorException>(() => VcfReader.Create(reader, reader, seqProvider, null, null, new NullVcfFilter()));
        }
Beispiel #11
0
        public void GetAllPositions()
        {
            //we only need the sequence provider for variant rotation.
            var seqProvider = ParserTestUtils.GetSequenceProvider(10329, "AC", 'A', ChromosomeUtilities.RefNameToChromosome);

            (var positions, _) = PreLoadUtilities.GetPositions(GetVcfStream(), null, seqProvider, null);

            Assert.Equal(2, positions.Count);
            Assert.Equal(4, positions[ChromosomeUtilities.Chr1].Count);
            Assert.Equal(4, positions[ChromosomeUtilities.Chr2].Count);
        }
Beispiel #12
0
        public void RemoveConflictingAlleles_does_not_remove_duplicates()
        {
            var seqProvider  = ParserTestUtils.GetSequenceProvider(70220313, "TGCC", 'A', _chromDict);
            var topMedReader = new TopMedReader(new StreamReader(GetDupItemsStream()), seqProvider);

            var items   = topMedReader.GetItems().ToList();
            var saItems = new List <ISupplementaryDataItem>(items);

            saItems = SuppDataUtilities.RemoveConflictingAlleles(saItems, false);
            Assert.Single(saItems);
        }
Beispiel #13
0
        public void CheckContigId_InferredAssemblyIsUnknown_GivenIrregularChrom(string contigLine)
        {
            var headers = new[] { "##fileformat=VCFv4.1", contigLine, "#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT"};

            AddLines(headers);
            var seqProvider = ParserTestUtils.GetSequenceProvider(1000, "A", 'T', _refNameToChromosome);

            using (var reader = FileUtilities.GetStreamReader(_ms))
                using (var vcfReader = VcfReader.Create(reader, reader, seqProvider, null, null, new NullVcfFilter()))
                {
                    Assert.Equal(GenomeAssembly.Unknown, vcfReader.InferredGenomeAssembly);
                }
        }
Beispiel #14
0
        public void ToString_translocation_breakend(string refAllele, string altAllele, int position, string expectedVid)
        {
            var chromosome1 = new Chromosome("chr1", "1", 0);
            var seqProvider = ParserTestUtils.GetSequenceProvider(position, refAllele, 'A', new Dictionary <string, IChromosome> {
                { "1", chromosome1 }
            });
            var variantFactory = new VariantFactory(seqProvider);

            var breakEnds = variantFactory.GetTranslocationBreakends(chromosome1, refAllele, altAllele, position);

            Assert.NotNull(breakEnds);
            Assert.Single(breakEnds);
            Assert.Equal(expectedVid, breakEnds[0].ToString());
        }
Beispiel #15
0
        public void ToString_deletion()
        {
            var chromosome1 = new Chromosome("chr1", "1", 0);
            var seqProvider = ParserTestUtils.GetSequenceProvider(1594584, "T", 'A', new Dictionary <string, IChromosome> {
                { "1", chromosome1 }
            });
            var variantFactory = new VariantFactory(seqProvider);

            var breakEnds = variantFactory.GetSvBreakEnds("1", 1594584, VariantType.deletion, 1660503);

            Assert.NotNull(breakEnds);
            Assert.Equal(2, breakEnds.Length);
            Assert.Equal("1:1594584:+:1:1660504:+", breakEnds[0].ToString());
            Assert.Equal("1:1660504:-:1:1594584:-", breakEnds[1].ToString());
        }
Beispiel #16
0
        public void ToString_duplication()
        {
            var chromosome1 = new Chromosome("chr1", "1", 0);
            var seqProvider = ParserTestUtils.GetSequenceProvider(37820921, "T", 'A', new Dictionary <string, IChromosome> {
                { "1", chromosome1 }
            });
            var variantFactory = new VariantFactory(seqProvider);

            var breakEnds = variantFactory.GetSvBreakEnds("1", 37820921, VariantType.duplication, 38404543);

            Assert.NotNull(breakEnds);
            Assert.Equal(2, breakEnds.Length);
            Assert.Equal("1:38404543:+:1:37820921:+", breakEnds[0].ToString());
            Assert.Equal("1:37820921:-:1:38404543:-", breakEnds[1].ToString());
        }
Beispiel #17
0
        public void Duplicated_headlines_are_removed()
        {
            var headers = new[] { "##fileformat=VCFv4.1", "##FILTER=<ID=PASS,Description=\"All filters passed\">", "##fileDate=20160920", "##dataSource=ClinVar,version:unknown,release date:2016-09-01", "#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NHL-16	NHL-17"};

            AddLines(headers);
            IEnumerable <string> observedHeaders;
            var seqProvider = ParserTestUtils.GetSequenceProvider(1000, "A", 'T', _refNameToChromosome);

            using (var reader = FileUtilities.GetStreamReader(_ms))
                using (var vcfReader = VcfReader.Create(reader, reader, seqProvider, null, null, new NullVcfFilter()))
                {
                    observedHeaders = vcfReader.GetHeaderLines();
                }

            Assert.Equal(4, observedHeaders.Count());
        }
Beispiel #18
0
        public void HeaderLines_are_parsed()
        {
            var headers = new[] { "##fileformat=VCFv4.1", "##FILTER=<ID=PASS,Description=\"All filters passed\">", "##fileDate=20160920", "#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NHL-16"};

            AddLines(headers);
            IEnumerable <string> observedHeaders;
            var seqProvider = ParserTestUtils.GetSequenceProvider(1000, "A", 'T', _refNameToChromosome);

            using (var reader = FileUtilities.GetStreamReader(_ms))
                using (var vcfReader = VcfReader.Create(reader, reader, seqProvider, null, null, new NullVcfFilter()))
                {
                    observedHeaders = vcfReader.GetHeaderLines();
                }

            Assert.Equal(headers, observedHeaders.ToArray());
        }
Beispiel #19
0
        public void Sample_names_are_reported()
        {
            var headers = new[] { "##fileformat=VCFv4.1", "##FILTER=<ID=PASS,Description=\"All filters passed\">", "##fileDate=20160920", "#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NHL-16	NHL-17"};

            AddLines(headers);
            string[] samples;
            var      seqProvider = ParserTestUtils.GetSequenceProvider(1000, "A", 'T', _refNameToChromosome);

            using (var reader = FileUtilities.GetStreamReader(_ms))
                using (var vcfReader = VcfReader.Create(reader, reader, seqProvider, null, null, new NullVcfFilter()))
                {
                    samples = vcfReader.GetSampleNames();
                }

            Assert.Equal(new[] { "NHL-16", "NHL-17" }, samples);
        }
Beispiel #20
0
        public void GetAllPositions_skip_refs()
        {
            //we only need the sequence provider for variant rotation.
            var seqProvider      = ParserTestUtils.GetSequenceProvider(10329, "AC", 'A', ChromosomeUtilities.RefNameToChromosome);
            var refMinorProvider = ParserTestUtils.GetRefMinorProvider(
                new List <(IChromosome chrom, int position, string globalMinor)>
            {
                (ChromosomeUtilities.Chr1, 10275, "A")
            }
                );

            (var positions, _) = PreLoadUtilities.GetPositions(GetRefMinorVcfStream(), null, seqProvider, refMinorProvider);

            Assert.Equal(2, positions.Count);
            Assert.Equal(5, positions[ChromosomeUtilities.Chr1].Count);
            Assert.Equal(4, positions[ChromosomeUtilities.Chr2].Count);
        }
Beispiel #21
0
        public void ParseVcfLine_line_with_only_NonRef_is_not_refMinor()
        {
            const string vcfLine = "1	10005	.	C	<NON_REF>	.	LowGQX	END=10034;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:3:1:0";

            var refMinorProvider = new Mock <IRefMinorProvider>();
            var seqProvider      =
                ParserTestUtils.GetSequenceProvider(10005, "C", 'A', ChromosomeUtilities.RefNameToChromosome);
            var variantFactory = new VariantFactory(seqProvider.Sequence, _vidCreator);

            var position          = AnnotationUtilities.ParseVcfLine(vcfLine, refMinorProvider.Object, seqProvider, null, variantFactory);
            var annotatedVariants = Annotator.GetAnnotatedVariants(position.Variants);

            Assert.Equal("C", position.RefAllele);
            Assert.Equal(new[] { "<NON_REF>" }, position.AltAlleles);
            Assert.Null(position.Variants);
            Assert.Null(annotatedVariants);
        }
Beispiel #22
0
        public void Test_crash_caused_by_variant_trimming()
        {
            const string vcfLine1 = "chr1	8021910	rs373653682	GGTGCTGGACGGTGTCCCT	G	.	.	.";

            var refMinorProvider = new Mock <IRefMinorProvider>();
            var seqProvider      = ParserTestUtils.GetSequenceProvider(8021910, "GGTGCTGGACGGTGTCCCT", 'A', ChromosomeUtilities.RefNameToChromosome);

            var variantFactory = new VariantFactory(seqProvider.Sequence, _vidCreator);

            var position1 = AnnotationUtilities.ParseVcfLine(vcfLine1, refMinorProvider.Object, seqProvider, null, variantFactory);

            var annotatedVariants1 = Annotator.GetAnnotatedVariants(position1.Variants);

            // SimplePositions
            Assert.Equal(new[] { "G" }, position1.AltAlleles);

            // Variants
            Assert.Equal(new[] { "" }, annotatedVariants1.Select(x => x.Variant.AltAllele).ToArray());
        }
        public void GetJsonString_fisherStrand()
        {
            const string vcfLine = "21\t9411410\t.\tC\tT\t9.51\tDRAGENSnpHardQUAL\tAC=2;AF=1.000;AN=2;DP=2;FS=0.000;MQ=100.00;QD=9.51;SOR=1.609";

            var refMinorProvider = new Mock <IRefMinorProvider>();
            var seqProvider      = ParserTestUtils.GetSequenceProvider(9411410, "C", 'A', ChromosomeUtilities.RefNameToChromosome);
            var variantFactory   = new VariantFactory(seqProvider.Sequence, new VariantId());

            var position = AnnotationUtilities.ParseVcfLine(vcfLine, refMinorProvider.Object, seqProvider, null, variantFactory);

            IVariant[]          variants          = GetVariants();
            IAnnotatedVariant[] annotatedVariants = Annotator.GetAnnotatedVariants(variants);
            var annotatedPosition = new AnnotatedPosition(position, annotatedVariants);

            string observedResult = annotatedPosition.GetJsonString();

            Assert.NotNull(observedResult);
            Assert.Contains("\"fisherStrandBias\":0", observedResult);
        }
        public void GetJsonString_BreakEndEventId()
        {
            const string vcfLine = "1\t38432782\tMantaBND:2312:0:1:0:0:0:0\tG\tG]6:28863899]\t971\tPASS\tSVTYPE=BND;MATEID=MantaBND:2312:0:1:0:0:0:1;EVENT=MantaBND:2312:0:1:0:0:0:0;JUNCTION_QUAL=716;BND_DEPTH=52;MATE_BND_DEPTH=56";

            var refMinorProvider = new Mock <IRefMinorProvider>();
            var seqProvider      = ParserTestUtils.GetSequenceProvider(38432782, "G", 'C', ChromosomeUtilities.RefNameToChromosome);
            var variantFactory   = new VariantFactory(seqProvider.Sequence, new VariantId());

            var position = AnnotationUtilities.ParseVcfLine(vcfLine, refMinorProvider.Object, seqProvider, null, variantFactory);

            IVariant[]          variants          = GetVariants();
            IAnnotatedVariant[] annotatedVariants = Annotator.GetAnnotatedVariants(variants);
            var annotatedPosition = new AnnotatedPosition(position, annotatedVariants);

            string observedResult = annotatedPosition.GetJsonString();

            Assert.NotNull(observedResult);
            Assert.Contains("\"breakendEventId\":\"MantaBND:2312:0:1:0:0:0:0\"", observedResult);
        }
Beispiel #25
0
        public void GetJsonString_StrelkaSomatic()
        {
            const string vcfLine = "chr1	13813	.	T	G	.	LowQscore	SOMATIC;QSS=33;TQSS=1;NT=ref;QSS_NT=16;TQSS_NT=1;SGT=TT->GT;DP=266;MQ=23.89;MQ0=59;ALTPOS=69;ALTMAP=37;ReadPosRankSum=1.22;SNVSB=5.92;PNOISE=0.00;PNOISE2=0.00;VQSR=1.93";

            var refMinorProvider = new Mock <IRefMinorProvider>();
            var seqProvider      = ParserTestUtils.GetSequenceProvider(13813, "T", 'C', ChromosomeUtilities.RefNameToChromosome);
            var variantFactory   = new VariantFactory(seqProvider.Sequence, new VariantId());

            var position = AnnotationUtilities.ParseVcfLine(vcfLine, refMinorProvider.Object, seqProvider, variantFactory);

            IVariant[]          variants          = GetVariants();
            IAnnotatedVariant[] annotatedVariants = Annotator.GetAnnotatedVariants(variants);
            var annotatedPosition = new AnnotatedPosition(position, annotatedVariants);

            string observedResult = annotatedPosition.GetJsonString();

            Assert.NotNull(observedResult);
            Assert.Contains("\"jointSomaticNormalQuality\":16", observedResult);
            Assert.Contains("\"recalibratedQuality\":1.93", observedResult);
        }
Beispiel #26
0
        public void CheckSampleConsistency_noSample()
        {
            const string vcfLine1 = "chr1	13133	.	T	C	36.00	PASS	SNVSB=0.0;SNVHPOL=4";
            const string vcfLine2 = "chr1	13133	.	T	A	36.00	PASS	SNVSB=0.0;SNVHPOL=4	GT:GQ:GQX:DP:DPF:AD	0/1:62:20:7:1:3,4";
            var          lines    = new[]
            {
                "##fileformat=VCFv4.1", "##FILTER=<ID=PASS,Description=\"All filters passed\">", "##fileDate=20160920",
                "#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO", vcfLine1, vcfLine2
            };

            AddLines(lines);

            var refMinorProvider = new Mock <IRefMinorProvider>();
            var seqProvider      = ParserTestUtils.GetSequenceProvider(13133, "T", 'A', ChromosomeUtilities.RefNameToChromosome);

            using (var reader = FileUtilities.GetStreamReader(_ms))
                using (var vcfReader = VcfReader.Create(reader, reader, seqProvider, refMinorProvider.Object, new NullRecomposer(), new NullVcfFilter(), _vidCreator, null))
                {
                    //first line is valid. So, no exception
                    Assert.NotNull(vcfReader.GetNextPosition());
                    // second line has invalid number of sample fields, so it will throw exception
                    Assert.Throws <UserErrorException>(() => vcfReader.GetNextPosition());
                }
        }