Exemple #1
0
        public override void Export(Core.ResultCollection results)
        {
            StreamWriter sw;

            try
            {
                sw = new StreamWriter(fileName);
            }
            catch (Exception)
            {
                throw new IOException("Could not access the output file. Check to see if it is already open.");
            }
            sw.WriteLine(headerLine);

            var data = new List <string>();

            foreach (var isosResult in results.ResultList)
            {
                var result = (StandardIsosResult)isosResult;

                data.Add(getScanNumber(result.ScanSet.PrimaryScanNumber).ToString());
                data.Add(result.IsotopicProfile.ChargeState.ToString());
                data.Add(DblToString(result.IsotopicProfile.GetAbundance(), 4, true));
                data.Add(DblToString(result.IsotopicProfile.GetMZ(), 5));
                data.Add(DblToString(result.IsotopicProfile.Score, 4));        // Fit Score
                data.Add(DblToString(result.IsotopicProfile.AverageMass, 5));
                data.Add(DblToString(result.IsotopicProfile.MonoIsotopicMass, 5));
                data.Add(DblToString(result.IsotopicProfile.MostAbundantIsotopeMass, 5));
                data.Add(DblToString(result.IsotopicProfile.GetFWHM(), 4));
                data.Add(DblToString(result.IsotopicProfile.GetSignalToNoise(), 2));
                data.Add(DblToString(result.IsotopicProfile.GetMonoAbundance(), 4, true));
                data.Add(DblToString(result.IsotopicProfile.GetMonoPlusTwoAbundance(), 4, true));
                data.Add(DblToString(result.IsotopicProfile.OriginalIntensity, 4, true));
                data.Add(result.IsotopicProfile.IsSaturatedAsNumericText);

                // Uncomment to write out the fit_count_basis
                //                //data.Add(result.IsotopicProfile.ScoreCountBasis);				// Number of points used for the fit score

                sw.WriteLine(string.Join(delimiter.ToString(), data));
            }

            sw.Close();
        }
Exemple #2
0
        public override void Execute(Core.ResultCollection resultList)
        {
            Check.Require(resultList != null && resultList.Run != null, String.Format("{0} failed. Run is empty.", this.Name));
            Check.Require(resultList.Run.CurrentMassTag != null, String.Format("{0} failed. CurrentMassTag hasn't been defined.", this.Name));

            var result = resultList.GetTargetedResult(resultList.Run.CurrentMassTag);

            var theorFeature = CreateTargetIso(resultList.Run);

            resultList.IsosResultBin.Clear();


            var msPeakList = new List <Peak>();
            var iso        = IterativelyFindMSFeature(resultList.Run.XYData, theorFeature, out msPeakList);

            result.Run.PeakList = msPeakList;     //this is important for subsequent tasks that use the peaks that were detected here.


            AddFeatureToResult(result, iso);


            var isoIsGood = (iso != null && iso.Peaklist != null && iso.Peaklist.Count > 0);

            if (isoIsGood)
            {
                //GORD: check here if there is an error in IQ intensities
                result.IntensityAggregate = sumPeaks(iso, this.NumPeaksUsedInAbundance, 0);
            }
            else
            {
                result.FailedResult = true;
                result.FailureType  = Globals.TargetedResultFailureType.MsfeatureNotFound;
            }

            resultList.IsosResultBin.Add(result);
        }
