コード例 #1
0
        public void TestColumnsShuffle(
            byte chrColumn,
            byte leftColumn,
            sbyte rightColumn,
            byte refSeqIDColumn,
            byte geneSymbolColumn,
            sbyte strandColumn)
        {
            // Arrange
            var rg = new RegionGenerator()
            {
                ChrColumn        = chrColumn,
                LeftColumn       = leftColumn,
                RightColumn      = rightColumn,
                RefSeqIDColumn   = refSeqIDColumn,
                GeneSymbolColumn = geneSymbolColumn,
                StrandColumn     = strandColumn
            };

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

                // Assert
                Assert.True(parsedGene.CompareTo(rg.Gene) == 0);
            }
        }
コード例 #2
0
        public void AssignHashKey()
        {
            // Arrange
            var rg = new RegionGenerator();

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

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands[rg.Strand].Intervals[0].GetHashCode() != 0);
            }
        }
コード例 #3
0
        public void TestDefaultRefSeqGenesColumnOrder()
        {
            // Arrange
            var rg = new RegionGenerator();

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

                // Assert
                Assert.True(parsedGene.CompareTo(rg.Gene) == 0);
            }
        }
コード例 #4
0
        public void FullySetArguments()
        {
            // Arrange
            var rg = new RegionGenerator();

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

                // Assert
                Assert.True(parsedGene.CompareTo(rg.Gene) == 0);
            }
        }
コード例 #5
0
        public void AvoidHeader(int headerCount, byte readOffset)
        {
            // Arrange
            using (var file = new TempFileCreator(new RegionGenerator(), headerLineCount: headerCount))
            {
                // Act
                var parser = new RefSeqParser()
                {
                    ReadOffset = readOffset
                };
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes.Count == 1);
            }
        }
コード例 #6
0
        public void FailReadGeneSymbol()
        {
            // Arrange
            using (var file = new TempFileCreator("chr1\t10\t20\tRefSeq\tGeneSymbol"))
            {
                // Act
                var parser = new RefSeqParser(new RefSeqColumns()
                {
                    GeneSeymbol = 10
                });
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.False(parsedData.Chromosomes.ContainsKey("chr1"));
            }
        }
コード例 #7
0
        public void ReadRefSeqID()
        {
            // Arrange
            var rg = new RegionGenerator {
                RefSeqID = "RefSeqID_001"
            };

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

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

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

                // Assert
                Assert.False(parsedData.Chromosomes.ContainsKey(chr));
            }
        }
コード例 #9
0
        public void ReadGeneSymbol()
        {
            // Arrange
            var rg = new RegionGenerator {
                GeneSymbol = "Symbol_001"
            };

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

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands[rg.Strand].Intervals.ToList()[0].GeneSymbol == rg.GeneSymbol);
            }
        }
コード例 #10
0
        public void MultiFeatureFile()
        {
            // Arrange
            var rg = new RegionGenerator {
                StrandColumn = 12
            };

            using (var file = new TempFileCreator(rg, genesCount: 10, headerLineCount: 2))
            {
                // Act
                var parser     = new RefSeqParser();
                var parsedData = parser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands[rg.Strand].Intervals.Count == 10);
            }
        }
コード例 #11
0
        public void ReadStrand(char strand)
        {
            // Arrange
            var rg = new RegionGenerator
            {
                Strand       = strand,
                StrandColumn = 5
            };

            using (var file = new TempFileCreator(rg))
            {
                // Act
                var genesParser = new RefSeqParser(rg.Columns);
                var parsedData  = genesParser.Parse(file.TempFilePath);

                // Assert
                Assert.True(parsedData.Chromosomes[rg.Chr].Strands.ContainsKey(strand));
            }
        }