Ejemplo n.º 1
0
        public void SimpleMatchTestStartLater()
        {
            var match = ProteinMatcher.Match("XAAAA", 1, "A2A", 1);

            Assert.IsTrue(match.HasMatch, "Has Match");
            Assert.AreEqual(0, match.Distance, "Distance is 0");
        }
Ejemplo n.º 2
0
        public List <ProteinMatch> FindInSequence(ProteinSequenceWithFundaments sequence, int fundamentIndex, string expression, int maximumDistance)
        {
            var result          = new List <ProteinMatch>();
            var minimalDistance = maximumDistance;
            var startFrom       = 0;

            //if (fundamentIndex > 1)
            //{
            //    var lastFundament = sequence[fundamentIndex - 1];
            //    if (lastFundament != null)
            //    {
            //        startFrom = lastFundament.Index + lastFundament.Length;
            //    }
            //}


            for (var i = startFrom; i < sequence.ProteinSequence.Sequence.Length; i++)
            {
                var match = ProteinMatcher.Match(sequence.ProteinSequence.Sequence, i, expression, maximumDistance);
                if (!match.HasMatch || match.Distance >= minimalDistance)
                {
                    continue;
                }

                if (match.Distance < minimalDistance)
                {
                    result.Clear();
                    minimalDistance = match.Distance;
                }

                if (match.Distance == minimalDistance)
                {
                    sequence[fundamentIndex] = match;
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
 public ProteinMatcherTests()
 {
     _matcher = new ProteinMatcher();
 }