1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ext.ensembl; |
22 |
|
|
23 |
|
import jalview.analysis.AlignmentUtils; |
24 |
|
import jalview.bin.Cache; |
25 |
|
import jalview.datamodel.DBRefSource; |
26 |
|
import jalview.ws.seqfetcher.DbSourceProxyImpl; |
27 |
|
|
28 |
|
import com.stevesoft.pat.Regex; |
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@author |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 11 |
Complexity Density: 0.92 |
|
35 |
|
abstract class EnsemblSequenceFetcher extends DbSourceProxyImpl |
36 |
|
{ |
37 |
|
|
38 |
|
protected static final String ENSEMBL_BASEURL = "ENSEMBL_BASEURL"; |
39 |
|
|
40 |
|
protected static final String ENSEMBL_GENOMES_BASEURL = "ENSEMBL_GENOMES_BASEURL"; |
41 |
|
|
42 |
|
|
43 |
|
protected static final String DEFAULT_ENSEMBL_BASEURL = "https://rest.ensembl.org"; |
44 |
|
|
45 |
|
|
46 |
|
protected static final String DEFAULT_ENSEMBL_GENOMES_BASEURL = DEFAULT_ENSEMBL_BASEURL; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
private static final Regex ACCESSION_REGEX = new Regex( |
54 |
|
"(ENS([A-Z]{3}|)[GTEP]{1}[0-9]{11}$)" + "|" |
55 |
|
+ "(CCDS[0-9.]{3,}$)"); |
56 |
|
|
57 |
|
protected final String ensemblGenomesDomain; |
58 |
|
|
59 |
|
protected final String ensemblDomain; |
60 |
|
|
61 |
|
protected static final String OBJECT_TYPE_TRANSLATION = "Translation"; |
62 |
|
|
63 |
|
protected static final String OBJECT_TYPE_TRANSCRIPT = "Transcript"; |
64 |
|
|
65 |
|
protected static final String OBJECT_TYPE_GENE = "Gene"; |
66 |
|
|
67 |
|
protected static final String PARENT = "Parent"; |
68 |
|
|
69 |
|
protected static final String JSON_ID = AlignmentUtils.VARIANT_ID; |
70 |
|
|
71 |
|
protected static final String OBJECT_TYPE = "object_type"; |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
@see |
76 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
77 |
|
protected enum EnsemblFeatureType |
78 |
|
{ |
79 |
|
gene, transcript, cds, exon, repeat, simple, misc, variation, |
80 |
|
somatic_variation, structural_variation, somatic_structural_variation, |
81 |
|
constrained, regulatory |
82 |
|
} |
83 |
|
|
84 |
|
private String domain; |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
89 |
0 |
public EnsemblSequenceFetcher()... |
90 |
|
{ |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
0 |
ensemblDomain = Cache |
96 |
|
.getDefault(ENSEMBL_BASEURL, DEFAULT_ENSEMBL_BASEURL).trim(); |
97 |
0 |
ensemblGenomesDomain = Cache.getDefault(ENSEMBL_GENOMES_BASEURL, |
98 |
|
DEFAULT_ENSEMBL_GENOMES_BASEURL).trim(); |
99 |
0 |
domain = ensemblDomain; |
100 |
|
} |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
0 |
@Override... |
103 |
|
public String getDbSource() |
104 |
|
{ |
105 |
|
|
106 |
0 |
return DBRefSource.ENSEMBL; |
107 |
|
} |
108 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
0 |
@Override... |
110 |
|
public String getAccessionSeparator() |
111 |
|
{ |
112 |
0 |
return " "; |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
@see |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
121 |
0 |
@Override... |
122 |
|
public Regex getAccessionValidator() |
123 |
|
{ |
124 |
0 |
return ACCESSION_REGEX; |
125 |
|
} |
126 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
0 |
@Override... |
128 |
|
public boolean isValidReference(String accession) |
129 |
|
{ |
130 |
0 |
return getAccessionValidator().search(accession); |
131 |
|
} |
132 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
0 |
@Override... |
134 |
|
public int getTier() |
135 |
|
{ |
136 |
0 |
return 0; |
137 |
|
} |
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
142 |
0 |
@Override... |
143 |
|
public String getTestQuery() |
144 |
|
{ |
145 |
|
|
146 |
0 |
return "ENST00000288602"; |
147 |
|
|
148 |
|
} |
149 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
0 |
@Override... |
151 |
|
public boolean isDnaCoding() |
152 |
|
{ |
153 |
0 |
return true; |
154 |
|
} |
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
@return |
161 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
162 |
0 |
protected String getDomain()... |
163 |
|
{ |
164 |
0 |
return domain; |
165 |
|
} |
166 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
167 |
0 |
protected void setDomain(String d)... |
168 |
|
{ |
169 |
0 |
domain = d == null ? null : d.trim(); |
170 |
|
} |
171 |
|
} |