コード例 #1
0
ファイル: Feature.cs プロジェクト: coongroup/Y3K-Software
        public Feature(MZPeak firstPeak, double RT, double HCDEnergy = 0)
        {
            this.allRTPeaks    = new List <RTPeak>();
            this.smoothRTPeaks = new List <RTPeak>();
            this.minRT         = RT;
            this.maxRT         = RT;
            RTPeak newRTPeak = new RTPeak(firstPeak, RT);

            this.allRTPeaks.Add(newRTPeak);
            this.maxPeak = newRTPeak;
            this.totalMZTimesIntensity += (firstPeak.Intensity * firstPeak.MZ);
            this.totalIntensity        += (firstPeak.Intensity);
            this.averageMZ              = firstPeak.MZ;
            newRTPeak.HCDEnergy         = HCDEnergy;
        }
コード例 #2
0
ファイル: Feature.cs プロジェクト: coongroup/Y3K-Software
        public void AddSmoothPeak(RTPeak peak)
        {
            this.smoothRTPeaks.Add(peak);
            if (this.maxPeak == null)
            {
                this.maxPeak = peak;
            }

            if (peak.Intensity > this.maxPeak.Intensity)
            {
                this.maxPeak = peak;
            }
            this.totalMZTimesIntensity += (peak.Intensity * peak.MZ);
            this.totalIntensity        += (peak.Intensity);
            this.averageMZ              = (this.totalMZTimesIntensity / this.totalIntensity);
        }
コード例 #3
0
ファイル: Feature.cs プロジェクト: coongroup/Y3K-Software
        public void AddPeak(MZPeak peak, double RT, double HCDEnergy = 0)
        {
            RTPeak newRTPeak = new RTPeak(peak, RT);

            this.allRTPeaks.Add(newRTPeak);
            if (peak.Intensity > maxPeak.Intensity)
            {
                apexTime = RT;
                maxPeak  = newRTPeak;
            }
            this.maxRT = RT;
            this.totalMZTimesIntensity += (peak.Intensity * peak.MZ);
            this.totalIntensity        += (peak.Intensity);
            this.averageMZ              = (this.totalMZTimesIntensity / this.totalIntensity);
            newRTPeak.HCDEnergy         = HCDEnergy;
        }
コード例 #4
0
        public static List <Feature> GetFeatures(double minTime, double maxTime, SQLiteConnection conn)
        {
            var queryText =
                "SELECT s.mz, s.ApexRT, s.ApexIntensity, s.ID_Number, s.SmoothFeatureString, s.RawFeatureString FROM featureTable s WHERE s.ApexRT>@minTime AND s.ApexRT<@maxTime";
            var command = new SQLiteCommand(queryText, conn);

            command.Parameters.AddWithValue("@minTime", minTime);
            command.Parameters.AddWithValue("@maxtime", maxTime);
            List <Feature> returnFeatures = new List <Feature>();
            var            reader         = command.ExecuteReader();

            while (reader.Read())
            {
                var      id            = int.Parse(reader["ID_Number"].ToString());
                double   mz            = double.Parse(reader["mz"].ToString());
                var      apexRT        = double.Parse(reader["ApexRT"].ToString());
                var      apexIntensity = double.Parse(reader["ApexIntensity"].ToString());
                var      featString    = reader["SmoothFeatureString"].ToString();
                string[] parts         = featString.Split('|');
                string[] peaks         = parts[0].Split(';');
                var      feature       = new Feature();
                feature.ApexTime = apexRT;
                foreach (var peak in peaks)
                {
                    if (!string.IsNullOrEmpty(peak))
                    {
                        string[] peakParts = peak.Split(',');
                        double   time      = double.Parse(peakParts[0]);
                        double   intensity = double.Parse(peakParts[1]);
                        var      newPeak   = new RTPeak(mz, intensity, time);
                        feature.AddSmoothPeak(newPeak);
                        if (Math.Round(newPeak.RT, 3) == Math.Round(apexRT, 3))
                        {
                            feature.totalIntensity += newPeak.Intensity;
                        }
                    }
                }
                feature.AverageMZ    = mz;
                feature.maxIntensity = apexIntensity;
                feature.ID_Number    = id;
                returnFeatures.Add(feature);
            }
            reader.Close();
            reader.Dispose();
            command.Dispose();
            return(returnFeatures);
        }
