internal IsosResult CreateIsosResult() { IsosResult result; switch (this.ResultType) { case Globals.ResultType.BASIC_TRADITIONAL_RESULT: result = new StandardIsosResult(this.Run, this.Run.CurrentScanSet); break; case Globals.ResultType.UIMF_TRADITIONAL_RESULT: Check.Require(this.Run is UIMFRun, "Tried to create an IMS_TRADITIONAL_RESULT but the Dataset is not a UIMF file."); var uimfRun = (UIMFRun)run; result = new UIMFIsosResult(this.Run, uimfRun.CurrentScanSet, uimfRun.CurrentIMSScanSet); break; case Globals.ResultType.O16O18_TRADITIONAL_RESULT: result = new O16O18IsosResult(this.Run, this.Run.CurrentScanSet); break; case Globals.ResultType.IMS_TRADITIONAL_RESULT: result = new StandardIsosResult(this.Run, this.Run.CurrentScanSet); break; case Globals.ResultType.BASIC_TARGETED_RESULT: throw new ApplicationException("ResultType is a Targeted type but currently we are trying to create a Traditional result"); case Globals.ResultType.O16O18_TARGETED_RESULT: throw new ApplicationException("ResultType is a Targeted type but currently we are trying to create a Traditional result"); case Globals.ResultType.N14N15_TARGETED_RESULT: throw new ApplicationException("ResultType is a Targeted type but currently we are trying to create a Traditional result"); case Globals.ResultType.DEUTERATED_TARGETED_RESULT: throw new ApplicationException("ResultType is a Targeted type but currently we are trying to create a Traditional result"); default: throw new ApplicationException("ResultType is not of a know type: " + this.ResultType); } return(result); }
private IsosResult convertTextToIsosResult(List <string> processedData, List <string> headers) { IsosResult result; if (fileType == Globals.MSFileType.PNNL_UIMF) { result = new UIMFIsosResult(); } else { result = new StandardIsosResult(); } result.IsotopicProfile = new IsotopicProfile(); //result.Run = getRunFromIsosFilename(this.importFilename, this.fileType); AM commenting this out since this gives me an error //get ScanSet number from file if (fileType == Globals.MSFileType.PNNL_UIMF) { var imsScanNum = parseIntField(lookup(processedData, headers, "ims_scan_num")); var frame_num = parseIntField(lookup(processedData, headers, "frame_num")); ((UIMFIsosResult)result).DriftTime = parseDoubleField(lookup(processedData, headers, "drift_time")); result.ScanSet = new LCScanSetIMS(frame_num); ((UIMFIsosResult)result).IMSScanSet = new IMSScanSet(imsScanNum); } else { var scan_num = parseIntField(lookup(processedData, headers, "scan_num")); result.ScanSet = new ScanSet(scan_num); } result.IsotopicProfile.ChargeState = parseIntField(lookup(processedData, headers, "charge")); result.IsotopicProfile.MonoIsotopicMass = parseDoubleField(lookup(processedData, headers, "monoisotopic_mw")); result.IsotopicProfile.Score = parseDoubleField(lookup(processedData, headers, "fit")); result.IntensityAggregate = parseFloatField(lookup(processedData, headers, "abundance")); //result.IsotopicProfile.IntensityMostAbundant = parseFloatField(lookup(processedData, headers, "abundance")); result.IsotopicProfile.MonoPeakMZ = parseDoubleField(lookup(processedData, headers, "mz")); result.InterferenceScore = parseDoubleField(lookup(processedData, headers, "interference_score")); result.IsotopicProfile.OriginalIntensity = parseDoubleField(lookup(processedData, headers, "unsummed_intensity")); var saturationFlagString = lookup(processedData, headers, "saturation_flag"); result.IsotopicProfile.IsSaturated = saturationFlagString == "1"; var mz = parseFloatField(lookup(processedData, headers, "mz")); var intensity = parseIntField(lookup(processedData, headers, "mono_abundance")); var peak = new MSPeak(mz, intensity) { Width = parseFloatField(lookup(processedData, headers, "fwhm")), SignalToNoise = parseFloatField(lookup(processedData, headers, "signal_noise")) }; //mono mz isn't available from _isos file AM modification, while this is true, we still need this. var flagString = lookup(processedData, headers, "flag"); if (string.IsNullOrEmpty(flagString)) { } else { var flagNum = parseIntField(flagString); if (flagNum == 1) { result.Flags.Add(new PeakToTheLeftResultFlag()); // TODO: it'll be good to make a factory class for creating flags. } } result.IsotopicProfile.Peaklist.Add(peak); return(result); }