private void gvFiles_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            if (e.RowIndex >= currentItems.Count)
            {
                e.Value = string.Empty;
                return;
            }

            if (e.ColumnIndex == 0)
            {
                e.Value = currentItems[e.RowIndex].Enabled;
            }
            else if (e.ColumnIndex == 1)
            {
                e.Value = currentItems[e.RowIndex].Precursor;
            }
            else
            {
                var fileitem = currentItems[e.RowIndex].Items[e.ColumnIndex - FirstProductIonColumn];
                if (fileitem == null || double.IsNaN(fileitem.PairedProductIon.Ratio) || double.IsInfinity(fileitem.PairedProductIon.Ratio))
                {
                    e.Value = string.Empty;
                }
                else
                {
                    var text = MyConvert.Format("[{0:0.0000} , {1:0.0000}]", fileitem.PairedProductIon.Ratio, fileitem.PairedProductIon.RegressionCorrelation);
                    e.Value = text;
                }
            }
        }
Ejemplo n.º 2
0
        public void TestGetChildrenByXPath()
        {
            string         xpath = MyConvert.Format("{0}:msms_run_summary/{0}:search_summary/{0}:parameter", helper.PREFIX);
            List <XmlNode> nodes = helper.GetChildrenByXPath(doc.DocumentElement, xpath);

            Assert.AreEqual(13, nodes.Count);
        }
        protected void WritePeak(StreamWriter writer, PeakList <T> pl)
        {
            PeakList <T> pkl;

            //Mascot Generic Format 要求每个spectrum不能超过10000个离子。
            if (pl.Count > 10000)
            {
                pkl = new PeakList <T>(pl);
                pkl.SortByIntensity();
                pkl.RemoveRange(10000, pkl.Count - 10000);
                pkl.SortByMz();
            }
            else
            {
                pkl = pl;
            }

            //if (pkl.Any(m => m.Charge > 0))
            //{
            //  foreach (T peak in pkl)
            //  {
            //    writer.WriteLine(MyConvert.Format("{0:0.#####} {1:0.0} {2}", peak.Mz, peak.Intensity, peak.Charge));
            //  }
            //}
            //else
            //{
            foreach (T peak in pkl)
            {
                writer.WriteLine(MyConvert.Format("{0:0.#####} {1:0.0###}", peak.Mz, peak.Intensity));
            }
            //}

            writer.WriteLine(MascotGenericFormatConstants.END_PEAK_LIST_TAG);
            writer.WriteLine();
        }
Ejemplo n.º 4
0
        public override IEnumerable <string> Process(string filename)
        {
            SequestResultTextFormat format = new SequestResultTextFormat();

            Progress.SetMessage("Reading from " + filename + "...");
            IIdentifiedResult sr = format.ReadFromFile(filename);

            HashSet <IIdentifiedSpectrum> result = new HashSet <IIdentifiedSpectrum>();

            foreach (IIdentifiedProteinGroup spg in sr)
            {
                if (acceptFunc(spg))
                {
                    result.UnionWith(spg[0].GetSpectra());
                }
            }

            List <IIdentifiedSpectrum> spectra = new List <IIdentifiedSpectrum>(result);

            spectra.Sort();

            string resultFilename = MyConvert.Format("{0}.{1}.peptides", filename, uniqueStr);

            Progress.SetMessage("Writing to " + resultFilename + "...");
            new SequestPeptideTextFormat(format.PeptideFormat.GetHeader()).WriteToFile(resultFilename, spectra);
            Progress.SetMessage("Finished");

            return(new[] { resultFilename });
        }
