public bool foundParent(string frag, ParentInfo.terminal terminal, FusionCandidate candidate, bool foundFirstSearch) { //localTheoreticals.AsParallel().Where(x => x.Contains(frag)).ToList(); if (notFoundSequences.Contains(frag)) //has the fragment been searched but not found before? { return(false); } List <TheoreticalProtein> matches = new List <TheoreticalProtein>(); if (foundSequences.TryGetValue(frag, out matches)) //has the fragment been searched AND found before? { candidate.parentInfo.Add(new ParentInfo(matches, terminal, frag)); return(true); } if (foundFirstSearch) //Has something smaller been found before? Well, then we can just search against those found sequences { string shorterFrag = terminal.Equals(ParentInfo.terminal.N) ? frag.Substring(0, frag.Length - 1) : frag.Substring(1, frag.Length - 1); foreach (ParentInfo info in candidate.parentInfo) { if (info.parentType.Equals(terminal) && info.fragFound.Equals(shorterFrag)) { List <TheoreticalProtein> tempProtList = new List <TheoreticalProtein>(); info.theoreticalProteins.ForEach(protein => tempProtList.Add(protein)); matches = tempProtList.AsParallel().Where(x => x.seq.Contains(frag)).ToList(); } } } else //it hasn't been found before... we need to search against the whole database :( { matches = theoreticalProteins.AsParallel().Where(x => x.seq.Contains(frag)).ToList(); } if (matches != null && matches.Count() > 0) { foundSequences.Add(frag, matches); candidate.parentInfo.Add(new ParentInfo(matches, terminal, frag)); return(true); } else { notFoundSequences.Add(frag); return(false); } }
public TransParent(string id, string seq, List <int> start, int length, ParentInfo.terminal terminal) : base(id, seq) { this.start = start; this.peptideLength = length; this.terminal = terminal; }