Ejemplo n.º 1
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);
        }
        /**
         * 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;
        }
Ejemplo n.º 3
0
        public object Clone()
        {
            Peptide peptide = new Peptide(base.factory, this.metadata);
            peptide.Sequence = Sequence;
            peptide.Accession = Accession;
            peptide.Unique = Unique;
            peptide.Database = Database;
            peptide.DatabaseVersion = DatabaseVersion;
            peptide.SearchEngine = SearchEngine;
            peptide.BestSearchEngineScore = BestSearchEngineScore;
            //TODO: peptide.setSearchEngineScore();
            peptide.Reliability = Reliability;
            peptide.Modifications = Modifications;
            peptide.RetentionTime = RetentionTime;
            peptide.RetentionTimeWindow = RetentionTimeWindow;
            peptide.Charge = Charge;
            peptide.MassToCharge = MassToCharge;
            peptide.URI = URI;
            peptide.SpectraRef = SpectraRef;

            return peptide;
        }
Ejemplo n.º 4
0
        /**
         * Add a Peptide record.
         *
         * @param peptide SHOULD NOT set null.
         */
        public void addPeptide(Peptide peptide)
        {
            if (peptide == null){
                throw new NullReferenceException("Peptide record is null!");
            }

            int position = peptides.Count == 0 ? 1 : peptides.Last().Key + 1;
            peptides.Add(position, peptide);
        }
Ejemplo n.º 5
0
        /**
         * Add a Peptide record.
         *
         * @param lineNumber SHOULD be positive integer
         * @param peptide SHOULD NOT set null.
         *
         * @throws ArgumentException  if there exists Peptide object for assigned lineNumber
         */
        public void addPeptide(int lineNumber, Peptide peptide)
        {
            if (peptide == null){
                throw new NullReferenceException("Peptide record is null!");
            }
            if (lineNumber <= 0){
                throw new ArgumentException("Line number should be positive integer");
            }
            if (peptides.ContainsKey(lineNumber)){
                throw new ArgumentException("There already exist peptide record in line number " + lineNumber);
            }

            peptides.Add(lineNumber, peptide);
        }