public override IEnumerable <string> Process(string filename) { string[] files = new string[splitCount]; MascotResultDtaselectFormat dtaSelectFormat = new MascotResultDtaselectFormat(); Progress.SetMessage("Reading document ..."); IIdentifiedResult mr = dtaSelectFormat.ReadFromFile(filename); Progress.SetRange(0, splitCount); for (int i = 0; i < splitCount; i++) { files[i] = FileUtils.ChangeExtension(filename, (i + 1).ToString() + new FileInfo(filename).Extension); MascotResult curMr = new MascotResult(); for (int j = 0; j < mr.Count; j++) { if (j % splitCount == i) { curMr.Add(mr[j]); } } Progress.SetMessage("Writing document " + files[i] + " ..."); dtaSelectFormat.WriteToFile(files[i], curMr); Progress.SetPosition(i + 1); } Progress.End(); return(new List <string>(files)); }
public void TestGetAnnotationKeys() { string key1 = "TEST1"; string key2 = "TEST2"; var mph1 = new IdentifiedSpectrum(); mph1.Annotations.Add(key1, null); mph1.Query.FileScan.Experimental = "EXP1"; new IdentifiedPeptide(mph1); var mph2 = new IdentifiedSpectrum(); mph2.Annotations.Add(key2, null); mph2.Query.FileScan.Experimental = "EXP2"; new IdentifiedPeptide(mph2); mph1.Peptide.Sequence = "SEQ1"; mph2.Peptide.Sequence = "SEQ2"; var protein = new IdentifiedProtein(); protein.Peptides.Add(mph1.Peptide); protein.Peptides.Add(mph2.Peptide); var mpg = new IdentifiedProteinGroup(); mpg.Add(protein); var mr = new MascotResult(); mr.Add(mpg); List<string> annotationKeys = AnnotationUtils.GetAnnotationKeys(mr.GetSpectra()); Assert.AreEqual(2, annotationKeys.Count); Assert.IsTrue(annotationKeys.Contains(key1)); Assert.IsTrue(annotationKeys.Contains(key2)); }