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); } }
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)); } }
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); } }
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); } }
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); } }
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); } }
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)); } }
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); } }
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); } }
internal static Gtf <GeneralFeature> ParseGTF(string filePath, RegionGenerator rg) { var parser = new GtfParser(rg.Columns); return(parser.Parse(filePath)); }