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 */
021package org.biojava.nbio.genome.parsers.gff;
022
023import java.util.HashMap;
024
025/**
026 * A feature on a sequence (for example, an exon or a gene), defined by a location
027 * and a set of attributes encoded as key/value pairs.
028 *
029 * @author Hanno Hinsch
030 */
031public interface FeatureI
032{
033
034        /**
035         * Get the location of the feature.
036         *
037         * @return The location.
038         */
039        public Location location();
040
041        /**
042         * Get the group id of the feature. The group id is defined in the GFF1
043         * format; features that share a common group id are presumed to be part
044         * of some logical group. For example, a gene might be represented by several
045         * exon features that all share the same group id.
046         *<br><br>
047         * The exact meaning of a feature's group id, or even its existence, is not guaranteed
048         * by this interface. An understanding of a particular file's data format is necessary to properly
049         * interpret the group id.
050         *
051         * @return The group id. This may be an empty string.
052         */
053        public String group();
054
055        /**
056         * Get the feature type, for example, "exon", "CDS", etc.
057         *
058         * @return The type.
059         */
060        public String type();
061
062        /**
063         * Get the sequence name.
064         *
065         * @return Sequence name.
066         */
067        public String seqname();
068
069        /**
070         * Get the attribute value for this key.
071         *
072         * @param key The key.
073         * @return The corresponding value. Null if the key has no value defined .
074         */
075        public String getAttribute( String key );
076
077
078        /**
079         * Check if the feature has a value defined for the specified key.
080         *
081         * @param key The key.
082         * @return True if a value is defined for this key.
083         */
084        public boolean hasAttribute( String key );
085
086        /**
087         * Check if the feature attributes include the specified key/value pair.
088         *
089         * @param key The key.
090         * @param value The value.
091         * @return True if the feature's value for this key matches the specified value.
092         */
093        public boolean hasAttribute( String key, String value );
094
095        /**
096         * A string representation of the feature.
097         *
098         * @return The string.
099         */
100        @Override
101        public String toString();
102
103        /**
104         * Get HashMap of user data.
105         *
106         * @return The user HashMap.
107         */
108        public  HashMap<String, String> userData();
109
110        public HashMap<String, String> getAttributes();
111
112}