本文整理汇总了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);
}
示例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());
}
}
示例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));
}
示例4: LogPattern
protected void LogPattern(Sequence sequentialPattern)
{
if (!_miningSettings.LogPatterns) return;
Log(sequentialPattern.ToString(_itemsManager));
}