public void ParseHeaderLines_InconsistentFields() { const string invalidHeaderLines = "#title=IcslAlleleFrequencies\n" + "#assembly=GRCh38\n" + "#CHROM\tPOS\tREF\tALT\tEND\tallAc\tallAn\tallAf\tfailedFilter\tpathogenicity\n" + "#categories\t.\t.\t.\t.\tAlleleCount\tAlleleNumber\tAlleleFrequency\t.\tPrediction\t.\tMore\n" + "#descriptions\t.\t.\t.\t.\tALL\tALL\tALL\n" + "#type\t.\t.\t.\t.\tnumber\tnumber\tnumber\tbool\tstring\tstring"; using (var parser = new VariantAnnotationsParser(GetReadStream(invalidHeaderLines), null)) { Assert.Throws <UserErrorException>(() => parser.ParseHeaderLines()); } }
public void ParseHeaderLines_AsExpected() { const string headerLines = "#title=IcslAlleleFrequencies \n" + "#assembly=GRCh38\t\n" + "#matchVariantsBy=allele\n" + "#CHROM\tPOS\tREF\tALT\tEND\tallAc\tallAn\tallAf\tfailedFilter\tpathogenicity\tdeNovoQual\tnotes\n" + "#categories\t.\t.\t.\t.\tAlleleCount\tAlleleNumber\tAlleleFrequency\t.\tPrediction\tScore\t.\n" + "#descriptions\t.\t.\t.\t.\tALL\tALL\tALL\t.\t.\t.\t.\n" + "#type\t.\t.\t.\t.\tnumber\tnumber\tnumber\tbool\tstring\tnumber\tstring"; using (var custParser = new VariantAnnotationsParser(GetReadStream(headerLines), null)) { custParser.ParseHeaderLines(); var expectedJsonKeys = new[] { "refAllele", "altAllele", "allAc", "allAn", "allAf", "failedFilter", "pathogenicity", "deNovoQual", "notes" }; var expectedIntervalJsonKeys = new[] { "start", "end", "allAc", "allAn", "allAf", "failedFilter", "pathogenicity", "deNovoQual", "notes" }; var expectedCategories = new[] { CustomAnnotationCategories.AlleleCount, CustomAnnotationCategories.AlleleNumber, CustomAnnotationCategories.AlleleFrequency, CustomAnnotationCategories.Unknown, CustomAnnotationCategories.Prediction, CustomAnnotationCategories.Score, CustomAnnotationCategories.Unknown }; var expectedDescriptions = new[] { "ALL", "ALL", "ALL", null, null, null, null }; var expectedTypes = new[] { SaJsonValueType.Number, SaJsonValueType.Number, SaJsonValueType.Number, SaJsonValueType.Bool, SaJsonValueType.String, SaJsonValueType.Number, SaJsonValueType.String }; Assert.Equal("IcslAlleleFrequencies", custParser.JsonTag); Assert.Equal(GenomeAssembly.GRCh38, custParser.Assembly); Assert.Equal(expectedJsonKeys, custParser.JsonKeys); Assert.Equal(expectedIntervalJsonKeys, custParser.IntervalJsonKeys); Assert.Equal(expectedCategories, custParser.Categories); Assert.Equal(expectedDescriptions, custParser.Descriptions); Assert.Equal(expectedTypes, custParser.ValueTypes); } }
public void ParseHeaderLines_matchBy_sv() { const string headerLines = "#title=IcslAlleleFrequencies\n" + "#assembly=GRCh38\n" + "#matchVariantsBy=sv\n" + "#CHROM\tPOS\tREF\tALT\tEND\tallAc\tallAn\tallAf\tfailedFilter\tpathogenicity\tnotes\n" + "#categories\t.\t.\t.\t.\tAlleleCount\tAlleleNumber\tAlleleFrequency\t.\tPrediction\t.\n" + "#descriptions\t.\t.\t.\t.\tALL\tALL\tALL\t.\t.\t.\n" + "#type\t.\t.\t.\t.\tnumber\tnumber\tnumber\tbool\tstring\tstring"; using (var custParser = new VariantAnnotationsParser(GetReadStream(headerLines), null)) { custParser.ParseHeaderLines(); Assert.Equal(ReportFor.StructuralVariants, custParser.ReportFor); } }