private void AddPeptideGroup(ICollection<PeptideGroupDocNode> listGroups, PeptideGroupBuilder builder, List<MeasuredRetentionTime> irtPeptides, List<SpectrumMzInfo> librarySpectra, List<TransitionImportErrorInfo> errorList) { PeptideGroupDocNode nodeGroup = builder.ToDocNode(); listGroups.Add(nodeGroup); irtPeptides.AddRange(builder.IrtPeptides); librarySpectra.AddRange(builder.LibrarySpectra); if (builder.PeptideGroupErrorInfo.Count > 0) errorList.AddRange(builder.PeptideGroupErrorInfo); _countPeptides += nodeGroup.MoleculeCount; _countIons += nodeGroup.TransitionCount; }
private PeptideGroupBuilder AddRow(PeptideGroupBuilder seqBuilder, MassListRowReader rowReader, IDictionary<string, FastaSequence> dictNameSeq, ICollection<PeptideGroupDocNode> peptideGroupsNew, long lineNum, List<MeasuredRetentionTime> irtPeptides, List<SpectrumMzInfo> librarySpectra, List<TransitionImportErrorInfo> errorList) { var info = rowReader.TransitionInfo; var irt = rowReader.Irt; var libraryIntensity = rowReader.LibraryIntensity; var productMz = rowReader.ProductMz; if (irt == null && rowReader.IrtColumn != -1) { var error = new TransitionImportErrorInfo(string.Format(Resources.MassListImporter_AddRow_Invalid_iRT_value_at_precusor_m_z__0__for_peptide__1_, rowReader.TransitionInfo.PrecursorMz, rowReader.TransitionInfo.ModifiedSequence), rowReader.IrtColumn, lineNum); errorList.Add(error); return seqBuilder; } if (libraryIntensity == null && rowReader.LibraryColumn != -1) { var error = new TransitionImportErrorInfo(string.Format(Resources.MassListImporter_AddRow_Invalid_library_intensity_at_precursor__0__for_peptide__1_, rowReader.TransitionInfo.PrecursorMz, rowReader.TransitionInfo.ModifiedSequence), rowReader.LibraryColumn, lineNum); errorList.Add(error); return seqBuilder; } string name = info.ProteinName; if (info.TransitionExps.Any(t => t.IsDecoy)) name = PeptideGroup.DECOYS; if (seqBuilder == null || (name != null && !Equals(name, seqBuilder.BaseName))) { if (seqBuilder != null) { AddPeptideGroup(peptideGroupsNew, seqBuilder, irtPeptides, librarySpectra, errorList); } FastaSequence fastaSeq; if (name != null && dictNameSeq.TryGetValue(name, out fastaSeq) && fastaSeq != null) seqBuilder = new PeptideGroupBuilder(fastaSeq, Document.Settings); else { string safeName = name != null ? Helpers.GetUniqueName(name, dictNameSeq.Keys) : Document.GetPeptideGroupId(true); seqBuilder = new PeptideGroupBuilder(">>" + safeName, true, Document.Settings) {BaseName = name}; // Not L10N } } try { seqBuilder.AppendTransition(info, irt, libraryIntensity, productMz, lineNum); } catch (InvalidDataException x) { throw new LineColNumberedIoException(x.Message, lineNum, -1, x); } return seqBuilder; }
private void AddPeptideGroup(List<PeptideGroupDocNode> listGroups, ICollection<FastaSequence> set, PeptideGroupBuilder builder) { PeptideGroupDocNode nodeGroup = builder.ToDocNode(); FastaSequence fastaSeq = nodeGroup.Id as FastaSequence; if (fastaSeq != null && set.Contains(fastaSeq)) return; if (nodeGroup.MoleculeCount == 0) { EmptyPeptideGroupCount++; // If more than MaxEmptyPeptideGroupCount, then don't keep the empty peptide groups // This is not useful and is likely to cause memory and performance issues if (EmptyPeptideGroupCount > MaxEmptyPeptideGroupCount) { if (EmptyPeptideGroupCount == MaxEmptyPeptideGroupCount + 1) { var nonEmptyGroups = listGroups.Where(g => g.MoleculeCount > 0).ToArray(); listGroups.Clear(); listGroups.AddRange(nonEmptyGroups); } return; } } listGroups.Add(nodeGroup); _countPeptides += nodeGroup.MoleculeCount; _countIons += nodeGroup.TransitionCount; }