Ejemplo n.º 5
0
        private void ShowRegression()
        {
            this.lvRegression.Items.Clear();
            foreach (SpeciesRegressionItem item in this.summary.SpeciesAbundance.RegressionItems)
            {
                ListViewItem lvItem = this.lvRegression.Items.Add(MyConvert.Format("{0:0.0000}", item.Mz));
                lvItem.SubItems.Add(MyConvert.Format("{0:0}", item.ObservedIntensity));
                lvItem.SubItems.Add(MyConvert.Format("{0:0}", item.RegressionIntensity));
            }

            var pplObserved   = new PointPairList();
            var pplRegression = new PointPairList();

            for (int i = 0; i < 6; i++)
            {
                pplObserved.Add(this.summary.SpeciesAbundance.RegressionItems[i].Mz,
                                this.summary.SpeciesAbundance.RegressionItems[i].ObservedIntensity);
                pplRegression.Add(this.summary.SpeciesAbundance.RegressionItems[i].Mz,
                                  this.summary.SpeciesAbundance.RegressionItems[i].RegressionIntensity);
            }

            ClearData(this.zgcRegression, false);

            AddDataToBar(this.zgcRegression, pplObserved, "Observed Envelope", Color.Red, false);
            AddDataToBar(this.zgcRegression, pplRegression, "Regression Envelope", Color.Blue, false);

            UpdateGraph(this.zgcRegression);
        }
        public static void WriteSpectrumBin <T>(StreamWriter sw, T source, Func <T, List <OptimalResultCondition> > condFunc, Func <T, OptimalResultCondition, OptimalItem> acceptCount)
        {
            sw.WriteLine("Classification\tCharge\tNumMissCleavage\tNumProteaseTermini\tModification\tProteinTag\tScore\tExpectValue\tTargetCount\tDecoyCount");
            var conds = condFunc(source);

            conds.Sort();
            foreach (OptimalResultCondition cond in conds)
            {
                var    item           = acceptCount(source, cond);
                int    targetCount    = 0;
                int    decoyCount     = 0;
                double acceptedScore  = 0.0;
                double acceptedEvalue = 0.0;
                if (item != null)
                {
                    decoyCount     = item.Spectra.Count(m => m.FromDecoy);
                    targetCount    = item.Spectra.Count - decoyCount;
                    acceptedScore  = item.Result.Score;
                    acceptedEvalue = item.Result.ExpectValue;
                }

                sw.WriteLine(MyConvert.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6:E3}\t{7:E3}\t{8}\t{9}",
                                              cond.Classification,
                                              cond.ChargeString,
                                              cond.NumMissCleavageString,
                                              cond.NumProteaseTermini,
                                              cond.ModificationCountString,
                                              cond.ProteinTag,
                                              acceptedScore,
                                              acceptedEvalue,
                                              targetCount,
                                              decoyCount));
            }
            sw.WriteLine();
        }
        public override List <IIdentifiedSpectrum> ReadFromFile(string outDirectory)
        {
            var result = new List <IIdentifiedSpectrum>();

            FileInfo[] outFiles = new DirectoryInfo(outDirectory).GetFiles("*.out");
            FileInfo[] dtaFiles = new DirectoryInfo(outDirectory).GetFiles("*.dta");

            if (dtaFiles.Length != 0 && outFiles.Length != dtaFiles.Length)
            {
                throw new Exception(MyConvert.Format("Dta file count ({0}) in {1} is not equals to out file count ({2})",
                                                     dtaFiles.Length, outDirectory, outFiles.Length));
            }

            Progress.SetRange(1, outFiles.Length);
            for (int i = 0; i < outFiles.Length; i++)
            {
                List <string> context = FileUtils.ReadFile(outFiles[i].FullName, false);

                IIdentifiedSpectrum spectrum = this.parser.Parse(context);

                if (null != spectrum)
                {
                    result.Add(spectrum);
                }

                Progress.SetPosition(i + 1);
            }

            Progress.End();

            return(result);
        }
        public string GetProteinString(IIdentifiedProtein mpro)
        {
            var sb = new StringBuilder();

            sb.Append(MyConvert.Format("{0}\t{1:0.0}\t{2}\t{3}\t{4}\t{5}",
                                       mpro.Name,
                                       mpro.MolecularWeight,
                                       mpro.Score,
                                       mpro.UniquePeptideCount,
                                       mpro.Peptides.Count,
                                       mpro.Description));

            foreach (string key in this._annotationKeys)
            {
                if (mpro.Annotations.ContainsKey(key))
                {
                    sb.Append("\t" + mpro.Annotations[key]);
                }
                else
                {
                    sb.Append("\t");
                }
            }
            return(sb.ToString());
        }
