当前位置: 首页>>代码示例>>C#>>正文


C# Classes.ClearRecords方法代码示例

本文整理汇总了C#中Classes.ClearRecords方法的典型用法代码示例。如果您正苦于以下问题:C# Classes.ClearRecords方法的具体用法?C# Classes.ClearRecords怎么用?C# Classes.ClearRecords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Classes的用法示例。


在下文中一共展示了Classes.ClearRecords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: foreach


//.........这里部分代码省略.........
                                    double max_score = 0;

                                    for (int k = 0; k < m._CandidateGlycopeptideRecords.Length; k++)
                                    {
                                        // Confirm glycan type matches with HCD prediction
                                        bool process_result = false;
                                        if ((e.GlycanType == GlypID.enmGlycanType.CS) || e.GlycanType == GlypID.enmGlycanType.HY)
                                        {
                                            if (m._CandidateGlycopeptideRecords[k].Glycan.numNeuAc >0)
                                                process_result = true;
                                            else
                                                process_result = false;
                                        }
                                        else
                                            process_result = true;

                                        // Stupidly planned type conversion ; Just doing the bare minimum
                                        GlypID.ETDScoring.clsETDScoringScanResults thisResult = new GlypID.ETDScoring.clsETDScoringScanResults();
                                        thisResult.mdbl_parent_mz = e.ParentMz;
                                        thisResult.mdbl_mono_mw = e.TransformResult.mdbl_mono_mw;
                                        thisResult.mshort_cs = e.TransformResult.mshort_cs;
                                        thisResult.mstr_glyco_site = m._CandidateGlycopeptideRecords[k].Sequence.nGlycoSite;
                                        thisResult.mstr_nglyco_site = m._CandidateGlycopeptideRecords[k].Sequence.nGlycoSite;
                                        thisResult.mstr_pep_seq = m._CandidateGlycopeptideRecords[k].Sequence.sequence;
                                        thisResult.mdbl_glycan_mass = m._CandidateGlycopeptideRecords[k].GlycanMonoMass;

                                        if (thisResult.mstr_pep_seq != "" && process_result)
                                        {
                                            double etd_score = _ETDScoring.ScoreETDSpectra(ref _MSMSPeaks, thisResult);
                                            if (etd_score >= max_score)
                                            {
                                                thisResult.mdbl_etd_score = etd_score;
                                                best_scoring_index = k;
                                                max_score = etd_score;
                                            }
                                        }
                                    }

                                    // Store
                                    if ((best_scoring_index != -1) && (max_score > e.ETDScore))
                                    {
                                        // Store
                                        e.ETDScan = scan;
                                        e.ETDMzs = msms_mzs;
                                        e.ETDIntensities = msms_intensities;
                                        e.ETDPeaks = new GlypID.Peaks.clsPeak[_MSMSPeaks.Length];
                                        Array.Copy(_MSMSPeaks, e.ETDPeaks, _MSMSPeaks.Length);

                                        e.ETDScore = max_score;
                                        e.GP_Record = m._CandidateGlycopeptideRecords[best_scoring_index];
                                        e.FalseHit = e.GP_Record.IsDecoy;

                                       /* if (e.FalseHit)
                                            _tMap._AllFalseHitsFDRScore.Add(e.ETDScore);
                                        else
                                            _tMap._AllTrueHitsFDRScore.Add(e.ETDScore) ; */

                                        // m._AssociatedUMCRecords[i].ETDScanRep = scan;

                                    }
                                }
                            }
                        }
                        // Store the most recent fragmentation event
                        if (e.HCDScore < 1)
                        {
                            /*FragEvents tEvent = new FragEvents(e);
                            m._AssociatedUMCRecords[i]._AssociatedFragEvents.Add(tEvent);*/
                            allobserved_frag_events.Add(e);
                        }
                       //  _RawData.Close();

                        m._AssociatedUMCRecords[i]._AssociatedFragEvents.Clear();
                        for (int kk = 0; kk < allobserved_frag_events.Count; kk++)
                        {
                            FragEvents tempE = allobserved_frag_events[kk] ; //as FragEvents;
                            m._AssociatedUMCRecords[i]._AssociatedFragEvents.Add(tempE);
                        }
                        m._AssociatedUMCRecords[i].SetRepScores();
                    }
                    if (store_record)
                        _tMap.AddRecord(m);

                }

            });

            if (_tMap._AllMLNRecords.Count != _glycoMap._AllMLNRecords.Count)
            {
                _glycoMap.ClearRecords();
                for (int k = 0; k < _tMap._AllMLNRecords.Count; k++)
                {
                    _glycoMap.AddRecord(_tMap._AllMLNRecords[k]);
                }
            }
               // _glycoMap._AllTrueHitsFDRScore = _tMap._AllTrueHitsFDRScore;
            //_glycoMap._AllFalseHitsFDRScore = _tMap._AllFalseHitsFDRScore;

            _tMap.ClearRecords();
        }
