コード例 #1
0
        public void LoopbackTest()
        {
            var wigFixFile = new FileInfo(Resources.TopPath("mini.WigFix"));
            var version    = new DataSourceVersion("phylop", "0", DateTime.Now.Ticks, "unit test");

            var phylopWriter = new PhylopWriter(wigFixFile.FullName, version, GenomeAssembly.Unknown, Path.GetTempPath(), 50);

            using (phylopWriter)
            {
                phylopWriter.ExtractPhylopScores();
            }

            var phylopReader = new PhylopReader(FileUtilities.GetReadStream(Path.GetTempPath() + Path.DirectorySeparatorChar + "chr1.npd"));

            using (phylopReader)
            {
                Assert.Equal(0.064, phylopReader.GetScore(100)); //first position of first block
                Assert.Equal(0.058, phylopReader.GetScore(101)); // second position
                Assert.Equal(0.064, phylopReader.GetScore(120)); // some internal position
                Assert.Equal(0.058, phylopReader.GetScore(130)); //last position of first block

                //moving on to the next block: should cause reloading from file
                Assert.Equal(0.064, phylopReader.GetScore(175));  //first position of first block
                Assert.Equal(-2.088, phylopReader.GetScore(182)); // some negative value
            }

            File.Delete(Path.GetTempPath() + Path.DirectorySeparatorChar + "chr1.npd");
        }
コード例 #2
0
        /// <summary>
        /// executes the program
        /// </summary>
        protected override void ProgramExecution()
        {
            Console.WriteLine("Reading file: {0}", ConfigurationSettings.InputWigFixFile);

            var timer = new Benchmark();

            var version = GetDataVersion();

            using (var nirvanaPhylopDatabaseCreator = new PhylopWriter(ConfigurationSettings.InputWigFixFile, version, GenomeAssemblyUtilities.Convert(ConfigurationSettings.GenomeAssembly), ConfigurationSettings.OutputNirvanaDirectory))
            {
                nirvanaPhylopDatabaseCreator.ExtractPhylopScores();
            }
            Console.WriteLine("Time:{0}", timer.GetElapsedTime());
        }