1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.io.vamsas; |
22 |
|
|
23 |
|
import jalview.bin.Console; |
24 |
|
import jalview.datamodel.DBRefEntry; |
25 |
|
import jalview.datamodel.SequenceI; |
26 |
|
import jalview.io.VamsasAppDatastore; |
27 |
|
|
28 |
|
import uk.ac.vamsas.objects.core.DataSet; |
29 |
|
import uk.ac.vamsas.objects.core.DbRef; |
30 |
|
import uk.ac.vamsas.objects.core.Map; |
31 |
|
import uk.ac.vamsas.objects.core.Sequence; |
32 |
|
|
|
|
| 0% |
Uncovered Elements: 111 (111) |
Complexity: 25 |
Complexity Density: 0.34 |
|
33 |
|
public class Dbref extends Rangetype |
34 |
|
{ |
35 |
|
jalview.datamodel.SequenceI sq = null; |
36 |
|
|
37 |
|
uk.ac.vamsas.objects.core.Sequence sequence = null; |
38 |
|
|
39 |
|
DataSet ds; |
40 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
41 |
0 |
public Dbref(VamsasAppDatastore datastore, DBRefEntry dbentry,... |
42 |
|
jalview.datamodel.SequenceI sq2, |
43 |
|
uk.ac.vamsas.objects.core.Sequence sequence2, DataSet dataset) |
44 |
|
{ |
45 |
0 |
super(datastore, dbentry, DbRef.class); |
46 |
|
|
47 |
0 |
sq = sq2; |
48 |
0 |
sequence = sequence2; |
49 |
0 |
this.jvobj = dbentry; |
50 |
0 |
ds = dataset; |
51 |
|
|
52 |
0 |
doSync(); |
53 |
|
} |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
55 |
0 |
public Dbref(VamsasAppDatastore datastore, DbRef ref, Sequence vdseq,... |
56 |
|
SequenceI dsseq) |
57 |
|
{ |
58 |
0 |
super(datastore, ref, jalview.datamodel.DBRefEntry.class); |
59 |
0 |
sequence = vdseq; |
60 |
0 |
sq = dsseq; |
61 |
0 |
ds = (DataSet) vdseq.getV_parent(); |
62 |
0 |
doJvUpdate(); |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 4 |
Complexity Density: 0.24 |
|
65 |
0 |
public void updateToDoc()... |
66 |
|
{ |
67 |
0 |
DbRef dbref = (DbRef) this.vobj; |
68 |
0 |
DBRefEntry jvobj = (DBRefEntry) this.jvobj; |
69 |
0 |
dbref.setAccessionId(jvobj.getAccessionId()); |
70 |
0 |
dbref.setSource(jvobj.getSource()); |
71 |
0 |
dbref.setVersion(jvobj.getVersion()); |
72 |
0 |
if (jvobj.getMap() != null) |
73 |
|
{ |
74 |
|
|
75 |
0 |
jalview.datamodel.Mapping mp = jvobj.getMap(); |
76 |
0 |
if (mp.getMap() != null) |
77 |
|
{ |
78 |
0 |
Map vMap = null; |
79 |
0 |
if (dbref.getMapCount() == 0) |
80 |
|
{ |
81 |
0 |
vMap = new Map(); |
82 |
0 |
initMapType(vMap, mp.getMap(), true); |
83 |
0 |
dbref.addMap(vMap); |
84 |
|
} |
85 |
|
else |
86 |
|
{ |
87 |
|
|
88 |
0 |
vMap = dbref.getMap(0); |
89 |
0 |
initMapType(vMap, mp.getMap(), true); |
90 |
|
} |
91 |
0 |
updateMapTo(mp); |
92 |
|
} |
93 |
|
} |
94 |
|
else |
95 |
|
{ |
96 |
0 |
Console.debug( |
97 |
|
"Ignoring mapless DbRef.Map " + jvobj.getSrcAccString()); |
98 |
|
} |
99 |
|
|
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
@param |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 7 |
Complexity Density: 1 |
|
108 |
0 |
private void updateMapTo(jalview.datamodel.Mapping mp)... |
109 |
|
{ |
110 |
0 |
log.info( |
111 |
|
"Performing updateMapTo remove this message when we know what we're doing."); |
112 |
|
|
113 |
|
|
114 |
0 |
if (mp != null && mp.getTo() != null) |
115 |
|
{ |
116 |
0 |
if (mp.getTo().getDatasetSequence() == null) |
117 |
|
{ |
118 |
|
|
119 |
0 |
DatastoreItem dssync = dsReg.getDatastoreItemFor(mp.getTo()); |
120 |
0 |
if (dssync == null) |
121 |
|
{ |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
0 |
dssync = new Datasetsequence(datastore, mp.getTo(), |
126 |
0 |
(mp.getMappedWidth() == mp.getWidth()) |
127 |
|
? sequence.getDictionary() |
128 |
0 |
: ((mp.getMappedWidth() == 3) |
129 |
|
? uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_NA |
130 |
|
: uk.ac.vamsas.objects.utils.SymbolDictionary.STANDARD_AA), |
131 |
|
ds); |
132 |
|
} |
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
} |
141 |
|
|
142 |
|
} |
143 |
|
else |
144 |
|
{ |
145 |
0 |
log.debug("Ignoring non-dataset sequence mapping."); |
146 |
|
} |
147 |
|
} |
148 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.45 |
|
149 |
0 |
public void updateFromDoc()... |
150 |
|
{ |
151 |
0 |
DbRef vobj = (DbRef) this.vobj; |
152 |
0 |
DBRefEntry jvobj = (DBRefEntry) this.jvobj; |
153 |
0 |
jvobj.setAccessionId(vobj.getAccessionId()); |
154 |
0 |
jvobj.setSource(vobj.getSource()); |
155 |
0 |
jvobj.setVersion(vobj.getVersion()); |
156 |
|
|
157 |
0 |
if (vobj.getMapCount() > 0) |
158 |
|
{ |
159 |
|
|
160 |
0 |
if (vobj.getMapCount() > 1) |
161 |
|
{ |
162 |
0 |
Console.debug("Ignoring additional mappings on DbRef: " |
163 |
|
+ jvobj.getSource() + ":" + jvobj.getAccessionId()); |
164 |
|
} |
165 |
0 |
jalview.datamodel.Mapping mp = new jalview.datamodel.Mapping( |
166 |
|
parsemapType(vobj.getMap(0))); |
167 |
0 |
if (jvobj.getMap() == null || !mp.equals(jvobj.getMap())) |
168 |
|
{ |
169 |
0 |
jvobj.setMap(mp); |
170 |
|
} |
171 |
|
} |
172 |
|
} |
173 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
174 |
0 |
public void conflict()... |
175 |
|
{ |
176 |
0 |
DbRef vobj = (DbRef) this.vobj; |
177 |
0 |
DBRefEntry jvobj = (DBRefEntry) this.jvobj; |
178 |
0 |
Console.debug("Conflict in dbentry update for " + vobj.getAccessionId() |
179 |
|
+ vobj.getSource() + " " + vobj.getVorbaId()); |
180 |
|
|
181 |
|
|
182 |
|
} |
183 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
184 |
0 |
public void addFromDocument()... |
185 |
|
{ |
186 |
0 |
DbRef vobj = (DbRef) this.vobj; |
187 |
0 |
DBRefEntry jvobj = (DBRefEntry) this.jvobj; |
188 |
|
|
189 |
0 |
sq.addDBRef(jvobj = new jalview.datamodel.DBRefEntry( |
190 |
|
vobj.getSource().toString(), vobj.getVersion().toString(), |
191 |
|
vobj.getAccessionId().toString())); |
192 |
0 |
if (vobj.getMapCount() > 0) |
193 |
|
{ |
194 |
|
|
195 |
0 |
if (vobj.getMapCount() > 1) |
196 |
|
{ |
197 |
0 |
Console.debug("Ignoring additional mappings on DbRef: " |
198 |
|
+ jvobj.getSource() + ":" + jvobj.getAccessionId()); |
199 |
|
} |
200 |
0 |
jalview.datamodel.Mapping mp = new jalview.datamodel.Mapping( |
201 |
|
parsemapType(vobj.getMap(0))); |
202 |
0 |
jvobj.setMap(mp); |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
0 |
bindjvvobj(jvobj, vobj); |
208 |
|
} |
209 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 3 |
Complexity Density: 0.2 |
|
210 |
0 |
public void addToDocument()... |
211 |
|
{ |
212 |
0 |
DBRefEntry jvobj = (DBRefEntry) this.jvobj; |
213 |
0 |
DbRef dbref = new DbRef(); |
214 |
0 |
bindjvvobj(jvobj, dbref); |
215 |
0 |
dbref.setAccessionId(jvobj.getAccessionId()); |
216 |
0 |
dbref.setSource(jvobj.getSource()); |
217 |
0 |
dbref.setVersion(jvobj.getVersion()); |
218 |
0 |
sequence.addDbRef(dbref); |
219 |
0 |
if (jvobj.getMap() != null) |
220 |
|
{ |
221 |
0 |
jalview.datamodel.Mapping mp = jvobj.getMap(); |
222 |
0 |
if (mp.getMap() != null) |
223 |
|
{ |
224 |
0 |
Map vMap = new Map(); |
225 |
0 |
initMapType(vMap, mp.getMap(), true); |
226 |
0 |
dbref.addMap(vMap); |
227 |
0 |
updateMapTo(mp); |
228 |
|
} |
229 |
|
else |
230 |
|
{ |
231 |
0 |
Console.debug( |
232 |
|
"Ignoring mapless DbRef.Map " + jvobj.getSrcAccString()); |
233 |
|
} |
234 |
|
} |
235 |
|
} |
236 |
|
|
237 |
|
} |