开发者ID:anmayam,项目名称:GlycoFragwork,代码行数:101,代码来源:MapCreator.cs

示例2: ClusterRecordsOnCID

        /// <summary>
        /// Function to cluster CID spectra in each record.  
        /// </summary>
        /// <param name="_glycoMap"></param>
        /// <param name="_params"></param>
        public void ClusterRecordsOnCID(ref Classes.MapRecord _glycoMap, ref Classes.Params _params)
        {
            Classes.MapRecord _tempMap = new MapRecord();
            _tempMap._AssociatedDatasetNames = _glycoMap._AssociatedDatasetNames;
            _tempMap._IsCID = _glycoMap._IsCID;
            _tempMap._IsETD = _glycoMap._IsETD;
            _tempMap._IsHCD = _glycoMap._IsHCD;

            int Id = 0;

            FragEvents tempE = new FragEvents();

            for (int i = 0; i < _glycoMap._AllMLNRecords.Count; i++)
            {
                MultiAlignRecord m = new MultiAlignRecord();
                m = _glycoMap._AllMLNRecords[i];
                int num_records = m._AssociatedUMCRecords.Count;

                short mincs = m.MinChargeStateObserved();
                short maxcs = m.MaxChargeStateObserved();

                for (short thiscs = mincs; thiscs <= maxcs; thiscs++)
                {
                    int spectra_num = 0;
                    string cum_spectra_names = null;
                    List<string> cluster_names = new List<string>();
                    List<int> orphan_ids = new List<int>();
                    for (int j = 0; j < num_records; j++)
                    {
                        if (m._AssociatedUMCRecords[j]._AssociatedFragEvents.Count == 0)
                        {
                            // Not fragmented in this UMC but keep track of this  but

                            // // This happens which means there was no fragmentation event then (or) HCD score was bad
                            if (m._AssociatedUMCRecords[j].Abundance > 0)
                                orphan_ids.Add(m._AssociatedUMCRecords[j].DatasetID);
                        }
                        for (int k = 0; k < m._AssociatedUMCRecords[j]._AssociatedFragEvents.Count; k++)
                        {
                            if ((m._AssociatedUMCRecords[j]._AssociatedFragEvents[k].CIDPeaks[0] != null) &&
                                (m._AssociatedUMCRecords[j]._AssociatedFragEvents[k].TransformResult.mshort_cs == thiscs))
                            {
                                string spectra_name = "Spectra_" + m._AssociatedUMCRecords[j].DatasetID + "_" + m._AssociatedUMCRecords[j]._AssociatedFragEvents[k].ID + "_" +
                                    spectra_num + "_" + m._AssociatedUMCRecords[j]._AssociatedFragEvents[k].CIDScan;

                                GlypID.Peaks.clsPeak[] thisCIDPeaks = new GlypID.Peaks.clsPeak[m._AssociatedUMCRecords[j]._AssociatedFragEvents[k].CIDPeaks.Length];
                                Array.Copy(m._AssociatedUMCRecords[j]._AssociatedFragEvents[k].CIDPeaks, thisCIDPeaks, m._AssociatedUMCRecords[j]._AssociatedFragEvents[k].CIDPeaks.Length);
                                _CIDSpectralUtilities.AddPeaksToList(ref thisCIDPeaks, spectra_name);
                                spectra_num++;
                                if (cum_spectra_names != null)
                                    cum_spectra_names = cum_spectra_names + "-" + spectra_name;
                                else
                                    cum_spectra_names = spectra_name;
                            }
                        }
                    }

                    int num_clusters = _CIDSpectralUtilities.ClusterSpectraInList();
                    _CIDSpectralUtilities.GetClusterNames(ref cluster_names);

                    if (num_clusters > 1)
                    {
                        // Indicates glycoforms
                        bool debug = true;
                        debug = true;
                    }

                    for (int c = 0; c < num_clusters; c++)
                    {
                        m._ClusterNames.Add(cluster_names[c]);
                    }

                    _CIDSpectralUtilities.Clear();
                }
                _tempMap.AddRecord(m);
            }
                 // Restore them.
            _glycoMap.ClearRecords();
            for (int i = 0; i < _tempMap._AllMLNRecords.Count; i++)
            {
                _glycoMap.AddRecord(_tempMap._AllMLNRecords[i]);
            }

                    /*else
                    {
                        /* MultiAlignRecord _tempM = new MultiAlignRecord(m);
                         _tempM.ID = Id;
                         _tempMap.AddRecord(_tempM);
                         Id++; */

                    /* if (cum_spectra_names != null)
                     {
                         // Choose the spectra with the greatest SNR
                         num_clusters = 1;
                         cluster_names.Add(cum_spectra_names);
//.........这里部分代码省略.........
开发者ID:anmayam,项目名称:GlycoFragwork,代码行数:101,代码来源:MapParser.cs


注:本文中的Classes.ClearRecords方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。