001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021
022package org.biojavax.bio.seq.io;
023
024import java.util.ArrayList;
025import java.util.Iterator;
026import java.util.List;
027
028import org.biojava.bio.seq.io.ParseException;
029import org.biojavax.Comment;
030
031
032/**
033 *
034 * @author Richard Holland
035 * @since 1.5
036 */
037public class UniProtCommentParser {
038    
039    /**
040     * Creates a new instance of UniProtCommentParser.
041     */
042    public UniProtCommentParser() {
043        this.interactions = new ArrayList();
044        this.isoforms = new ArrayList();
045        this.events = new ArrayList();
046        this.KMs = new ArrayList();
047        this.VMaxes = new ArrayList();
048        this.seqCautions = new ArrayList();
049    }
050    
051    // the prefix for comments
052    private static final String PREFIX = "-!-";
053    
054    /**
055     * A name for a comment type.
056     */
057    public static final String BIOPHYSICOCHEMICAL_PROPERTIES = "BIOPHYSICOCHEMICAL PROPERTIES";
058    
059    /**
060     * A name for a comment type.
061     */
062    public static final String DATABASE = "DATABASE";
063    
064    /**
065     * A name for a comment type.
066     */
067    public static final String MASS_SPECTROMETRY = "MASS SPECTROMETRY";
068    
069    /**
070     * A name for a comment type.
071     */
072    public static final String ALTERNATIVE_PRODUCTS = "ALTERNATIVE PRODUCTS";
073    
074    /**
075     * A name for a comment type.
076     */
077    public static final String INTERACTION = "INTERACTION";
078    
079    /**
080     * A name for a comment type.
081     */
082    public static final String PTM = "PTM";
083    
084    /**
085     * A name for a comment type.
086     */
087    public static final String SEQUENCE_CAUTION = "SEQUENCE CAUTION";
088    
089    /**
090     * Parses the comment string from the given comment and populates
091     * the internal fields appropriately.  If the comment is not a
092     * UniProt comment (does not start with -!-) then an exception is
093     * thrown.
094     * @param c the comment to parse.
095     * @throws ParseException if the comment was not parseable.
096     */
097    public void parseComment(Comment c) throws ParseException {
098        this.parseComment(c.getComment());
099    }
100    
101    /**
102     * Parses the comment string from the given comment and populates
103     * the internal fields appropriately. If the comment is not a
104     * UniProt comment (does not start with -!-) then an exception is
105     * thrown.
106     * @param c the comment to parse.
107     * @throws ParseException if the comment was not parseable.
108     */
109    public void parseComment(String c) throws ParseException {
110        if (!isParseable(c)) throw new ParseException("Comment is not a UniProt structured comment. Comment was "+c);
111        
112        String comment = new String(c); //keep the original just in case...
113        // do the parsing here.
114        try{
115            c = c.replaceAll("\\s+", " ").trim(); // replace all multi-spaces and newlines with single spaces
116            // our comment is now one long string, -!- TYPE: [prefix: key=value; | key=value; | text]
117            c = c.substring(PREFIX.length()+1); // chomp "-!- "
118            String type = c.substring(0,c.indexOf(':')); // find type
119            this.setCommentType(type); // remember type
120            c = c.substring(c.indexOf(':')+1); // chomp type and colon
121            if (c.endsWith(".")) c=c.substring(0,c.length()-1); // chomp trailing full stop
122            
123            // what we have left is the [prefix: key=value; | key=value; | text.] section
124            if (this.getCommentType().equalsIgnoreCase(BIOPHYSICOCHEMICAL_PROPERTIES)) {
125            /*
126CC   -!- BIOPHYSICOCHEMICAL PROPERTIES:
127CC       Absorption:
128CC         Abs(max)=xx nm;
129CC         Note=free_text;
130CC       Kinetic parameters:
131CC         KM=xx unit for substrate [(free_text)];
132CC         Vmax=xx unit enzyme [free_text];
133CC         Note=free_text;
134CC       pH dependence:
135CC         free_text;
136CC       Redox potential:
137CC         free_text;
138CC       Temperature dependence:
139CC         free_text;
140             */
141                do {
142                    String[] parts = c.split(";");
143                    if (parts.length==1) {
144                        // we are one of the last three options on the list
145                        int firstColon = parts[0].indexOf(':');
146                        String key = parts[0].substring(0,firstColon).trim();
147                        String value = parts[0].substring(firstColon+1).trim();
148                        if (key.equalsIgnoreCase("pH dependence")) this.setPHDependence(value);
149                        else if (key.equalsIgnoreCase("Redox potential")) this.setRedoxPotential(value);
150                        else if (key.equalsIgnoreCase("Temperature dependence")) this.setTemperatureDependence(value);
151                        // skip to next chunk
152                        c = c.substring(c.indexOf(";")+1);
153                    } else {
154                        // we are one of the first two options on the list
155                        int skippos = -1;
156                        String key = parts[0].split(":")[0].trim();
157                        if (key.equalsIgnoreCase("Absorption")) {
158                            String[] subparts = parts[0].split(":")[1].split("=");
159                            this.setAbsorptionMax(subparts[1].trim());
160                            subparts = parts[1].split("=");
161                            this.setAbsorptionNote(subparts[1].trim());
162                            skippos = 2;
163                        } else if (key.equalsIgnoreCase("Kinetic parameters")) {
164                            int partCount = 0;
165                            String[] subparts = parts[partCount].split(":")[1].split("=");
166                            key = subparts[0].trim();
167                            String value = subparts[1].trim();
168                            while (!key.equalsIgnoreCase("Note")) {
169                                if (key.equalsIgnoreCase("KM")) this.getKMs().add(value);
170                                else if (key.equalsIgnoreCase("VMax")) this.getVMaxes().add(value);
171                                subparts = parts[++partCount].split("=");
172                                key = subparts[0].trim();
173                                value = subparts[1].trim();
174                            }
175                            this.setKineticsNote(value);
176                        }
177                        // skip to next chunk
178                        int chunkpos = c.indexOf(parts[skippos]);
179                        c = c.substring(chunkpos);
180                    }
181                    c = c.trim();
182                } while (c.length()>0);
183            } else if (this.getCommentType().equalsIgnoreCase(DATABASE)) {
184            /*
185CC   -!- DATABASE: NAME=Text[; NOTE=Text][; WWW="Address"][; FTP="Address"].
186             */
187                c = c.substring(0,c.length()-1); // chomp trailing dot
188                String[] parts = c.split(";");
189                for (int i = 0; i < parts.length; i++) {
190                    String[] subparts = parts[i].split("=");
191                    String key = subparts[0].trim();
192                    String value = subparts[1].trim();
193                    if (key.equalsIgnoreCase("NAME")) this.setDatabaseName(value);
194                    else if (key.equalsIgnoreCase("NOTE")) this.setNote(value);
195                    else if (key.equalsIgnoreCase("WWW") || key.equalsIgnoreCase("FTP")) this.setUri(value);
196                }
197            } else if (this.getCommentType().equalsIgnoreCase(MASS_SPECTROMETRY)) {
198            /*
199CC   -!- MASS SPECTROMETRY: MW=XXX[; MW_ERR=XX]; METHOD=XX; RANGE=XX-XX[ (Name)]; NOTE={Free text (Ref.n)|Ref.n}.
200             */
201                c = c.substring(0,c.length()-1); // chomp trailing dot
202                String[] parts = c.split(";");
203                for (int i = 0; i < parts.length; i++) {
204                    String[] subparts = parts[i].split("=");
205                    String key = subparts[0].trim();
206                    String value = subparts[1].trim();
207                    if (key.equalsIgnoreCase("MW")) this.setMolecularWeight(Integer.parseInt(value));
208                    else if (key.equalsIgnoreCase("MW_ERR")) this.setMolWeightError(new Integer(value));
209                    else if (key.equalsIgnoreCase("METHOD")) this.setMolWeightMethod(value);
210                    else if (key.equalsIgnoreCase("RANGE")) {
211                        if (value.indexOf(' ')>-1) value = value.substring(0, value.indexOf(' ')); // drop name
212                        String[] locs = value.split("-");
213                        this.setMolWeightRangeStart(Integer.parseInt(locs[0]));
214                        this.setMolWeightRangeEnd(Integer.parseInt(locs[1]));
215                    } else if (key.equalsIgnoreCase("NOTE")) this.setNote(value);
216                }
217            } else if (this.getCommentType().equalsIgnoreCase(INTERACTION)) {
218            /*
219CC   -!- INTERACTION:
220CC       {{SP_Ac:identifier[ (xeno)]}|Self}; NbExp=n; IntAct=IntAct_Protein_Ac, IntAct_Protein_Ac;
221             */
222                String[] parts = c.split(";");
223                Interaction interact = null;
224                for (int i = 0; i < parts.length; i++) {
225                    String[] subparts = parts[i].split("=");
226                    String key = subparts[0].trim();
227                    String value = null;
228                    if (key.equalsIgnoreCase("Self")) {
229                        // start new self-self interaction
230                        interact = new Interaction();
231                        interact.setID("Self");
232                        interact.setOrganismsDiffer(false);
233                        this.getInteractions().add(interact);
234                    } else if (subparts.length==1) {
235                        // start new protein-protein interaction
236                        subparts = key.split(":");
237                        boolean differ = false;
238                        if (subparts[1].indexOf("(xeno)")>-1) {
239                            differ = true;
240                            subparts[1] = subparts[1].substring(0,subparts[1].indexOf("(xeno)"));
241                        }
242                        interact = new Interaction();
243                        interact.setID(subparts[0].trim());
244                        interact.setLabel(subparts[1].trim());
245                        interact.setOrganismsDiffer(differ);
246                        this.getInteractions().add(interact);
247                    } else {
248                        value = subparts[1].trim();
249                        // continue existing interaction
250                        if (key.equalsIgnoreCase("NbExp")) interact.setNumberExperiments(Integer.parseInt(value));
251                        else if (key.equalsIgnoreCase("IntAct")) {
252                            subparts = value.split(",");
253                            interact.setFirstIntActID(subparts[0].trim());
254                            interact.setSecondIntActID(subparts[1].trim());
255                        }
256                    }
257                }
258            } else if (this.getCommentType().equalsIgnoreCase(ALTERNATIVE_PRODUCTS)) {
259            /*
260CC   -!- ALTERNATIVE PRODUCTS:
261CC       Event=Alternative promoter;
262CC         Comment=Free text;
263CC       Event=Alternative splicing; Named isoforms=n;
264CC         Comment=Optional free text;
265CC       Name=Isoform_1; Synonyms=Synonym_1[, Synonym_n];
266CC         IsoId=Isoform_identifier_1[, Isoform_identifier_n]; Sequence=Displayed;
267CC         Note=Free text;
268CC       Name=Isoform_n; Synonyms=Synonym_1[, Synonym_n];
269CC         IsoId=Isoform_identifier_1[, Isoform_identifier_n]; Sequence=VSP_identifier_1 [, VSP_identifier_n];
270CC         Note=Free text;
271CC       Event=Alternative initiation;
272CC         Comment=Free text;
273             */
274                Event event = null;
275                Isoform isoform = null;
276                String[] parts = c.split(";");
277                for (int i = 0; i < parts.length; i++) {
278                    String[] subparts = parts[i].split("=");
279                    if (subparts.length<2)
280                        continue;
281                    String key = subparts[0].trim();
282                    String value = subparts[1].trim();
283                    if (key.equalsIgnoreCase("Event")) {
284                        // new event
285                        event = new Event();
286                        this.getEvents().add(event);
287                        event.setType(value);
288                    } else if (key.equalsIgnoreCase("Name")) {
289                        // new isoform
290                        isoform = new Isoform();
291                        this.getIsoforms().add(isoform);
292                        isoform.getNames().add(value);
293                    } else if (key.equalsIgnoreCase("Synonyms")) {
294                        subparts = value.split(",");
295                        for (int j = 0; j < subparts.length; j++) isoform.getNames().add(subparts[j].trim());
296                    } else if (key.equalsIgnoreCase("IsoId")) {
297                        subparts = value.split(",");
298                        for (int j = 0; j < subparts.length; j++) isoform.getIsoIDs().add(subparts[j].trim());
299                    } else if (key.equalsIgnoreCase("Sequence")) {
300                        if (value.equalsIgnoreCase("Displayed")) isoform.setSequenceType("Displayed");
301                        else if (value.equalsIgnoreCase("Not described")) isoform.setSequenceType("Not described");
302                        else if (value.equalsIgnoreCase("External")) isoform.setSequenceType("External");
303                        else {
304                            isoform.setSequenceType("Described");
305                            isoform.setSequenceRef(value);
306                        }
307                    } else if (key.equalsIgnoreCase("Note")) {
308                        isoform.setNote(value);
309                    } else if (key.equalsIgnoreCase("Named isoforms")) {
310                        event.setNamedIsoforms(Integer.parseInt(value));
311                    } else if (key.equalsIgnoreCase("Comment")) {
312                        event.setComment(value);
313                    }
314                }
315            } else if (this.getCommentType().equalsIgnoreCase(SEQUENCE_CAUTION)) {
316            /*
317CC   -!- SEQUENCE_CAUTION: Sequence=Sequence; Type=Type;[ Positions=Positions;][ Note=Note;]
318             */
319                SeqCaution seqc = null;
320                c = c.substring(0,c.length()-1); // chomp trailing dot
321                String[] parts = c.split(";");
322                for (int i = 0; i < parts.length; i++) {
323                    String[] subparts = parts[i].split("=");
324                    String key = subparts[0].trim();
325                    String value = subparts[1].trim();
326                    if (key.equalsIgnoreCase("SEQUENCE")) {
327                        seqc = new SeqCaution();
328                        this.getSeqCautions().add(seqc);
329                        seqc.setSequence(value);
330                    } else if (key.equalsIgnoreCase("TYPE")) seqc.setType(value);
331                    else if (key.equalsIgnoreCase("POSITIONS")) seqc.setPositions(value);
332                    else if (key.equalsIgnoreCase("NOTE")) seqc.setNote(value);
333                }
334            } else {
335                // all others are just free text.
336                this.setText(c);
337            }
338        }catch(RuntimeException ex){
339            throw new ParseException(ex, "Cannot parse the comment: "+comment);
340        }
341        // all done
342    }
343    
344    /**
345     * Returns true if the comment may be parseable (starts with -!-).
346     * @param c the comment to check.
347     * @return true if it starts with -!-, false otherwise.
348     */
349    public static boolean isParseable(Comment c) {
350        return isParseable(c.getComment());
351    }
352    
353    /**
354     * Returns true if the comment may be parseable (starts with -!-).
355     * @param c the comment to check.
356     * @return true if it starts with -!-, false otherwise.
357     */
358    public static boolean isParseable(String c) {
359        return c.trim().startsWith(PREFIX);
360    }
361    
362    /**
363     * Generates a comment string based on the current values of the
364     * internal fields.
365     * @return the comment string representing the current settings.
366     * @throws ParseException if the current settings do not allow the
367     * creation of a correct comment string.
368     */
369    public String generate() throws ParseException {
370        StringBuffer sb = new StringBuffer();
371        sb.append(PREFIX);
372        sb.append(" ");
373        sb.append(this.getCommentType());
374        sb.append(": ");
375        
376        // output the specifics
377        if (this.getCommentType().equalsIgnoreCase(BIOPHYSICOCHEMICAL_PROPERTIES)) {
378            /*
379CC   -!- BIOPHYSICOCHEMICAL PROPERTIES:
380CC       Absorption:
381CC         Abs(max)=xx nm;
382CC         Note=free_text;
383CC       Kinetic parameters:
384CC         KM=xx unit for substrate [(free_text)];
385CC         Vmax=xx unit enzyme [free_text];
386CC         Note=free_text;
387CC       pH dependence:
388CC         free_text;
389CC       Redox potential:
390CC         free_text;
391CC       Temperature dependence:
392CC         free_text;
393             */
394            if (this.getAbsorptionNote()!=null) {
395                // we have an absorption line!
396                sb.append("\nAbsorption:\n  Abs(max)=");
397                sb.append(this.getAbsorptionMax());
398                sb.append(";\n  Note=");
399                sb.append(this.getAbsorptionNote());
400                sb.append(";");
401            }
402            if (this.getKineticsNote()!=null) {
403                // we have a kinetics note!
404                sb.append("\nKinetic parameters:\n");
405                for (Iterator j = this.getKMs().iterator(); j.hasNext(); ) {
406                    sb.append("  KM=");
407                    sb.append((String)j.next());
408                    sb.append(";\n");
409                }
410                for (Iterator j = this.getVMaxes().iterator(); j.hasNext(); ) {
411                    sb.append("  VMax=");
412                    sb.append((String)j.next());
413                    sb.append(";\n");
414                }
415                sb.append("  Note=");
416                sb.append(this.getKineticsNote());
417                sb.append(";");
418            }
419            if (this.getPHDependence()!=null) {
420                sb.append("\npH dependence:\n  ");
421                sb.append(this.getPHDependence());
422                sb.append(";");
423            }
424            if (this.getRedoxPotential()!=null) {
425                sb.append("\nRedox potential:\n  ");
426                sb.append(this.getRedoxPotential());
427                sb.append(";");
428            }
429            if (this.getTemperatureDependence()!=null) {
430                sb.append("\nTemperature dependence:\n  ");
431                sb.append(this.getTemperatureDependence());
432                sb.append(";");
433            }
434            
435        } else if (this.getCommentType().equalsIgnoreCase(DATABASE)) {
436            if (this.getDatabaseName()==null) throw new ParseException("Database name is missing");
437            /*
438CC   -!- DATABASE: NAME=Text[; NOTE=Text][; WWW="Address"][; FTP="Address"].
439             */
440            sb.append("NAME=");
441            sb.append(this.getDatabaseName());
442            if (this.getNote()!=null) {
443                sb.append("; NOTE=");
444                sb.append(this.getNote());
445            }
446            if (this.getUri()!=null) {
447                sb.append("; ");
448                if (this.getUri().startsWith("ftp")) sb.append(" FTP=");
449                else sb.append(" WWW=");
450                sb.append(this.getUri());
451            }
452            sb.append(".");
453            
454        } else if (this.getCommentType().equalsIgnoreCase(MASS_SPECTROMETRY)) {
455            /*
456CC   -!- MASS SPECTROMETRY: MW=XXX[; MW_ERR=XX]; METHOD=XX; RANGE=XX-XX[ (Name)]; NOTE={Free text (Ref.n)|Ref.n}.
457             */
458            sb.append("MW=");
459            sb.append(""+this.getMolecularWeight());
460            if (this.getMolWeightError()!=null) {
461                sb.append("; MW_ERR=");
462                sb.append(""+this.getMolWeightError());
463            }
464            sb.append("; METHOD=");
465            sb.append(this.getMolWeightMethod());
466            sb.append("; RANGE=");
467            sb.append(""+this.getMolWeightRangeStart());
468            sb.append("-");
469            sb.append(""+this.getMolWeightRangeEnd());
470            sb.append("; NOTE=");
471            sb.append(this.getNote());
472            sb.append(".");
473            
474        } else if (this.getCommentType().equalsIgnoreCase(INTERACTION)) {
475            /*
476CC   -!- INTERACTION:
477CC       {{SP_Ac:identifier[ (xeno)]}|Self}; NbExp=n; IntAct=IntAct_Protein_Ac, IntAct_Protein_Ac;
478             */
479            for (Iterator i = this.getInteractions().iterator(); i.hasNext(); ) {
480                Interaction interact = (Interaction)i.next();
481                sb.append("\n"); // each interaction starts on a new line
482                if (interact.getID().equals("Self")) {
483                    sb.append("Self; ");
484                } else {
485                    sb.append(interact.getID());
486                    sb.append(":");
487                    sb.append(interact.getLabel());
488                    if (interact.isOrganismsDiffer()) sb.append(" (xeno)");
489                    sb.append("; ");
490                }
491                sb.append("NbExp=");
492                sb.append(""+interact.getNumberExperiments());
493                sb.append("; ");
494                sb.append("IntAct=");
495                sb.append(interact.getFirstIntActID());
496                sb.append(", ");
497                sb.append(interact.getSecondIntActID());
498                sb.append(";");
499            }
500            
501        } else if (this.getCommentType().equalsIgnoreCase(ALTERNATIVE_PRODUCTS)) {
502            /*
503CC   -!- ALTERNATIVE PRODUCTS:
504CC       Event=Alternative promoter;
505CC         Comment=Free text;
506CC       Event=Alternative splicing; Named isoforms=n;
507CC         Comment=Optional free text;
508CC       Name=Isoform_1; Synonyms=Synonym_1[, Synonym_n];
509CC         IsoId=Isoform_identifier_1[, Isoform_identifier_n]; Sequence=Displayed;
510CC         Note=Free text;
511CC       Name=Isoform_n; Synonyms=Synonym_1[, Synonym_n];
512CC         IsoId=Isoform_identifier_1[, Isoform_identifier_n]; Sequence=VSP_identifier_1 [, VSP_identifier_n];
513CC         Note=Free text;
514CC       Event=Alternative initiation;
515CC         Comment=Free text;
516             */
517            for (Iterator i = this.getEvents().iterator(); i.hasNext(); ) {
518                Event event = (Event)i.next();
519                sb.append("\n"); // each one starts on a new line
520                sb.append("Event=");
521                sb.append(event.getType());
522                if (event.getType().equals("Alternative splicing")) {
523                    sb.append("; Named isoforms=");
524                    sb.append(""+event.getNamedIsoforms());
525                }
526                sb.append(";\n  Comment="); // comment is indented two on next line
527                sb.append(event.getComment());
528                sb.append(";");
529                if (event.getType().equals("Alternative splicing")) {
530                    for (Iterator j = this.getIsoforms().iterator(); j.hasNext(); ) {
531                        Isoform isoform = (Isoform)j.next();
532                        sb.append("\nName="); // each isoform on a new line
533                        sb.append(isoform.getNames().get(0));
534                        sb.append("; Synonyms=");
535                        for (int k =1 ; k < isoform.getNames().size(); k++) {
536                            sb.append(isoform.getNames().get(k));
537                            if (k<isoform.getNames().size()-1) sb.append(", ");
538                        }
539                        sb.append(";\n  IsoId="); // isoid on new line indented by two
540                        sb.append(isoform.getIsoIDs().get(0));
541                        for (int k =1 ; k < isoform.getIsoIDs().size(); k++) {
542                            sb.append(isoform.getIsoIDs().get(k));
543                            if (k<isoform.getIsoIDs().size()-1) sb.append(", ");
544                        }
545                        sb.append("; Sequence=");
546                        if (isoform.getSequenceRef()!=null) sb.append(isoform.getSequenceRef());
547                        else sb.append(isoform.getSequenceType());
548                        sb.append(";\n  Note="); // note is indented by two as well
549                        sb.append(isoform.getNote());
550                        sb.append(";");
551                    }
552                }
553            }
554        } else if (this.getCommentType().equalsIgnoreCase(SEQUENCE_CAUTION)) {
555                /*
556CC   -!- SEQUENCE_CAUTION: Sequence=Sequence; Type=Type;[ Positions=Positions;][ Note=Note;]
557                 */
558            for (Iterator i = this.getSeqCautions().iterator(); i.hasNext(); ) {
559                SeqCaution seqc = (SeqCaution)i.next();
560                sb.append("\n"); // each one starts on a new line
561                sb.append("Sequence=");
562                sb.append(seqc.getSequence());
563                sb.append("; Type=");
564                sb.append(seqc.getType());
565                if (seqc.getPositions()!=null) {
566                    sb.append("; Positions=");
567                    sb.append(seqc.getPositions());
568                }
569                if (this.getNote()!=null) {
570                    sb.append("; Note=");
571                    sb.append(seqc.getNote());
572                }
573                sb.append(";");
574            }
575        } else {
576            // just append free text for all others.
577            sb.append(this.getText());
578            if (!this.getText().endsWith(".")) sb.append(".");
579        }
580        
581        // return it
582        return sb.toString();
583    }
584    
585    /**
586     * Holds value of property commentType.
587     */
588    private String commentType;
589    
590    /**
591     * Getter for property commentType.
592     * @return Value of property commentType.
593     */
594    public String getCommentType() {
595        
596        return this.commentType;
597    }
598    
599    /**
600     * Setter for property commentType.
601     * @param commentType New value of property commentType.
602     */
603    public void setCommentType(String commentType) {
604        
605        this.commentType = commentType;
606    }
607    
608    /**
609     * Holds value of property text.
610     */
611    private String text;
612    
613    /**
614     * Getter for property text.
615     * @return Value of property text.
616     */
617    public String getText() {
618        
619        return this.text;
620    }
621    
622    /**
623     * Setter for property text.
624     * @param text New value of property text.
625     */
626    public void setText(String text) {
627        
628        this.text = text;
629    }
630    
631    /**
632     * Holds value of property databaseName.
633     */
634    private String databaseName;
635    
636    /**
637     * Getter for property databaseName.
638     * @return Value of property databaseName.
639     */
640    public String getDatabaseName() {
641        
642        return this.databaseName;
643    }
644    
645    /**
646     * Setter for property databaseName.
647     * @param databaseName New value of property databaseName.
648     */
649    public void setDatabaseName(String databaseName) {
650        
651        this.databaseName = databaseName;
652    }
653    
654    /**
655     * Holds value of property note.
656     */
657    private String note;
658    
659    /**
660     * Getter for property note.
661     * @return Value of property note.
662     */
663    public String getNote() {
664        
665        return this.note;
666    }
667    
668    /**
669     * Setter for property note.
670     * @param note New value of property note.
671     */
672    public void setNote(String note) {
673        
674        this.note = note;
675    }
676    
677    /**
678     * Holds value of property uri.
679     */
680    private String uri;
681    
682    /**
683     * Getter for property uri.
684     * @return Value of property uri.
685     */
686    public String getUri() {
687        
688        return this.uri;
689    }
690    
691    /**
692     * Setter for property uri.
693     * @param uri New value of property uri.
694     */
695    public void setUri(String uri) {
696        
697        this.uri = uri;
698    }
699    
700    /**
701     * Holds value of property molecularWeight.
702     */
703    private int molecularWeight;
704    
705    /**
706     * Getter for property molecularWeight.
707     * @return Value of property molecularWeight.
708     */
709    public int getMolecularWeight() {
710        
711        return this.molecularWeight;
712    }
713    
714    /**
715     * Setter for property molecularWeight.
716     * @param molecularWeight New value of property molecularWeight.
717     */
718    public void setMolecularWeight(int molecularWeight) {
719        
720        this.molecularWeight = molecularWeight;
721    }
722    
723    /**
724     * Holds value of property molWeightError.
725     */
726    private Integer molWeightError;
727    
728    /**
729     * Getter for property molWeightError.
730     * @return Value of property molWeightError.
731     */
732    public Integer getMolWeightError() {
733        
734        return this.molWeightError;
735    }
736    
737    /**
738     * Setter for property molWeightError.
739     * @param molWeightError New value of property molWeightError.
740     */
741    public void setMolWeightError(Integer molWeightError) {
742        
743        this.molWeightError = molWeightError;
744    }
745    
746    /**
747     * Holds value of property molWeightRangeStart.
748     */
749    private int molWeightRangeStart;
750    
751    /**
752     * Getter for property molWeightRangeStart.
753     * @return Value of property molWeightRangeStart.
754     */
755    public int getMolWeightRangeStart() {
756        
757        return this.molWeightRangeStart;
758    }
759    
760    /**
761     * Setter for property molWeightRangeStart.
762     * @param molWeightRangeStart New value of property molWeightRangeStart.
763     */
764    public void setMolWeightRangeStart(int molWeightRangeStart) {
765        
766        this.molWeightRangeStart = molWeightRangeStart;
767    }
768    
769    /**
770     * Holds value of property molWeightRangeEnd.
771     */
772    private int molWeightRangeEnd;
773    
774    /**
775     * Getter for property molWeightRangeEnd.
776     * @return Value of property molWeightRangeEnd.
777     */
778    public int getMolWeightRangeEnd() {
779        
780        return this.molWeightRangeEnd;
781    }
782    
783    /**
784     * Setter for property molWeightRangeEnd.
785     * @param molWeightRangeEnd New value of property molWeightRangeEnd.
786     */
787    public void setMolWeightRangeEnd(int molWeightRangeEnd) {
788        
789        this.molWeightRangeEnd = molWeightRangeEnd;
790    }
791    
792    /**
793     * Holds value of property molWeightMethod.
794     */
795    private String molWeightMethod;
796    
797    /**
798     * Getter for property molWeightMethod.
799     * @return Value of property molWeightMethod.
800     */
801    public String getMolWeightMethod() {
802        
803        return this.molWeightMethod;
804    }
805    
806    /**
807     * Setter for property molWeightMethod.
808     * @param molWeightMethod New value of property molWeightMethod.
809     */
810    public void setMolWeightMethod(String molWeightMethod) {
811        
812        this.molWeightMethod = molWeightMethod;
813    }
814    
815    /**
816     * Holds value of property interactions.
817     */
818    private List interactions;
819    
820    /**
821     * Getter for property interactions.
822     * @return Value of property interactions.
823     */
824    public List getInteractions() {
825        
826        return this.interactions;
827    }
828    
829    /**
830     * Setter for property interactions.
831     * @param interactions New value of property interactions.
832     */
833    public void setInteractions(List interactions) {
834        
835        this.interactions = interactions;
836    }
837    
838    /**
839     * Holds value of property seqCautions.
840     */
841    private List seqCautions;
842    
843    /**
844     * Getter for property seqCautions.
845     * @return Value of property seqCautions.
846     */
847    public List getSeqCautions() {
848        
849        return this.seqCautions;
850    }
851    
852    /**
853     * Setter for property seqCautions.
854     * @param seqCautions New value of property seqCautions.
855     */
856    public void setSeqCautions(List seqCautions) {
857        
858        this.seqCautions = seqCautions;
859    }
860    
861    /**
862     * Holds value of property events.
863     */
864    private List events;
865    
866    /**
867     * Getter for property events.
868     * @return Value of property events.
869     */
870    public List getEvents() {
871        
872        return this.events;
873    }
874    
875    /**
876     * Setter for property events.
877     * @param events New value of property events.
878     */
879    public void setEvents(List events) {
880        
881        this.events = events;
882    }
883    
884    /**
885     * Holds value of property isoforms.
886     */
887    private List isoforms;
888    
889    /**
890     * Getter for property isoforms.
891     * @return Value of property isoforms.
892     */
893    public List getIsoforms() {
894        
895        return this.isoforms;
896    }
897    
898    /**
899     * Setter for property isoforms.
900     * @param isoforms New value of property isoforms.
901     */
902    public void setIsoforms(List isoforms) {
903        
904        this.isoforms = isoforms;
905    }
906    
907    /**
908     * Holds value of property absorptionMax.
909     */
910    private String absorptionMax;
911    
912    /**
913     * Getter for property absorptionMax.
914     * @return Value of property absorptionMax.
915     */
916    public String getAbsorptionMax() {
917        
918        return this.absorptionMax;
919    }
920    
921    /**
922     * Setter for property absorptionMax.
923     * @param absorptionMax New value of property absorptionMax.
924     */
925    public void setAbsorptionMax(String absorptionMax) {
926        
927        this.absorptionMax = absorptionMax;
928    }
929    
930    /**
931     * Holds value of property absorptionNote.
932     */
933    private String absorptionNote;
934    
935    /**
936     * Getter for property absorptionNote.
937     * @return Value of property absorptionNote.
938     */
939    public String getAbsorptionNote() {
940        
941        return this.absorptionNote;
942    }
943    
944    /**
945     * Setter for property absorptionNote.
946     * @param absorptionNote New value of property absorptionNote.
947     */
948    public void setAbsorptionNote(String absorptionNote) {
949        
950        this.absorptionNote = absorptionNote;
951    }
952    
953    /**
954     * Holds value of property KMs.
955     */
956    private List KMs;
957    
958    /**
959     * Getter for property KMs.
960     * @return Value of property KMs.
961     */
962    public List getKMs() {
963        
964        return this.KMs;
965    }
966    
967    /**
968     * Setter for property KMs.
969     * @param KMs New value of property KMs.
970     */
971    public void setKMs(List KMs) {
972        
973        this.KMs = KMs;
974    }
975    
976    /**
977     * Holds value of property VMaxes.
978     */
979    private List VMaxes;
980    
981    /**
982     * Getter for property VMaxes.
983     * @return Value of property VMaxes.
984     */
985    public List getVMaxes() {
986        
987        return this.VMaxes;
988    }
989    
990    /**
991     * Setter for property VMaxes.
992     * @param VMaxes New value of property VMaxes.
993     */
994    public void setVMaxes(List VMaxes) {
995        
996        this.VMaxes = VMaxes;
997    }
998    
999    /**
1000     * Holds value of property kineticsNote.
1001     */
1002    private String kineticsNote;
1003    
1004    /**
1005     * Getter for property kineticsNote.
1006     * @return Value of property kineticsNote.
1007     */
1008    public String getKineticsNote() {
1009        
1010        return this.kineticsNote;
1011    }
1012    
1013    /**
1014     * Setter for property kineticsNote.
1015     * @param kineticsNote New value of property kineticsNote.
1016     */
1017    public void setKineticsNote(String kineticsNote) {
1018        
1019        this.kineticsNote = kineticsNote;
1020    }
1021    
1022    /**
1023     * Holds value of property PHDependence.
1024     */
1025    private String PHDependence;
1026    
1027    /**
1028     * Getter for property PHDependence.
1029     * @return Value of property PHDependence.
1030     */
1031    public String getPHDependence() {
1032        
1033        return this.PHDependence;
1034    }
1035    
1036    /**
1037     * Setter for property PHDependence.
1038     * @param PHDependence New value of property PHDependence.
1039     */
1040    public void setPHDependence(String PHDependence) {
1041        
1042        this.PHDependence = PHDependence;
1043    }
1044    
1045    /**
1046     * Holds value of property redoxPotential.
1047     */
1048    private String redoxPotential;
1049    
1050    /**
1051     * Getter for property redoxPotential.
1052     * @return Value of property redoxPotential.
1053     */
1054    public String getRedoxPotential() {
1055        
1056        return this.redoxPotential;
1057    }
1058    
1059    /**
1060     * Setter for property redoxPotential.
1061     * @param redoxPotential New value of property redoxPotential.
1062     */
1063    public void setRedoxPotential(String redoxPotential) {
1064        
1065        this.redoxPotential = redoxPotential;
1066    }
1067    
1068    /**
1069     * Holds value of property temperatureDependence.
1070     */
1071    private String temperatureDependence;
1072    
1073    /**
1074     * Getter for property temperatureDependence.
1075     * @return Value of property temperatureDependence.
1076     */
1077    public String getTemperatureDependence() {
1078        
1079        return this.temperatureDependence;
1080    }
1081    
1082    /**
1083     * Setter for property temperatureDependence.
1084     * @param temperatureDependence New value of property temperatureDependence.
1085     */
1086    public void setTemperatureDependence(String temperatureDependence) {
1087        
1088        this.temperatureDependence = temperatureDependence;
1089    }
1090    
1091    /**
1092     * A class to describe protein-protein interactions.
1093     */
1094    public static class Interaction {
1095        /**
1096         * Holds value of property ID.
1097         */
1098        private String ID;
1099        
1100        /**
1101         * Getter for property ID.
1102         * @return Value of property ID.
1103         */
1104        public String getID() {
1105            
1106            return this.ID;
1107        }
1108        
1109        /**
1110         * Setter for property ID.
1111         * @param ID New value of property ID.
1112         */
1113        public void setID(String ID) {
1114            
1115            this.ID = ID;
1116        }
1117        
1118        /**
1119         * Holds value of property label.
1120         */
1121        private String label;
1122        
1123        /**
1124         * Getter for property label.
1125         * @return Value of property label.
1126         */
1127        public String getLabel() {
1128            
1129            return this.label;
1130        }
1131        
1132        /**
1133         * Setter for property label.
1134         * @param label New value of property label.
1135         */
1136        public void setLabel(String label) {
1137            
1138            this.label = label;
1139        }
1140        
1141        /**
1142         * Holds value of property organismsDiffer.
1143         */
1144        private boolean organismsDiffer;
1145        
1146        /**
1147         * Getter for property organismsDiffer.
1148         * @return Value of property organismsDiffer.
1149         */
1150        public boolean isOrganismsDiffer() {
1151            
1152            return this.organismsDiffer;
1153        }
1154        
1155        /**
1156         * Setter for property organismsDiffer.
1157         * @param organismsDiffer New value of property organismsDiffer.
1158         */
1159        public void setOrganismsDiffer(boolean organismsDiffer) {
1160            
1161            this.organismsDiffer = organismsDiffer;
1162        }
1163        
1164        /**
1165         * Holds value of property firstIntActID.
1166         */
1167        private String firstIntActID;
1168        
1169        /**
1170         * Getter for property firstIntActID.
1171         * @return Value of property firstIntActID.
1172         */
1173        public String getFirstIntActID() {
1174            
1175            return this.firstIntActID;
1176        }
1177        
1178        /**
1179         * Setter for property firstIntActID.
1180         * @param firstIntActID New value of property firstIntActID.
1181         */
1182        public void setFirstIntActID(String firstIntActID) {
1183            
1184            this.firstIntActID = firstIntActID;
1185        }
1186        
1187        /**
1188         * Holds value of property secondIntActID.
1189         */
1190        private String secondIntActID;
1191        
1192        /**
1193         * Getter for property secondIntActID.
1194         * @return Value of property secondIntActID.
1195         */
1196        public String getSecondIntActID() {
1197            
1198            return this.secondIntActID;
1199        }
1200        
1201        /**
1202         * Setter for property secondIntActID.
1203         * @param secondIntActID New value of property secondIntActID.
1204         */
1205        public void setSecondIntActID(String secondIntActID) {
1206            
1207            this.secondIntActID = secondIntActID;
1208        }
1209        
1210        /**
1211         * Holds value of property numberExperiments.
1212         */
1213        private int numberExperiments;
1214        
1215        /**
1216         * Getter for property numberExperiments.
1217         * @return Value of property numberExperiments.
1218         */
1219        public int getNumberExperiments() {
1220            
1221            return this.numberExperiments;
1222        }
1223        
1224        /**
1225         * Setter for property numberExperiments.
1226         * @param numberExperiments New value of property numberExperiments.
1227         */
1228        public void setNumberExperiments(int numberExperiments) {
1229            
1230            this.numberExperiments = numberExperiments;
1231        }
1232    }
1233    
1234    /**
1235     * A class to describe events for alternative product comments.
1236     */
1237    public static class Event {
1238        /**
1239         * Holds value of property type.
1240         */
1241        private String type;
1242        
1243        /**
1244         * Getter for property type.
1245         * @return Value of property type.
1246         */
1247        public String getType() {
1248            
1249            return this.type;
1250        }
1251        
1252        /**
1253         * Setter for property type.
1254         * @param type New value of property type.
1255         */
1256        public void setType(String type) {
1257            
1258            this.type = type;
1259        }
1260        
1261        /**
1262         * Holds value of property comment.
1263         */
1264        private String comment;
1265        
1266        /**
1267         * Getter for property comment.
1268         * @return Value of property comment.
1269         */
1270        public String getComment() {
1271            
1272            return this.comment;
1273        }
1274        
1275        /**
1276         * Setter for property comment.
1277         * @param comment New value of property comment.
1278         */
1279        public void setComment(String comment) {
1280            
1281            this.comment = comment;
1282        }
1283        
1284        /**
1285         * Holds value of property namedIsoforms.
1286         */
1287        private int namedIsoforms;
1288        
1289        /**
1290         * Getter for property namedIsoforms.
1291         * @return Value of property namedIsoforms.
1292         */
1293        public int getNamedIsoforms() {
1294            
1295            return this.namedIsoforms;
1296        }
1297        
1298        /**
1299         * Setter for property namedIsoforms.
1300         * @param namedIsoforms New value of property namedIsoforms.
1301         */
1302        public void setNamedIsoforms(int namedIsoforms) {
1303            
1304            this.namedIsoforms = namedIsoforms;
1305        }
1306        
1307    }
1308    
1309    /**
1310     * A class to describe isoforms for alternative product comments.
1311     */
1312    public static class Isoform {
1313        
1314        /**
1315         * Creates a new instance.
1316         */
1317        public Isoform() {
1318            this.names = new ArrayList();
1319            this.isoIDs = new ArrayList();
1320        }
1321        
1322        /**
1323         * Holds value of property names.
1324         */
1325        private List names;
1326        
1327        /**
1328         * Getter for property names.
1329         * @return Value of property names.
1330         */
1331        public List getNames() {
1332            
1333            return this.names;
1334        }
1335        
1336        /**
1337         * Setter for property names.
1338         * @param names New value of property names.
1339         */
1340        public void setNames(List names) {
1341            
1342            this.names = names;
1343        }
1344        
1345        /**
1346         * Holds value of property isoIDs.
1347         */
1348        private List isoIDs;
1349        
1350        /**
1351         * Getter for property isoIDs.
1352         * @return Value of property isoIDs.
1353         */
1354        public List getIsoIDs() {
1355            
1356            return this.isoIDs;
1357        }
1358        
1359        /**
1360         * Setter for property isoIDs.
1361         * @param isoIDs New value of property isoIDs.
1362         */
1363        public void setIsoIDs(List isoIDs) {
1364            
1365            this.isoIDs = isoIDs;
1366        }
1367        
1368        /**
1369         * Holds value of property sequenceType.
1370         */
1371        private String sequenceType;
1372        
1373        /**
1374         * Getter for property sequenceType.
1375         * @return Value of property sequenceType.
1376         */
1377        public String getSequenceType() {
1378            
1379            return this.sequenceType;
1380        }
1381        
1382        /**
1383         * Setter for property sequenceType.
1384         * @param sequenceType New value of property sequenceType.
1385         */
1386        public void setSequenceType(String sequenceType) {
1387            
1388            this.sequenceType = sequenceType;
1389        }
1390        
1391        /**
1392         * Holds value of property sequenceRef.
1393         */
1394        private String sequenceRef;
1395        
1396        /**
1397         * Getter for property sequenceRef.
1398         * @return Value of property sequenceRef.
1399         */
1400        public String getSequenceRef() {
1401            
1402            return this.sequenceRef;
1403        }
1404        
1405        /**
1406         * Setter for property sequenceRef.
1407         * @param sequenceRef New value of property sequenceRef.
1408         */
1409        public void setSequenceRef(String sequenceRef) {
1410            
1411            this.sequenceRef = sequenceRef;
1412        }
1413        
1414        /**
1415         * Holds value of property note.
1416         */
1417        private String note;
1418        
1419        /**
1420         * Getter for property note.
1421         * @return Value of property note.
1422         */
1423        public String getNote() {
1424            
1425            return this.note;
1426        }
1427        
1428        /**
1429         * Setter for property note.
1430         * @param note New value of property note.
1431         */
1432        public void setNote(String note) {
1433            
1434            this.note = note;
1435        }
1436        
1437    }
1438    
1439    /**
1440     * A class to describe seq caution entries.
1441     */
1442    public static class SeqCaution {
1443        
1444        private String sequence;
1445        
1446        private String type;
1447        
1448        private String positions;
1449        
1450        private String note;
1451        
1452        /**
1453         * Creates a new instance.
1454         */
1455        public SeqCaution() {
1456        }
1457        
1458        /**
1459         * @return the note
1460         */
1461        public String getNote() {
1462            return note;
1463        }
1464        
1465        /**
1466         * @param note the note to set
1467         */
1468        public void setNote(String note) {
1469            this.note = note;
1470        }
1471        
1472        /**
1473         * @return the positions
1474         */
1475        public String getPositions() {
1476            return positions;
1477        }
1478        
1479        /**
1480         * @param positions the positions to set
1481         */
1482        public void setPositions(String positions) {
1483            this.positions = positions;
1484        }
1485        
1486        /**
1487         * @return the sequence
1488         */
1489        public String getSequence() {
1490            return sequence;
1491        }
1492        
1493        /**
1494         * @param sequence the sequence to set
1495         */
1496        public void setSequence(String sequence) {
1497            this.sequence = sequence;
1498        }
1499        
1500        /**
1501         * @return the type
1502         */
1503        public String getType() {
1504            return type;
1505        }
1506        
1507        /**
1508         * @param type the type to set
1509         */
1510        public void setType(String type) {
1511            this.type = type;
1512        }
1513        
1514    }
1515}