/** * Translate the data line to a {@link MZTabRecord}. * * NOTICE: Normally, we suggest user do convert operation after validate successfully. * * @see #parse(int, string, uk.ac.ebi.pride.jmztab.utils.errors.MZTabErrorList) */ protected MZTabRecord getRecord(Section section, string line) { MZTabRecord record = null; if (section.Equals(Section.Protein)){ record = new Protein(factory); } else if (section.Equals(Section.Peptide)){ record = new Peptide(factory, metadata); } else if (section.Equals(Section.PSM)){ record = new PSM(factory, metadata); } else if (section.Equals(Section.Small_Molecule)){ record = new SmallMolecule(factory, metadata); } int offset = loadStableData(record, line); if (offset == _items.Length - 1){ return record; } loadOptionalData(record, offset); return record; }
public object Clone() { PSM psm = new PSM(factory, metadata); psm.Sequence = Sequence; psm.PSM_ID = PSM_ID; psm.Accession = Accession; psm.Unique = Unique; psm.Database = Database; psm.DatabaseVersion = DatabaseVersion; psm.SearchEngine = SearchEngine; psm.SearchEngineScore = SearchEngineScore; psm.Reliability = Reliability; psm.Modifications = Modifications; psm.RetentionTime = RetentionTime; psm.Charge = Charge; psm.ExpMassToCharge = ExpMassToCharge; psm.CalcMassToCharge = CalcMassToCharge; psm.URI = URI; psm.SpectraRef = SpectraRef; psm.Post = Post; psm.Pre = Pre; psm.Start = Start; psm.End = End; return psm; }
/** * Add a PSM record. * * @param psm SHOULD NOT set null. */ public void addPSM(PSM psm) { if (psm == null){ throw new NullReferenceException("PSM record is null!"); } int position = psms.Count == 0 ? 1 : psms.Last().Key + 1; psms.Add(position, psm); }
/** * Add a PSM record. * * @param lineNumber SHOULD be positive integer * @param psm SHOULD NOT set null. * * @throws ArgumentException if there exists PSM object for assigned lineNumber */ public void addPSM(int lineNumber, PSM psm) { if (psm == null){ throw new NullReferenceException("PSM record is null!"); } if (lineNumber <= 0){ throw new ArgumentException("Line number should be positive integer"); } if (psms.ContainsKey(lineNumber)){ throw new ArgumentException("There already exist PSM record in line number " + lineNumber); } psms.Add(lineNumber, psm); }
private void addPSMValue() { Assay assay1 = new Assay(1); MZTabColumnFactory factory = MZTabColumnFactory.GetInstance(Section.PSM_Header); factory.AddOptionalColumn(assay1, "my_value", typeof (string)); CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null); factory.AddOptionalColumn(param, typeof (string)); Metadata metadata = new Metadata(); metadata.AddMsRunLocation(2, new Url("file://C:\\path\\to\\my\\file")); Console.WriteLine(factory); PSM psm = new PSM(factory, metadata); psm.Sequence = "KVPQVSTPTLVEVSR"; psm.SetPSM_ID("1"); psm.Accession = "P02768"; psm.Unique = MZBoolean.False; psm.Database = "UniProtKB"; psm.DatabaseVersion = "2011_11"; psm.setSearchEngine("[MS,MS:1001207,Mascot,]|[MS,MS:1001208,Sequest,]"); psm.setSearchEngineScore("[MS,MS:1001155,Sequest:xcorr,2]"); psm.setReliability("3"); psm.setModifications("CHEMMOD:+159.93"); psm.AddRetentionTime(10.2); psm.Charge = new Integer(2); psm.SetExpMassToCharge("1234.4"); psm.SetCalcMassToCharge("123.4"); psm.SetUri("http://www.ebi.ac.uk/pride/link/to/peptide"); psm.SetSpectraRef("ms_run[2]:index=7|ms_run[2]:index=9"); psm.Pre = "K"; psm.Post = "D"; psm.Start = "45"; psm.End = "57"; Console.WriteLine(psm); }