Пример #1
0
        public void GetItems_UnrecognizedGeneId_ThrowException()
        {
            const string lines = "#title=InternalGeneAnnotation\n" +
                                 "#geneSymbol\tgeneId\tOMIM Description\tIs Oncogene\tphenotype\tmimNumber\tnotes\n" +
                                 "#categories\t.\tDescription\tFilter\t\tIdentifier\t.\n" +
                                 "#descriptions\t.\tGene description from OMIM\t\tGene phenotype\t\tFree text\n" +
                                 "#type\t\tstring\tbool\tstring\tnumber\tstring\n" +
                                 "Abc\t3\tsome text\ttrue\tgood\t234\ttest\n";

            using (var parser = GeneAnnotationsParser.Create(GetReadStream(lines), EntrezGeneIdToSymbol, EnsemblIdToSymbol))
            {
                Assert.Throws <UserErrorException>(() => parser.GetItems());
            }
        }
Пример #2
0
        public void GetItems_AsExpected()
        {
            const string lines = "#title=InternalGeneAnnotation\n" +
                                 "#geneSymbol\tgeneId\tOMIM Description\tIs Oncogene\tphenotype\tmimNumber\tnotes\n" +
                                 "#categories\t.\tDescription\tFilter\t\tIdentifier\t.\n" +
                                 "#descriptions\t.\tGene description from OMIM\t\tGene phenotype\t\tFree text\n" +
                                 "#type\t\tstring\tbool\tstring\tnumber\tstring\n" +
                                 "Abc\t1\tsome text\ttrue\tgood\t234\ttest\n" +
                                 "Abc\tENSG2\tsome other text\tfalse\tbad\t200\ttest2\n";

            using (var parser = GeneAnnotationsParser.Create(GetReadStream(lines), EntrezGeneIdToSymbol, EnsemblIdToSymbol))
            {
                var geneSymbol2Items = parser.GetItems();
                Assert.Equal(2, geneSymbol2Items.Count);
                Assert.Single(geneSymbol2Items["Gene1"]);
                Assert.Single(geneSymbol2Items["Gene2"]);
                Assert.Equal("{\"OMIM Description\":\"some text\",\"Is Oncogene\":true,\"phenotype\":\"good\",\"mimNumber\":234,\"notes\":\"test\"}", geneSymbol2Items["Gene1"][0].GetJsonString());
                Assert.Equal("{\"OMIM Description\":\"some other text\",\"phenotype\":\"bad\",\"mimNumber\":200,\"notes\":\"test2\"}", geneSymbol2Items["Gene2"][0].GetJsonString());
            }
        }
Пример #3
0
 private static GeneAnnotationsParser GetGeneAnnotationsParserFromCustomTsvStream(PersistentStream customTsvStream)
 {
     var(entrezGeneIdToSymbol, ensemblGeneIdToSymbol) = GeneUtilities.ParseUniversalGeneArchive(null, LambdaUrlHelper.GetUgaUrl());
     return(GeneAnnotationsParser.Create(new StreamReader(GZipUtilities.GetAppropriateStream(customTsvStream)), entrezGeneIdToSymbol, ensemblGeneIdToSymbol));
 }