Exemplo n.º 1
0
        private void CreateCustIntervalTsv(string fileName)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            var benchMark = new Benchmark();

            var version = DataSourceVersionReader.GetSourceVersion(fileName);
            var reader  = new CustomIntervalParser(new FileInfo(fileName), _refNamesDictionary);

            using (var writer = new IntervalTsvWriter(_outputDirectory, version,
                                                      _genomeAssembly.ToString(), SaTsvCommon.CustIntervalSchemaVersion, reader.KeyName,
                                                      ReportFor.AllVariants))
            {
                foreach (var custInterval in reader.GetCustomIntervals())
                {
                    writer.AddEntry(custInterval.Chromosome.EnsemblName, custInterval.Start, custInterval.End, custInterval.GetJsonString());
                }
            }

            var timeSpan = Benchmark.ToHumanReadable(benchMark.GetElapsedTime());

            TsvWriterUtilities.WriteCompleteInfo("customInterval", fileName, timeSpan);
        }
        public void CustomIntervalTypeReaderTest()
        {
            var customFile = new FileInfo(Resources.TopPath("icslInterval.bed"));

            var customReader = new CustomIntervalParser(customFile, _refChromDict);

            // all items from this file should be of type cosmic.
            foreach (var customInterval in customReader.GetCustomIntervals())
            {
                Assert.Equal("IcslIntervals", customInterval.Type);
            }
        }
        public void InforFieldsTest()
        {
            var customFile = new FileInfo(Resources.TopPath("icslInterval.bed"));

            var customReader = new CustomIntervalParser(customFile, _refChromDict);

            // all items from this file should be of type cosmic.
            var i = 0;

            foreach (var customInterval in customReader.GetCustomIntervals())
            {
                switch (i)
                {
                case 0:    //checking the first item
                    Assert.Equal("chr1", customInterval.Chromosome.UcscName);
                    Assert.Equal(69091, customInterval.Start);
                    Assert.Equal(70008, customInterval.End);
                    Assert.Equal("OR4F5", customInterval.StringValues["gene"]);
                    Assert.Equal("0.0", customInterval.NonStringValues["score"]);
                    Assert.Equal("3.60208899915", customInterval.NonStringValues["exacScore"]);
                    Assert.Equal("Some_evidence_of_constraint", customInterval.StringValues["assesment"]);
                    break;

                case 1:
                    Assert.Equal("chr1", customInterval.Chromosome.UcscName);
                    Assert.Equal(861121, customInterval.Start);
                    Assert.Equal(879582, customInterval.End);
                    Assert.Equal("SAMD11", customInterval.StringValues["gene"]);
                    Assert.Equal("0.997960686608", customInterval.NonStringValues["score"]);
                    Assert.Equal("-3.7861959419", customInterval.NonStringValues["exacScore"]);
                    Assert.Equal("Minimal_evidence_of_constraint", customInterval.StringValues["assesment"]);
                    break;
                }

                i++;
            }
        }