Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     
     ThermoRawReader TRaw = (ThermoRawReader)raw;
     string[] TagArray = TRaw.GetTrailerExtraLabelArray(1);
     //Title
     int msCount = 0;
     int msmsCount = 0;
     int CIDcount = 0;
     int msCount = 0;
     int msmsCount = 0;
     int CIDcount = 0;
     int HCDcount = 0;
     int HCDcount = 0;
     for (int i = 1; i <= raw.NumberOfScans; i++)
     {
      
      
         if (TRaw.GetMsLevel(i) == 1)
         {
             msCount += 1;
             msCount += 1;
         }
         else
         {
             msmsCount += 1;
             msmsCount += 1;
             if (TRaw.IsCIDScan(i))
             {
                 CIDcount += 1;
             }
             else
             {
                 HCDcount += 1;
             }
             }
         }
         }
Beispiel #2
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
        }