/// <summary> /// Add information about the spectra input to the search /// </summary> /// <param name="location"></param> /// <param name="name"></param> /// <param name="spectrumIdFormat"></param> /// <param name="fileFormatCvid"></param> /// <returns></returns> public SpectraDataObj AddSpectraData(string location, string name, CV.CV.CVID spectrumIdFormat, CV.CV.CVID fileFormatCvid = CV.CV.CVID.CVID_Unknown) { var dataFile = new SpectraDataObj { Id = "SD_" + specDataCounter++, Location = location, Name = name, SpectrumIDFormat = new SpectrumIDFormatObj() { CVParam = new CVParamObj(spectrumIdFormat), }, }; if (fileFormatCvid != CV.CV.CVID.CVID_Unknown) { dataFile.FileFormat = new FileFormatInfo() { CVParam = new CVParamObj(fileFormatCvid), }; } if (identData.DataCollection.Inputs == null) { identData.DataCollection.Inputs = new InputsObj(); } if (identData.DataCollection.Inputs.SpectraDataList == null) { identData.DataCollection.Inputs.SpectraDataList = new IdentDataList <SpectraDataObj>(); } identData.DataCollection.Inputs.SpectraDataList.Add(dataFile); return(dataFile); }
/// <summary> /// Create a spectrum identification item for the mzid; scores, peptide, and peptideEvidences must be added. Calculated m/z can also be added. /// </summary> /// <param name="spectraSource">source object for the spectrum, returned from <see cref="AddSpectraData"/></param> /// <param name="nativeId">native id of the spectrum</param> /// <param name="retentionTimeMinutes">retention time in minutes of the spectrum</param> /// <param name="expMz">experimental m/z of the peptide</param> /// <param name="charge">Charge of the peptide</param> /// <param name="rank">rank of result for a spectrum; may be the same as another result for the same spectrum if they score equally</param> /// <param name="calcMz">(optional) Calculated m/z of the peptide; default double.NaN (not added)</param> /// <returns>Object: Must populate PeptideEvidences and Peptide, as well as add score information to CVParams and UserParams</returns> public SpectrumIdentificationItemObj AddSpectrumIdentification(SpectraDataObj spectraSource, string nativeId, double retentionTimeMinutes, double expMz, int charge, int rank = 1, double calcMz = double.NaN) { SpectrumIdentificationResultObj specResult; if (!identificationResults.TryGetValue(nativeId, out specResult)) { specResult = new SpectrumIdentificationResultObj() { SpectrumID = nativeId, SpectraData = spectraSource, SpectrumIdentificationItems = new IdentDataList <SpectrumIdentificationItemObj>(), CVParams = new IdentDataList <CVParamObj>(), UserParams = new IdentDataList <UserParamObj>(), }; identificationResults.Add(nativeId, specResult); var number = nativeId.Split('=').Last(); specResult.Id = "SIR_" + number; var rt = new CVParamObj(CV.CV.CVID.MS_scan_start_time, retentionTimeMinutes.ToString(CultureInfo.InvariantCulture)) { UnitCvid = CV.CV.CVID.UO_minute, }; specResult.CVParams.Add(rt); } var specIdent = new SpectrumIdentificationItemObj() { Id = specResult.Id + "_" + (specResult.SpectrumIdentificationItems.Count + 1), PeptideEvidences = new IdentDataList <PeptideEvidenceRefObj>(), ChargeState = charge, ExperimentalMassToCharge = expMz, Rank = rank, PassThreshold = true, CVParams = new IdentDataList <CVParamObj>(), UserParams = new IdentDataList <UserParamObj>(), }; if (!calcMz.Equals(double.NaN)) { specIdent.CalculatedMassToCharge = calcMz; } specResult.SpectrumIdentificationItems.Add(specIdent); return(specIdent); }