X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FGeneLocus.java;fp=src%2Fjalview%2Fdatamodel%2FGeneLocus.java;h=f81348fa303e1f1a4a4b7e811feaf69bce698afd;hb=aace9d05c0870c703bfdfb28c1608213cee019bf;hp=0000000000000000000000000000000000000000;hpb=2a3bac30ae8290e912eb7ffe7ff7ec700b6cfaac;p=jalview.git diff --git a/src/jalview/datamodel/GeneLocus.java b/src/jalview/datamodel/GeneLocus.java new file mode 100644 index 0000000..f81348f --- /dev/null +++ b/src/jalview/datamodel/GeneLocus.java @@ -0,0 +1,91 @@ +package jalview.datamodel; + +import jalview.util.MapList; + +/** + * A specialisation of DBRefEntry used to hold the chromosomal coordinates for a + * (typically gene) sequence + * + * + * @author gmcarstairs + * + */ +public class GeneLocus extends DBRefEntry implements GeneLociI +{ + /** + * Constructor adapts species, assembly, chromosome to DBRefEntry source, + * version, accession, respectively, and saves the mapping of sequence to + * chromosomal coordinates + * + * @param speciesId + * @param assemblyId + * @param chromosomeId + * @param mapping + */ + public GeneLocus(String speciesId, String assemblyId, String chromosomeId, + Mapping mapping) + { + super(speciesId, assemblyId, chromosomeId, mapping); + } + + /** + * Constructor + * + * @param speciesId + * @param assemblyId + * @param chromosomeId + */ + public GeneLocus(String speciesId, String assemblyId, String chromosomeId) + { + this(speciesId, assemblyId, chromosomeId, null); + } + + @Override + public boolean equals(Object o) + { + return o instanceof GeneLocus && super.equals(o); + } + + @Override + public MapList getMapping() + { + return map == null ? null : map.getMap(); + } + + /** + * Answers the species identifier e.g. "human", stored as field source of + * DBRefEntry + */ + @Override + public String getSpeciesId() + { + return getSource(); + } + + /** + * Answers the genome assembly id e.g. "GRCh38", stored as field + * version of DBRefEntry + */ + @Override + public String getAssemblyId() + { + return getVersion(); + } + + /** + * Answers the chromosome identifier e.g. "X", stored as field + * accession of DBRefEntry + */ + @Override + public String getChromosomeId() + { + return getAccessionId(); + } + +}