private void btnLoadRawCSMSL_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { COL.MassLib.ThermoRawReader raw = new ThermoRawReader(openFileDialog1.FileName); } }
public Form1() { InitializeComponent(); //StreamReader SR = new StreamReader(@"D:\Data\Jacobson Tang Meeting\bkdsub_smooth_centroid RNASE5.txt"); //List<double> mzs = new List<double>(); //List<double> intensities = new List<double>(); //do //{ // string tmp = SR.ReadLine(); // mzs.Add(Convert.ToDouble(tmp.Split('\t')[0])); // intensities.Add(Convert.ToDouble(tmp.Split('\t')[1])); //} while (!SR.EndOfStream); //SR.Close(); //GraphPane gp = zedGraphControl1.GraphPane; //PointPairList ppl = new PointPairList(mzs.ToArray(), intensities.ToArray()); //gp.AddBar("X-Y", ppl, Color.Black); //gp.AxisChange(); //zedGraphControl1.Refresh(); //List<Protease.Type> proteasList = new List<Protease.Type>(); //proteasList.Add(Protease.Type.Trypsin); //List<ProteinInfo> PInfos = FastaReader.ReadFasta(@"E:\Dropbox\@Paper\MyPaper\GlycanSeq_AC\Data\H1N1\H1N1.fasta"); //List<string> Peptides = PInfos[0].NGlycopeptide(0, proteasList, enumPeptideMutation.NoMutation); //List<string> MutaPeptides = PInfos[0].NGlycopeptide(0, proteasList,enumPeptideMutation.DtoN); //Console.WriteLine(Peptides.Count); //Console.WriteLine(MutaPeptides.Count); COL.GlycoLib.ReadGlycanListFromFile.ReadGlycanList(@"D:\!Git\MultiGlycan\lib\Default_Combination.csv", true, false, false, true, true); COL.MassLib.ThermoRawReader Raw = new ThermoRawReader(@"E:\Dropbox\@Paper\MyPaper\GlycanSeq_AC\Data\H1N1\P-Glu-C_IU_090710_HCD.RAW"); List <MSScan> Scan = Raw.ReadScanWMSLevel(13107, 13127, 1); Console.WriteLine(Raw.NumberOfScans.ToString()); List <MSScan> MS1 = Raw.ReadScanWMSLevel(1, Raw.NumberOfScans, 1); List <MSScan> MS2 = Raw.ReadScanWMSLevel(1, Raw.NumberOfScans, 2); int CIDCount = 0; int HCDCount = 0; foreach (var m in MS2) { if (m.IsCIDScan) { CIDCount++; } if (m.IsHCDScan) { HCDCount++; } } Console.WriteLine(CIDCount.ToString()); }
private void button3_Click(object sender, EventArgs e) { MassLib.ThermoRawReader Raw = new ThermoRawReader(@"E:\Dropbox\Chuan-Yih\PerMethQuant\RiboB_7plex_05302014.raw"); List <MSScan> scans = Raw.ReadScans(766, 1066); List <MSPeak> Peaks = new List <MSPeak>(); foreach (MSScan s in scans) { foreach (MSPeak p in s.MSPeaks) { if (p.ChargeState == 2) { Peaks.Add(p); } //if (p.MonoisotopicMZ >= 834.62 && p.MonoisotopicMZ <= 834.65) //{ // Peaks.Add(p); //} } } }
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; } } } }
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 }