Exemplo n.º 1
0
        private void btnGetPeptideMass_Click(object sender, EventArgs e)
        {
            AminoAcidMass AAMS = new AminoAcidMass();
            lblPeptideMass.Text = "       Mass:" + AAMS.GetMonoMW(txtPeptideSeq.Text, chkCYS_CAM.Checked) + "\nAvg Mass:" +
                                  AAMS.GetAVGMonoMW(txtPeptideSeq.Text, chkCYS_CAM.Checked);

        }
Exemplo n.º 2
0
        /// <summary>
        /// Scan No,Charge,Peptide Seq, MaxMz,Y1Mz,Y1Intensity,Y2Mz,Y2Intensity,Y3Mz,Y3Intensity,Y4Mz,Y4Intensity
        /// </summary>
        /// <returns></returns>
        public List <string> Process(int argMissCleavage)
        {
            List <string> result = new List <string>();
            AminoAcidMass AAMW   = new AminoAcidMass();

            foreach (ProteinInfo p in _pInfo)
            {
                p.CreateCleavage(argMissCleavage);
                List <string> Glycopeptide = p.Glycopeptide(0);
                foreach (string Pep in Glycopeptide)
                {
                    for (int i = 0; i <= 2; i++)
                    {
                        float        PeptideMass  = AAMW.GetMonoMW(Pep, true);
                        List <float> Peakmz       = GetPeakCluster(PeptideMass, _scan.ParentCharge - i);
                        List <int>   ClosePeakIdx = new List <int>();
                        int          foundpeak    = 0;
                        double       MaxIntensity = 0.0;
                        double       MaxMz        = 0.0;
                        foreach (float peak in Peakmz)
                        {
                            int closepeakidx = MassUtility.GetClosestMassIdx(_scan.MSPeaks, peak);
                            ClosePeakIdx.Add(closepeakidx);
                            if (MassUtility.GetMassPPM(peak, _scan.MSPeaks[closepeakidx].MonoMass) < _torelance)
                            {
                                if (_scan.MSPeaks[closepeakidx].MonoIntensity > MaxIntensity)
                                {
                                    MaxIntensity = _scan.MSPeaks[closepeakidx].MonoIntensity;
                                    MaxMz        = _scan.MSPeaks[closepeakidx].MonoMass;
                                }
                                foundpeak++;
                            }
                        }
                        if (foundpeak >= 3)
                        {
                            string tmp = _scan.ScanNo + "," + Convert.ToString(_scan.ParentCharge - i) + "," + Pep + "," + MaxMz.ToString() + ",";
                            for (int j = 0; j < 4; j++)
                            {
                                if (MassUtility.GetMassPPM(_scan.MSPeaks[ClosePeakIdx[j]].MonoMass, Peakmz[j]) < _torelance)
                                {
                                    tmp = tmp + _scan.MSPeaks[ClosePeakIdx[j]].MonoMass + "," + (_scan.MSPeaks[ClosePeakIdx[j]].MonoIntensity / MaxIntensity) + ",";
                                }
                                else
                                {
                                    tmp = tmp + ",,";
                                }
                            }
                            result.Add(tmp);
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 3
0
 public TargetPeptide(string argPeptide, string argProteinName, float argPeptideMass, float argStartTime, float argEndTime)
 {
     _PeptideSeq  = argPeptide;
     _ProteinName = argProteinName;
     if (argPeptideMass == 0)
     {
         AminoAcidMass AAMS = new AminoAcidMass();
         _PeptideMass = AAMS.GetMonoMW(_PeptideSeq, true);
     }
     else
     {
         _PeptideMass = argPeptideMass;
     }
     _StartTime = argStartTime;
     _EndTime   = argEndTime;
 }
Exemplo n.º 4
0
        private void bgWorker_Process_DoWork(object sender, DoWorkEventArgs e)
        {
            AAMW = new AminoAcidMass();
            this.lblStatus.SafeBeginInvoke(new Action(() => lblStatus.Text = "Begin initial raw file"));
            Raw = new ThermoRawReader(_rawFile);
            this.lblStatus.SafeBeginInvoke(new Action(() => lblStatus.Text = "Initial raw file completed"));
            List <GlycanSequencing> lstGS = new List <GlycanSequencing>();

            if (_UseGlycanList)
            {
                _GlycanCompounds        = ReadGlycanListFromFile.ReadGlycanList(_glycanFile, false, _Human, false);
                _MassGlycanMapping      = new Dictionary <double, GlycanCompound>();
                _GlycanCompoundMassList = new List <float>();
                foreach (GlycanCompound G in _GlycanCompounds)
                {
                    if (!_MassGlycanMapping.ContainsKey(G.AVGMass))
                    {
                        _MassGlycanMapping.Add(G.AVGMass, G);
                        _GlycanCompoundMassList.Add((float)G.AVGMass);
                    }
                }
            }

            for (int i = 0; i < lstScans.Count; i++)
            {
                int ScanNo = lstScans[i];
                if (Raw.GetMsLevel(ScanNo) == 1)
                {
                    CurrentScan = ScanNo;
                    int ProcessReport = Convert.ToInt32((i / (float)lstScans.Count) * 100);
                    //Console.WriteLine("Scan:" + ScanNo.ToString()+"\t Peptide:" + Peptide + "  completed");
                    bgWorker_Process.ReportProgress(ProcessReport);
                    this.lblStatus.SafeBeginInvoke(new Action(() => lblStatus.Text = "MS scan pass:"******"Scan:" + ScanNo.ToString()+"\t Peptide:" + Peptide + "  completed");
                    bgWorker_Process.ReportProgress(ProcessReport);
                    this.lblStatus.SafeBeginInvoke(new Action(() => lblStatus.Text = "Not CID scan pass:"******"ms2")+4, _scan.ScanHeader.IndexOf("@") - _scan.ScanHeader.IndexOf("ms2")-3) + "hcd";
                    do
                    {
                        CheckScanNO++;
                        //    if (Raw.GlypIDReader.GetScanDescription(CheckScanNO).Contains(ScanHeader))
                        //    {
                        //        HCDScanNo = CheckScanNO;
                        //        HCD = new HCDInfo(Raw.GlypIDReader, HCDScanNo);
                        //        break;
                        //    }
                        if (Raw.GetHCDInfo(CheckScanNO) != null)
                        {
                            HCD = Raw.GetHCDInfo(CheckScanNO);
                            break;
                        }
                    } while (Raw.GetMsLevel(CheckScanNO) != 1); //Check Until hit Next Full MS

                    //CA: Complex Asialyated, CS:Complex Sialylated, HM:High mannose, HY:Hybrid and NA
                }
                if (HCD != null)
                {
                    Console.WriteLine("CID Scan No:" + ScanNo.ToString() + "\tHCD Scan No:" + HCDScanNo.ToString() + "\tGlycanType:" + HCD.GlycanType.ToString());
                }

                this.lblStatus.SafeBeginInvoke(new Action(() => lblStatus.Text = "Sequencing:" + ScanNo.ToString()));
                foreach (string Peptide in _Peptides)
                {
                    float PeptideMass = AAMW.GetMonoMW(Peptide, true);
                    for (int j = PrecursorCharge - 1; j <= PrecursorCharge; j++)
                    {
                        int Y1ChargeSt = j;
                        if (j == 0)
                        {
                            continue;
                        }
                        float PredictedY1 = 0.0f;
                        PredictedY1 = (float)(PeptideMass + GlycanMass.GetGlycanAVGMass(Glycan.Type.HexNAc) + COL.MassLib.Atoms.ProtonMass * Y1ChargeSt) / Y1ChargeSt;
                        GlycanSequencing GS = null;
                        if (_UseGlycanList)
                        {
                            float GlycanMonoMass = (_scan.ParentMZ - Atoms.ProtonMass) * _scan.ParentCharge - AAMW.GetAVGMonoMW(Peptide, true);
                            float PrecursorMono  = _scan.ParentMonoMW;
                            //if (_scan.ParentAVGMonoMW != 0.0)
                            //{
                            //    GlycanMonoMass = _scan.ParentAVGMonoMW - PeptideMass + (Atoms.HydrogenAVGMass * 2 + Atoms.OxygenAVGMass);
                            //    PrecursorMono = _scan.ParentAVGMonoMW;
                            //}
                            //else
                            //{
                            //    GlycanMonoMass = (_scan.ParentMZ - Atoms.ProtonMass) * _scan.ParentCharge - PeptideMass + (Atoms.HydrogenAVGMass * 2 + Atoms.OxygenAVGMass);
                            //    PrecursorMono = _scan.ParentMonoMW;
                            //}

                            List <GlycanCompound> ClosedGlycans = new List <GlycanCompound>();
                            foreach (float gMass in _GlycanCompoundMassList)
                            {
                                if (Math.Abs(gMass - GlycanMonoMass) < 100.0f)
                                {
                                    ClosedGlycans.Add(_GlycanCompounds[MassUtility.GetClosestMassIdx(_GlycanCompoundMassList, gMass)]);
                                }
                            }

                            //if (HCD != null)
                            //{
                            //    if ((HCD.GlycanType == GlypID.enmGlycanType.CA && ClosedGlycan.NoOfSia>0) ||
                            //         (HCD.GlycanType == GlypID.enmGlycanType.HM && (ClosedGlycan.NoOfSia!=0||ClosedGlycan.NoOfHexNAc!=2 || ClosedGlycan.NoOfDeHex!=0) ) ||
                            //         (HCD.GlycanType == GlypID.enmGlycanType.CS && ClosedGlycan.NoOfSia==0))
                            //    {
                            //        continue;
                            //    }
                            //}
                            //if (Math.Abs(ClosedGlycan.AVGMass - GlycanMonoMass) <= _MSMSTol)
                            foreach (GlycanCompound ClosedGlycan in ClosedGlycans)
                            {
                                if (_Human) //NeuAc
                                {
                                    int NoOfSia   = ClosedGlycan.NoOfSia;
                                    int NoOfDeHex = ClosedGlycan.NoOfDeHex;
                                    if (HCD != null && HCD.GlycanType == COL.MassLib.enumGlycanType.CA && ClosedGlycan.NoOfSia > 0)
                                    {
                                        NoOfDeHex = NoOfDeHex + NoOfSia * 2;
                                        NoOfSia   = 0;
                                    }
                                    GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, ClosedGlycan.NoOfHex, ClosedGlycan.NoOfHexNAc, NoOfDeHex, NoOfSia, 0, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                }
                                else //NeuGc
                                {
                                    GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, ClosedGlycan.NoOfHex, ClosedGlycan.NoOfHexNAc, ClosedGlycan.NoOfDeHex, 0, ClosedGlycan.NoOfSia, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                }
                                GS.NumbersOfPeaksForSequencing = 140;
                                GS.UseAVGMass        = _AverageMass;
                                GS.CreatePrecursotMZ = true;
                                if (!_CompletedOnly)
                                {
                                    GS.RewardForCompleteStructure = 0.0f;
                                }
                                if (HCD != null)
                                {
                                    GS.GlycanType = HCD.GlycanType;
                                }
                                GS.StartSequencing();
                                if (_CompletedOnly && GS.FullSequencedStructures.Count == 0)
                                {
                                    continue;
                                }
                                lstGS.Add(GS);
                                CurrentScan    = ScanNo;
                                CurrentPeptide = GS.PeptideSeq;
                                int ProcessReport = Convert.ToInt32((i / (float)lstScans.Count) * 100);
                                //Console.WriteLine("Scan:" + ScanNo.ToString()+"\t Peptide:" + Peptide + "  completed");
                                bgWorker_Process.ReportProgress(ProcessReport);
                            }
                        }
                        else // no list
                        {
                            if (_Human) //NeuAc
                            {
                                if (HCD != null)
                                {
                                    //CA: Complex Asialyated, CS:Complex Sialylated, HM:High mannose, HY:Hybrid and NA
                                    if (HCD.GlycanType == enumGlycanType.CA)
                                    {
                                        GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, _NoHex, _NoHexNAc, _NoDeHex, 0, 0, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                    }
                                    else if (HCD.GlycanType == enumGlycanType.HM)
                                    {
                                        GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, _NoHex, 2, 0, 0, 0, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                    }
                                    else
                                    {
                                        GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, _NoHex, _NoHexNAc, _NoDeHex, _NoSia, 0, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                    }
                                }
                                else
                                {
                                    GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, _NoHex, _NoHexNAc, _NoDeHex, _NoSia, 0, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                }
                            }
                            else //NeuGc
                            {
                                if (HCD != null)
                                {
                                    //CA: Complex Asialyated, CS:Complex Sialylated, HM:High mannose, HY:Hybrid and NA
                                    if (HCD.GlycanType == enumGlycanType.CA)
                                    {
                                        GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, _NoHex, _NoHexNAc, _NoDeHex, 0, 0, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                    }
                                    else if (HCD.GlycanType == enumGlycanType.HM)
                                    {
                                        GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, _NoHex, 2, 0, 0, 0, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                    }
                                    else
                                    {
                                        GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, _NoHex, _NoHexNAc, _NoDeHex, 0, _NoSia, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                    }
                                }
                                else
                                {
                                    GS = new GlycanSequencing(_scan, Peptide, true, Y1ChargeSt, _NoHex, _NoHexNAc, _NoDeHex, 0, _NoSia, @"d:\tmp", _NGlycan, _MSMSTol, _PrecursorTol);
                                }
                            }
                            GS.NumbersOfPeaksForSequencing = 140;
                            GS.UseAVGMass        = _AverageMass;
                            GS.CreatePrecursotMZ = true;
                            if (!_CompletedOnly)
                            {
                                GS.RewardForCompleteStructure = 0.0f;
                            }
                            if (HCD != null)
                            {
                                GS.GlycanType = HCD.GlycanType;
                            }
                            GS.StartSequencing();
                            if (_CompletedOnly && GS.FullSequencedStructures.Count == 0)
                            {
                                continue;
                            }
                            lstGS.Add(GS);
                            CurrentScan    = ScanNo;
                            CurrentPeptide = GS.PeptideSeq;
                            int ProcessReport = Convert.ToInt32((i / (float)lstScans.Count) * 100);
                            //Console.WriteLine("Scan:" + ScanNo.ToString()+"\t Peptide:" + Peptide + "  completed");
                            bgWorker_Process.ReportProgress(ProcessReport);
                        }
                    } //Foreach charge
                }     //Foreach peptide
                if (lstGS.Count > 0)
                {
                    GenerateReportBody(lstGS);
                }
            }//Foreach Scan
        }
Exemplo n.º 5
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter           = "Raw files (*.RAW,*.mzXML)|*.RAW;*.mzXML";
            openFileDialog1.RestoreDirectory = true;
            if (txtScanNo.Text == "" || txtPeptideSeq.Text == "")
            {
                MessageBox.Show("Please fill the information");
                return;
            }
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                _torelance          = Convert.ToSingle(txtPeaKTol.Text);
                _precursorTorelance = Convert.ToSingle(txtPrecusorTol.Text);
                dtTrees.Rows.Clear();
                int ScanNo = 0;
                if (Int32.TryParse(txtScanNo.Text, out ScanNo) == false)
                {
                    MessageBox.Show("Input Scan Number Error");
                    return;
                }

                if (Path.GetExtension(openFileDialog1.FileName).ToLower() == ".raw")
                {
                    ThermoRawReader RawReader = new COL.MassLib.ThermoRawReader(openFileDialog1.FileName);

                    /*GlypID.Peaks.clsPeakProcessorParameters clsParameters = new GlypID.Peaks.clsPeakProcessorParameters();
                     * clsParameters.SignalToNoiseThreshold = 0.0f;
                     * clsParameters.PeakBackgroundRatio = 0.01f;*/
                    //RawReader.SetPeakProcessorParameter(2, 2);
                    scan = RawReader.ReadScan(ScanNo);
                }
                else
                {
                    //scan = new mzXMLReader(openFileDialog1.FileName).ReadScan(ScanNo);
                }


                int NoNeuAc = 0;
                int NoNeuGc = 0;
                if (rdoNeuAc.Checked)
                {
                    NoNeuAc = Convert.ToInt32(txtSia.Text);
                }
                else
                {
                    NoNeuGc = Convert.ToInt32(txtSia.Text);
                }


                List <int> SequenceParameters = new List <int>();
                SequenceParameters.Add(Convert.ToInt32(txtTopPeaks_i.Text));
                SequenceParameters.Add(Convert.ToInt32(txtTopDiagPeaks_j.Text));
                SequenceParameters.Add(Convert.ToInt32(txtTopCorePeaks_k.Text));
                SequenceParameters.Add(Convert.ToInt32(txtTopBrancingPeaks_l.Text));
                SequenceParameters.Add(Convert.ToInt32(txtMaxGlycansToCompleteStruct_m.Text));


                GS = new GlycanSequencing_MultipleScoring(scan, scan.ParentCharge, Convert.ToInt32(txtHex.Text), Convert.ToInt32(txtHexNAc.Text), Convert.ToInt32(txtdeHex.Text), NoNeuAc, NoNeuGc, @"D:\tmp", true, 0.8f, 10, SequenceParameters, Peptides.ReadFastaFile(txtPeptideSeq.Text));
                GS.NumbersOfPeaksForSequencing = 140;
                GS.UseAVGMass = true;
                //GS.DebugMode(@"E:\temp\SeqTmp\");
                GS.CreatePrecursotMZ          = true;
                GS.RewardForCompleteStructure = 3;
                GS.StartSequencing();
                GS.GetTopRankScoreStructre(1);



                //lstPeak.Items.Add("Top " + GS.FilteredPeaks.Count.ToString() + "  peaks");
                //lstPeak.Items.Add("m/z / normailzed intensity ");
                //foreach (MSPoint p in GS.FilteredPeaks)
                //{
                //    lstPeak.Items.Add(p.Mass.ToString("0.0000") +"/" + p.Intensity.ToString("0.0000"));
                //}

                bool isFullSeq = false;
                ReportStructure = GS.SequencedStructures;
                if (ReportStructure.Count == 0)
                {
                    MessageBox.Show("No Structure Found");
                    return;
                }
                if (GS.FullSequencedStructures.Count != 0)
                {
                    ReportStructure = GS.FullSequencedStructures;
                    isFullSeq       = true;
                }
                AminoAcidMass AA = new AminoAcidMass();
                for (int i = 0; i < ReportStructure.Count; i++)
                {
                    GlycanStructure gt  = ReportStructure[i];
                    DataRow         row = dtTrees.NewRow();
                    //row.Add(new Object[] (gt.Mass.ToString("0.0000"), gt.Score.ToString("0.0000"),gt.GetIUPACString()));
                    row["ID"]                  = i.ToString();
                    row["Glycan Mass"]         = gt.GlycanAVGMonoMass.ToString("0.0000");
                    row["Y1"]                  = gt.Y1.Mass.ToString("0.0000");;
                    row["Core Score"]          = Convert.ToSingle((gt.CoreScore).ToString("0.00"));
                    row["Branch Score"]        = Convert.ToSingle((gt.BranchScore).ToString("0.00"));
                    row["Append Glycan Score"] = Convert.ToSingle((gt.InCompleteScore).ToString("0.00"));
                    if (gt.IsCompleteByPrecursorDifference)
                    {
                        row["PPM"] =
                            Convert.ToSingle(
                                MassUtility.GetMassPPM(
                                    gt.GlycanMonoMass + AA.GetMonoMW(gt.PeptideSequence, true) +
                                    GetGlycanMassByGlycanString(gt.RestGlycanString), GS.PrecusorMonoMass)
                                .ToString("0.00"));
                    }
                    else
                    {
                        row["PPM"] =
                            Convert.ToSingle(
                                MassUtility.GetMassPPM(
                                    gt.GlycanMonoMass + AA.GetMonoMW(gt.PeptideSequence, true), GS.PrecusorMonoMass).ToString("0.00"));
                    }
                    row["Peptide"]       = gt.PeptideSequence;
                    row["Append Glycan"] = gt.RestGlycanString;
                    row["IUPAC"]         = gt.IUPACString;

                    GlycansDrawer GDRaw  = new GlycansDrawer(gt.IUPACString, false);
                    Image         tmpImg = GDRaw.GetImage();
                    row["Structure"] = tmpImg;
                    dtTrees.Rows.Add(row);
                }
                ////GS.SequencStructures[0].TheoreticalFragment
                dtTrees.DefaultView.Sort = "Glycan Mass DESC";


                for (int i = 0; i < dgView.Rows.Count; i++)
                {
                    this.dgView.AutoResizeRow(i);
                    if (Convert.ToSingle(dgView.Rows[i].Cells["PPM"].Value) <= Convert.ToSingle(txtPrecusorTol.Text))
                    {
                        dgView.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                    }
                }
            }
        }