Пример #1
0
        private void ExecuteParsingTest(string arguments, bool shouldPass, Action <ApplicationOptions> assertions = null)
        {
            var options = new ApplicationOptions();

            if (shouldPass)
            {
                options.UpdateOptions(arguments.Split(' '));
                if (assertions != null)
                {
                    assertions(options);
                }
            }
            else
            {
                Assert.Throws <Exception>(() => options.UpdateOptions(arguments.Split(' ')));
            }
        }
Пример #2
0
        public void InvalidVcfOutputFolder()
        {
            var appOptions = new ApplicationOptions
            {
                BAMPaths      = new[] { _bamChr19, _bamChr17Chr19, _bamChr17Chr19Dup },
                IntervalPaths = new[] { _intervalsChr17, _intervalsChr19, null },
                GenomePaths   = new[] { _genomeChr17Chr19 }
            };

            Assert.False(Directory.Exists("56:\\Illumina\\OutputFolder"));
            var outputFolder = Path.Combine("56:\\Illumina\\OutputFolder");
//            var outputFile = Path.Combine(outputFolder, "VcfFileWriterTests.vcf");
            var outputFileOptions = new[] { "-OutFolder", outputFolder };

            appOptions.UpdateOptions(outputFileOptions);
            Assert.Throws <ArgumentException>(() => appOptions.Validate());
        }
Пример #3
0
        public void GvcfHeaderFormat()
        {
            var appOptions = new ApplicationOptions
            {
                BAMPaths      = new[] { _bamChr19, _bamChr17Chr19, _bamChr17Chr19Dup },
                IntervalPaths = new[] { _intervalsChr17, _intervalsChr19, null },
                GenomePaths   = new[] { _genomeChr17Chr19 }
            };
            var gVCFOption = new[] { "-gVCF", "true" };

            appOptions.UpdateOptions(gVCFOption);

            var factory = new Factory(appOptions);

            var context = new VcfWriterInputContext
            {
                CommandLine   = new[] { "myCommandLine" },
                SampleName    = "mySample",
                ReferenceName = "myReference",
                ContigsByChr  = new List <Tuple <string, long> >
                {
                    new Tuple <string, long>("chr1", 10001),
                    new Tuple <string, long>("chrX", 500)
                }
            };
            var outputFile = factory.GetOutputFile(appOptions.BAMPaths[0]);
            var writer     = factory.CreateVcfWriter(outputFile, context);

            var candidates = _defaultCandidates;

            writer.WriteHeader();
            writer.Write(candidates);
            writer.Dispose();

            // Time to read the header
            VcfFileWriterTests.VcfFileFormatValidation(outputFile, 5);
        }
Пример #4
0
        public void DefaultGVCFOutput()
        {
            var appOptions = new ApplicationOptions
            {
                BAMPaths      = new[] { _bamChr19, _bamChr17Chr19, _bamChr17Chr19Dup },
                IntervalPaths = new[] { _intervalsChr17, _intervalsChr19, null },
                GenomePaths   = new[] { _genomeChr17Chr19 }
            };
            var gVCFOption = new[] { "-gVCF", "true" };

            appOptions.UpdateOptions(gVCFOption);

            var factory = new Factory(appOptions);

            var context = new VcfWriterInputContext
            {
                CommandLine   = new[] { "myCommandLine" },
                SampleName    = "mySample",
                ReferenceName = "myReference",
                ContigsByChr  = new List <Tuple <string, long> >
                {
                    new Tuple <string, long>("chr1", 10001),
                    new Tuple <string, long>("chrX", 500)
                }
            };
            var outputFile = factory.GetOutputFile(appOptions.BAMPaths[0]);
            var writer     = factory.CreateVcfWriter(outputFile, context);

            var candidates = _defaultCandidates;

            writer.WriteHeader();
            writer.Write(candidates);
            writer.Dispose();

            Assert.True(File.Exists(outputFile));
            Assert.Equal(outputFile, Path.ChangeExtension(_bamChr19, "genome.vcf"));
        }