コード例 #1
0
        /**
         * Add a SmallMolecule record.
         *
         * @param lineNumber SHOULD be positive integer
         * @param smallMolecule SHOULD NOT set null.
         *
         * @throws ArgumentException  if there exists SmallMolecule object for assigned lineNumber
         */
        public void addSmallMolecule(int lineNumber, SmallMolecule smallMolecule)
        {
            if (smallMolecule == null){
                throw new NullReferenceException("Small Molecule record is null!");
            }
            if (lineNumber <= 0){
                throw new ArgumentException("Line number should be positive integer");
            }
            if (smallMolecules.ContainsKey(lineNumber)){
                throw new ArgumentException("There already exist small molecule record in line number " +
                                            lineNumber);
            }

            smallMolecules.Add(lineNumber, smallMolecule);
        }
コード例 #2
0
        /**
         * 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;
        }
コード例 #3
0
        /**
         * Add a Small Molecule record.
         *
         * @param smallMolecule SHOULD NOT set null.
         */
        public void addSmallMolecule(SmallMolecule smallMolecule)
        {
            if (smallMolecule == null){
                throw new NullReferenceException("Small Molecule record is null!");
            }

            int position = smallMolecules.Count == 0 ? 1 : smallMolecules.Last().Key + 1;
            smallMolecules.Add(position, smallMolecule);
        }