private string FixFilterLine() { // split FilterLine by spaces. remove empty entries var filterLineParts = FilterLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList(); for (var i = 0; i < filterLineParts.Count; i++) { var item = filterLineParts[i]; if (item.Contains("cv=")) { filterLineParts.RemoveAt(i); i--; } } return(string.Join(" ", filterLineParts.ToArray())); }
private string GetScanType() { const string returnString = "Unknown"; foreach (var param in FilterLine.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)) { if (param.Equals("Full")) { return("Full"); } if (param.Equals("SIM")) { return("SIM"); } } return(returnString); }
public void AddMs2ScanParameters(XRawFileIO reader) { // grab precursorMz from raw file var success = reader.GetScanInfo(ScanNumber, out var scanInfo); if (!success) { ConsoleMsgUtils.ShowWarning("Scan {0} not found by AddMs2ScanParameters", ScanNumber); return; } var precursorMzValue = Math.Round(scanInfo.ParentIonMZ, 8); var parentScanInfo = GetParentScan(reader, scanInfo); var parentScanDataCount = reader.GetScanData(parentScanInfo.ScanNumber, out var mzList, out var intensityList); double precursorIntensity = 0; if (parentScanDataCount > 0) { const double PRECURSOR_TOLERANCE = 0.1; var closestDifference = double.MaxValue; for (var i = 0; i < mzList.Length; i++) { var mzDifference = Math.Abs(mzList[i] - precursorMzValue); if (mzDifference > closestDifference) { continue; } closestDifference = mzDifference; precursorIntensity = Math.Round(intensityList[i], 2); } if (closestDifference > PRECURSOR_TOLERANCE) { // couldn't find precursor mass in MS1. That's fine i guess. precursorIntensity = 0; } } var filterLineParts = FilterLine.Split(' '); string activationType; switch (scanInfo.ActivationType) { case ActivationTypeConstants.CID: case ActivationTypeConstants.MPD: case ActivationTypeConstants.ECD: case ActivationTypeConstants.PQD: case ActivationTypeConstants.ETD: case ActivationTypeConstants.HCD: case ActivationTypeConstants.SA: case ActivationTypeConstants.PTR: case ActivationTypeConstants.NETD: case ActivationTypeConstants.NPTR: case ActivationTypeConstants.UVPD: activationType = scanInfo.ActivationType.ToString(); break; default: // Includes ActivationTypeConstants.AnyType activationType = "CID"; break; } foreach (var param in filterLineParts) { if (param.Contains("@")) { // HCD25.00 -> [HCD, 25.00] // RegEx alpha from numeric var activationArray = Regex.Matches(param.Split('@')[1].Trim(), @"\D+|\d+").Cast <Match>().Select(m => m.Value).ToArray(); CollisionEnergy = Convert.ToInt32(double.Parse(activationArray[1])); } } PrecursorMz = new PrecursorMz(precursorIntensity, activationType, precursorMzValue); }