public List<Matched> PerformSearch(string BioPatMLContent, SequenceContract sequence)
        {
            List<Matched> matchedList = new List<Matched>();
            StringReader sr = new StringReader(BioPatMLContent);
            Definition MyPatterns = null;

            using (BioPatMLPatternReader reader = new BioPatMLPatternReader())
            {
                MyPatterns = reader.ReadBioPatML(sr);
            }

            Sequence targetSequence = new Sequence(sequence.AlphabetName, sequence.Characters);
            SequenceList matches = new FeatureList();

            IPattern MatchingPattern = MyPatterns.MainPattern;

            #region If bioPatML pattern is SeriesBest OR SetBest : Search by best

            if (MatchingPattern is SeriesBest
                    || MatchingPattern is SetBest)
            {
                Match match = targetSequence.SearchBest(0, 0, MatchingPattern);
                matches.Add(match);
            }

            #endregion

            #region Else, pattern is Motif, Any, Anchor, Prosite, RegularEx : Search by normal

            else
            //The rest
            {
                matches = targetSequence.Search(1, targetSequence.Length, MatchingPattern);
            }

            #endregion

            for (int i = 0; i < matches.Count; i++)
            {
                Match matched = matches[i] as Match;

                matchedList.Add(new Matched
                                         (matched.Similarity,
                                         matched.Start, matched.End,
                                         matched.Length, matched.Letters(), sequence.Name));
            }

            return matchedList;
        }
        public SequenceContract ParseGenbankFile(string gbContent)
        {
            StringReader sr = new StringReader(gbContent);
            SequenceContract sequence = new SequenceContract();
            SequenceList bioSeqList = null; //BioPatML's data structure

            using (ReaderBase reader = new BioPatMBF_Reader())
            {
                bioSeqList = reader.Read(sr);
            }

            //for now we only always use the first sequence SequenceName
            sequence.Name = bioSeqList[0].Annotations("SequenceName").AnnotationValue as string;
            //sequence.Name = bioSeqList[0].Name;
            sequence.AlphabetName = bioSeqList[0].Alphabet.Name;
            sequence.Characters = bioSeqList[0].Letters();

            return sequence;
        }