1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.io.gff; |
22 |
|
|
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.Collections; |
25 |
|
import java.util.HashMap; |
26 |
|
import java.util.List; |
27 |
|
import java.util.Map; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@author |
39 |
|
|
40 |
|
|
|
|
| 0% |
Uncovered Elements: 56 (56) |
Complexity: 15 |
Complexity Density: 0.43 |
|
41 |
|
public class SequenceOntologyLite implements SequenceOntologyI |
42 |
|
{ |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
private final String[][] TERMS = new String[][] { |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
{ "gene", "gene" }, |
56 |
|
{ "ncRNA_gene", "gene" }, |
57 |
|
{ "snRNA_gene", "gene" }, |
58 |
|
{ "miRNA_gene", "gene" }, |
59 |
|
{ "lincRNA_gene", "gene" }, |
60 |
|
{ "rRNA_gene", "gene" }, |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
{ "transcript", "transcript" }, |
66 |
|
{ "mature_transcript", "transcript" }, |
67 |
|
{ "processed_transcript", "transcript" }, |
68 |
|
{ "aberrant_processed_transcript", "transcript" }, |
69 |
|
{ "ncRNA", "transcript" }, |
70 |
|
{ "snRNA", "transcript" }, |
71 |
|
{ "miRNA", "transcript" }, |
72 |
|
{ "lincRNA", "transcript" }, |
73 |
|
{ "lnc_RNA", "transcript" }, |
74 |
|
{ "rRNA", "transcript" }, |
75 |
|
{ "mRNA", "transcript" }, |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
{ "sequence_variant", "sequence_variant" }, |
82 |
|
{ "structural_variant", "sequence_variant" }, |
83 |
|
{ "feature_variant", "sequence_variant" }, |
84 |
|
{ "gene_variant", "sequence_variant" }, |
85 |
|
{ "transcript_variant", "sequence_variant" }, |
86 |
|
|
87 |
|
|
88 |
|
{ "NMD_transcript_variant", "sequence_variant" }, |
89 |
|
{ "missense_variant", "sequence_variant" }, |
90 |
|
{ "synonymous_variant", "sequence_variant" }, |
91 |
|
{ "frameshift_variant", "sequence_variant" }, |
92 |
|
{ "5_prime_UTR_variant", "sequence_variant" }, |
93 |
|
{ "3_prime_UTR_variant", "sequence_variant" }, |
94 |
|
{ "stop_gained", "sequence_variant" }, |
95 |
|
{ "stop_lost", "sequence_variant" }, |
96 |
|
{ "inframe_deletion", "sequence_variant" }, |
97 |
|
{ "inframe_insertion", "sequence_variant" }, |
98 |
|
{ "splice_region_variant", "sequence_variant" }, |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
{ "exon", "exon" }, |
105 |
|
{ "coding_exon", "exon" }, |
106 |
|
{ "CDS", "CDS" }, |
107 |
|
{ "CDS_predicted", "CDS" }, |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
{ "protein_match", "protein_match"}, |
113 |
|
{ "nucleotide_match", "nucleotide_match"}, |
114 |
|
{ "cDNA_match", "nucleotide_match"}, |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
{ "polypeptide", "polypeptide" } |
120 |
|
}; |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
private Map<String, List<String>> parents; |
128 |
|
|
129 |
|
private List<String> termsFound; |
130 |
|
|
131 |
|
private List<String> termsNotFound; |
132 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
133 |
0 |
public SequenceOntologyLite()... |
134 |
|
{ |
135 |
0 |
termsFound = new ArrayList<>(); |
136 |
0 |
termsNotFound = new ArrayList<>(); |
137 |
0 |
loadStaticData(); |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
143 |
0 |
private void loadStaticData()... |
144 |
|
{ |
145 |
0 |
parents = new HashMap<>(); |
146 |
0 |
for (String[] pair : TERMS) |
147 |
|
{ |
148 |
0 |
List<String> p = parents.get(pair[0]); |
149 |
0 |
if (p == null) |
150 |
|
{ |
151 |
0 |
p = new ArrayList<>(); |
152 |
0 |
parents.put(pair[0], p); |
153 |
|
} |
154 |
0 |
p.add(pair[1]); |
155 |
|
} |
156 |
|
} |
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 6 |
Complexity Density: 0.46 |
|
162 |
0 |
@Override... |
163 |
|
public boolean isA(String child, String parent) |
164 |
|
{ |
165 |
0 |
if (child == null || parent == null) |
166 |
|
{ |
167 |
0 |
return false; |
168 |
|
} |
169 |
0 |
if (child.equals(parent)) |
170 |
|
{ |
171 |
0 |
termFound(child); |
172 |
0 |
return true; |
173 |
|
} |
174 |
|
|
175 |
0 |
List<String> p = parents.get(child); |
176 |
0 |
if (p == null) |
177 |
|
{ |
178 |
0 |
termNotFound(child); |
179 |
0 |
return false; |
180 |
|
} |
181 |
0 |
termFound(child); |
182 |
0 |
if (p.contains(parent)) |
183 |
|
{ |
184 |
0 |
return true; |
185 |
|
} |
186 |
0 |
return false; |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
@param |
193 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
194 |
0 |
private void termFound(String term)... |
195 |
|
{ |
196 |
0 |
if (!termsFound.contains(term)) |
197 |
|
{ |
198 |
0 |
synchronized (termsFound) |
199 |
|
{ |
200 |
0 |
termsFound.add(term); |
201 |
|
} |
202 |
|
} |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
@param |
209 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
210 |
0 |
private void termNotFound(String term)... |
211 |
|
{ |
212 |
0 |
synchronized (termsNotFound) |
213 |
|
{ |
214 |
0 |
if (!termsNotFound.contains(term)) |
215 |
|
{ |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
0 |
termsNotFound.add(term); |
222 |
|
} |
223 |
|
} |
224 |
|
} |
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
229 |
0 |
@Override... |
230 |
|
public List<String> termsFound() |
231 |
|
{ |
232 |
0 |
synchronized (termsFound) |
233 |
|
{ |
234 |
0 |
Collections.sort(termsFound, String.CASE_INSENSITIVE_ORDER); |
235 |
0 |
return termsFound; |
236 |
|
} |
237 |
|
} |
238 |
|
|
239 |
|
|
240 |
|
|
241 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
242 |
0 |
@Override... |
243 |
|
public List<String> termsNotFound() |
244 |
|
{ |
245 |
0 |
synchronized (termsNotFound) |
246 |
|
{ |
247 |
0 |
Collections.sort(termsNotFound, String.CASE_INSENSITIVE_ORDER); |
248 |
0 |
return termsNotFound; |
249 |
|
} |
250 |
|
} |
251 |
|
} |