public void BuildResult(Dictionary <string, MaxQuantModificationItem> shortModMap, string noredundantFile, string iniFile, List <IIdentifiedSpectrum> spectra)
        {
            var proteins = new IdentifiedProteinBuilder().Build(spectra);
            var groups   = new IdentifiedProteinGroupBuilder().Build(proteins);
            var ir       = new IdentifiedResultBuilder(DefaultAccessNumberParser.GetInstance(), "").Build(groups);

            new MascotResultTextFormat().WriteToFile(noredundantFile, ir);

            Aminoacids samAminoacids, refAminoacids;

            InitializeAminoacids(out samAminoacids, out refAminoacids);

            using (var sw = new StreamWriter(iniFile))
            {
                for (var idx = 0; idx < samAminoacids.Count; idx++)
                {
                    var samAA = samAminoacids[idx];
                    var refAA = refAminoacids[idx];
                    if (samAA.Visible)
                    {
                        sw.WriteLine("<{0}>\tSAM\tREF", samAA.OneName);
                        WriteAtom(sw, samAA, refAA, new[] { Atom.C }, "C");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.H }, "H");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.O }, "O");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.N }, "N");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.S }, "S");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.P }, "P");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.N15, Atom.Nx }, "15N");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.H2, Atom.Hx }, "2H");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.C13, Atom.Cx }, "13C");
                        WriteAtom(sw, samAA, refAA, new[] { Atom.O18, Atom.Ox }, "18O", false);
                        sw.WriteLine();
                    }
                }

                var terms = new[] { new MaxQuantModificationItem()
                                    {
                                        Symbol = "NTERM", Composition = new AtomComposition("H")
                                    },
                                    new MaxQuantModificationItem()
                                    {
                                        Symbol = "CTERM", Composition = new AtomComposition("OH")
                                    } };
                var usedMods = (from v in shortModMap.Values
                                orderby v.Symbol
                                select v).ToList();
                usedMods.AddRange(terms);

                foreach (var mod in usedMods)
                {
                    mod.WriteToSilacINI(sw);
                }
            }
        }
示例#2
0
        public override IEnumerable <string> Process(string fileName)
        {
            var proteins = ParseProteins(fileName);

            Progress.SetMessage("Building protein groups ...");
            var groups = new IdentifiedProteinGroupBuilder().Build(proteins);

            Progress.SetMessage("Building result ...");
            var ir = new IdentifiedResultBuilder(null, null).Build(groups);

            var result = FileUtils.ChangeExtension(fileName, ".noredundant");

            RefineModifications(ir);

            Progress.SetMessage("Saving result ...");
            new SequestResultTextFormat(SequestHeader.SEQUEST_PROTEIN_HEADER, SequestHeader.SEQUEST_PEPTIDE_HEADER + "\tModification").WriteToFile(result, ir);

            Progress.SetMessage("Finished.");

            return(new string[] { result });
        }
    public void TestBuild()
    {
      List<IIdentifiedSpectrum> spectra = new SequestPeptideTextFormat().ReadFromFile(@"../../../data/TestBuilder.peptides");
      Assert.AreEqual(4, spectra.Count);

      IAccessNumberParser parser = AccessNumberParserFactory.FindOrCreateParser(@"(IPI\d+)", "IPI");

      List<IIdentifiedProtein> proteins = new IdentifiedProteinBuilder().Build(spectra);
      Assert.AreEqual(4, proteins.Count);

      List<IIdentifiedProteinGroup> groups = new IdentifiedProteinGroupBuilder().Build(proteins);
      Assert.AreEqual(2, groups.Count);

      Assert.AreEqual(1, groups[0].Count);
      Assert.AreEqual("IPI:IPI00784154.1|SW", groups[0][0].Name);

      Assert.AreEqual(2, groups[1].Count);
      Assert.AreEqual("REVERSED_00000001", groups[1][0].Name);
      Assert.AreEqual("REVERSED_00000002", groups[1][1].Name);

      IIdentifiedResult result = new IdentifiedResultBuilder(parser,"").Build(groups);
    }