public override List <IIdentifiedSpectrum> ReadFromFile(string fileName)
        {
            var result = new List <IIdentifiedSpectrum>();

            using (var reader = new OutsReader(fileName))
            {
                Progress.SetRange(1, reader.FileCount);

                int count = 0;
                while (reader.HasNext)
                {
                    if (Progress.IsCancellationPending())
                    {
                        throw new UserTerminatedException();
                    }

                    List <string> context = reader.NextContent();

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

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

                    Progress.SetPosition(count++);
                }

                Progress.End();
            }

            return(result);
        }
Ejemplo n.º 2
0
        protected string GetRatioFile(IQuantificationSummaryOption option, IIdentifiedSpectrum mph)
        {
            var    o18option = option as O18QuantificationSummaryViewerOptions;
            string ratioFile = (string)mph.Annotations[o18option.RatioFileKey];

            if (ratioFile.Equals("-"))
            {
                return(null);
            }

            FileInfo fi = new FileInfo(SummaryFilename);
            string   result;

            if (IsRelativeDir(ratioFile))
            {
                result = fi.DirectoryName + "/" + ratioFile;
            }
            else
            {
                result = fi.DirectoryName + "/" + DefaultDetailDirectory + "/" + ratioFile;
            }

            result = new FileInfo(result).FullName;

            if (!File.Exists(result))
            {
                return(null);
            }

            return(result);
        }
        protected void AssignModification(IIdentifiedSpectrum mph, Dictionary <int, string> modifications, PFindModification mm)
        {
            var mods = (from m in modifications
                        select m.Value).Distinct().ToArray();

            mph.Modifications = string.Join("; ", mods);
        }
        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 IIdentifiedSpectrum[] Process(List <IIdentifiedSpectrum> source)
        {
            if (null == source || source.Count == 0)
            {
                return(null);
            }

            double minQValue         = double.MaxValue;
            IIdentifiedSpectrum top1 = null;

            foreach (var spectrum in source)
            {
                if (spectrum.QValue < minQValue)
                {
                    minQValue = spectrum.QValue;
                    top1      = spectrum;
                }
            }

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

            result.Add(top1);

            foreach (var spectrum in source)
            {
                if (spectrum != top1 && spectrum.SequenceEquals(top1))
                {
                    result.Add(spectrum);
                }
            }

            return(result.ToArray());
        }
        protected string GetRatioFile(IQuantificationSummaryOption option, IIdentifiedSpectrum mph)
        {
            string ratioFile = mph.GetQuantificationItem().Filename;

            if (ratioFile.Equals("-"))
            {
                return(null);
            }

            FileInfo fi = new FileInfo(SummaryFilename);
            string   result;

            if (IsRelativeDir(ratioFile))
            {
                result = fi.DirectoryName + "/" + ratioFile;
            }
            else
            {
                result = fi.DirectoryName + "/" + DefaultDetailDirectory + "/" + ratioFile;
            }

            result = new FileInfo(result).FullName;

            if (!File.Exists(result))
            {
                return(null);
            }

            return(result);
        }
Ejemplo n.º 7
0
 public override void ParseScoreAndOtherInformation(IIdentifiedSpectrum sph, XElement searchHit)
 {
     if (this.baseParser != null)
     {
         this.baseParser.ParseScoreAndOtherInformation(sph, searchHit);
     }
 }
