public static string GetHeader(IndexedElement element, CVParam param)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(OPT).Append("_").Append(element == null ? GLOBAL : element.Reference);
            sb.Append("_").Append(CV).Append(param.Accession).Append("_").Append(param.Name.Replace(" ", "_"));

            return sb.ToString();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);*/
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
 public void AddPosition(int id, CVParam param)
 {
     _positionMap.Add(id, param);
 }
 /**
  * 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);
 }
Exemplo n.º 10
0
 /**
  * Add {@link CVParamOptionColumn} followed by study variable into {@link #optionalColumnMapping} and {@link #columnMapping}.
  * The header like: opt_study_variable[1]_cv_{accession}_{parameter name}
  *
  * @param studyVariable SHOULD NOT empty.
  * @param param SHOULD NOT empty.
  * @param columnType SHOULD NOT empty.
  */
 public string AddOptionalColumn(StudyVariable studyVariable, CVParam param, Type columnType)
 {
     MZTabColumn column = new CVParamOptionColumn(studyVariable, param, columnType,
                                                  ParseColumnOrder(columnMapping.Last().Key));
     return AddOptionColumn(column);
 }
        /**
         * Some {@link CVParamOptionColumn}, their data type have defined. Currently, we provide two {@link CVParam}
         * which defined in the mzTab specification. One is "emPAI value" (MS:1001905), data type is Double;
         * another is "decoy peptide" (MS:1002217), the data type is Boolean (0/1). Besides them, "opt_" start optional
         * column data type is string.
         *
         * @see #checkOptColumnName(string)
         */
        private Type getDataType(CVParam param)
        {
            Type dataType;

            if (param == null){
                dataType = typeof (string);
            }
            else if (param.Accession.Equals("MS:1001905")){
                dataType = typeof (double);
            }
            else if (param.Accession.Equals("MS:1002217")){
                dataType = typeof (MZBoolean);
            }
            else{
                dataType = typeof (string);
            }

            return dataType;
        }
 public CVParamOptionColumn(IndexedElement element, CVParam param, System.Type columnType, int offset)
     : base(element, CV + param.Accession + "_" + param.Name.Replace(" ", "_"), columnType, offset)
 {
     this.param = param;
 }