public FeatureSet GetFeatures(double mz, Tolerance tolerance, DataReader.FrameType frameType) { var intensityBlock = _uimfUtil.GetXic(mz, tolerance.GetValue(), frameType, tolerance.GetUnit() == ToleranceUnit.Ppm ? DataReader.ToleranceType.PPM : DataReader.ToleranceType.Thomson); var features = new FeatureSet(intensityBlock); return(features); }
public void TestDoWaterShedAlgorithmByBin() { var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF"; var uimfUtil = new UimfUtil(fileLocation); var smoother = new SavitzkyGolaySmoother(5, 2); var bin = 73009; var intensityPointList = uimfUtil.GetXic(bin, UIMFData.FrameType.MS1); var pointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList).ToList(); var preSmoothedFeatureList = FeatureDetection.DoWatershedAlgorithm(pointList).ToList(); Console.WriteLine(DateTime.Now + "\tBefore Smoothing:\tNumPoints = " + pointList.Count + "\tNumFeatures = " + preSmoothedFeatureList.Count); foreach (var featureBlob in preSmoothedFeatureList) { var mostIntensePoint = featureBlob.PointList.First(); Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity); } Console.WriteLine("******************************************************"); var newPointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList); smoother.Smooth(ref newPointList); var smoothedFeatureList = FeatureDetection.DoWatershedAlgorithm(newPointList).ToList(); Console.WriteLine(DateTime.Now + "\tAfter Smoothing:\tNumPoints = " + newPointList.Count() + "\tNumFeatures = " + smoothedFeatureList.Count); foreach (var featureBlob in smoothedFeatureList) { var mostIntensePoint = featureBlob.PointList.First(); Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity); } }
public void TestDoWaterShedAlgorithmAllBins() { var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF"; var uimfUtil = new UimfUtil(fileLocation); // ReSharper disable once UnusedVariable var numberOfBins = uimfUtil.GetNumberOfBins(); var smoother = new SavitzkyGolaySmoother(5, 2); for (var i = 73009; i <= 84000; i++) { var mz = uimfUtil.GetMzFromBin(i); var intensityPointList = uimfUtil.GetXic(mz, 25, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM); //List<IntensityPoint> intensityPointList = uimfUtil.GetXic(i, DataReader.FrameType.MS1); //SavitzkyGolaySmoother smoother = new SavitzkyGolaySmoother(9, 2); //smoother.Smooth(ref intensityBlock); //int boundX = intensityBlock.GetUpperBound(0); //int boundY = intensityBlock.GetUpperBound(1); //TextWriter smoothedWriter = new StreamWriter("smoothedRaw.csv"); //for (int j = 0; j < boundX; j++) //{ // StringBuilder row = new StringBuilder(); // for (int k = 0; k < boundY; k++) // { // row.Append(intensityBlock[j, k] + ","); // } // smoothedWriter.WriteLine(row.ToString()); //} //smoothedWriter.Close(); var pointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList); smoother.Smooth(ref pointList); var featureList = FeatureDetection.DoWatershedAlgorithm(pointList); Console.WriteLine(DateTime.Now + "\tBin = " + i + "\tNumPoints = " + pointList.Count() + "\tNumFeatures = " + featureList.Count()); } }
public void TestDoWaterShedAlgorithm() { var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF"; var uimfUtil = new UimfUtil(fileLocation); var targetMz = 582.32181703760114; double ppmTolerance = 25; var intensityBlock = uimfUtil.GetXicAsArray(targetMz, ppmTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM); var smoother = new SavitzkyGolaySmoother(11, 2); smoother.Smooth(ref intensityBlock); var pointList = WaterShedMapUtil.BuildWatershedMap(intensityBlock, 0, 0); var featureList = FeatureDetection.DoWatershedAlgorithm(pointList); foreach (var featureBlob in featureList) { var mostIntensePoint = featureBlob.PointList.First(); Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity); } Console.WriteLine("******************************************************"); var intensityPointList = uimfUtil.GetXic(targetMz, ppmTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM); var newPointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList); smoother.Smooth(ref newPointList); var newFeatureList = FeatureDetection.DoWatershedAlgorithm(newPointList); foreach (var featureBlob in newFeatureList) { var mostIntensePoint = featureBlob.PointList.First(); Console.WriteLine("Num Points = " + featureBlob.PointList.Count + "\tLC = " + mostIntensePoint.ScanLc + "\tIMS = " + mostIntensePoint.ScanIms + "\tIntensity = " + mostIntensePoint.Intensity); } }
public void TestComputingApexProfiles() { var fileLocation = @"\\proto-2\UnitTest_Files\MultidimensionalFeatureFinding\BSA_10ugml_IMS6_TOF03_CID_27Aug12_Frodo_Collision_Energy_Collapsed.UIMF"; var uimfUtil = new UimfUtil(fileLocation); var smoother = new SavitzkyGolaySmoother(5, 2); var targetMz = 964.40334; double tolerance = 20; var intensityPointList = uimfUtil.GetXic(targetMz, tolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM); var pointList = WaterShedMapUtil.BuildWatershedMap(intensityPointList); smoother.Smooth(ref pointList); var featureBlobs = FeatureDetection.DoWatershedAlgorithm(pointList); IEnumerable <FeatureBlobStatistics> featureBlobStatList = featureBlobs.Select(featureBlob => featureBlob.Statistics).ToList(); foreach (var f in featureBlobStatList) { Console.WriteLine( "LC: [{0},{1}], IMS: [{2},{3}], Apex: [{4},{5}] SumIntensities: {6}, NumPoints: {7}", f.ScanLcMin, f.ScanLcMax, f.ScanImsMin, f.ScanImsMax, f.ScanLcRep, f.ScanImsRep, f.SumIntensities, f.NumPoints ); Console.WriteLine("LC Apex profile"); Console.WriteLine(string.Join(",", f.LcApexPeakProfile)); Console.WriteLine("IMS Apex profile"); Console.WriteLine(string.Join(",", f.ImsApexPeakProfile)); } }
private void FindFeatures() { m_FeatureFinderBackgroundWorker.ReportProgress(0, "Finding 3-D Features for Precursor and Fragments"); var seqGraph = SequenceGraph.CreateGraph(m_aminoAcidSet, CurrentPeptide); // var scoringGraph = seqGraph.GetScoringGraph(0); // var precursorIon = scoringGraph.GetPrecursorIon(this.CurrentChargeState); // var monoMz = precursorIon.GetMz(); var sequence = new Sequence(CurrentPeptide, m_aminoAcidSet); var precursorIon = sequence.GetPrecursorIon(CurrentChargeState); var monoMz = precursorIon.GetMonoIsotopicMz(); var uimfPointList = UimfUtil.GetXic(monoMz, CurrentTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM); var watershedPointList = WaterShedMapUtil.BuildWatershedMap(uimfPointList); var smoother = new SavitzkyGolaySmoother(11, 2); smoother.Smooth(ref watershedPointList); FeatureList = FeatureDetection.DoWatershedAlgorithm(watershedPointList).ToList(); IsotopeFeaturesDictionary.Clear(); var precursorTargetList = CurrentChargeState == 2 ? new List <string> { "-1", "0.5", "1", "1.5", "2", "3" } : new List <string> { "-1", "1", "2", "3" }; foreach (var precursorTarget in precursorTargetList) { var targetMz = precursorIon.GetIsotopeMz(double.Parse(precursorTarget)); var isotopeUimfPointList = UimfUtil.GetXic(targetMz, CurrentTolerance, UIMFData.FrameType.MS1, DataReader.ToleranceType.PPM); var isotopeWatershedPointList = WaterShedMapUtil.BuildWatershedMap(isotopeUimfPointList); var isotopeFeatures = FeatureDetection.DoWatershedAlgorithm(isotopeWatershedPointList).ToList(); IsotopeFeaturesDictionary.Add(precursorTarget, isotopeFeatures); } LcSlicePlot = new PlotModel(); ImsSlicePlot = new PlotModel(); FragmentFeaturesDictionary.Clear(); // var sequence = new Sequence(this.CurrentPeptide, m_aminoAcidSet); var ionTypeDictionary = sequence.GetProductIons(m_ionTypeFactory.GetAllKnownIonTypes()); double fragmentCount = ionTypeDictionary.Count; var index = 0; foreach (var ionTypeKvp in ionTypeDictionary) { var ionTypeTuple = ionTypeKvp.Key; var ion = ionTypeKvp.Value; var fragmentMz = ion.GetMonoIsotopicMz(); uimfPointList = UimfUtil.GetXic(fragmentMz, CurrentTolerance, UIMFData.FrameType.MS2, DataReader.ToleranceType.PPM); watershedPointList = WaterShedMapUtil.BuildWatershedMap(uimfPointList); smoother.Smooth(ref watershedPointList); var fragmentFeatureBlobList = FeatureDetection.DoWatershedAlgorithm(watershedPointList).ToList(); FragmentFeaturesDictionary.Add(ionTypeTuple, fragmentFeatureBlobList); index++; var progress = (int)((index / fragmentCount) * 100); m_FeatureFinderBackgroundWorker.ReportProgress(progress); } OnPropertyChanged("FeatureList"); OnPropertyChanged("LcSlicePlot"); OnPropertyChanged("ImsSlicePlot"); }