示例#1
0
        public void FailReadRight()
        {
            // Arrange
            using (var file = new TempFileCreator("chr1\tSource\tFeature\t10\t20V\t100.0\t*\t0\tatt1=1;att2=v2"))
            {
                // ACt
                var parser     = new GtfParser();
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.False(parsedData.Chromosomes.ContainsKey("chr1"));
            }
        }
        public void FullySetArguments()
        {
            // Arrange
            var rg = new RegionGenerator();

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var parser        = new GtfParser(rg.Columns);
                var parsedFeature = parser.Parse(file.TempFilePath).Chromosomes[rg.Chr].Strands[rg.Strand].Intervals[0];

                // Assert
                Assert.True(parsedFeature.CompareTo(rg.GFeature) == 0);
            }
        }
示例#3
0
        public void ReadStrand()
        {
            // Arrange
            var rg = new RegionGenerator();

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var parser     = new GtfParser();
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands.ContainsKey(rg.Strand));
            }
        }
示例#4
0
        public void AssignHashKey()
        {
            // Arrange
            var rg = new RegionGenerator();

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var parser     = new GtfParser();
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands[rg.Strand].Intervals.ToList()[0].GetHashCode() != 0);
            }
        }
示例#5
0
        public void TestDefaultColumnOrder()
        {
            // Arrange
            var rg = new RegionGenerator();

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var parser        = new GtfParser();
                var parsedFeature = parser.Parse(file.TempFilePath).Chromosomes[rg.Chr].Strands[rg.Strand].Intervals.ToList()[0];

                // Assert
                Assert.True(parsedFeature.CompareTo(rg.GFeature) == 0);
            }
        }
示例#6
0
        public void AvoidHeader(int headerCount, byte readOffset)
        {
            // Arrange
            using (var file = new TempFileCreator(new RegionGenerator(), headerLineCount: headerCount))
            {
                // Act
                var parser = new GtfParser()
                {
                    ReadOffset = readOffset
                };
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes.Count == 1);
            }
        }
示例#7
0
        public void ReadLeft()
        {
            // Arrange
            var rg = new RegionGenerator {
                Left = 10
            };

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var parser     = new GtfParser();
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands[rg.Strand].Intervals.ToList()[0].Left == rg.Left);
            }
        }
示例#8
0
        public void FailReadChr(string chr)
        {
            // Arrange
            var rg = new RegionGenerator {
                Chr = "chr1"
            };

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var parser     = new GtfParser();
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.False(parsedData.Chromosomes.ContainsKey(chr));
            }
        }
示例#9
0
        public void ReadAttribute()
        {
            // Arrange
            var rg = new RegionGenerator {
                Attribute = "att1=at1;att2=at2;att3=3"
            };

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var parser     = new GtfParser();
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands[rg.Strand].Intervals.ToList()[0].Attribute == rg.Attribute);
            }
        }
示例#10
0
        public void ReadScore()
        {
            // Arrange
            var rg = new RegionGenerator {
                Score = 123.456
            };

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var parser     = new GtfParser();
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands[rg.Strand].Intervals[0].Score == rg.Score);
            }
        }
示例#11
0
        internal static Gtf <GeneralFeature> ParseGTF(string filePath, RegionGenerator rg)
        {
            var parser = new GtfParser(rg.Columns);

            return(parser.Parse(filePath));
        }