예제 #1
0
        public CustomIntervalExtractor(string inputCustIntervalPath, string outputDir, int begin, int end)
        {
            _begin = begin;
            _end   = end;

            _reader = new CustomIntervalReader(inputCustIntervalPath);


            string outputFileName = outputDir + Path.DirectorySeparatorChar + _reader.GetReferenceName() + '_' + _reader.GetIntervalType()
                                    + '_' + begin.ToString(CultureInfo.InvariantCulture) + '_' + end.ToString(CultureInfo.InvariantCulture) + ".nci";

            Console.WriteLine("Creating custom interval db: " + outputFileName);
            _writer = new CustomIntervalWriter(outputFileName, _reader.GetReferenceName(), _reader.GetIntervalType(), _reader.DataVersion);
        }
        public void ReadAndWriteTests()
        {
            using (var reader = new CustomIntervalReader(_randomPath))
            {
                var observedType    = reader.GetIntervalType();
                var observedRefName = reader.GetReferenceName();

                Assert.Equal(_intervalType, observedType);
                Assert.Equal("chr1", observedRefName);



                for (var i = 0; i < _totalIntervals; i++)
                {
                    var observedInterval = reader.GetNextCustomInterval();

                    Assert.Equal(_expectedCustomIntervals[i].ReferenceName, observedInterval.ReferenceName);
                    Assert.Equal(_expectedCustomIntervals[i].Start, observedInterval.Start);
                    Assert.Equal(_expectedCustomIntervals[i].End, observedInterval.End);
                    if (i > 0)
                    {
                        Assert.Equal(_expectedCustomIntervals[i].StringValues, observedInterval.StringValues);
                        Assert.Equal(_expectedCustomIntervals[i].NonStringValues, observedInterval.NonStringValues);
                    }
                    else
                    {
                        Assert.Null(observedInterval.StringValues);
                        Assert.Null(observedInterval.NonStringValues);
                    }
                }
            }
        }