コード例 #5
0
ファイル: Feature.cs プロジェクト: coongroup/Y3K-Software
 public void AddPeak(RTPeak peak)
 {
     this.allRTPeaks.Add(peak);
     if (maxPeak == null)
     {
         MaxPeak = peak;
     }
     if (peak.Intensity > maxPeak.Intensity)
     {
         apexTime = peak.RT;
         maxPeak  = peak;
     }
     this.maxRT = peak.RT;
     this.totalMZTimesIntensity += (peak.Intensity * peak.MZ);
     this.totalIntensity        += (peak.Intensity);
     this.averageMZ              = (this.totalMZTimesIntensity / this.totalIntensity);
 }
コード例 #6
0
        public static List <RTPeak> ConvertFeatureStringToPeakList(string featureString)
        {
            List <RTPeak> returnList = new List <RTPeak>();

            string[] parts = featureString.Split(';');
            foreach (var part in parts)
            {
                if (!string.IsNullOrEmpty(part))
                {
                    string[] subparts  = part.Split(',');
                    double   rt        = double.Parse(subparts[0]);
                    double   intensity = double.Parse(subparts[1]);
                    var      newRTPeak = new RTPeak();
                    newRTPeak.RT        = rt;
                    newRTPeak.Intensity = intensity;
                    returnList.Add(newRTPeak);
                }
            }
            return(returnList);
        }
コード例 #7
0
        public List <RTPeak> RemoveSolventFrontFromTIC(List <RTPeak> ticChroma, double firstScanTime)
        {
            //added this line for the sake of MJR
            return(ticChroma);

            //assume the solvent front comes off and ends within the first four minutes of the run
            var timeRange = new DoubleRange(firstScanTime, firstScanTime + 4);

            //rank order all tic points by intensity
            ticChroma = ticChroma.OrderByDescending(x => x.Intensity).ToList();

            //find first tic point that occurs within that first two minutes and store the peak
            RTPeak holdPeak = null;

            foreach (var peak in ticChroma)
            {
                if (timeRange.Contains(peak.RT))
                {
                    holdPeak = peak;
                    break;
                }
            }

            //reorder the tic chromatogram by time
            ticChroma = ticChroma.OrderBy(x => x.RT).ToList();

            //binary search your way to the solvent front peak you just found
            int index     = ticChroma.BinarySearch(holdPeak);
            int nextIndex = index;

            //start riding the curve to the right (increased time)
            for (int i = index; i < ticChroma.Count; i++)
            {
                var currPeak = ticChroma[i];
                //once you are at .2 intensity as what you were at the apex start clocking
                if (currPeak.Intensity < holdPeak.Intensity * .2)
                {
                    nextIndex = i;
                    break;
                }
            }

            //keep riding the curve until you hit an point where the intensity increases from the previous point
            RTPeak prevPeak  = ticChroma[nextIndex];
            int    lastIndex = nextIndex;

            for (int i = nextIndex; i < ticChroma.Count; i++)
            {
                var currPeak = ticChroma[i];
                if (currPeak.Intensity > prevPeak.Intensity)
                {
                    lastIndex = i;
                    break;
                }
                else
                {
                    prevPeak = currPeak;
                }
            }

            //every point after that should be free of the solvent front.
            ticChroma.RemoveRange(0, lastIndex);
            return(ticChroma);
        }
コード例 #8
0
ファイル: RTPeak.cs プロジェクト: coongroup/Y3K-Software
 public bool Equals(RTPeak obj)
 {
     return(obj is RTPeak && Equals((RTPeak)obj));
 }
コード例 #9
0
ファイル: RTPeak.cs プロジェクト: coongroup/Y3K-Software
        public int CompareTo(Object other)
        {
            RTPeak otherPeak = (RTPeak)other;

            return(RT.CompareTo(otherPeak.RT));
        }
コード例 #10
0
ファイル: RTPeak.cs プロジェクト: coongroup/Y3K-Software
 public int CompareTo(RTPeak other)
 {
     return(RT.CompareTo(other.RT));
 }