当前位置: 首页>>代码示例>>C#>>正文


C# Sequence.ToString方法代码示例

本文整理汇总了C#中Sequence.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Sequence.ToString方法的具体用法?C# Sequence.ToString怎么用?C# Sequence.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sequence的用法示例。


在下文中一共展示了Sequence.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestSequenceToString

        public void TestSequenceToString()
        {
            ISequence seqSmall = new Sequence(Alphabets.DNA, "ATCG");
            ISequence seqLarge = new Sequence(Alphabets.DNA, "ATCGGGGGGGGGGGGGGGGGGGGGGGGCCCCCCCCCCCCCCCCCCCCCCGGGGGGGGGGTTTTTTTTTTTTTTT");
            string ActualSmallString = seqSmall.ToString();
            string ActualLargeString = seqLarge.ToString();
            string ExpectedSmallString = "ATCG";
            string expectedLargeString = string.Format(CultureInfo.CurrentCulture, "ATCGGGGGGGGGGGGGGGGGGGGGGGGCCCCCCCCCCCCCCCCCCCCCCGGGGGGGGGGTTTTT... +[{0}]", (seqLarge.Count - Helper.AlphabetsToShowInToString));

            Assert.AreEqual(ExpectedSmallString, ActualSmallString);
            Assert.AreEqual(expectedLargeString, ActualLargeString);
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:12,代码来源:TestToStringForBio.cs

示例2: ValidateSequenceToString

        public void ValidateSequenceToString()
        {
            ISequence seqSmall = new Sequence(Alphabets.DNA, "ATCG");
            string seqLargeString = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName,
                                                                    Constants.seqLargeStringNode);
            ISequence seqLarge = new Sequence(Alphabets.DNA, seqLargeString);
            string ActualSmallString = seqSmall.ToString();
            string ActualLargeString = seqLarge.ToString();
            string ExpectedSmallString = "ATCG";
            string seqLargeExpected = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName,
                                                                      Constants.seqLargeExpected2Node);
            string expectedLargeString = string.Format(CultureInfo.CurrentCulture,
                                                       seqLargeExpected,
                                                       (seqLarge.Count - Helper.AlphabetsToShowInToString));
            Assert.AreEqual(ExpectedSmallString, ActualSmallString);
            Assert.AreEqual(expectedLargeString, ActualLargeString);

            //check with blank sequence
            var seqBlank = new Sequence(Alphabets.DNA, "");
            string blankString = seqBlank.ToString();
            Assert.AreEqual(string.Empty, blankString);

            // Gets the expected sequence from the Xml
            string filePath = this.utilityObj.xmlUtil.GetTextValue(Constants.SimpleFastaNodeName,
                                                              Constants.FilePathNode);
            //read sequence from file
            var parser = new FastAParser { Alphabet = Alphabets.Protein };
            List<ISequence> seqsList = parser.Parse(filePath).ToList();

            var seqString = new string(seqsList[0].Select(a => (char) a).ToArray());
            if (seqString.Length > Helper.AlphabetsToShowInToString)
            {
                //check if the whole sequence string contains the string retrieved from ToString
                Assert.IsTrue(seqString.Contains(seqsList[0].ToString().Substring(0, Helper.AlphabetsToShowInToString)));
                Assert.IsTrue(seqsList[0].ToString().Contains("... +["));
            }
            else
            {
                Assert.AreEqual(seqString, seqsList[0].ToString());
            }
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:41,代码来源:ToStringBvtTestCases.cs

示例3: ValidateSequenceConvertToString

        public void ValidateSequenceConvertToString()
        {
            string seqLargeString = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName,
                                                                    Constants.seqLargeStringNode);
            ISequence seqLarge = new Sequence(Alphabets.DNA, seqLargeString);
            string ActualLargeString = seqLarge.ToString();
            string seqLargeExpected = this.utilityObj.xmlUtil.GetTextValue(Constants.ToStringNodeName,
                                                                      Constants.seqLargeExpected2Node);
            string expectedLargeString = string.Format(CultureInfo.CurrentCulture,
                                                       seqLargeExpected,
                                                       (seqLarge.Count - Helper.AlphabetsToShowInToString));
            Assert.AreEqual(expectedLargeString, ActualLargeString);

            List<ISequence> seqsList;
            // Gets the expected sequence from the Xml
            string filePath = this.utilityObj.xmlUtil.GetTextValue(Constants.SimpleFastaNodeName,
                                                              Constants.FilePathNode);

            var parser = new FastAParser { Alphabet = Alphabets.Protein };
            IEnumerable<ISequence> seq = parser.Parse(filePath);

            //Create a list of sequences.
            seqsList = seq.ToList();

            var seqString = new string(seqsList[0].Select(a => (char) a).ToArray());
            Assert.AreEqual(seqString.Substring(2, 5), ((Sequence) seqsList[0]).ConvertToString(2, 5));
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:27,代码来源:ToStringBvtTestCases.cs

示例4: LogPattern

 protected void LogPattern(Sequence sequentialPattern)
 {
   if (!_miningSettings.LogPatterns) return;
   
   Log(sequentialPattern.ToString(_itemsManager));
 }
开发者ID:supereagleflying,项目名称:datamining-sequentialpatterns,代码行数:6,代码来源:SequenceMiningAlgorithm.cs


注:本文中的Sequence.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。