Exemple #3
0
        protected override void addResults(Core.ResultCollection rc)
        {
            var myconnection = (SQLiteConnection)cnn;

            using (var mytransaction = myconnection.BeginTransaction())
            {
                using (var mycommand = new SQLiteCommand(myconnection))
                {
                    var featureIDParam      = new SQLiteParameter();
                    var scanNumParam        = new SQLiteParameter();
                    var chargeParam         = new SQLiteParameter();
                    var abundanceParam      = new SQLiteParameter();
                    var mzParam             = new SQLiteParameter();
                    var fitParam            = new SQLiteParameter();
                    var averageMWParam      = new SQLiteParameter();
                    var monoIsotopicMWParam = new SQLiteParameter();
                    var mostAbundantMWParam = new SQLiteParameter();
                    var fwhmParam           = new SQLiteParameter();
                    var sigNoiseParam       = new SQLiteParameter();
                    var monoAbundanceParam  = new SQLiteParameter();
                    var monoPlus2AbundParam = new SQLiteParameter();

                    var netParam             = new SQLiteParameter();
                    var massTagIDParam       = new SQLiteParameter();
                    var massTagMZParam       = new SQLiteParameter();
                    var massTagNETParam      = new SQLiteParameter();
                    var massTagSequenceParam = new SQLiteParameter();

                    mycommand.CommandText = @"INSERT INTO T_MassTagResults ([feature_id],[scan_num],[charge],[abundance],[mz],[fit],
[net],[mass_tag_id],[mass_tag_mz],[mass_tag_NET],[mass_tag_sequence],
[average_mw],[monoisotopic_mw],[mostabundant_mw],[fwhm],[signal_noise],[mono_abundance],[mono_plus2_abundance]) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
                    mycommand.Parameters.Add(featureIDParam);
                    mycommand.Parameters.Add(scanNumParam);
                    mycommand.Parameters.Add(chargeParam);
                    mycommand.Parameters.Add(abundanceParam);
                    mycommand.Parameters.Add(mzParam);
                    mycommand.Parameters.Add(fitParam);

                    mycommand.Parameters.Add(netParam);
                    mycommand.Parameters.Add(massTagIDParam);
                    mycommand.Parameters.Add(massTagMZParam);
                    mycommand.Parameters.Add(massTagNETParam);
                    mycommand.Parameters.Add(massTagSequenceParam);

                    mycommand.Parameters.Add(averageMWParam);
                    mycommand.Parameters.Add(monoIsotopicMWParam);
                    mycommand.Parameters.Add(mostAbundantMWParam);
                    mycommand.Parameters.Add(fwhmParam);
                    mycommand.Parameters.Add(sigNoiseParam);
                    mycommand.Parameters.Add(monoAbundanceParam);

                    mycommand.Parameters.Add(monoPlus2AbundParam);

                    foreach (var item in rc.MassTagResultList)
                    {
                        featureIDParam.Value = item.Value.MSFeatureID;
                        fitParam.Value       = item.Value.Score;

                        if (item.Value.ScanSet != null)
                        {
                            scanNumParam.Value = item.Value.ScanSet.PrimaryScanNumber;
                        }
                        netParam.Value             = item.Value.GetNET();
                        massTagIDParam.Value       = item.Value.Target.ID;
                        massTagMZParam.Value       = item.Value.Target.MZ;
                        massTagNETParam.Value      = item.Value.Target.NormalizedElutionTime;
                        massTagSequenceParam.Value = item.Value.Target.Code;

                        if (item.Value.IsotopicProfile != null)
                        {
                            chargeParam.Value    = item.Value.IsotopicProfile.ChargeState;
                            abundanceParam.Value = item.Value.IsotopicProfile.GetAbundance();
                            mzParam.Value        = item.Value.IsotopicProfile.GetMZ();

                            averageMWParam.Value      = item.Value.IsotopicProfile.AverageMass;
                            monoIsotopicMWParam.Value = item.Value.IsotopicProfile.MonoIsotopicMass;
                            //mostAbundantMWParam.Value = item.Value.IsotopicProfile.getMostIntensePeak().XValue;
                            fwhmParam.Value           = item.Value.IsotopicProfile.GetFWHM();
                            sigNoiseParam.Value       = item.Value.IsotopicProfile.GetSignalToNoise();
                            monoAbundanceParam.Value  = item.Value.IsotopicProfile.GetMonoAbundance();
                            monoPlus2AbundParam.Value = item.Value.IsotopicProfile.GetMonoPlusTwoAbundance();
                        }
                        mycommand.ExecuteNonQuery();
                    }
                }
                mytransaction.Commit();
            }
        }
Exemple #4
0
 public override void ExportMassTagResults(Core.ResultCollection resultColl)
 {
     addResults(resultColl);
     resultColl.MassTagResultList.Clear();
 }
 public override void LoadRunRelatedInfo(Core.ResultCollection results)
 {
     //
 }