1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel; |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@author |
37 |
|
|
38 |
|
|
39 |
|
import java.util.Locale; |
40 |
|
|
|
|
| 91.7% |
Uncovered Elements: 2 (24) |
Complexity: 8 |
Complexity Density: 0.73 |
|
41 |
|
public class DBRefSource |
42 |
|
{ |
43 |
|
|
44 |
|
public static final String UNIPROT = "UNIPROT"; |
45 |
|
|
46 |
|
public static final String UP_NAME = "UNIPROT_NAME" |
47 |
|
.toUpperCase(Locale.ROOT); |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
public static final String UNIPROTKB = "UniProtKB/TrEMBL" |
53 |
|
.toUpperCase(Locale.ROOT); |
54 |
|
|
55 |
|
public static final String ENSEMBL = "ENSEMBL"; |
56 |
|
|
57 |
|
public static final String ENSEMBLGENOMES = "ENSEMBLGENOMES"; |
58 |
|
|
59 |
|
public static final String EMBL = "EMBL"; |
60 |
|
|
61 |
|
public static final String EMBLCDS = "EMBLCDS"; |
62 |
|
|
63 |
|
public static final String EMBLCDSProduct = "EMBLCDSProtein" |
64 |
|
.toUpperCase(Locale.ROOT); |
65 |
|
|
66 |
|
public static final String PDB = "PDB"; |
67 |
|
|
68 |
|
public static final String PFAM = "PFAM"; |
69 |
|
|
70 |
|
public static final String RFAM = "RFAM"; |
71 |
|
|
72 |
|
public static final String GENEDB = "GeneDB".toUpperCase(Locale.ROOT); |
73 |
|
|
74 |
|
public static final String PDB_CANONICAL_NAME = PDB; |
75 |
|
|
76 |
|
public static final String[] allSources = new String[] { UNIPROT, UP_NAME, |
77 |
|
UNIPROTKB, ENSEMBL, ENSEMBLGENOMES, EMBL, EMBLCDS, EMBLCDSProduct, |
78 |
|
PDB, PFAM, RFAM, GENEDB }; |
79 |
|
|
80 |
|
public static final int UNIPROT_MASK = 1 << 0; |
81 |
|
|
82 |
|
public static final int UP_NAME_MASK = 1 << 1; |
83 |
|
|
84 |
|
public static final int UNIPROT_KB_MASK = 1 << 2; |
85 |
|
|
86 |
|
public static final int ENSEMBL_MASK = 1 << 3; |
87 |
|
|
88 |
|
public static final int ENSEMBL_GENOMES_MASK = 1 << 4; |
89 |
|
|
90 |
|
public static final int EMBL_MASK = 1 << 5; |
91 |
|
|
92 |
|
public static final int EMBL_CDS_MASK = 1 << 6; |
93 |
|
|
94 |
|
public static final int EMBL_CDS_PRODUCT_MASK = 1 << 7; |
95 |
|
|
96 |
|
public static final int PDB_MASK = 1 << 8; |
97 |
|
|
98 |
|
public static final int PFAM_MASK = 1 << 9; |
99 |
|
|
100 |
|
public static final int RFAM_MASK = 1 << 10; |
101 |
|
|
102 |
|
public static final int GENE_DB_MASK = 1 << 11; |
103 |
|
|
104 |
|
public static final int MASK_COUNT = 12; |
105 |
|
|
106 |
|
public static final int ALL_MASKS = (1 << MASK_COUNT) - 1; |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
108 |
356 |
public static int getSourceKey(String name)... |
109 |
|
{ |
110 |
3148 |
for (int i = 0; i < MASK_COUNT; i++) |
111 |
|
{ |
112 |
2999 |
if (name.equals(allSources[i])) |
113 |
|
{ |
114 |
207 |
return 1 << i; |
115 |
|
} |
116 |
|
} |
117 |
149 |
return 0; |
118 |
|
} |
119 |
|
|
120 |
|
public static final int PRIMARY_MASK = UNIPROT_MASK | ENSEMBL_MASK; |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
public static final String[] DNACODINGDBS = { ENSEMBL, ENSEMBLGENOMES, |
126 |
|
EMBL, EMBLCDS, GENEDB }; |
127 |
|
|
128 |
|
public static final int DNA_CODING_MASK = ENSEMBL_MASK |
129 |
|
| ENSEMBL_GENOMES_MASK | EMBL_MASK | EMBL_CDS_MASK | GENE_DB_MASK; |
130 |
|
|
131 |
|
public static final String[] CODINGDBS = { EMBLCDS, GENEDB, ENSEMBL }; |
132 |
|
|
133 |
|
public static final int CODING_MASK = EMBL_CDS_MASK | GENE_DB_MASK |
134 |
|
| ENSEMBL_MASK; |
135 |
|
|
136 |
|
public static final String[] PROTEINDBS = { UNIPROT, UNIPROTKB, ENSEMBL, |
137 |
|
EMBLCDSProduct }; |
138 |
|
|
139 |
|
public static final int PROTEIN_MASK = UNIPROT_MASK | UNIPROT_KB_MASK |
140 |
|
| ENSEMBL_MASK | EMBL_CDS_PRODUCT_MASK; |
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
public static final int PRIMARY_SOURCES_MASK = CODING_MASK |
148 |
|
| DNA_CODING_MASK | PROTEIN_MASK; |
149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
48 |
public static boolean isPrimarySource(String source)... |
151 |
|
{ |
152 |
48 |
return ((PRIMARY_SOURCES_MASK & getSourceKey(source)) != 0); |
153 |
|
} |
154 |
|
|
|
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 4 |
Complexity Density: 0.67 |
|
155 |
834 |
public static boolean isPrimaryCandidate(String ucversion)... |
156 |
|
{ |
157 |
834 |
if (ucversion == null) |
158 |
|
{ |
159 |
|
|
160 |
0 |
return false; |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
4436 |
for (int i = allSources.length; --i >= 0;) |
165 |
|
{ |
166 |
4376 |
if (ucversion.startsWith(allSources[i])) |
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
{ |
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
|
175 |
774 |
return false; |
176 |
|
} |
177 |
|
} |
178 |
60 |
return true; |
179 |
|
} |
180 |
|
|
181 |
|
} |