Class SimpleGFFRecord

  • All Implemented Interfaces:
    GFFRecord

    public class SimpleGFFRecord
    extends java.lang.Object
    implements GFFRecord
    A no-frills implementation of a GFFRecord.
    Author:
    Matthew Pocock, Greg Cox, Aroul Ramadass, Len Trigg, Richard Holland
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleGFFRecord()
      Create a new SimpleGFFRecord with values set to null or zero
      SimpleGFFRecord​(java.lang.String seqName, java.lang.String source, java.lang.String feature, int start, int end, double score, StrandedFeature.Strand strand, int frame, java.lang.String comment, java.util.Map groupAttributes)  
      SimpleGFFRecord​(GFFRecord rec)
      Create a new SimpleGFFRecord from GFFRecord object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getComment()
      The feature comment.
      int getEnd()
      The end of this feature within the source sequence.
      java.lang.String getFeature()
      The feature type filed.
      int getFrame()
      The frame of the feature.
      java.util.Map getGroupAttributes()
      A Map containing the group / attribute information.
      double getScore()
      The score of the feature.
      java.lang.String getSeqName()
      The sequence name field.
      java.lang.String getSource()
      The source, or creator of this feature.
      int getStart()
      The start of this feature within the source sequence.
      StrandedFeature.Strand getStrand()
      The strand of the feature.
      void setComment​(java.lang.String comment)
      Set the comment to comment.
      void setEnd​(int end)
      Set the end coordinate to end.
      void setFeature​(java.lang.String feature)
      Set the feature type to type.
      void setFrame​(int frame)
      Set the frame to frame.
      void setGroupAttributes​(java.util.Map ga)
      Replace the group-attribute Map with ga.
      void setScore​(double score)
      Set the score to score.
      void setSeqName​(java.lang.String seqName)
      Set the sequence name to seqName.
      void setSource​(java.lang.String source)
      Set the feature source to source.
      void setStart​(int start)
      Set the start coordinate to start.
      void setStrand​(StrandedFeature.Strand strand)
      Set the strand to strand.
      static java.lang.String stringifyAttributes​(java.util.Map attMap)
      Create a String representation of attMap.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleGFFRecord

        public SimpleGFFRecord​(GFFRecord rec)
        Create a new SimpleGFFRecord from GFFRecord object
        Parameters:
        rec - - A GFFRecord object
      • SimpleGFFRecord

        public SimpleGFFRecord​(java.lang.String seqName,
                               java.lang.String source,
                               java.lang.String feature,
                               int start,
                               int end,
                               double score,
                               StrandedFeature.Strand strand,
                               int frame,
                               java.lang.String comment,
                               java.util.Map groupAttributes)
      • SimpleGFFRecord

        public SimpleGFFRecord()
        Create a new SimpleGFFRecord with values set to null or zero
    • Method Detail

      • setSeqName

        public void setSeqName​(java.lang.String seqName)
        Set the sequence name to seqName.
        Parameters:
        seqName - the new name
      • getSeqName

        public java.lang.String getSeqName()
        Description copied from interface: GFFRecord
        The sequence name field.

        This should be the name of the sequence that this GFF record is within.

        Specified by:
        getSeqName in interface GFFRecord
        Returns:
        the name of the sequence
      • setSource

        public void setSource​(java.lang.String source)
        Set the feature source to source.
        Parameters:
        source - the new source
      • getSource

        public java.lang.String getSource()
        Description copied from interface: GFFRecord
        The source, or creator of this feature.

        This is usualy a program name.

        Specified by:
        getSource in interface GFFRecord
        Returns:
        the feature source
      • setFeature

        public void setFeature​(java.lang.String feature)
        Set the feature type to type.
        Parameters:
        feature - the new feature type
      • getFeature

        public java.lang.String getFeature()
        Description copied from interface: GFFRecord
        The feature type filed.

        This is something like "exon" - usualy corresponds to an EMBL term.

        Specified by:
        getFeature in interface GFFRecord
        Returns:
        the feature type
      • setStart

        public void setStart​(int start)
        Set the start coordinate to start.
        Parameters:
        start - the new start coordinate
      • getStart

        public int getStart()
        Description copied from interface: GFFRecord
        The start of this feature within the source sequence.
        Specified by:
        getStart in interface GFFRecord
        Returns:
        the start index
      • setEnd

        public void setEnd​(int end)
        Set the end coordinate to end.
        Parameters:
        end - the new end coordinate
      • getEnd

        public int getEnd()
        Description copied from interface: GFFRecord
        The end of this feature within the source sequence.
        Specified by:
        getEnd in interface GFFRecord
        Returns:
        the end index
      • setScore

        public void setScore​(double score)
        Set the score to score.

        The score must be a double, inclusive of 0. If you wish to indicate that there is no score, then use GFFRecord.NO_SCORE.

        Parameters:
        score - the new score
      • getScore

        public double getScore()
        Description copied from interface: GFFRecord
        The score of the feature.

        For sequences that have no score, this will be set to GFFRecord.NO_SCORE.

        Specified by:
        getScore in interface GFFRecord
        Returns:
        the score, or NO_SCORE
      • getStrand

        public StrandedFeature.Strand getStrand()
        Description copied from interface: GFFRecord
        The strand of the feature.

        This will be one of GFFRecord.POSITIVE_STRAND, GFFRecord.NEGATIVE_STRAND, or GFFRecord.NO_STRAND.

        Specified by:
        getStrand in interface GFFRecord
        Returns:
        the strand field
      • setFrame

        public void setFrame​(int frame)
        Set the frame to frame.

        The score must be one of {0, 1, 2} or GFFRecord.NO_FRAME.

        Parameters:
        frame - the frame
        Throws:
        java.lang.IllegalArgumentException - if score is not valid.
      • getFrame

        public int getFrame()
        Description copied from interface: GFFRecord
        The frame of the feature.

        This will be one of {1, 2, 3} or GFFRecord.NO_FRAME.

        Specified by:
        getFrame in interface GFFRecord
        Returns:
        the frame field
      • setGroupAttributes

        public void setGroupAttributes​(java.util.Map ga)
        Replace the group-attribute Map with ga.

        To efficiently add a key, call getGroupAttributes() and modify the Map.

        Parameters:
        ga - the new group-attribute Map
      • getGroupAttributes

        public java.util.Map getGroupAttributes()
        Description copied from interface: GFFRecord
        A Map containing the group / attribute information.

        This will be a Map of group-names to List objects.

        Specified by:
        getGroupAttributes in interface GFFRecord
        Returns:
        a Map containing the group and attribute info.
      • setComment

        public void setComment​(java.lang.String comment)
        Set the comment to comment.

        If you set it to null, then the comment for this line will be ignored.

        Parameters:
        comment - the new comment
      • getComment

        public java.lang.String getComment()
        Description copied from interface: GFFRecord
        The feature comment.
        Specified by:
        getComment in interface GFFRecord
        Returns:
        null or the feature comment
      • stringifyAttributes

        public static java.lang.String stringifyAttributes​(java.util.Map attMap)
        Create a String representation of attMap. attMap is assumed to contain String keys and List values.
        Parameters:
        attMap - the Map of attributes and value lists
        Returns:
        a GFF attribute/value String