Beispiel #1
0
        public Window(string chr, int left, int right, int maxIntervalLength, int k, int lambda)
        {
            _chr    = chr;
            _left   = left;
            _right  = right;
            _length = _right - _left;

            this.k      = k;
            this.lambda = lambda;

            _ErlangDistribution = new ErlangDistribution(k, lambda, left, right);

            _nameAlphabet = new char[] { 'H', 'A', 'M', 'E', 'D', 'V', 'I', '5', '3', '0', '1' };

            _random            = new Random();
            _maxIntervalLength = maxIntervalLength;
        }
Beispiel #2
0
        public void Generate(int sampleCount, int maxICount, int chrCount, ErlangDistribution kDis, ErlangDistribution lambdaDis, int fileSizeProb)
        {
            _kDis         = kDis;
            _lambdaDis    = lambdaDis;
            _maxICount    = maxICount;
            _fileSizeProb = fileSizeProb;
            _chrCount     = chrCount;

            string outputPath = _outputDirectory + "count_" + maxICount.ToString();

            Directory.CreateDirectory(outputPath);
            Directory.CreateDirectory(outputPath + Path.DirectorySeparatorChar + "sorted" + Path.DirectorySeparatorChar);
            Directory.CreateDirectory(outputPath + Path.DirectorySeparatorChar + "shuffled" + Path.DirectorySeparatorChar);

            CreateWindows();
            for (int i = 0; i < sampleCount; i++)
            {
                Console.Write("now creating sample {0}", i);
                GenerateSample(outputPath, i);
            }

            #region For Test purpose only
            Dictionary <int, int> llllambda = new Dictionary <int, int>();
            Dictionary <int, int> kkkk      = new Dictionary <int, int>();
            foreach (var window in _windows)
            {
                if (llllambda.ContainsKey(window.lambda))
                {
                    llllambda[window.lambda]++;
                }
                else
                {
                    llllambda.Add(window.lambda, 1);
                }

                if (kkkk.ContainsKey(window.k))
                {
                    kkkk[window.k]++;
                }
                else
                {
                    kkkk.Add(window.k, 1);
                }
            }

            using (FileStream fs = new FileStream(outputPath + Path.DirectorySeparatorChar + "WindowParameters__Lambda.txt", FileMode.Append, FileAccess.Write))
                using (StreamWriter sw = new StreamWriter(fs))
                    foreach (var window in llllambda)
                    {
                        sw.WriteLine(window.Key + "\t" + window.Value);
                    }

            using (FileStream fs = new FileStream(outputPath + Path.DirectorySeparatorChar + "WindowParameters__K.txt", FileMode.Append, FileAccess.Write))
                using (StreamWriter sw = new StreamWriter(fs))
                    foreach (var window in kkkk)
                    {
                        sw.WriteLine(window.Key + "\t" + window.Value);
                    }

            #endregion
        }