Ejemplo n.º 9
0
        public override IEnumerable <string> Process(string fileName)
        {
            var format = new MascotPeptideTextFormat();

            var peptides = format.ReadFromFile(fileName);

            peptides.RemoveAll(m => m.QValue >= fdr);
            peptides.ForEach(m => m.TheoreticalMinusExperimentalMass = Math.Round(m.TheoreticalMinusExperimentalMass));
            peptides.RemoveAll(m => m.TheoreticalMinusExperimentalMass == 0.0);

            var result1 = MyConvert.Format("{0}.fdr{1:0.000}.txt", fileName, fdr);

            format.WriteToFile(result1, peptides);

            var groups = peptides.GroupBy(m => m.TheoreticalMinusExperimentalMass).ToList();

            groups.Sort((m1, m2) => - m1.Count().CompareTo(m2.Count()));

            var result2 = MyConvert.Format("{0}.fdr{1:0.000}.groups", fileName, fdr);

            using (StreamWriter sw = new StreamWriter(result2))
            {
                foreach (var group in groups)
                {
                    sw.WriteLine("{0:0}\t{1}", -group.Key, group.Count());
                }
            }

            return(new string[] { result1, result2 });
        }
Ejemplo n.º 10
0
 private void CheckValue()
 {
     if ((from < to && step <= 0) || (from > to && step >= 0))
     {
         throw new ArgumentException(MyConvert.Format("Error argument of LoopDefinition : From={0}, To={1}, Step={2}.", from, to, step));
     }
 }
Ejemplo n.º 11
0
        public void WriteToFile(string filename, SilacQuantificationSummaryItem t)
        {
            XElement root = new XElement("SilacQuantificationInformation",
                                         new XElement("RawFilename", t.RawFilename),
                                         new XElement("SoftwareVersion", t.SoftwareVersion),
                                         new XElement("PeptideSequence", t.PeptideSequence),
                                         new XElement("Charge", t.Charge),
                                         new XElement("SampleAtomComposition", t.SampleAtomComposition),
                                         new XElement("ReferenceAtomComposition", t.ReferenceAtomComposition),
                                         new XElement("SampleIsLight", t.SampleIsLight),
                                         new XElement("Ratio", MyConvert.Format("{0:0.0000}", t.Ratio)),
                                         new XElement("Correlation", MyConvert.Format("{0:0.0000}", t.RegressionCorrelation)),
                                         new XElement("SampleAbundance", MyConvert.Format("{0:0.0}", t.SampleAbundance)),
                                         new XElement("ReferenceAbundance", MyConvert.Format("{0:0.0}", t.ReferenceAbundance)),
                                         GetProfileElement("SampleProfile", t.SampleProfile),
                                         GetProfileElement("ReferenceProfile", t.ReferenceProfile),
                                         new XElement("ObservedEnvelopes",
                                                      from pkl in t.ObservedEnvelopes
                                                      select new XElement("Envelope",
                                                                          new XAttribute("Scan", pkl.Light.ScanTimes[0].Scan),
                                                                          new XAttribute("Retentiontime", MyConvert.Format("{0:0.00##}", pkl.Light.ScanTimes[0].RetentionTime)),
                                                                          new XAttribute("Enabled", pkl.Enabled),
                                                                          new XAttribute("Identified", pkl.IsIdentified),
                                                                          new XAttribute("ExtendedIdentification", pkl.IsExtendedIdentification),
                                                                          new XAttribute("LightIntensity", MyConvert.Format("{0:0.0}", pkl.LightIntensity)),
                                                                          new XAttribute("HeavyIntensity", MyConvert.Format("{0:0.0}", pkl.HeavyIntensity)),
                                                                          GetPeakListElement("LightPeakList", pkl.Light),
                                                                          GetPeakListElement("HeavyPeakList", pkl.Heavy))));

            root.Save(filename);
        }
 public virtual double this[int index]
 {
     get
     {
         if (_definition.IsValid(index))
         {
             return(_ions[index - _baseIndex]);
         }
         else
         {
             throw new ArgumentOutOfRangeException(MyConvert.Format("index {0} out of range", index));
         }
     }
     set
     {
         if (_definition.IsValid(index))
         {
             _ions[index - _baseIndex] = value;
         }
         else
         {
             throw new ArgumentOutOfRangeException(MyConvert.Format("index {0} out of range", index));
         }
     }
 }
