/** Tests the adding of a sequence list to the histogram */
        public void TestAddSequenceList()
        {
            SequenceList list = new SequenceList();
            list.Add(new Sequence(AlphabetType.DNA, "actga"));
            list.Add(new Sequence(AlphabetType.DNA, "ctaca"));

            histo.Add(list);

            Assert.AreEqual(4, histo.HistoValue(alpha['a']));
            Assert.AreEqual(3, histo.HistoValue(alpha['c']));
            Assert.AreEqual(2, histo.HistoValue(alpha['t']));
            Assert.AreEqual(1, histo.HistoValue(alpha['g']));
        }
        /** Tests constructor */
        public void TestConstructor()
        {
            SequenceList list = new SequenceList();
            list.Add(new Sequence(AlphabetType.DNA, "aa", false));
			list.Add( new Sequence( AlphabetType.DNA, "at", false ) );
            Block block = new Block("test", list, null, 0.0);
            Assert.AreEqual(1.000, block.Get('a', 0), 1e-3);
            Assert.AreEqual(-0.584, block.Get('c', 0), 1e-3);
            Assert.AreEqual(-0.584, block.Get('t', 0), 1e-3);
            Assert.AreEqual(-0.584, block.Get('g', 0), 1e-3);
            Assert.AreEqual(0.415, block.Get('a', 1), 1e-3);
            Assert.AreEqual(-0.584, block.Get('c', 1), 1e-3);
            Assert.AreEqual(0.415, block.Get('t', 1), 1e-3);
            Assert.AreEqual(-0.584, block.Get('g', 1), 1e-3);
        }
        /// <summary>
        /// Reads the Genbank file and have it parsed by MBF library.
        /// </summary>
        /// <param name="genbankFileURL">Your genbank file path</param>
        /// <returns></returns>
        private SequenceList ParseSequencePath
                                    (string genbankFileURL)
        {
            if (IsOnline)  
                throw new NotImplementedException
                    ("online genbank reading is not supported in this version!"); 
            
            //Download the file and parse it

            //Create the parser first
            ISequenceParser gbParser = new GenBankParser();

            //Always Try parsing multi sequence in a file
            List<ISequence> mbfSequences = gbParser.Parse(genbankFileURL);

            SequenceList bioSeqList = new SequenceList();

            foreach (Sequence mbfseq in mbfSequences)
            {
                ConvertToBioPatMLSeq(mbfseq);
                bioSeqList.Add(ConvertToBioPatMLSeq(mbfseq));
            }

            return bioSeqList;
        }
        /// <summary>
        /// Reads in the fasta file.
        /// </summary>
        /// <param name="reader">your local filepath for genbank</param>
        /// <returns>list of BioPatML Sequences</returns>
        public override SequenceList Read(TextReader reader)
        {
            //Create the parser first
            ISequenceParser fastaParser = new FastaParser();

            List<ISequence> mbfSequences = fastaParser.Parse(reader);

            SequenceList bioSeqList = new SequenceList();

            foreach (Sequence mbfseq in mbfSequences)
            {
                bioSeqList.Add(ConvertToBioPatMLSeq(mbfseq));
            }

            return bioSeqList;
        }
        /// <summary>
        /// The param could also be a stringreader.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        private SequenceList ParseSequencePath
                                    (TextReader reader)
        {
            //Create the parser first
            ISequenceParser gbParser = new GenBankParser();

            //Always Try parsing multi sequence in a reader
            List<ISequence> mbfSequences = gbParser.Parse(reader);

            SequenceList bioSeqList = new SequenceList();

            foreach (Sequence mbfseq in mbfSequences)
            {
                ConvertToBioPatMLSeq(mbfseq);
                bioSeqList.Add(ConvertToBioPatMLSeq(mbfseq));
            }

            return bioSeqList;
        }
        /// <summary>
        /// Reads the parameters and populate the attributes for this pattern.
        /// </summary>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when sequences in blocks are missing.</exception>
        /// <param name="node"></param>
        /// <param name="definition">The Definition element where the node sits in</param>
        public override void ReadNode
            (XmlNode node, Definition definition)
        {
            PatternName = (XMLHelper.GetAttrValueString(node, "name"));
            Threshold = (XMLHelper.GetAttrValDouble(node, "threshold"));
            Impact = (XMLHelper.GetAttrValDouble(node, "impact"));

            PWMalphabet = AlphabetFactory.Instance
                        (XMLHelper.GetAttrValueString(node, "alphabet"));
            SequenceList seqList = new SequenceList();

            node = node.FirstChild;
            while (node != null)
            {
                if (node.Name.Equals("Sequence"))
                {
                    String letters = node.InnerText.Trim();

                    if (letters == null)
                        throw new ArgumentNullException
                            ("Sequences in Block are missing!");

                    seqList.Add(new Sequence(PWMalphabet, letters, false));
                }
                node = node.NextSibling;
            }

            Estimate(seqList, null);
        }