public void Parse_Somatic_Strelka() { var info = VcfInfoParser.Parse("SOMATIC;QSS=2;TQSS=1;NT=het;QSS_NT=2;TQSS_NT=1;SGT=CG->CG;DP=183;MQ=46.57;MQ0=15;ALTPOS=35;ALTMAP=24;ReadPosRankSum=-1.23;SNVSB=0.00;PNOISE=0.00;PNOISE2=0.00;VQSR=1.23"); Assert.Equal(1.23, info.RecalibratedQuality); Assert.Equal(2, info.JointSomaticNormalQuality); }
public void Blank_info_field_when_remove_all_info_tags() { var info = VcfInfoParser.Parse( "AA=G;CSQT=1|AGRN|ENST00000379370|"); Assert.Equal("", info.UpdatedInfoField); }
public void Parse_GATK() { var info = VcfInfoParser.Parse("AC=2;AF=0.250;AN=8;BaseQRankSum=1.719;DB;DP=106;Dels=0.00;FS=20.202;HaplotypeScore=0.0000;MLEAC=2;MLEAF=0.250;MQ=43.50;MQ0=52;MQRankSum=2.955;QD=4.73;ReadPosRankSum=1.024;SB=-1.368e+02;VQSLOD=-0.3503;culprit=MQ;PLF"); Assert.Equal(-136.8, info.StrandBias); Assert.Equal(20.202, info.FisherStrandBias); Assert.Equal(43.50, info.MappingQuality); }
public void Info_tags_are_correctly_removed() { var info = VcfInfoParser.Parse( "END=964423;SVTYPE=DEL;SVLEN=-422;IMPRECISE;CIPOS=-170,170;CIEND=-175,175;CSQT=1|AGRN|ENST00000379370|"); Assert.Equal("END=964423;SVTYPE=DEL;SVLEN=-422;IMPRECISE;CIPOS=-170,170;CIEND=-175,175", info.UpdatedInfoField); }
public void Info_tags_are_capturedCorrect3() { var info = VcfInfoParser.Parse( "AC=2;AF=0.250;AN=8;BaseQRankSum=1.719;DB;DP=106;Dels=0.00;FS=20.202;HaplotypeScore=0.0000;MLEAC=2;MLEAF=0.250;MQ=43.50;MQ0=52;MQRankSum=2.955;QD=4.73;ReadPosRankSum=1.024;SB=-1.368e+02;VQSLOD=-0.3503;culprit=MQ;PLF"); Assert.Equal(106, info.Depth); Assert.Equal(-136.8, info.StrandBias); }
public void GetVariant_svDel() { var infoData = VcfInfoParser.Parse("SVTYPE=DEL;END=138730"); var variantFactory = new VariantFactory(Sequence, _vidCreator); IVariant[] variants = variantFactory.CreateVariants(ChromosomeUtilities.Chr1, 69391, 138730, "A", new[] { "<DEL>" }, infoData, new[] { false }, false, null, null); Assert.NotNull(variants); }
public void Info_tags_are_capturedCorrect1() { var info = VcfInfoParser.Parse( "SOMATIC;QSI=2;TQSI=1;NT=het;QSI_NT=2;TQSI_NT=1;VQSR=5.9;CN=6"); Assert.Equal(2, info.JointSomaticNormalQuality); Assert.Equal(6, info.CopyNumber); Assert.Equal(5.9, info.RecalibratedQuality); }
public void Parse_Somatic_Manta() { var info = VcfInfoParser.Parse("END=1660503;SVTYPE=DEL;SVLEN=-65919;IMPRECISE;CIPOS=-285,285;CIEND=-205,205;SOMATIC;SOMATICSCORE=36;ColocalizedCanvas"); Assert.Equal(65919, info.SvLength); Assert.Equal(1660503, info.End); Assert.Equal(36, info.JointSomaticNormalQuality); Assert.Equal(new[] { -285, 285 }, info.CiPos); Assert.Equal(new[] { -205, 205 }, info.CiEnd); }
public void GetVariant_svDel() { var infoData = VcfInfoParser.Parse("SVTYPE=DEL;END=138730"); var variantFactory = new VariantFactory(_sequenceProvider); var variants = variantFactory.CreateVariants(_chromosome1, 69391, 138730, "A", new[] { "<DEL>" }, infoData, new[] { false }, false, null, null); Assert.NotNull(variants); Assert.Equal(2, variants[0].BreakEnds.Length); }
public void Info_tags_are_capturedCorrect2() { var info = VcfInfoParser.Parse( "END=1660503;SVTYPE=DEL;SVLEN=-65919;IMPRECISE;CIPOS=-285,285;CIEND=-205,205;SOMATIC;SOMATICSCORE=36;ColocalizedCanvas"); Assert.Equal(65919, info.SvLength); Assert.Equal(1660503, info.End); Assert.True(info.ColocalizedWithCnv); Assert.Equal(36, info.JointSomaticNormalQuality); Assert.Equal(new[] { -285, 285 }, info.CiPos); Assert.Equal(new[] { -205, 205 }, info.CiEnd); }
public void GetVariant_svDel() { var infoData = VcfInfoParser.Parse("SVTYPE=DEL;END=138730"); var chromosome1 = new Chromosome("chr1", "1", 0); var variantFactory = new VariantFactory(new Dictionary <string, IChromosome> { { "1", chromosome1 } }, null, false); var variants = variantFactory.CreateVariants(chromosome1, null, 69391, 138730, "A", new[] { "<DEL>" }, infoData, new[] { false }, false); Assert.NotNull(variants); Assert.Equal(2, variants[0].BreakEnds.Length); }
public static IPosition ToPosition(ISimplePosition simplePosition, IRefMinorProvider refMinorProvider, ISequenceProvider sequenceProvider, IMitoHeteroplasmyProvider mitoHeteroplasmyProvider, VariantFactory variantFactory, bool enableDq = false) { if (simplePosition == null) { return(null); } sequenceProvider.LoadChromosome(simplePosition.Chromosome); string[] vcfFields = simplePosition.VcfFields; string[] altAlleles = vcfFields[VcfCommon.AltIndex].OptimizedSplit(','); bool isReference = altAlleles.Length == 1 && VcfCommon.ReferenceAltAllele.Contains(altAlleles[0]); string globalMajorAllele = isReference ? refMinorProvider?.GetGlobalMajorAllele(simplePosition.Chromosome, simplePosition.Start) : null; bool isRefMinor = isReference && globalMajorAllele != null; if (isReference && !isRefMinor) { return(GetReferencePosition(simplePosition)); } var infoData = VcfInfoParser.Parse(vcfFields[VcfCommon.InfoIndex]); int end = ExtractEnd(infoData, simplePosition.Start, simplePosition.RefAllele.Length); double?quality = vcfFields[VcfCommon.QualIndex].GetNullableValue <double>(double.TryParse); string[] filters = vcfFields[VcfCommon.FilterIndex].OptimizedSplit(';'); ISample[] samples = vcfFields.ToSamples(variantFactory.FormatIndices, simplePosition, mitoHeteroplasmyProvider, enableDq); IVariant[] variants = variantFactory.CreateVariants(simplePosition.Chromosome, simplePosition.Start, end, simplePosition.RefAllele, altAlleles, infoData, simplePosition.IsDecomposed, simplePosition.IsRecomposed, simplePosition.LinkedVids, globalMajorAllele); return(new Position(simplePosition.Chromosome, simplePosition.Start, end, simplePosition.RefAllele, altAlleles, quality, filters, variants, samples, infoData, vcfFields, simplePosition.IsDecomposed, simplePosition.IsRecomposed)); }
public static Position CreatFromSimplePosition(ISimplePosition simplePosition, VariantFactory variantFactory) { if (simplePosition == null) { return(null); } var vcfFields = simplePosition.VcfFields; var infoData = VcfInfoParser.Parse(vcfFields[VcfCommon.InfoIndex]); var id = vcfFields[VcfCommon.IdIndex]; int end = ExtractEnd(infoData, simplePosition.Start, simplePosition.RefAllele.Length); // re-calculate the end by checking INFO field string[] altAlleles = vcfFields[VcfCommon.AltIndex].Split(',').ToArray(); double? quality = vcfFields[VcfCommon.QualIndex].GetNullableValue <double>(double.TryParse); string[] filters = vcfFields[VcfCommon.FilterIndex].Split(';'); var samples = new SampleFieldExtractor(vcfFields, infoData.Depth).ExtractSamples(); var variants = variantFactory.CreateVariants(simplePosition.Chromosome, id, simplePosition.Start, end, simplePosition.RefAllele, altAlleles, infoData, simplePosition.IsDecomposed, simplePosition.IsRecomposed); return(new Position(simplePosition.Chromosome, simplePosition.Start, end, simplePosition.RefAllele, altAlleles, quality, filters, variants, samples, infoData, vcfFields, simplePosition.IsDecomposed, simplePosition.IsRecomposed)); }
public void EmptyInfoField() { Assert.Null(VcfInfoParser.Parse("")); }
public void Parse_Breakend_Event_Id() { var info = VcfInfoParser.Parse("SVTYPE=BND;MATEID=MantaBND:2312:0:1:1:0:0:0;IMPRECISE;CIPOS=-344,344;EVENT=MantaBND:2312:0:1:0:0:0:0;JUNCTION_QUAL=204;BND_DEPTH=38;MATE_BND_DEPTH=46"); Assert.Equal("MantaBND:2312:0:1:0:0:0:0", info.BreakendEventId); }