001package org.biojava.bio.program.gff3;
002
003import org.biojava.bio.Annotatable;
004import org.biojava.bio.Annotation;
005import org.biojava.bio.SmallAnnotation;
006import org.biojava.bio.program.gff.GFFTools;
007import org.biojava.bio.seq.StrandedFeature;
008import org.biojava.ontology.OntoTools;
009import org.biojava.ontology.Term;
010import org.biojava.utils.AbstractChangeable;
011
012/**
013 * A record in a GFF3 formatted file.
014 *
015 * @author Matthew Pocock
016 */
017public interface GFF3Record
018extends Annotatable {
019  public String getSequenceID();
020  
021  public Term getSource();
022  
023  public Term getType();
024  
025  public int getStart();
026  
027  public int getEnd();
028  
029  public double getScore();
030  
031  public StrandedFeature.Strand getStrand();
032  
033  public int getPhase();
034  
035  public static final class Impl
036  extends AbstractChangeable
037  implements GFF3Record {
038    
039    private String sequenceID;
040    private Term source;
041    private Term type;
042    private int start;
043    private int end;
044    private double score;
045    private StrandedFeature.Strand strand;
046    private int phase;
047    private Annotation annotation;
048    
049    public Impl() {
050      // do nothing much - initialize us with uninformative data
051      sequenceID = null;
052      source = OntoTools.ANY;
053      type = OntoTools.ANY;
054      start = Integer.MAX_VALUE;
055      end = Integer.MIN_VALUE;
056      score = GFFTools.NO_SCORE;
057      strand = StrandedFeature.UNKNOWN;
058      phase = GFFTools.NO_FRAME;
059    }
060    
061    public Impl(GFF3Record rec) {
062      this.sequenceID = rec.getSequenceID();
063      this.source = rec.getSource();
064      this.type = rec.getType();
065      this.start = rec.getStart();
066      this.end = rec.getEnd();
067      this.score = rec.getScore();
068      this.strand = rec.getStrand();
069      this.phase = rec.getPhase();
070    }
071    
072    public String getSequenceID() {
073      return this.sequenceID;
074    }
075    
076    public void setSequenceID(String sequenceID) {
077      this.sequenceID = sequenceID;
078    }
079    
080    public Term getSource() {
081      return this.source;
082    }
083    
084    public void setSource(Term source) {
085      this.source = source;
086    }
087    
088    public Term getType() {
089      return this.type;
090    }
091    
092    public void setType(Term type) {
093      this.type = type;
094    }
095    
096    public int getStart() {
097      return this.start;
098    }
099    
100    public void setStart(int start) {
101      this.start = start;
102    }
103    
104    public int getEnd() {
105      return this.end;
106    }
107    
108    public void setEnd(int end) {
109      this.end = end;
110    }
111    
112    public double getScore() {
113      return this.score;
114    }
115    
116    public void setScore(double score) {
117      this.score = score;
118    }
119    
120    public StrandedFeature.Strand getStrand() {
121      return this.strand;
122    }
123    
124    public void setStrand(StrandedFeature.Strand strand) {
125      this.strand = strand;
126    }
127    
128    public int getPhase() {
129      return this.phase;
130    }
131    
132    public void setPhase(int phase) {
133      this.phase = phase;
134    }
135    
136    public Annotation getAnnotation() {
137      if(annotation == null) {
138        annotation = new SmallAnnotation();
139      }
140      
141      return annotation;
142    }
143  }
144}