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 |
|
|
|
|
| 80.4% |
Uncovered Elements: 11 (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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
133 |
6 |
public SequenceOntologyLite()... |
134 |
|
{ |
135 |
6 |
termsFound = new ArrayList<>(); |
136 |
6 |
termsNotFound = new ArrayList<>(); |
137 |
6 |
loadStaticData(); |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
143 |
6 |
private void loadStaticData()... |
144 |
|
{ |
145 |
6 |
parents = new HashMap<>(); |
146 |
6 |
for (String[] pair : TERMS) |
147 |
|
{ |
148 |
246 |
List<String> p = parents.get(pair[0]); |
149 |
246 |
if (p == null) |
150 |
|
{ |
151 |
246 |
p = new ArrayList<>(); |
152 |
246 |
parents.put(pair[0], p); |
153 |
|
} |
154 |
246 |
p.add(pair[1]); |
155 |
|
} |
156 |
|
} |
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
|
|
| 90.5% |
Uncovered Elements: 2 (21) |
Complexity: 6 |
Complexity Density: 0.46 |
|
162 |
80 |
@Override... |
163 |
|
public boolean isA(String child, String parent) |
164 |
|
{ |
165 |
80 |
if (child == null || parent == null) |
166 |
|
{ |
167 |
0 |
return false; |
168 |
|
} |
169 |
80 |
if (child.equals(parent)) |
170 |
|
{ |
171 |
11 |
termFound(child); |
172 |
11 |
return true; |
173 |
|
} |
174 |
|
|
175 |
69 |
List<String> p = parents.get(child); |
176 |
69 |
if (p == null) |
177 |
|
{ |
178 |
13 |
termNotFound(child); |
179 |
13 |
return false; |
180 |
|
} |
181 |
56 |
termFound(child); |
182 |
56 |
if (p.contains(parent)) |
183 |
|
{ |
184 |
22 |
return true; |
185 |
|
} |
186 |
34 |
return false; |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
@param |
193 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
194 |
67 |
private void termFound(String term)... |
195 |
|
{ |
196 |
67 |
if (!termsFound.contains(term)) |
197 |
|
{ |
198 |
27 |
synchronized (termsFound) |
199 |
|
{ |
200 |
27 |
termsFound.add(term); |
201 |
|
} |
202 |
|
} |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
@param |
209 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
210 |
13 |
private void termNotFound(String term)... |
211 |
|
{ |
212 |
13 |
synchronized (termsNotFound) |
213 |
|
{ |
214 |
13 |
if (!termsNotFound.contains(term)) |
215 |
|
{ |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
7 |
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 |
|
} |