public Factory(HygeaOptions options) : base(options) { _options = options; UpdateWorkRequests(); UpdateKnownPriors(); }
public void ExecuteTest(string inputBamFile, string outputBamFile, int expectedNumRealignedReads, int maxShift = 250) { if (File.Exists(outputBamFile)) { File.Delete(outputBamFile); } var options = new HygeaOptions(); options.SkipAndRemoveDuplicates = false; //(old default/simple behavior for regression testing basic execution) options.MaxRealignShift = maxShift; var factory = new Factory(options); var chrRef = GetGenomeSnippet(); var writer = new RemapBamWriter(inputBamFile, outputBamFile); writer.Initialize(); var realigner = (ChrRealigner)factory.CreateRealigner(chrRef, inputBamFile, writer); realigner.Execute(); writer.FinishAll(); Assert.True(File.Exists(outputBamFile)); Assert.Equal(expectedNumRealignedReads, realigner.TotalRealignedReads); }
public void PopulateBAMPaths() { //Happy Path var options_1 = new HygeaOptions() { BAMPaths = new string[] { TestPaths.LocalTestDataDirectory }, GenomePaths = new[] { _existingGenome }, }; Assert.NotNull(options_1.BAMPaths); Assert.True(options_1.BAMPaths.Length > 0); //no bam files found var options_3 = new HygeaOptions() { BAMPaths = new string[] { TestPaths.LocalTestDataDirectory }, GenomePaths = new[] { _existingGenome }, }; var appOptions = new HygeaOptionParser() { Options = options_3 }; appOptions.ValidateOptions(); Assert.IsType <ArgumentException>(appOptions.ParsingResult.Exception); }
private HygeaOptions GetBasicOptions() { var basicOptions = new HygeaOptions() { BAMPaths = new[] { _existingBamPath }, GenomePaths = new[] { _existingGenome } }; basicOptions.SetIODirectories("Hygea"); return(basicOptions); }
public void OpenLogTest() { var outDir = Path.Combine(TestPaths.LocalScratchDirectory, "HygeaTestsOutDir"); var options = new HygeaOptions(); options.OutputDirectory = outDir; Logger.OpenLog(options.OutputDirectory, "testLog.txt", true); Logger.CloseLog(); Assert.True(Directory.Exists(outDir)); Assert.True(File.Exists(Path.Combine(options.OutputDirectory, "testLog.txt"))); //cleanup and redirect logging var SafeLogDir = TestPaths.LocalScratchDirectory; Logger.OpenLog(SafeLogDir, "DefaultLog.txt", true); Logger.CloseLog(); Directory.Delete(outDir, true); }
public void GetLogFolder() { var options = GetBasicOptions(); Assert.Equal(Path.Combine(Path.GetDirectoryName(_existingBamPath), "HygeaLogs"), options.LogFolder); // when multiple bam paths, use first bam file options = new HygeaOptions(); var nonExistingBam = Path.Combine(TestPaths.LocalScratchDirectory, "nonexistant.bam"); options.BAMPaths = new[] { nonExistingBam, _existingBamPath }; options.SetIODirectories("Hygea"); Assert.Equal(Path.Combine(Path.GetDirectoryName(nonExistingBam), "HygeaLogs"), options.LogFolder); // use output folder if provided options = new HygeaOptions(); options.BAMPaths = new[] { _existingBamPath }; options.OutputDirectory = @"C:\SomeOutput"; options.SetIODirectories("Hygea"); Assert.Equal(Path.Combine(options.OutputDirectory, "HygeaLogs"), options.LogFolder); }
public void ReadGenome() { Directory.CreateDirectory(_outputFolder); var options_1 = new HygeaOptions() { BAMPaths = BamProcessorParsingUtils.UpdateBamPathsWithBamsFromFolder(_existingBamFolder), GenomePaths = new[] { _existingGenome }, OutputDirectory = _outputFolder }; var factory = new Factory(options_1); Assert.Equal(factory.GetOutputFile(_existingBamPath), _outputFilePath); // Run the genome processor using the filter for chr19, it will run through the IndelRealigner path as usual. var genome = new Genome(_existingGenome, new List <string>() { "chr19" }); var gp1 = new GenomeProcessor(factory, genome, "chr19"); gp1.Execute(1); var outputFilePath = Path.Combine(_outputFolder, Path.GetFileName(_existingBamPath)); Assert.True(File.Exists(outputFilePath)); Assert.NotEqual(new FileInfo(outputFilePath).Length, new FileInfo(_existingBamPath).Length); File.Delete(outputFilePath); // Run the genome processor using the filter for chr18 to follow the path in GenomeProcessor.Process // for chromosomes outside the filter. var gp2 = new GenomeProcessor(factory, genome, "chr18"); gp2.Execute(1); Assert.True(File.Exists(outputFilePath)); Assert.NotEqual(new FileInfo(outputFilePath).Length, new FileInfo(_existingBamPath).Length); }
public MockFactoryWithDefaults(HygeaOptions options) : base(options) { }