public MsRunImpl(MsRun run) : base(run.Id) { Format = run.Format; IdFormat = run.IdFormat; FragmentationMethod = run.FragmentationMethod; Location = run.Location; }
/** * Creates a new SpectraRef object. * * @param reference The reference to the spectrum in the MS fiile. */ public SpectraRef(MsRun msRun, string reference) { if (msRun == null){ throw new NullReferenceException("msRun can not null!"); } if (reference == null){ throw new NullReferenceException("msRun reference can not empty!"); } this.msRun = msRun; this.reference = reference; }
private void addPeptideValue() { MsRun msRun1 = new MsRun(1); Assay assay1 = new Assay(1); Assay assay2 = new Assay(2); StudyVariable studyVariable1 = new StudyVariable(1); MZTabColumnFactory factory = MZTabColumnFactory.GetInstance(Section.Peptide_Header); factory.AddOptionalColumn(PeptideColumn.SEARCH_ENGINE_SCORE, msRun1); factory.AddAbundanceOptionalColumn(assay1); factory.AddAbundanceOptionalColumn(studyVariable1); factory.AddAbundanceOptionalColumn(assay2); factory.AddOptionalColumn(msRun1, "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); Peptide peptide = new Peptide(factory, metadata); peptide.Sequence = "KVPQVSTPTLVEVSR"; peptide.Accession = "P02768"; peptide.SetUnique("0"); peptide.Database = "UniProtKB"; peptide.DatabaseVersion = "2011_11"; peptide.SetSearchEngine("[MS,MS:1001207,Mascot,]|[MS,MS:1001208,Sequest,]"); peptide.SetBestSearchEngineScore("[MS,MS:1001155,Sequest:xcorr,2]"); peptide.Reliability = Reliability.findReliability("3"); peptide.SetModifications( "3[MS,MS:1001876, modification probability, 0.8]|4[MS,MS:1001876, modification probability, 0.2]-MOD:00412,8[MS,MS:1001876, modification probability, 0.3]-MOD:00412"); peptide.AddRetentionTime(10.2); peptide.AddRetentionTimeWindow(1123.2); peptide.AddRetentionTimeWindow(1145.3); peptide.Charge = new Integer(2); peptide.MassToCharge = 1234.4; peptide.URI = new Uri("http://www.ebi.ac.uk/pride/link/to/peptide"); peptide.SetSpectraRef("ms_run[2]:index=7|ms_run[2]:index=9"); Console.WriteLine(peptide); }
public bool AddAssayMsRun(int id, MsRun msRun) { Assay assay; if (!_assayMap.ContainsKey(id)){ assay = new Assay(id){MsRun = msRun}; _assayMap.Add(id, assay); return true; } assay = _assayMap[id]; assay.MsRun = msRun; return true; }
public void AddMsRun(MsRun msRun) { _msRunMap.Add(msRun.Id, msRun); }
public SplitList<Param> getSearchEngineScore(MsRun msRun) { return GetSplitList<Param>(getPosition(SmallMoleculeColumn.SEARCH_ENGINE_SCORE, msRun)); }
public void setNumPSMs(MsRun msRun, Integer numPSMs) { setNumPSMs(getLogicalPosition(ProteinColumn.NUM_PSMS, null, msRun), numPSMs.ToString()); }
/** * The search engine score for the given protein in the defined ms run. The type of score * MUST be defined in the metadata section. If the protein was not identified by the specified * search engine “null” must be reported * * @param id protein_search_engine_score[id] which MUST be defined in the metadata section. * @param msRun SHOULD NOT set null */ public Double getSearchEngineScore(Integer id, MsRun msRun) { return getDouble(getLogicalPosition(PeptideColumn.SEARCH_ENGINE_SCORE, id, msRun)); }
public void SetSearchEngineScore(MsRun msRun, SplitList<Param> searchEngineScore) { SetSearchEngineScore(getPosition(PeptideColumn.SEARCH_ENGINE_SCORE, msRun), searchEngineScore); }
/** * Add {@link CVParamOptionColumn} followed by ms_run into {@link #optionalColumnMapping} and {@link #columnMapping}. * The header like: opt_ms_run[1]_cv_{accession}_{parameter name} * * @param msRun SHOULD NOT empty. * @param param SHOULD NOT empty. * @param columnType SHOULD NOT empty. */ public string AddOptionalColumn(MsRun msRun, CVParam param, Type columnType) { MZTabColumn column = new CVParamOptionColumn(msRun, param, columnType, ParseColumnOrder(columnMapping.Last().Key)); return AddOptionColumn(column); }
public bool AddMsRunLocation(int id, Url location) { MsRun msRun; if (!_msRunMap.ContainsKey(id)){ msRun = new MsRun(id){Location = location}; _msRunMap.Add(id, msRun); return true; } msRun = _msRunMap[id]; if (msRun.Location != null){ return false; } msRun.Location = location; return true; }
/** * Add a optional column which has stable order and name, into {@link #optionalColumnMapping} and {@link #columnMapping}. * * @see MZTabColumn#createOptionalColumn(Section, MZTabColumn, IndexedElement) * * @exception ArgumentException: If user would like to add duplicate optional columns. * @param column SHOULD NOT set null. * @param msRun SHOULD NOT set null. */ public void AddOptionalColumn(MZTabColumn column, MsRun msRun) { string position = column.LogicPosition; if (optionalColumnMapping.ContainsKey(position)){ throw new ArgumentException("There exists column " + optionalColumnMapping[position] + " in position " + position); } MZTabColumn newColumn = null; /*if (section.Equals(Section.Protein_Header)){ if (position.Equals("09") || position.Equals("11") || position.Equals("12") || position.Equals("13")){ newColumn = MZTabColumn.CreateOptionalColumn(section, column, msRun); } } else if (section.Equals(Section.Peptide_Header)){ if (position.Equals("08")){ newColumn = MZTabColumn.CreateOptionalColumn(section, column, msRun); } } else if (section.Equals(Section.Small_Molecule_Header)){ if (position.Equals("19")){ newColumn = MZTabColumn.CreateOptionalColumn(section, column, msRun); } }*/ if (section.Equals(Section.Protein_Header)) { if (column.Name.Equals(ProteinColumn.NUM_PSMS.Name) || column.Name.Equals(ProteinColumn.NUM_PEPTIDES_DISTINCT.Name) || column.Name.Equals(ProteinColumn.NUM_PEPTIDES_UNIQUE.Name)) { newColumn = MZTabColumn.CreateOptionalColumn(section, column, null, msRun); } } if (newColumn != null){ optionalColumnMapping.Add(newColumn.LogicPosition, newColumn); columnMapping.Add(newColumn.LogicPosition, newColumn); } }
/** * Add {@link OptionColumn} followed by ms_run into {@link #optionalColumnMapping} and {@link #columnMapping}. * The header like: opt_ms_run[1]_{name} * * @param msRun SHOULD NOT empty. * @param name SHOULD NOT empty. * @param columnType SHOULD NOT empty. */ public string AddOptionalColumn(MsRun msRun, String name, Type columnType) { MZTabColumn column = new OptionColumn(msRun, name, columnType, ParseColumnOrder(columnMapping.Last().Key)); return AddOptionColumn(column); }
public void setSearchEngineScore(MsRun msRun, SplitList<Param> searchEngineScore) { setSearchEngineScore(getPosition(ProteinColumn.SEARCH_ENGINE_SCORE, msRun), searchEngineScore); }
public void setNumPSMs(MsRun msRun, string numPSMsLabel) { setNumPSMs(msRun, MZTabUtils.ParseInteger(numPSMsLabel)); }
public void setNumPSMs(MsRun msRun, int numPSMs) { setNumPSMs(getPosition(ProteinColumn.NUM_PSMS, msRun), numPSMs); }
public bool AddMsRunFragmentationMethod(int id, Param fragmentationMethod) { MsRun msRun; if (!_msRunMap.ContainsKey(id)){ msRun = new MsRun(id){FragmentationMethod = fragmentationMethod}; _msRunMap.Add(id, msRun); return true; } msRun = _msRunMap[id]; if (msRun.FragmentationMethod != null){ return false; } msRun.FragmentationMethod = fragmentationMethod; return true; }
/** Add {@link SearchEngineScore} followed by {@link MsRun} (MsRun will be null in the PSM section) which has stable order and name, * into {@link #optionalColumnMapping} and {@link #columnMapping}. * * @param column search_engine_score column to add. SHOULD NOT set null. * @param id of the {section}_search_engine_score[id] param defined in {@link Metadata} for this column. SHOULD NOT set null. * @param msRun {@link MsRun} for this search_engine_score * * The header will be represented as: search_engine_score[id]{_ms_run[1-n]} */ public void AddSearchEngineScoreOptionalColumn(MZTabColumn column, Integer id, MsRun msRun) { String position = column.LogicPosition; if (optionalColumnMapping.ContainsKey(position)) { throw new ArgumentOutOfRangeException("There exists column " + optionalColumnMapping[position] + " in position " + position); } MZTabColumn newColumn = null; if (section.Equals(Section.Protein_Header)){ if (column.Name.Equals(ProteinColumn.SEARCH_ENGINE_SCORE.Name)) { newColumn = MZTabColumn.CreateOptionalColumn(section, column, id, msRun); } } else if (section.Equals(Section.Peptide_Header)){ if (column.Name.Equals(PeptideColumn.SEARCH_ENGINE_SCORE.Name)) { newColumn = MZTabColumn.CreateOptionalColumn(section, column, id, msRun); } }else if (section.Equals(Section.Small_Molecule_Header)){ if (column.Name.Equals(SmallMoleculeColumn.SEARCH_ENGINE_SCORE.Name)) { newColumn = MZTabColumn.CreateOptionalColumn(section, column, id, msRun); } }else if (section.Equals(Section.PSM_Header)){ if (column.Name.Equals(PSMColumn.SEARCH_ENGINE_SCORE.Name)) { newColumn = MZTabColumn.CreateOptionalColumn(section, column, id, null); } } if (newColumn != null) { optionalColumnMapping.Add(newColumn.LogicPosition, newColumn); columnMapping.Add(newColumn.LogicPosition, newColumn); } }
public bool AddMsRunIdFormat(int id, Param idFormat) { MsRun msRun; if (!_msRunMap.ContainsKey(id)){ msRun = new MsRun(id){IdFormat = idFormat}; _msRunMap.Add(id, msRun); return true; } msRun = _msRunMap[id]; if (msRun.IdFormat != null){ return false; } msRun.IdFormat = idFormat; return true; }
public void setNumPeptidesUnique(MsRun msRun, int numPeptidesUnique) { setNumPeptidesUnique(getPosition(ProteinColumn.NUM_PEPTIDES_UNIQUE, msRun), numPeptidesUnique); }
public bool AddSearchEngineScore(MsRun msRun, CVParam param) { if (param == null){ return false; } SplitList<Param> searchparams = getSearchEngineScore(msRun); if (searchparams == null){ searchparams = new SplitList<Param>(MZTabConstants.BAR); SetSearchEngineScore(msRun, searchparams); } searchparams.Add(param); return true; }
private void addSmallMoleculeValue() { MsRun msRun1 = new MsRun(1); Assay assay1 = new Assay(1); Assay assay2 = new Assay(2); StudyVariable studyVariable1 = new StudyVariable(1); MZTabColumnFactory factory = MZTabColumnFactory.GetInstance(Section.Small_Molecule); factory.AddAbundanceOptionalColumn(assay1); factory.AddAbundanceOptionalColumn(studyVariable1); factory.AddAbundanceOptionalColumn(assay2); factory.AddOptionalColumn(msRun1, "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); /*TODO: SmallMolecule sm = new SmallMolecule(factory, metadata); sm.setIdentifier("CID:00027395"); sm.setChemicalFormula("C17H20N4O2"); sm.setSmiles("C1=CC=C(C=C1)CCNC(=O)CCNNC(=O)C2=CC=NC=C2"); sm.setInchiKey("QXBMEGUKVLFJAM-UHFFFAOYSA-N"); sm.setDescription("N-(2-phenylethyl)-3-[2-(pyridine-4-carbonyl)hydrazinyl]propanamide"); sm.setExpMassToCharge("1234.4"); sm.setCalcMassToCharge("1234.5"); sm.setCharge("2"); sm.setRetentionTime("10.2|11.5"); sm.setTaxid("10116"); sm.setSpecies("Rattus norvegicus (Rat)"); sm.setDatabase("UniProtKB"); sm.setDatabaseVersion("2011_11"); sm.setReliability("2"); sm.setURI("http://www.ebi.ac.uk/pride/link/to/identification"); sm.setSpectraRef("ms_run[2]:index=7|ms_run[2]:index=9"); sm.setSearchEngine("[MS, MS:1001477, SpectraST,]"); sm.setBestSearchEngineScore("[MS, MS:1001419, SpectraST:discriminant score F, 0.7]"); sm.setModifications("CHEMMOD:+Na-H"); Console.WriteLine(sm);*/ }
/** * The search engine score for the given protein in the defined ms run. The type of score * MUST be defined in the metadata section. If the protein was not identified by the specified * search engine “null” must be reported * * @param id protein_search_engine_score[id] which MUST be defined in the metadata section. * @param msRun SHOULD NOT set null */ public void setSearchEngineScore(Integer id, MsRun msRun, double searchEngineScore) { setValue(getLogicalPosition(PeptideColumn.SEARCH_ENGINE_SCORE, id, msRun), searchEngineScore); }
public void setSearchEngineScore(MsRun msRun, string paramsLabel) { setSearchEngineScore(msRun, MZTabUtils.ParseParamList(paramsLabel)); }
public bool addSearchEngineScore(MsRun msRun, CVParam param) { if (param == null){ return false; } SplitList<Param> paramList = getSearchEngineScore(msRun); if (paramList == null){ paramList = new SplitList<Param>(MZTabConstants.BAR); setSearchEngineScore(msRun, paramList); } paramList.Add(param); return true; }
public void setNumPeptidesDistinct(MsRun msRun, string numPeptidesDistinct) { setNumPeptidesDistinct(msRun, MZTabUtils.ParseInteger(numPeptidesDistinct)); }
public void setSearchEngineScore(MsRun msRun, SplitList<Param> searchEngineScore) { setValue(getPosition(SmallMoleculeColumn.SEARCH_ENGINE_SCORE, msRun), searchEngineScore); }
public void setNumPeptidesUnique(MsRun msRun, string numPeptidesUnique) { setNumPeptidesUnique(msRun, MZTabUtils.ParseInteger(numPeptidesUnique)); }
private string MsRunToString(MsRun msrun) { return string.Format("[{0}] {1}", msrun.Id, msrun is MsRunImpl ? (msrun as MsRunImpl).Description : Path.GetFileNameWithoutExtension(msrun.Location.Value)); }
private void addProteinValue() { MsRun msRun1 = new MsRun(1); MsRun msRun2 = new MsRun(2); Assay assay1 = new Assay(1); Assay assay2 = new Assay(2); StudyVariable studyVariable1 = new StudyVariable(1); MZTabColumnFactory factory = MZTabColumnFactory.GetInstance(Section.Protein_Header); factory.AddOptionalColumn(ProteinColumn.SEARCH_ENGINE_SCORE, msRun1); factory.AddOptionalColumn(ProteinColumn.NUM_PSMS, msRun1); factory.AddOptionalColumn(ProteinColumn.NUM_PEPTIDES_DISTINCT, msRun1); factory.AddOptionalColumn(ProteinColumn.NUM_PEPTIDES_UNIQUE, msRun1); factory.AddOptionalColumn(ProteinColumn.NUM_PSMS, msRun2); factory.AddOptionalColumn(ProteinColumn.NUM_PEPTIDES_DISTINCT, msRun2); factory.AddAbundanceOptionalColumn(assay1); factory.AddAbundanceOptionalColumn(studyVariable1); factory.AddAbundanceOptionalColumn(assay2); factory.AddOptionalColumn(assay1, "my_value", typeof (string)); CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null); factory.AddOptionalColumn(param, typeof (string)); Console.WriteLine(factory); Protein protein = new Protein(factory); // set stable columns data. protein.Accession = "P12345"; protein.Description = "Aspartate aminotransferase, mitochondrial"; protein.SetTaxid("10116"); protein.Species = "Rattus norvegicus (Rat)"; protein.Database = "UniProtKB"; protein.DatabaseVersion = "2011_11"; protein.SetSearchEngine("[MS,MS:1001207,Mascot,]"); protein.AddSearchEngine("[MS,MS:1001208,Sequest,]"); protein.SetBestSearchEngineScore("[MS,MS:1001171,Mascot score,50]|[MS,MS:1001155,Sequest:xcorr,2]"); protein.Reliability = Reliability.High; protein.SetAmbiguityMembers("P12347,P12348"); protein.SetModifications("3|4|8-MOD:00412, 3|4|8-MOD:00412"); protein.SetURI("http://www.ebi.ac.uk/pride/url/to/P12345"); protein.SetGOTerms("GO:0006457|GO:0005759|GO:0005886|GO:0004069"); protein.SetProteinCoverage("0.4"); Console.WriteLine(protein); // set optional columns which have stable order. protein.setSearchEngineScore(msRun1, "[MS,MS:1001171,Mascot score,50]|[MS,MS:1001155,Sequest:xcorr,2]"); protein.setNumPSMs(msRun1, 4); protein.setNumPSMs(msRun2, 2); protein.setNumPeptidesDistinct(msRun1, 3); protein.setNumPeptidesUnique(msRun1, 2); Console.WriteLine(protein); // set abundance columns protein.setAbundanceColumn(assay1, "0.4"); protein.setAbundanceColumn(assay2, "0.2"); protein.setAbundanceColumn(studyVariable1, "0.4"); protein.setAbundanceStdevColumn(studyVariable1, "0.3"); protein.setAbundanceStdErrorColumn(studyVariable1, "0.2"); Console.WriteLine(protein); // set user defined optional columns protein.setOptionColumn(assay1, "my_value", "My value about assay[1]"); protein.setOptionColumn(param, "TOM value"); Console.WriteLine(protein); }