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 custParser = new CustomAnnotationsParser(GetReadStream(invalidHeaderLines), null)) { Assert.Throws <UserErrorException>(() => custParser.ParseHeaderLines()); } }
public void ParseHeaderLines_AsExpected() { const string headerLines = "#title=IcslAlleleFrequencies\n" + "#assembly=GRCh38\n" + "#matchVariantsBy=allele\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 CustomAnnotationsParser(GetReadStream(headerLines), null)) { custParser.ParseHeaderLines(); var expectedJsonKeys = new[] { "refAllele", "altAllele", "allAc", "allAn", "allAf", "failedFilter", "pathogenicity", "notes" }; var expectedIntervalJsonKeys = new[] { "start", "end", "allAc", "allAn", "allAf", "failedFilter", "pathogenicity", "notes" }; var expectedCategories = new[] { CustomAnnotationCategories.AlleleCount, CustomAnnotationCategories.AlleleNumber, CustomAnnotationCategories.AlleleFrequency, CustomAnnotationCategories.Unknown, CustomAnnotationCategories.Prediction, CustomAnnotationCategories.Unknown }; var expectedDescriptions = new[] { "ALL", "ALL", "ALL", null, null, null }; var expectedTypes = new[] { SaJsonValueType.Number, SaJsonValueType.Number, SaJsonValueType.Number, SaJsonValueType.Bool, SaJsonValueType.String, SaJsonValueType.String }; Assert.Equal("IcslAlleleFrequencies", custParser.JsonTag); Assert.Equal(GenomeAssembly.GRCh38, custParser.Assembly); Assert.True(expectedJsonKeys.SequenceEqual(custParser.JsonKeys)); Assert.True(expectedIntervalJsonKeys.SequenceEqual(custParser.IntervalJsonKeys)); Assert.True(expectedCategories.SequenceEqual(custParser.Categories)); Assert.True(expectedDescriptions.SequenceEqual(custParser.Descriptions)); Assert.Equal(expectedTypes, custParser.ValueTypes); } }