Ejemplo n.º 13
0
        public override IEnumerable <string> Process(string targetDirectory)
        {
            var targetDir = new DirectoryInfo(targetDirectory);

            if (!targetDir.Exists)
            {
                targetDir.Create();
            }

            var result = new List <string>();

            for (int i = 0; i < rawFiles.Count; i++)
            {
                if (Progress.IsCancellationPending())
                {
                    throw new UserTerminatedException();
                }

                string rootMsg = MyConvert.Format("{0} / {1} : {2}", i + 1, rawFiles.Count,
                                                  rawFiles[i]);

                Progress.SetMessage(1, rootMsg);
                using (var rawFile = RawFileFactory.GetRawFileReader(rawFiles[i]))
                {
                    var processor = new Raw2MgfProcessor(rawFile, this.writer, this.retentionTimeTolerance, this.ppmPrecursorTolerance,
                                                         this.ppmPeakTolerance, this.pklProcessor, targetDir, groupByMode);
                    processor.Progress = Progress;

                    result.AddRange(processor.Process(rawFiles[i]));
                }
            }

            return(result);
        }
        private void UpdateProteinEntry(ListViewItem item, IIdentifiedProteinGroup mpg, int index)
        {
            item.ImageIndex = index;
            IIdentifiedProtein mp = mpg[index];
            var parts             = new List <string>(this.format.ProteinFormat.GetString(mp).Split(new[] { '\t' }));

            if (item.SubItems.Count != this.proteinColumnIndecies.Count)
            {
                item.SubItems.Clear();
                item.Text = MyConvert.Format("${0}-{1}", mpg.Index, index + 1);
                for (int i = 0; i < proteinColumnIndecies.Count; i++)
                {
                    item.SubItems.Add(parts[proteinColumnIndecies[i]]);
                }
            }
            else
            {
                for (int i = 0; i < proteinColumnIndecies.Count; i++)
                {
                    item.SubItems[i].Text = parts[proteinColumnIndecies[i]];
                }
            }
            item.Checked = option.IsProteinRatioValid(mpg[0]) && !option.IsProteinOutlier(mpg[0]);

            item.Tag = mpg;

            UpdateProteinColor(mpg[index], item);
        }
Ejemplo n.º 15
0
        private void ShowExperimentalScans()
        {
            this.lvExperimentalScans.BeginUpdate();
            try
            {
                for (int i = 0; i < 6; i++)
                {
                    this.lvExperimentalScans.Columns[i + 1].Text = MyConvert.Format("{0:0.0000}",
                                                                                    this.summary.ObservedEnvelopes[0][i].Mz);
                }

                this.lvExperimentalScans.Items.Clear();
                foreach (var envelope in this.summary.ObservedEnvelopes)
                {
                    ListViewItem item = this.lvExperimentalScans.Items.Add(envelope.ScanTimes[0].Scan.ToString());
                    for (int i = 0; i < 6; i++)
                    {
                        item.SubItems.Add(MyConvert.Format("{0:0}", envelope[i].Intensity));
                    }
                    item.Checked   = envelope.Enabled;
                    item.BackColor = envelope.IsIdentified ? Color.Red : item.BackColor;
                    item.Tag       = envelope;
                }
            }
            finally
            {
                this.lvExperimentalScans.EndUpdate();
            }

            this.lvExperimentalScans.Items[0].Selected = true;
        }
Ejemplo n.º 16
0
 public static XElement FilterToXml(string name, bool active, object value)
 {
     return(new XElement("Filter",
                         new XAttribute("Name", name),
                         new XAttribute("Active", active.ToString()),
                         new XAttribute("Value", MyConvert.Format(value))));
 }
Ejemplo n.º 17
0
        private void UpdatePrecursorItem()
        {
            LabelFreeSummaryItem item = lvScans.Tag as LabelFreeSummaryItem;

            if (null == item)
            {
                return;
            }

            for (int i = 0; i < item.Count; i++)
            {
                item[i].Enabled = lvScans.Items[i].Checked;
            }

            new LabelFreeSummaryItemXmlFormat().WriteToFile(GetDetailFileName(), item);

            PrecursorArea pa = (PrecursorArea)lvPrecursor.SelectedItems[0].Tag;

            pa.Area = item.GetArea();

            List <PrecursorArea> pas = (List <PrecursorArea>)lvPrecursor.Tag;

            new PrecursorAreaListTextFormat().WriteToFile(GetAreaFileName(), pas);

            lvPrecursor.SelectedItems[0].SubItems[2].Text = MyConvert.Format("{0:0.0}", pa.Area);
            lvPrecursor.Invalidate();
        }
