Exemplo n.º 1
0
 public PatternIdentifier()
 {
     _apm = new ApproximatePatternMatchingCalculator();
     _patternConverter = new PatternConverter();
     _ngen = new NeighborhoodGenerator();
     _rc = new ReverseComplement();
 }
        public string Solve(string dna, int k, double[,] profile)
        {
            PatternConverter patternConverter = new PatternConverter();
            var kmers = ExtractKmers(dna, k).ToList();
            double maxProbability = 0;
            int maxIndex = -1;

            for (var row = 0; row < kmers.Count; row++)
            {
                string kmer = kmers[row];
                double product = 1;
                for (int index = 0; index < kmer.Length; index++)
                {
                    product *= profile[patternConverter.SymbolToNumber(kmer[index]), index];
                }

                if (maxProbability < product)
                {
                    maxProbability = product;
                    maxIndex = row;
                }
            }

            return kmers[maxIndex];
        }
Exemplo n.º 3
0
 public FrequencyCalculator()
 {
     converter = new PatternConverter();
 }
Exemplo n.º 4
0
 public ClumpFinder()
 {
     _calculator = new FrequencyCalculator();
     _converter = new PatternConverter();
 }