Ejemplo n.º 8
0
        private void ParseSearchHit(IIdentifiedSpectrum sph, XElement searchHit, PepXmlModifications ppmods)
        {
            var sp = new IdentifiedPeptide(sph);

            var mod_info = searchHit.FindFirstDescendant("modification_info");

            string seq = searchHit.Attribute("peptide").Value;

            if (mod_info != null)
            {
                var modified_peptide = mod_info.Attribute("modified_peptide");
                if (modified_peptide != null && !modReg.Match(modified_peptide.Value).Success)
                {
                    seq = modified_peptide.Value;
                }
                else
                {
                    var pureSeq = seq;
                    var modaas  = PeptideProphetUtils.ParseModificationAminoacidMass(mod_info);
                    if (modaas != null && modaas.Count > 0)
                    {
                        modaas.Reverse();
                        foreach (var modaa in modaas)
                        {
                            string modchar = FindModificationChar(ppmods, modaa, pureSeq);
                            seq = seq.Insert(modaa.Position, modchar);
                        }
                    }
                }
            }

            if (searchHit.Attribute("peptide_prev_aa") != null)
            {
                sp.Sequence = searchHit.Attribute("peptide_prev_aa").Value + "." +
                              seq + "." +
                              searchHit.Attribute("peptide_next_aa").Value;
            }
            else
            {
                sp.Sequence = seq;
            }

            sph.NumMissedCleavages = GetAttributeValue(searchHit, "num_missed_cleavages", 0);
            sph.NumProteaseTermini = GetAttributeValue(searchHit, "num_tol_term", 2);

            sp.AddProtein(searchHit.Attribute("protein").Value);

            var NumTotalProteins = int.Parse(searchHit.Attribute("num_tot_proteins").Value);

            if (NumTotalProteins > 1)
            {
                var alternative_proteins = searchHit.FindDescendants("alternative_protein");
                foreach (var alternative_protein in alternative_proteins)
                {
                    sp.AddProtein(alternative_protein.Attribute("protein").Value);
                }
            }

            ParseScoreAndOtherInformation(sph, searchHit);
        }
        protected virtual void ShowPeptideInfo(IIdentifiedSpectrum mph)
        {
            var ratioFile = GetRatioFile(mph);

            if (ratioFile == null)
            {
                return;
            }

            try
            {
                if (this.peptideForm == null || this.peptideForm.IsDisposed)
                {
                    this.peptideForm = option.CreateForm();
                    this.peptideForm.UpdateParent = UpdateFile;
                }
                this.peptideForm.Show();
                this.peptideForm.SetSummaryFilename(ratioFile, mph);
                this.peptideForm.BringToFront();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private string GetSequence(IIdentifiedSpectrum sepc)
        {
            var pure   = sepc.GetMatchSequence();
            var result = new StringBuilder();
            var dic    = new Dictionary <char, int>();

            foreach (var c in pure)
            {
                if (Char.IsLetter(c))
                {
                    result.Append(c);
                }
                else
                {
                    if (dic.ContainsKey(c))
                    {
                        dic[c] = dic[c] + 1;
                    }
                    else
                    {
                        dic[c] = 1;
                    }
                }
            }

            return(string.Format("{0}_{1}", result.ToString(), (from k in dic.Keys
                                                                orderby k
                                                                select string.Format("{0}{1}", k, dic[k])).Merge("_")));
        }
Ejemplo n.º 11
0
        public void TestParse()
        {
            var format = new SequestPeptideTextFormat("\t\"File, Scan(s)\"\tSequence\tMH+\tDiff(MH+)\tCharge\tRank\tXC\tDeltaCn\tSp\tRSp\tIons\tReference\tDIFF_MODIFIED_CANDIDATE\tPI\tMissCleavage\tMatchedTIC");

            string spLine = "\tJWH_SAX_35_050906,10755\tK.GLEAEATY*PYEGKDGPCR.Y ! K.GLEAEATYPY*EGKDGPCR.Y\t2094.09819\t-1.27181\t2\t1\t2.71\t0.28\t127.40\t34\t15|51\tIPI:IPI00126770.2|SWISS-PROT:Q9R014|TREMBL:Q91XK6|REFSEQ_NP:NP_036137|ENSEMBL: ! IPI:IPI00126770.2|SWISS-PROT:Q9R014|TREMBL:Q91XK6|REFSEQ_NP:NP_036137|ENSEMBL:\tK.GLEAEAT*YPYEGKDGPCR.Y(2.6670,0.0154) ! K.GLEAEATYPY*EGKDGPCR.Y(2.5464,0.0599)\t4.41\t1\t100.01";
            IIdentifiedSpectrum peptide = format.PeptideFormat.ParseString(spLine);

            Assert.AreEqual("JWH_SAX_35_050906", peptide.Query.FileScan.Experimental);
            Assert.AreEqual(10755, peptide.Query.FileScan.FirstScan);
            Assert.AreEqual(10755, peptide.Query.FileScan.LastScan);
            Assert.AreEqual(2, peptide.Peptides.Count);
            Assert.AreEqual("K.GLEAEATY*PYEGKDGPCR.Y", peptide.Peptides[0].Sequence);
            Assert.AreEqual("K.GLEAEATYPY*EGKDGPCR.Y", peptide.Peptides[1].Sequence);
            Assert.AreEqual(2094.09819, peptide.TheoreticalMH);
            Assert.AreEqual(1, peptide.Rank);
            Assert.AreEqual(2.71, peptide.Score, 0.01);
            Assert.AreEqual(0.28, peptide.DeltaScore, 0.01);
            Assert.AreEqual(127.4, peptide.SpScore);
            Assert.AreEqual(34, peptide.SpRank);
            Assert.AreEqual(15, peptide.MatchedIonCount);
            Assert.AreEqual(51, peptide.TheoreticalIonCount);
            Assert.AreEqual(2, peptide.DiffModificationSiteCandidates.Count);
            Assert.AreEqual(1, peptide.NumMissedCleavages);

            Assert.AreEqual("K.GLEAEAT*YPYEGKDGPCR.Y", peptide.DiffModificationSiteCandidates[0].Sequence);
            Assert.AreEqual(2.6670, peptide.DiffModificationSiteCandidates[0].Score);
            Assert.AreEqual(0.0154, peptide.DiffModificationSiteCandidates[0].DeltaScore);

            Assert.AreEqual("K.GLEAEATYPY*EGKDGPCR.Y", peptide.DiffModificationSiteCandidates[1].Sequence);
            Assert.AreEqual(2.5464, peptide.DiffModificationSiteCandidates[1].Score);
            Assert.AreEqual(0.0599, peptide.DiffModificationSiteCandidates[1].DeltaScore);

            Assert.AreEqual(100.01, peptide.MatchedTIC, 0.01);
            Assert.AreEqual(spLine, format.PeptideFormat.GetString(peptide));
        }
Ejemplo n.º 12
0
        public void TestReadFromFile()
        {
            IIdentifiedResult ir = new SequestResultTextFormat().ReadFromFile(TestContext.CurrentContext.TestDirectory + "/../../../data/Standard_Protein_FIT_060222.noredundant");

            Assert.AreEqual(19, ir.Count);

            List <IIdentifiedProtein> prohits = ir.GetProteins();

            Assert.AreEqual(43, prohits.Count);

            List <IIdentifiedSpectrum> pephits = ir.GetSpectra();

            Assert.AreEqual(287, pephits.Count);

            IIdentifiedProtein protein1_1 = ir[0][0];

            Assert.AreEqual(1, protein1_1.GroupIndex);
            Assert.AreEqual("sp|P00489|PHS2_RABIT Glycogen phosphorylase, muscle form (EC 2.4.1.1) (Myophosphorylase) - Oryctolagus cuniculus (Rabbit).", protein1_1.Reference.Trim());
            Assert.AreEqual(97, protein1_1.Peptides.Count);

            IIdentifiedSpectrum pephit = protein1_1.Peptides[0].Spectrum;

            Assert.AreEqual(1689.886, pephit.TheoreticalMH, 0.001);
            Assert.AreEqual(3.8133, pephit.Score, 0.01);
            Assert.AreEqual(0.65, pephit.DeltaScore, 0.01);
            Assert.AreEqual(1602.8, pephit.SpScore, 0.1);
            Assert.AreEqual(1, pephit.SpRank);
            Assert.AreEqual(27, pephit.MatchedIonCount);
            Assert.AreEqual(52, pephit.TheoreticalIonCount);
            Assert.AreEqual("K.ARPEFTLPVHFYGR.V", protein1_1.Peptides[0].Sequence);
            Assert.AreEqual("Standard_Protein_FIT_060222,7066", protein1_1.Peptides[0].Spectrum.Query.FileScan.ShortFileName);
        }
        public void TestRead()
        {
            SrfXmlReader reader = new SrfXmlReader();
            List <IIdentifiedProtein> proteins = reader.ReadFromFile(TestContext.CurrentContext.TestDirectory + "/../../../data/searchresult.xml");

            Assert.AreEqual(2, proteins.Count);
            Assert.AreEqual("rat_mine", proteins[0].Reference);
            Assert.AreEqual(1.00E-30, proteins[0].Score);
            Assert.AreEqual(0.00, proteins[0].Coverage);
            Assert.AreEqual(142901.9, proteins[0].MolecularWeight);
            Assert.AreEqual("rat_mine", proteins[0].Name);

            Assert.AreEqual(160, proteins[0].Peptides.Count);

            IIdentifiedSpectrum peptide = proteins[0].Peptides[0].Spectrum;

            Assert.AreEqual("2006091402,1115 - 1126", peptide.Query.FileScan.ShortFileName);
            Assert.AreEqual("R.THSGTYQVTVR.I", peptide.Peptides[0].Sequence);
            Assert.AreEqual("rat_mine", peptide.Peptides[0].Proteins[0]);
            Assert.AreEqual(1248.63, peptide.TheoreticalMH, 0.01);
            Assert.AreEqual(0.01, peptide.TheoreticalMinusExperimentalMass, 0.01);
            Assert.AreEqual(3, peptide.Query.Charge);
            Assert.AreEqual(2.634, peptide.Score, 0.001);
            Assert.AreEqual(1.0, peptide.DeltaScore);
            Assert.AreEqual(1694.8, peptide.SpScore, 0.1);
            Assert.AreEqual(1, peptide.SpRank);
            Assert.AreEqual("37/80", peptide.Ions);
        }
        private string GetImageFilename(IIdentifiedSpectrum spectrum)
        {
            var jpgName = GetImageFileName(spectrum, "jpg");

            if (File.Exists(jpgName))
            {
                return(jpgName);
            }

            var pngName = GetImageFileName(spectrum, "png");

            if (File.Exists(pngName))
            {
                return(pngName);
            }

            var tiffName = GetImageFileName(spectrum, "tiff");

            if (File.Exists(tiffName))
            {
                return(tiffName);
            }

            return(string.Empty);
        }
        public QuantificationChromotograph Build(IIdentifiedSpectrum mphit, IRawFile reader)
        {
            QuantificationChromotograph result = new QuantificationChromotograph();

            var envelopes = builder.Build(mphit);

            int startScan = mphit.Query.FileScan.FirstScan;

            double mzTolerance = PrecursorUtils.ppm2mz(envelopes[0][0], ppmTolerance);

            bool bFirst = true;

            int firstScanNumber = reader.GetFirstSpectrumNumber();
            int lastScanNumber  = reader.GetLastSpectrumNumber();

            //backward
            for (int scan = startScan; scan >= firstScanNumber; scan--)
            {
                if (1 == reader.GetMsLevel(scan))
                {
                    QuantificationScan qscan = reader.GetPeakList(scan).GetQuantificationScan(envelopes, mzTolerance);

                    if (!validate(qscan))
                    {
                        break;
                    }

                    if (bFirst)
                    {
                        qscan.IsIdentified = true;
                        bFirst             = false;
                    }
                    result.Insert(0, qscan);
                }
            }

            //forward
            for (int scan = startScan + 1; scan <= lastScanNumber; scan++)
            {
                if (1 == reader.GetMsLevel(scan))
                {
                    QuantificationScan qscan = reader.GetPeakList(scan).GetQuantificationScan(envelopes, mzTolerance);

                    if (!validate(qscan))
                    {
                        break;
                    }

                    result.Add(qscan);
                }
            }

            if (result.Count > 0)
            {
                result.IdentifiedSpectra.Add(mphit);
            }

            return(result);
        }
Ejemplo n.º 16
0
 protected override void WritePeptide(StreamWriter sw, IIdentifiedSpectrum mph)
 {
     base.WritePeptide(sw, mph);
     if (ScanWriter != null)
     {
         ScanWriter.WriteToStream(sw, mph);
     }
 }
Ejemplo n.º 17
0
        public void TestParseFromMultipleCandidate()
        {
            IIdentifiedSpectrum peptide = ParseFromFile(@TestContext.CurrentContext.TestDirectory + "/../../../data//ZhouH_ML_050720_Nano_pH_02.29478.29478.2.out");

            Assert.IsNotNull(peptide);
            Assert.AreEqual("ZhouH_ML_050720_Nano_pH_02,29478", peptide.Query.FileScan.ShortFileName);
            Assert.AreEqual(2, peptide.Peptides.Count);
        }
        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 static void AddDuplicatedSpectrum(this IAnnotation ann, IIdentifiedSpectrum spectrum)
 {
     if (!ann.Annotations.ContainsKey(DUPLICATED_SPECTRA_KEY))
     {
         ann.Annotations[DUPLICATED_SPECTRA_KEY] = new List <IIdentifiedSpectrum>();
     }
     (ann.Annotations[DUPLICATED_SPECTRA_KEY] as List <IIdentifiedSpectrum>).Add(spectrum);
 }
Ejemplo n.º 20
0
        public override IEnumerable <string> Process(string filename)
        {
            var parser = new OutParser();

            string resultFilename;

            if (null == this.targetDir)
            {
                resultFilename = FileUtils.ChangeExtension(filename, ".xml");
            }
            else
            {
                resultFilename = targetDir + "/" + FileUtils.ChangeExtension(new FileInfo(filename).Name, ".xml");
            }


            using (PepXmlWriter writer = new PepXmlWriter("out"))
            {
                writer.Open(resultFilename);

                writer.OpenMsmsRunSummary(filename);

                SequestParam sp = new SequestParamFile().ReadFromFile(filename);

                writer.WriteSequestParam(sp);

                using (var reader = new OutsReader(filename))
                {
                    int totalCount = reader.FileCount;
                    Progress.SetRange(0, totalCount);
                    int currentCount = 0;

                    while (reader.HasNext)
                    {
                        if (Progress.IsCancellationPending())
                        {
                            throw new UserTerminatedException();
                        }

                        List <string>       contents = reader.NextContent();
                        IIdentifiedSpectrum sph      = parser.Parse(contents);
                        if (sph == null)
                        {
                            continue;
                        }

                        writer.WriteSequestPeptideHit(sph);

                        currentCount++;
                        Progress.SetPosition(currentCount);
                    }
                    Progress.SetPosition(totalCount);
                }
                writer.CloseMsmsRunSummary();
            }

            return(new[] { resultFilename });
        }
Ejemplo n.º 21
0
        public void ParseMaxQuantEvidencePeptide(IIdentifiedSpectrum spectrum)
        {
            var proteins = (spectrum.Annotations["Proteins"] as string).Split(';');

            foreach (var protein in proteins)
            {
                spectrum.Peptide.AddProtein(protein);
            }

            if (spectrum.Modifications == null || spectrum.Modifications.Equals("Unmodified"))
            {
                spectrum.Modifications = string.Empty;
            }

            if (spectrum.Annotations.ContainsKey("PEP"))
            {
                spectrum.ExpectValue = double.Parse(spectrum.Annotations["PEP"] as string);
            }

            spectrum.Query.FileScan.Experimental = spectrum.Annotations["Raw file"] as string;
            spectrum.Query.FileScan.FirstScan    = int.Parse(spectrum.Annotations["MS/MS Scan Number"] as string);
            spectrum.Query.FileScan.LastScan     = spectrum.Query.FileScan.FirstScan;
            spectrum.TheoreticalMass             = double.Parse(spectrum.Annotations["Mass"] as string);

            if (spectrum.Annotations.ContainsKey("MS/MS m/z"))
            {
                spectrum.ObservedMz = double.Parse(spectrum.Annotations["MS/MS m/z"] as string);
            }
            spectrum.Rank = 1;

            var newseq = spectrum.Sequence;
            var m      = modPattern.Match(newseq);

            while (m.Success)
            {
                var mod = m.Groups[1].Value;
                if (!moddic.ContainsKey(mod))
                {
                    moddic[mod] = modstring[moddic.Count];
                }
                var modc = moddic[mod];
                newseq = newseq.Replace(mod, modc.ToString());
                m      = m.NextMatch();
            }

            if (newseq.StartsWith("_"))
            {
                newseq = "-." + newseq.Substring(1);
            }
            if (newseq.EndsWith("_"))
            {
                newseq = newseq.Substring(0, newseq.Length - 1) + ".-";
            }

            spectrum.Peptide.Sequence = newseq;
            spectrum.Annotations.Clear();
        }
Ejemplo n.º 22
0
        public void TestReadFromFileMissingTerminalAminoacid()
        {
            IIdentifiedSpectrum peptide = ParseFromFile(@TestContext.CurrentContext.TestDirectory + "/../../../data//12228_15N_1_01.6027.6027.2.out");

            Assert.IsNotNull(peptide);
            Assert.AreEqual("12228_15N_1_01,6027", peptide.Query.FileScan.ShortFileName);
            Assert.AreEqual("K.EINEVDLQLK.X", peptide.Peptides[0].Sequence);
            Assert.AreEqual("SER0844", peptide.Peptides[0].Proteins[0]);
        }
 private SimplePeakChro SpectrumToChro(IIdentifiedSpectrum spectrum)
 {
     return(new SimplePeakChro()
     {
         Mz = spectrum.GetPrecursorMz(),
         Sequence = spectrum.Peptide.PureSequence,
         Charge = spectrum.Charge
     });
 }
Ejemplo n.º 24
0
        public static HashSet <string> GetSequencesSet(this IIdentifiedSpectrum spectrum)
        {
            HashSet <string> result = new HashSet <string>();

            foreach (var p in spectrum.Peptides)
            {
                result.Add(p.Sequence);
            }
            return(result);
        }
        public static void AssignNumProteaseTermini(this IProtease protease, IIdentifiedSpectrum s)
        {
            var counts = (from p in s.Peptides
                          let beforeChar = p.Sequence[0]
                                           let afterChar = p.Sequence[p.Sequence.Length - 1]
                                                           let c = protease.GetProteaseTerminiCount(beforeChar, p.PureSequence, afterChar, '-')
                                                                   select c).Distinct().ToList();

            s.NumProteaseTermini = counts.Max();
        }
Ejemplo n.º 26
0
        public bool MoveNext()
        {
            bool bParsingProtein = true;

            current = new IdentifiedProteinGroup();
            while (lastLine != null)
            {
                if (0 == lastLine.Trim().Length)
                {
                    break;
                }

                if (lastLine.StartsWith("$"))
                {
                    if (!bParsingProtein)
                    {
                        break;
                    }

                    IIdentifiedProtein protein = proteinFormat.ParseString(lastLine);

                    Match m = groupReg.Match(lastLine);
                    if (!m.Success)
                    {
                        throw new Exception("Error when paring group index from " + lastLine);
                    }

                    protein.GroupIndex = int.Parse(m.Groups[1].Value);

                    current.Add(protein);
                }
                else if (lastLine.StartsWith("@"))
                {
                    continue;
                }
                else
                {
                    bParsingProtein = false;
                    IIdentifiedSpectrum pephit = peptideFormat.ParseString(lastLine);
                    current.AddIdentifiedSpectrum(pephit);
                }

                lastLine = br.ReadLine();
            }

            if (current.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public string GetTargetFile(IIdentifiedSpectrum peptide)
        {
            var result = MyConvert.Format(@"{0}\{1}_{2}_{3}_{4}.chro.tsv",
                                          GetTargetDirectory(peptide),
                                          peptide.Query.FileScan.Experimental.Replace(" ", "_"),
                                          peptide.Peptide.PureSequence,
                                          Math.Round(peptide.GetTheoreticalMz()),
                                          peptide.Query.FileScan.FirstScan);

            return(new FileInfo(result).FullName);
        }
 private void UpdatePeptideColor(IIdentifiedSpectrum mph, ListViewItem item)
 {
     if (option.IsPeptideOutlier(mph))
     {
         item.BackColor = OUTLIER_COLOR;
     }
     else
     {
         item.BackColor = item.ListView.BackColor;
     }
 }
Ejemplo n.º 29
0
 public bool Accept(IIdentifiedSpectrum sph)
 {
     foreach (string protein in sph.Peptides[0].Proteins)
     {
         if (this.regex.Match(protein).Success)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 30
0
        private Color GetColor(IIdentifiedSpectrum sph)
        {
            foreach (ProteinClassificationFilter pcf in this.pcfs)
            {
                if (pcf.Accept(sph))
                {
                    return(pcf.PlotColor);
                }
            }

            return(Color.Black);
        }
    public void SetUp()
    {
      s1 = new IdentifiedSpectrum();
      s1.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11110";
      s1.Query.Charge = 2;
      s1.Score = 3.0;
      s1.AddPeptide(new IdentifiedPeptide(s1) { Sequence = "R.#VK*PDR.T" });

      s2 = new IdentifiedSpectrum();
      s2.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11110";
      s2.Query.Charge = 2;
      s2.Score = 2.0;
      s2.AddPeptide(new IdentifiedPeptide(s2) { Sequence = "R.#VK*PDR.T" });

      s3 = new IdentifiedSpectrum();
      s3.Score = 1.0;
      s3.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11110";
      s3.Query.Charge = 3;
      s3.AddPeptide(new IdentifiedPeptide(s3) { Sequence = "R.#VK*PDDEFER.T" });

      s4 = new IdentifiedSpectrum();
      s4.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11111";
      s4.Query.Charge = 3;
      s4.Score = 5.0;
      s4.AddPeptide(new IdentifiedPeptide(s4) { Sequence = "R.#VK*PDDSKEIEFER.T" });

      s5 = new IdentifiedSpectrum();
      s5.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11111";
      s5.Query.Charge = 3;
      s5.Score = 4.0;
      s5.AddPeptide(new IdentifiedPeptide(s5) { Sequence = "R.#VK*PEESKEIEFER.T" });

      s6 = new IdentifiedSpectrum();
      s6.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11111";
      s6.Query.Charge = 2;
      s6.Score = 3.0;
      s6.AddPeptide(new IdentifiedPeptide(s6) { Sequence = "R.#VK*PEESEFER.T" });

      s7 = new IdentifiedSpectrum();
      s7.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11111";
      s7.Query.Charge = 2;
      s7.Score = 3.0;
      s7.AddPeptide(new IdentifiedPeptide(s7) { Sequence = "R.#VKPEESEFER*.T" });
    }