Ejemplo n.º 18
0
        private void UpdateScans()
        {
            lvScans.BeginUpdate();
            try
            {
                lvScanUpdating = true;
                lvScans.Items.Clear();

                if (lvPrecursor.SelectedItems.Count == 0)
                {
                    return;
                }

                LabelFreeSummaryItem chro = GetSelectLabelFreeSummaryItem();

                chro.ForEach(m =>
                {
                    var item = lvScans.Items.Add(m.Scan.ToString());
                    item.SubItems.Add(MyConvert.Format("{0:0.0000}", m.Intensity));
                    item.Checked = m.Enabled;
                    if (m.Identified)
                    {
                        item.ForeColor = Color.Red;
                    }
                    item.Tag = m;
                });
            }
            finally
            {
                lvScanUpdating = false;
                lvScans.EndUpdate();
            }
        }
Ejemplo n.º 19
0
 public override string Build <T>(Spectrum.PeakList <T> pl)
 {
     return(MyConvert.Format("Cmpd {0}, +MSn({1:0.####}), {2:0.00} min",
                             pl.GetFirstScanTime().Scan,
                             pl.PrecursorMZ,
                             pl.GetFirstScanTime().RetentionTime));
 }
Ejemplo n.º 20
0
        public override void Update(object sender, UpdateQuantificationItemEventArgs e)
        {
            IQuantificationSummaryOption option = e.Option as IQuantificationSummaryOption;
            IIdentifiedResult            mr     = e.Item as IIdentifiedResult;

            string xTitle = MyConvert.Format("(Log({0}) + Log({1})) / 2", option.Func.ReferenceKey, option.Func.SampleKey);
            string yTitle = MyConvert.Format("Log(Ratio)");

            panel.InitGraphPane(title, xTitle, yTitle, true, 0.0);

            try
            {
                HashSet <IIdentifiedSpectrum> spectra = new HashSet <IIdentifiedSpectrum>();

                var groups = from g in mr
                             where g[0].IsEnabled(true) && option.IsProteinRatioValid(g[0])
                             select g;

                foreach (var mpg in groups)
                {
                    var peptides = from p in mpg.GetPeptides()
                                   where p.IsEnabled(true) && option.IsPeptideRatioValid(p)
                                   select p;

                    spectra.UnionWith(peptides);
                }

                List <LSPADItem> items = new List <LSPADItem>();
                foreach (var pep in spectra)
                {
                    double refIntensity    = Math.Log(option.Func.GetReferenceIntensity(pep));
                    double sampleIntensity = Math.Log(option.Func.GetSampleIntensity(pep));

                    double A     = (refIntensity + sampleIntensity) / 2;
                    double ratio = Math.Log(option.GetPeptideRatio(pep));

                    items.Add(new LSPADItem()
                    {
                        LogRatio  = ratio,
                        Intensity = A,
                        Tag       = pep
                    });
                }

                LSPADItem.CalculatePValue(items);



                //this.panel.DrawProbabilityRange(maxX, ratios);

                //this.panel.AddPoints(pplSelected, SelectedColor, "Current Peptide");
                //this.panel.AddPoints(pplGroup, GroupColor, "Current Protein");
                //this.panel.AddPoints(pplOutlier, OutlierColor, "Outlier");
                //this.panel.AddPoints(pplNormal, NormalColor, "Other");
            }
            finally
            {
                ZedGraphicExtension.UpdateGraph(this.zgcGraph);
            }
        }
        public void ReadFromFile(string fileName, string sectionName)
        {
            Clear();

            if (!File.Exists(fileName))
            {
                throw new FileNotFoundException("File not found", fileName);
            }

            XElement doc = XElement.Load(fileName);

            var sectionXml = doc.Element(sectionName);

            if (null == sectionXml)
            {
                throw new ArgumentException(MyConvert.Format("Section {0} not exists in file {1}", sectionName, fileName), "sectionName");
            }

            var formatXmls =
                from format in sectionXml.Descendants("parseFormat")
                orderby Convert.ToInt32(format.Element("GUInameIndex").Value)
                select format;

            foreach (var formatXml in formatXmls)
            {
                var formatItem = new ParserFormat();

                formatItem.FormatName   = formatXml.Element("formatName").Value;
                formatItem.FormatId     = formatXml.Element("formatID").Value;
                formatItem.GUInameIndex = Convert.ToInt32(formatXml.Element("GUInameIndex").Value);

                var sample = formatXml.Element("formatSample");
                if (null != sample)
                {
                    formatItem.Sample = sample.Value;
                }

                var reg = formatXml.Element("regex");
                if (null != reg)
                {
                    formatItem.IdentityRegex = reg.Value;
                }

                var parseItemXmls = formatXml.Descendants("parseItem");
                foreach (var parseItemXml in parseItemXmls)
                {
                    var parseItem = new ParserItem();

                    parseItem.ItemName          = parseItemXml.Element("itemName").Value;
                    parseItem.RegularExpression = parseItemXml.Element("regularExpression").Value;
                    parseItem.Slope             = MyConvert.ToDouble(parseItemXml.Element("slope").Value);
                    parseItem.Offset            = MyConvert.ToDouble(parseItemXml.Element("offset").Value);

                    formatItem.Add(parseItem);
                }

                Add(formatItem);
            }
        }
