コード例 #1
0
        public static void DoReformating(ReformatOptions options)
        {
            var inputFile  = options.VcfPath;
            var outputFile = inputFile.Replace(".vcf", ".uncrushed.vcf");
            var crush      = false;


            if (options.VcfWritingParams.ForceCrush.HasValue)
            {
                crush = (bool)options.VcfWritingParams.ForceCrush;
                options.VcfWritingParams.AllowMultipleVcfLinesPerLoci = !crush;
            }

            if (crush)
            {
                Console.WriteLine("crushing " + inputFile + "...");
                outputFile = inputFile.Replace(".vcf", ".crushed.vcf");
            }
            else
            {
                Console.WriteLine("uncrushing " + inputFile + "...");
            }

            if (File.Exists(outputFile))
            {
                File.Delete(outputFile);
            }

            //Update Vcf, variant by variant, based on the table data.
            VcfUpdater <bool> .UpdateVcfAlleleByAllele(outputFile, options, false, true, UpdateAllele, CanSkipNeverVcfLine,
                                                       GetVcfFileWriter);
        }
コード例 #2
0
        public void ReformatTest()
        {
            var outDir = Path.Combine(TestPaths.LocalScratchDirectory, "UncrushOutDir");

            //For added challenge, this is a none-pisces vcf we are parsing and reformatting.
            var inputDir  = Path.Combine(TestPaths.LocalTestDataDirectory);
            var testVcf   = Path.Combine(inputDir, "CrushedExample.vcf");
            var inputFile = Path.Combine(outDir, "CrushedExample.vcf");

            TestHelper.RecreateDirectory(outDir);

            if (!Directory.Exists(outDir))
            {
                Directory.CreateDirectory(outDir);
            }

            if (File.Exists(inputFile))
            {
                File.Delete(inputFile);
            }

            File.Copy(testVcf, inputFile);

            var crushedOutFile   = Path.Combine(outDir, "crushedexample.crushed.vcf");
            var uncrushedOutFile = Path.Combine(outDir, "crushedexample.uncrushed.vcf");
            var options          = new ReformatOptions();

            options.VcfPath = inputFile;
            options.VariantCallingParams.AmpliconBiasFilterThreshold = null; //just to keep vcf header the same as before we added this filter.

            //ouput uncrushed
            options.VcfWritingParams.ForceCrush = false;
            ReformatVcf.Reformat.DoReformating(options);

            //output crushed
            options.VcfWritingParams.ForceCrush = true;
            ReformatVcf.Reformat.DoReformating(options);

            //check files
            TestHelper.CompareFiles(crushedOutFile, Path.Combine(TestPaths.LocalTestDataDirectory, "expected.crushed.vcf"));
            TestHelper.CompareFiles(uncrushedOutFile, Path.Combine(TestPaths.LocalTestDataDirectory, "expected.uncrushed.vcf"));
        }
コード例 #3
0
ファイル: ASParser.cs プロジェクト: nomilogic/fdplugins
 public ASParser(ITokenStream input, ReformatOptions opt)
     : base(input)
 {
     options = opt;
     InitializeCyclicDFAs();
     ruleMemo = new IDictionary[307 + 1];
 }
コード例 #4
0
 public ReformatOptionsParser()
 {
     Options = new ReformatOptions();
 }