Class |
Line # |
Actions |
|||
---|---|---|---|---|---|
GeneLocus | 39 | 7 | 8 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
7 | * Jalview is free software: you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Public License | |
9 | * as published by the Free Software Foundation, either version 3 | |
10 | * of the License, or (at your option) any later version. | |
11 | * | |
12 | * Jalview is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty | |
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
15 | * PURPOSE. See the GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with Jalview. If not, see <http://www.gnu.org/licenses/>. | |
19 | * The Jalview Authors are detailed in the 'AUTHORS' file. | |
20 | */ | |
21 | package jalview.datamodel; | |
22 | ||
23 | import jalview.util.MapList; | |
24 | ||
25 | /** | |
26 | * A specialisation of DBRefEntry used to hold the chromosomal coordinates for a | |
27 | * (typically gene) sequence | |
28 | * <ul> | |
29 | * <li>field <code>source</code> is used to hold a species id e.g. human</li> | |
30 | * <li>field <code>version</code> is used to hold assembly id e.g GRCh38</li> | |
31 | * <li>field <code>accession</code> is used to hold the chromosome id</li> | |
32 | * <li>field <code>map</code> is used to hold the mapping from sequence to | |
33 | * chromosome coordinates</li> | |
34 | * </ul> | |
35 | * | |
36 | * @author gmcarstairs | |
37 | * | |
38 | */ | |
39 | public class GeneLocus extends DBRefEntry implements GeneLociI | |
40 | { | |
41 | /** | |
42 | * Constructor adapts species, assembly, chromosome to DBRefEntry source, | |
43 | * version, accession, respectively, and saves the mapping of sequence to | |
44 | * chromosomal coordinates | |
45 | * | |
46 | * @param speciesId | |
47 | * @param assemblyId | |
48 | * @param chromosomeId | |
49 | * @param mapping | |
50 | */ | |
51 | 59 | public GeneLocus(String speciesId, String assemblyId, String chromosomeId, |
52 | Mapping mapping) | |
53 | { | |
54 | 59 | super(speciesId, assemblyId, chromosomeId, mapping); |
55 | } | |
56 | ||
57 | /** | |
58 | * Constructor | |
59 | * | |
60 | * @param speciesId | |
61 | * @param assemblyId | |
62 | * @param chromosomeId | |
63 | */ | |
64 | 23 | public GeneLocus(String speciesId, String assemblyId, String chromosomeId) |
65 | { | |
66 | 23 | this(speciesId, assemblyId, chromosomeId, null); |
67 | } | |
68 | ||
69 | 2 | @Override |
70 | public boolean equals(Object o) | |
71 | { | |
72 | 2 | return o instanceof GeneLocus && super.equals(o); |
73 | } | |
74 | ||
75 | 35 | @Override |
76 | public MapList getMapping() | |
77 | { | |
78 | 35 | return map == null ? null : map.getMap(); |
79 | } | |
80 | ||
81 | /** | |
82 | * Answers the species identifier e.g. "human", stored as field | |
83 | * <code>source</code> of DBRefEntry | |
84 | */ | |
85 | 34 | @Override |
86 | public String getSpeciesId() | |
87 | { | |
88 | 34 | return getSource(); |
89 | } | |
90 | ||
91 | /** | |
92 | * Answers the genome assembly id e.g. "GRCh38", stored as field | |
93 | * <code>version</code> of DBRefEntry | |
94 | */ | |
95 | 35 | @Override |
96 | public String getAssemblyId() | |
97 | { | |
98 | 35 | return getVersion(); |
99 | } | |
100 | ||
101 | /** | |
102 | * Answers the chromosome identifier e.g. "X", stored as field | |
103 | * <code>accession</code> of DBRefEntry | |
104 | */ | |
105 | 35 | @Override |
106 | public String getChromosomeId() | |
107 | { | |
108 | 35 | return getAccessionId(); |
109 | } | |
110 | ||
111 | } |