Ejemplo n.º 22
0
        public string GetProteinRatioDescription(IIdentifiedProtein ann)
        {
            var ratio = func.GetRatio(ann);

            LinearRegressionRatioResult lrrr = ann.Annotations[O18QuantificationConstants.O18_RATIO] as LinearRegressionRatioResult;

            return(MyConvert.Format("Ratio={0:0.00}; StdErr={1:0.0000}; pValue={2:0.##E-000}", lrrr.Ratio, lrrr.RSquare, lrrr.PValue));
        }
Ejemplo n.º 23
0
 public void Output(List <IonTypePeak> pkl, IonType ionType)
 {
     Console.WriteLine("Assert.AreEqual({0}, pkl.Count);", pkl.Count);
     for (int i = 0; i < pkl.Count; i++)
     {
         Console.WriteLine(MyConvert.Format("AssertPeak(pkl[{0}], IonType.{1}, {2}, {3:0.0000});", i, ionType.ToString(), i + 1, pkl[i].Mz));
     }
 }
        private void WriteImage(string imageDir, string imageDirName, StreamWriter sw, SrmPairedPeptideItem pep)
        {
            var imageFile = MyConvert.Format("{0}\\{1}.png", imageDir, pep.PrecursorFormula);

            zgcPeptide.GetImage().Save(imageFile, ImageFormat.Png);
            sw.WriteLine("<img src=\"{0}/{1}.png\" width=\"800\" /><br>", imageDirName, pep.PrecursorFormula);
            sw.WriteLine("<hr>");
        }
Ejemplo n.º 25
0
 public override string GetProperty(T t)
 {
     if (t.Annotations.ContainsKey(this.key))
     {
         return(MyConvert.Format(t.Annotations[this.key]));
     }
     return(this.defaultValue);
 }
 private void gvPeptides_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (gvPeptides.Columns[e.ColumnIndex].DataPropertyName == "ObservedMz")
     {
         var spectrum = spectra[e.RowIndex];
         e.Value = MyConvert.Format("{0:0.00000}", spectrum.ObservedMz);
     }
 }
Ejemplo n.º 27
0
 private XElement GetPeakListElement(string elementName, PeakList <Peak> pkl)
 {
     return(new XElement(elementName,
                         from peak in pkl
                         select new XElement("Peak",
                                             new XAttribute("Mz", MyConvert.Format("{0:0.0000}", peak.Mz)),
                                             new XAttribute("Intensity", MyConvert.Format("{0:0.0}", peak.Intensity)))));
 }
Ejemplo n.º 28
0
 public override string Build <T>(Spectrum.PeakList <T> pkl)
 {
     return(MyConvert.Format("{0}.{1}.{2}.{3}.dta",
                             pkl.Experimental,
                             pkl.GetFirstScanTime().Scan,
                             pkl.GetLastScanTime().Scan,
                             pkl.PrecursorCharge));
 }
        private string GetImageFileName(IIdentifiedSpectrum spectrum, string ext)
        {
            var sf      = spectrum.Query.FileScan;
            var jpgName = MyConvert.Format("{0}.{1}.{2}.{3}.{4}", sf.Experimental, sf.FirstScan, sf.LastScan, sf.Charge, ext);

            jpgName = new FileInfo(imageDirectory.FullName + "\\" + jpgName).FullName;
            return(jpgName);
        }
        public string GetScanRange()
        {
            var scanList = from pkl in this
                           let s = pkl.Scan
                                   orderby s
                                   select s;

            return(MyConvert.Format("{0}-{1}", scanList.Min(), scanList.Max()));
        }