本文整理汇总了C#中Sequence.GetMass方法的典型用法代码示例。如果您正苦于以下问题:C# Sequence.GetMass方法的具体用法?C# Sequence.GetMass怎么用?C# Sequence.GetMass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence.GetMass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestFeatureId
public void TestFeatureId()
{
var methodName = MethodBase.GetCurrentMethod().Name;
TestUtils.ShowStarting(methodName);
const string dataSet = @"H:\Research\QCShew_TopDown\Production\QC_Shew_Intact_26Sep14_Bane_C2Column3";
if (!File.Exists(dataSet))
{
Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, dataSet);
}
// Feature: 5236-5286 6-12 8480.3681 5
const int minScanNum = 5236;
const int maxScanNum = 5286;
const double featureMass = 8480.3681;
//const int minScanNum = 7251;
//const int maxScanNum = 7326;
//const double featureMass = 32347.18;
// const int minScanNum = 4451;
// const int maxScanNum = 4541;
// const double featureMass = 31267.95;
var tolerance = new Tolerance(10);
var relaxedTolerance = new Tolerance(20);
const int minTagLength = 5;
const int minMergedTagLength = 7;
const int minNumTagMatches = 1;
var rawFileName = MassSpecDataReaderFactory.ChangeExtension(dataSet, ".raw");
var run = PbfLcMsRun.GetLcMsRun(rawFileName);
var aminoAcidSet = AminoAcidSet.GetStandardAminoAcidSet();
var featureFileName = MassSpecDataReaderFactory.ChangeExtension(dataSet, ".ms1ft");
var filter = new Ms1FtFilter(run, tolerance, featureFileName);
var ms2ScanNums =
filter.GetMatchingMs2ScanNums(featureMass)
.Where(scanNum => scanNum > minScanNum && scanNum < maxScanNum)
.ToArray();
const string tagFileName = dataSet + ".seqtag"; //"_MinLength3.seqtag"; //Path.ChangeExtension(dataSet, ".seqtag");
const string fastaFilePath = @"H:\Research\QCShew_TopDown\Production\ID_002216_235ACCEA.fasta";
if (!File.Exists(fastaFilePath))
{
Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, fastaFilePath);
}
var fastaDb = new FastaDatabase(fastaFilePath);
var searchableDb = new SearchableDatabase(fastaDb);
var tagParser = new SequenceTagParser(tagFileName, minTagLength);
var proteinsToTags = new Dictionary<string, IList<MatchedTag>>();
foreach (var ms2ScanNum in ms2ScanNums)
{
var tags = tagParser.GetSequenceTags(ms2ScanNum);
foreach (var tag in tags)
{
var matchedIndices = searchableDb.FindAllMatchedSequenceIndices(tag.Sequence).ToArray();
foreach (var index in matchedIndices)
{
var protein = fastaDb.GetProteinName(index);
var startIndex = fastaDb.GetZeroBasedPositionInProtein(index);
var matchedTag = new MatchedTag(tag, startIndex, featureMass);
IList<MatchedTag> existingTags;
if (proteinsToTags.TryGetValue(protein, out existingTags))
{
existingTags.Add(matchedTag);
}
else
{
proteinsToTags.Add(protein, new List<MatchedTag> { matchedTag });
}
}
}
}
foreach (var entry in proteinsToTags.OrderByDescending(e => e.Value.Count))
{
if (entry.Value.Count < minNumTagMatches) break;
var proteinName = entry.Key;
var proteinSequence = fastaDb.GetProteinSequence(proteinName);
var protein = new Sequence(proteinSequence, aminoAcidSet);
Console.WriteLine(proteinName + "\t" + entry.Value.Count);
var matchedTagSet = new MatchedTagSet(proteinSequence, aminoAcidSet,
tolerance, relaxedTolerance);
Console.WriteLine("********** Before merging");
foreach (var matchedTag in entry.Value)
{
var seq = proteinSequence.Substring(matchedTag.StartIndex,
matchedTag.EndIndex - matchedTag.StartIndex);
var nTermMass = protein.GetMass(0, matchedTag.StartIndex);
var cTermMass = protein.GetMass(matchedTag.EndIndex, protein.Count);
Console.WriteLine("\t{0}\t{1}\t{2}\t{3}\t{4}\t{5}",
(matchedTag.NTermFlankingMass - nTermMass), seq, (matchedTag.CTermFlankingMass - cTermMass), matchedTag.StartIndex,
//.........这里部分代码省略.........
示例2: GetLocationIndex
private static int GetLocationIndex(Sequence peptide, int cutNumber)
{
return (int)(peptide.GetMass(0, cutNumber) / peptide.GetMass() * 4 + 1);
}
示例3: TestGetProteinsWithTagMatchingSingleSpec
public void TestGetProteinsWithTagMatchingSingleSpec()
{
var methodName = MethodBase.GetCurrentMethod().Name;
TestUtils.ShowStarting(methodName);
const string dataSet = @"H:\Research\Lewy\raw\Lewy_intact_07";
// const int scanNum = 5158;
const int minTagLength = 7;
const int minNumTagMatches = 1;
var aminoAcidSet = AminoAcidSet.GetStandardAminoAcidSet();
const int scanNum = 2;
// Parse sequence tags
//const string tagFileName = dataSet + ".seqtag"; //"_MinLength3.seqtag"; //Path.ChangeExtension(dataSet, ".seqtag");
const string rawFilePath = "";
const string fastaFilePath = @"H:\Research\Lewy\ID_004858_0EE8CF61.fasta";
if (!File.Exists(rawFilePath))
{
Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, rawFilePath);
}
if (!File.Exists(fastaFilePath))
{
Assert.Ignore(@"Skipping test {0} since file not found: {1}", methodName, fastaFilePath);
}
var fastaDb = new FastaDatabase(fastaFilePath);
var searchableDb = new SearchableDatabase(fastaDb);
//var tagParser = new SequenceTagParser(tagFileName, minTagLength);
//var tags = tagParser.GetSequenceTags(scanNum);
var run = PbfLcMsRun.GetLcMsRun(rawFilePath);
var spec = run.GetSpectrum(scanNum) as ProductSpectrum;
var tagFinder = new SequenceTagFinder(spec, new Tolerance(5));
var tags = tagFinder.GetAllSequenceTagString();
var proteinsToTags = new Dictionary<string, IList<MatchedTag>>();
foreach (var tag in tags)
{
var matchedIndices = searchableDb.FindAllMatchedSequenceIndices(tag.Sequence).ToArray();
foreach (var index in matchedIndices)
{
var protein = fastaDb.GetProteinName(index);
var startIndex = fastaDb.GetOneBasedPositionInProtein(index);
var matchedTag = new MatchedTag(tag, startIndex, 0.0);
IList<MatchedTag> existingTags;
if (proteinsToTags.TryGetValue(protein, out existingTags))
{
existingTags.Add(matchedTag);
}
else
{
proteinsToTags.Add(protein, new List<MatchedTag> { matchedTag });
}
}
}
foreach (var entry in proteinsToTags.OrderByDescending(e => e.Value.Count))
{
if (entry.Value.Count < minNumTagMatches) break;
var proteinName = entry.Key;
var proteinSequence = fastaDb.GetProteinSequence(proteinName);
var protein = new Sequence(proteinSequence, aminoAcidSet);
Console.WriteLine(proteinName + "\t" + entry.Value.Count);
foreach (var matchedTag in entry.Value)
{
var seq = proteinSequence.Substring(matchedTag.StartIndex,
matchedTag.EndIndex - matchedTag.StartIndex);
var nTermMass = protein.GetMass(0, matchedTag.StartIndex);
var cTermMass = protein.GetMass(matchedTag.EndIndex, protein.Count);
Console.WriteLine("\t{0} ({1})\t{2}\t{3} ({4})\t{5}\t{6}\t{7}",
matchedTag.NTermFlankingMass, (matchedTag.NTermFlankingMass - nTermMass),
seq,
matchedTag.CTermFlankingMass, (matchedTag.CTermFlankingMass - cTermMass),
matchedTag.StartIndex,
matchedTag.IsNTermFlankingMassReliable, matchedTag.IsCTermFlankingMassReliable);
}
}
}