9f3520f34b8e2d876819bfb7a2832fef427e06ed
[jalview.git] / src / jalview / datamodel / GeneLoci.java
1 package jalview.datamodel;
2
3 import jalview.util.MapList;
4
5 /**
6  * A data bean to model one or more contiguous regions on one chromosome
7  */
8 public class GeneLoci
9 {
10   /*
11    * implemented as an adapter over DBRefEntry with
12    * source -> species id
13    * version -> reference
14    * accession -> chromosome
15    */
16   private DBRefEntry loci;
17
18   boolean forwardStrand;
19
20   /**
21    * Constructor
22    * 
23    * @param taxon
24    * @param ref
25    * @param chrId
26    * @param map
27    * @param forward
28    */
29   public GeneLoci(String taxon, String ref, String chrId, MapList map,
30           boolean forward)
31   {
32     loci = new DBRefEntry(taxon, ref, chrId, new Mapping(map));
33     forwardStrand = forward;
34   }
35
36   /**
37    * Answers the identifier for the species
38    * 
39    * @return
40    */
41   public String getSpecies()
42   {
43     return loci.getSource();
44   }
45
46   /**
47    * Answers the identifier for the genomic reference assembly
48    */
49   public String getReference()
50   {
51     return loci.getVersion();
52   }
53
54   /**
55    * Answers the chromosome identifier
56    * 
57    * @return
58    */
59   public String getChromosome()
60   {
61     return loci.getAccessionId();
62   }
63
64   /**
65    * Answers the mapping from sequence positions (in sequence start..end
66    * coordinates) to the corresponding loci in the chromosome (in reference
67    * assembly coordinates, base 1)
68    * 
69    * @return
70    */
71   public MapList getMapping()
72   {
73     return loci.getMap().getMap();
74   }
75
76   public boolean isForwardStrand()
77   {
78     return forwardStrand;
79   }
80 }