| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package mc_view; |
| 22 |
|
|
| 23 |
|
import java.awt.Color; |
| 24 |
|
import java.util.ArrayList; |
| 25 |
|
import java.util.Collection; |
| 26 |
|
import java.util.List; |
| 27 |
|
import java.util.Locale; |
| 28 |
|
import java.util.Vector; |
| 29 |
|
|
| 30 |
|
import jalview.analysis.AlignSeq; |
| 31 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 32 |
|
import jalview.datamodel.Annotation; |
| 33 |
|
import jalview.datamodel.ContactMatrixI; |
| 34 |
|
import jalview.datamodel.Mapping; |
| 35 |
|
import jalview.datamodel.Sequence; |
| 36 |
|
import jalview.datamodel.SequenceFeature; |
| 37 |
|
import jalview.datamodel.SequenceI; |
| 38 |
|
import jalview.datamodel.annotations.AnnotationRowBuilder; |
| 39 |
|
import jalview.schemes.ColourSchemeI; |
| 40 |
|
import jalview.schemes.ResidueProperties; |
| 41 |
|
import jalview.structure.StructureImportSettings; |
| 42 |
|
import jalview.structure.StructureMapping; |
| 43 |
|
import jalview.util.Comparison; |
| 44 |
|
import jalview.util.Constants; |
| 45 |
|
import jalview.ws.datamodel.MappableContactMatrixI; |
| 46 |
|
|
| |
|
| 73.5% |
Uncovered Elements: 100 (378) |
Complexity: 99 |
Complexity Density: 0.41 |
|
| 47 |
|
public class PDBChain |
| 48 |
|
{ |
| 49 |
|
public static final String RESNUM_FEATURE = "RESNUM"; |
| 50 |
|
|
| 51 |
|
private static final String IEASTATUS = "IEA:jalview"; |
| 52 |
|
|
| 53 |
|
public String id; |
| 54 |
|
|
| 55 |
|
public Vector<Bond> bonds = new Vector<>(); |
| 56 |
|
|
| 57 |
|
public Vector<Atom> atoms = new Vector<>(); |
| 58 |
|
|
| 59 |
|
public Vector<Residue> residues = new Vector<>(); |
| 60 |
|
|
| 61 |
|
public int offset; |
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
public SequenceI sequence; |
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
public SequenceI shadow = null; |
| 73 |
|
|
| 74 |
|
public boolean isNa = false; |
| 75 |
|
|
| 76 |
|
public boolean isVisible = true; |
| 77 |
|
|
| 78 |
|
public int pdbstart = 0; |
| 79 |
|
|
| 80 |
|
public int pdbend = 0; |
| 81 |
|
|
| 82 |
|
public int seqstart = 0; |
| 83 |
|
|
| 84 |
|
public int seqend = 0; |
| 85 |
|
|
| 86 |
|
public String pdbid = ""; |
| 87 |
|
|
| 88 |
|
AnnotationRowBuilder tfacTemplate = new AnnotationRowBuilder( |
| 89 |
|
"Temperature Factor"); |
| 90 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 91 |
335 |
public PDBChain(String thePdbid, String theId,... |
| 92 |
|
AnnotationRowBuilder template) |
| 93 |
|
{ |
| 94 |
335 |
this(thePdbid, theId); |
| 95 |
335 |
if (template != null) |
| 96 |
|
{ |
| 97 |
79 |
tfacTemplate = template; |
| 98 |
|
} |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| 105 |
|
@param |
| 106 |
|
@param |
| 107 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 108 |
382 |
public PDBChain(String thePdbid, String theId)... |
| 109 |
|
{ |
| 110 |
382 |
this.pdbid = thePdbid == null ? thePdbid |
| 111 |
|
: thePdbid.toLowerCase(Locale.ROOT); |
| 112 |
382 |
this.id = theId; |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
|
| 116 |
|
|
| 117 |
|
|
| 118 |
|
protected String newline = System.getProperty("line.separator"); |
| 119 |
|
|
| 120 |
|
public Mapping shadowMap; |
| 121 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 122 |
1 |
public void setNewlineString(String nl)... |
| 123 |
|
{ |
| 124 |
1 |
newline = nl; |
| 125 |
|
} |
| 126 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 127 |
2 |
public String getNewlineString()... |
| 128 |
|
{ |
| 129 |
2 |
return newline; |
| 130 |
|
} |
| 131 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 132 |
1 |
public String print()... |
| 133 |
|
{ |
| 134 |
1 |
StringBuilder tmp = new StringBuilder(256); |
| 135 |
|
|
| 136 |
1 |
for (Bond b : bonds) |
| 137 |
|
{ |
| 138 |
3 |
tmp.append(b.at1.resName).append(" ").append(b.at1.resNumber) |
| 139 |
|
.append(" ").append(offset).append(newline); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
1 |
return tmp.toString(); |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 147 |
|
|
| 148 |
|
|
| 149 |
|
|
| 150 |
|
@param |
| 151 |
|
@param |
| 152 |
|
|
| |
|
| 84.6% |
Uncovered Elements: 4 (26) |
Complexity: 6 |
Complexity Density: 0.38 |
|
| 153 |
262 |
public void makeExactMapping(AlignSeq as, SequenceI s1)... |
| 154 |
|
{ |
| 155 |
262 |
int pdbpos = as.getSeq2Start() - 2; |
| 156 |
262 |
int alignpos = s1.getStart() + as.getSeq1Start() - 3; |
| 157 |
|
|
| 158 |
262 |
for (Atom atom : atoms) |
| 159 |
|
{ |
| 160 |
29012 |
atom.alignmentMapping = -1; |
| 161 |
|
} |
| 162 |
|
|
| 163 |
29267 |
for (int i = 0; i < as.astr1.length(); i++) |
| 164 |
|
{ |
| 165 |
29005 |
if (as.astr1.charAt(i) != '-') |
| 166 |
|
{ |
| 167 |
29005 |
alignpos++; |
| 168 |
|
} |
| 169 |
|
|
| 170 |
29005 |
if (as.astr2.charAt(i) != '-') |
| 171 |
|
{ |
| 172 |
29005 |
pdbpos++; |
| 173 |
|
} |
| 174 |
|
|
| 175 |
29005 |
boolean sameResidue = Comparison.isSameResidue(as.astr1.charAt(i), |
| 176 |
|
as.astr2.charAt(i), false); |
| 177 |
29005 |
if (sameResidue) |
| 178 |
|
{ |
| 179 |
28960 |
if (pdbpos >= residues.size()) |
| 180 |
|
{ |
| 181 |
0 |
continue; |
| 182 |
|
} |
| 183 |
28960 |
Residue res = residues.elementAt(pdbpos); |
| 184 |
28960 |
for (Atom atom : res.atoms) |
| 185 |
|
{ |
| 186 |
28963 |
atom.alignmentMapping = alignpos; |
| 187 |
|
} |
| 188 |
|
} |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
|
| 192 |
|
|
| 193 |
|
|
| 194 |
|
|
| 195 |
|
|
| 196 |
|
|
| 197 |
|
@param |
| 198 |
|
@param |
| 199 |
|
|
| |
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 4 |
Complexity Density: 0.25 |
|
| 200 |
0 |
public void makeExactMapping(StructureMapping mapping, SequenceI s1)... |
| 201 |
|
{ |
| 202 |
|
|
| 203 |
0 |
for (Atom atom : atoms) |
| 204 |
|
{ |
| 205 |
0 |
atom.alignmentMapping = -1; |
| 206 |
|
} |
| 207 |
0 |
SequenceI ds = s1; |
| 208 |
0 |
while (ds.getDatasetSequence() != null) |
| 209 |
|
{ |
| 210 |
0 |
ds = ds.getDatasetSequence(); |
| 211 |
|
} |
| 212 |
0 |
int pdboffset = 0; |
| 213 |
0 |
for (Residue res : residues) |
| 214 |
|
{ |
| 215 |
|
|
| 216 |
0 |
int seqpos = mapping.getSeqPos(res.atoms.get(0).resNumber); |
| 217 |
0 |
char strchar = sequence.getCharAt(pdboffset++); |
| 218 |
0 |
if (seqpos == StructureMapping.UNASSIGNED_VALUE) |
| 219 |
|
{ |
| 220 |
0 |
continue; |
| 221 |
|
} |
| 222 |
0 |
char seqchar = ds.getCharAt(seqpos - ds.getStart()); |
| 223 |
|
|
| 224 |
0 |
boolean sameResidue = Comparison.isSameResidue(seqchar, strchar, |
| 225 |
|
false); |
| 226 |
0 |
if (sameResidue) |
| 227 |
|
{ |
| 228 |
0 |
for (Atom atom : res.atoms) |
| 229 |
|
{ |
| 230 |
0 |
atom.alignmentMapping = seqpos - 1; |
| 231 |
|
} |
| 232 |
|
} |
| 233 |
|
} |
| 234 |
|
} |
| 235 |
|
|
| 236 |
|
|
| 237 |
|
|
| 238 |
|
|
| 239 |
|
|
| 240 |
|
@param |
| 241 |
|
@param |
| 242 |
|
|
| 243 |
|
|
| 244 |
|
@param |
| 245 |
|
|
| 246 |
|
|
| 247 |
|
|
| |
|
| 78.1% |
Uncovered Elements: 7 (32) |
Complexity: 12 |
Complexity Density: 0.67 |
|
| 248 |
261 |
public void transferRESNUMFeatures(SequenceI seq, String status,... |
| 249 |
|
String altPDBID) |
| 250 |
|
{ |
| 251 |
261 |
if (altPDBID == null) |
| 252 |
|
{ |
| 253 |
0 |
altPDBID = pdbid; |
| 254 |
|
} |
| 255 |
261 |
SequenceI sq = seq; |
| 256 |
520 |
while (sq != null && sq.getDatasetSequence() != null) |
| 257 |
|
{ |
| 258 |
259 |
sq = sq.getDatasetSequence(); |
| 259 |
259 |
if (sq == sequence) |
| 260 |
|
{ |
| 261 |
0 |
return; |
| 262 |
|
} |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
|
| 266 |
|
|
| 267 |
|
|
| 268 |
|
|
| 269 |
|
|
| 270 |
|
|
| 271 |
261 |
if (status == null) |
| 272 |
|
{ |
| 273 |
261 |
status = PDBChain.IEASTATUS; |
| 274 |
|
} |
| 275 |
|
|
| 276 |
261 |
List<SequenceFeature> features = sequence.getSequenceFeatures(); |
| 277 |
261 |
for (SequenceFeature feature : features) |
| 278 |
|
{ |
| 279 |
29006 |
if (feature.getFeatureGroup() != null |
| 280 |
|
&& feature.getFeatureGroup().equals(pdbid)) |
| 281 |
|
{ |
| 282 |
29006 |
int newBegin = 1 |
| 283 |
|
+ residues.elementAt(feature.getBegin() - offset).atoms |
| 284 |
|
.elementAt(0).alignmentMapping; |
| 285 |
29006 |
int newEnd = 1 + residues.elementAt(feature.getEnd() - offset).atoms |
| 286 |
|
.elementAt(0).alignmentMapping; |
| 287 |
29006 |
SequenceFeature tx = new SequenceFeature(feature, newBegin, newEnd, |
| 288 |
|
altPDBID, feature.getScore()); |
| 289 |
29006 |
tx.setStatus(status |
| 290 |
29006 |
+ ((tx.getStatus() == null || tx.getStatus().length() == 0) |
| 291 |
|
? "" |
| 292 |
|
: ":" + tx.getStatus())); |
| 293 |
29006 |
if (tx.begin != 0 && tx.end != 0) |
| 294 |
|
{ |
| 295 |
28957 |
sq.addSequenceFeature(tx); |
| 296 |
|
} |
| 297 |
|
} |
| 298 |
|
} |
| 299 |
|
} |
| 300 |
|
|
| 301 |
|
|
| 302 |
|
|
| 303 |
|
|
| 304 |
|
|
| 305 |
|
|
| |
|
| 90.6% |
Uncovered Elements: 3 (32) |
Complexity: 10 |
Complexity Density: 0.5 |
|
| 306 |
372 |
public void makeCaBondList()... |
| 307 |
|
{ |
| 308 |
372 |
boolean na = false; |
| 309 |
372 |
int numNa = 0; |
| 310 |
55847 |
for (int i = 0; i < (residues.size() - 1); i++) |
| 311 |
|
{ |
| 312 |
55475 |
Residue tmpres = residues.elementAt(i); |
| 313 |
55475 |
Residue tmpres2 = residues.elementAt(i + 1); |
| 314 |
55475 |
Atom at1 = tmpres.findAtom("CA"); |
| 315 |
55475 |
Atom at2 = tmpres2.findAtom("CA"); |
| 316 |
55475 |
na = false; |
| 317 |
55475 |
if ((at1 == null) && (at2 == null)) |
| 318 |
|
{ |
| 319 |
2 |
na = true; |
| 320 |
2 |
at1 = tmpres.findAtom("P"); |
| 321 |
2 |
at2 = tmpres2.findAtom("P"); |
| 322 |
|
} |
| 323 |
55475 |
if ((at1 != null) && (at2 != null)) |
| 324 |
|
{ |
| 325 |
55475 |
if (at1.chain.equals(at2.chain)) |
| 326 |
|
{ |
| 327 |
55475 |
if (na) |
| 328 |
|
{ |
| 329 |
2 |
numNa++; |
| 330 |
|
} |
| 331 |
55475 |
makeBond(at1, at2); |
| 332 |
|
} |
| 333 |
|
} |
| 334 |
|
else |
| 335 |
|
{ |
| 336 |
0 |
System.out.println("not found " + i); |
| 337 |
|
} |
| 338 |
|
} |
| 339 |
|
|
| 340 |
|
|
| 341 |
|
|
| 342 |
|
|
| 343 |
|
|
| 344 |
372 |
if (residues.size() > 1 && (numNa / (residues.size() - 1) > 0.99)) |
| 345 |
|
{ |
| 346 |
1 |
isNa = true; |
| 347 |
|
} |
| 348 |
|
} |
| 349 |
|
|
| 350 |
|
|
| 351 |
|
|
| 352 |
|
|
| 353 |
|
|
| 354 |
|
@param |
| 355 |
|
@param |
| 356 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 357 |
55485 |
public void makeBond(Atom at1, Atom at2)... |
| 358 |
|
{ |
| 359 |
55485 |
bonds.addElement(new Bond(at1, at2)); |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
|
| 363 |
|
|
| 364 |
|
|
| 365 |
|
|
| 366 |
|
|
| 367 |
|
|
| 368 |
|
|
| 369 |
|
|
| 370 |
|
|
| 371 |
|
|
| 372 |
|
|
| 373 |
|
|
| 374 |
|
@param |
| 375 |
|
|
| |
|
| 87.3% |
Uncovered Elements: 15 (118) |
Complexity: 24 |
Complexity Density: 0.29 |
|
| 376 |
375 |
public void makeResidueList(boolean visibleChainAnnotation)... |
| 377 |
|
{ |
| 378 |
375 |
int count = 0; |
| 379 |
375 |
Object symbol; |
| 380 |
375 |
boolean deoxyn = false; |
| 381 |
375 |
boolean nucleotide = false; |
| 382 |
375 |
StringBuilder seq = new StringBuilder(256); |
| 383 |
375 |
Vector<SequenceFeature> resFeatures = new Vector<>(); |
| 384 |
375 |
Vector<Annotation> resAnnotation = new Vector<>(); |
| 385 |
375 |
int iSize = atoms.size() - 1; |
| 386 |
375 |
int resNumber = -1; |
| 387 |
375 |
char insCode = ' '; |
| 388 |
|
|
| 389 |
56231 |
for (int i = 0; i <= iSize; i++) |
| 390 |
|
{ |
| 391 |
55856 |
Atom tmp = atoms.elementAt(i); |
| 392 |
55856 |
resNumber = tmp.resNumber; |
| 393 |
55856 |
insCode = tmp.insCode; |
| 394 |
|
|
| 395 |
55856 |
int res = resNumber; |
| 396 |
55856 |
char ins = insCode; |
| 397 |
|
|
| 398 |
55856 |
if (i == 0) |
| 399 |
|
{ |
| 400 |
375 |
offset = resNumber; |
| 401 |
|
} |
| 402 |
|
|
| 403 |
55856 |
Vector<Atom> resAtoms = new Vector<>(); |
| 404 |
|
|
| 405 |
|
|
| 406 |
111733 |
while ((resNumber == res) && (ins == insCode) && (i < atoms.size())) |
| 407 |
|
{ |
| 408 |
55877 |
resAtoms.add(atoms.elementAt(i)); |
| 409 |
55877 |
i++; |
| 410 |
|
|
| 411 |
55877 |
if (i < atoms.size()) |
| 412 |
|
{ |
| 413 |
55502 |
resNumber = atoms.elementAt(i).resNumber; |
| 414 |
55502 |
insCode = atoms.elementAt(i).insCode; |
| 415 |
|
} |
| 416 |
|
else |
| 417 |
|
{ |
| 418 |
375 |
resNumber++; |
| 419 |
|
} |
| 420 |
|
} |
| 421 |
|
|
| 422 |
|
|
| 423 |
55856 |
i--; |
| 424 |
|
|
| 425 |
|
|
| 426 |
55856 |
Atom currAtom = resAtoms.get(0); |
| 427 |
55856 |
if (currAtom.insCode != ' ' && !residues.isEmpty() |
| 428 |
|
&& residues.lastElement().atoms |
| 429 |
|
.get(0).resNumber == currAtom.resNumber) |
| 430 |
|
{ |
| 431 |
0 |
String desc = currAtom.resName + ":" + currAtom.resNumIns + " " |
| 432 |
|
+ pdbid + id; |
| 433 |
0 |
SequenceFeature sf = new SequenceFeature("INSERTION", desc, |
| 434 |
|
offset + count - 1, offset + count - 1, "PDB_INS"); |
| 435 |
0 |
resFeatures.addElement(sf); |
| 436 |
0 |
residues.lastElement().atoms.addAll(resAtoms); |
| 437 |
|
} |
| 438 |
|
else |
| 439 |
|
{ |
| 440 |
|
|
| 441 |
55856 |
residues.addElement(new Residue(resAtoms, resNumber - 1, count)); |
| 442 |
|
|
| 443 |
55856 |
Residue tmpres = residues.lastElement(); |
| 444 |
55856 |
Atom tmpat = tmpres.atoms.get(0); |
| 445 |
|
|
| 446 |
55856 |
String desc = tmpat.resName + ":" + tmpat.resNumIns + " " + pdbid |
| 447 |
|
+ id; |
| 448 |
55856 |
SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, desc, |
| 449 |
|
offset + count, offset + count, pdbid); |
| 450 |
55856 |
resFeatures.addElement(sf); |
| 451 |
55856 |
resAnnotation.addElement(new Annotation(tmpat.tfactor)); |
| 452 |
|
|
| 453 |
|
|
| 454 |
? |
if ((symbol = ResidueProperties.getAA3Hash() |
| 455 |
|
.get(tmpat.resName)) == null) |
| 456 |
|
{ |
| 457 |
7 |
String nucname = tmpat.resName.trim(); |
| 458 |
|
|
| 459 |
|
|
| 460 |
7 |
deoxyn = nucname.length() == 2 |
| 461 |
|
&& ResidueProperties.aaIndex[nucname |
| 462 |
|
.charAt(0)] == ResidueProperties.aaIndex['D']; |
| 463 |
7 |
if (tmpat.name.equalsIgnoreCase("CA") |
| 464 |
|
|| ResidueProperties.nucleotideIndex[nucname |
| 465 |
3 |
.charAt((deoxyn ? 1 : 0))] == -1) |
| 466 |
|
{ |
| 467 |
4 |
char r = ResidueProperties.getSingleCharacterCode( |
| 468 |
|
ResidueProperties.getCanonicalAminoAcid(tmpat.resName)); |
| 469 |
4 |
seq.append(r == '0' ? 'X' : r); |
| 470 |
|
|
| 471 |
|
|
| 472 |
|
} |
| 473 |
|
else |
| 474 |
|
{ |
| 475 |
|
|
| 476 |
3 |
nucleotide = true; |
| 477 |
3 |
seq.append(nucname.charAt((deoxyn ? 1 : 0))); |
| 478 |
|
} |
| 479 |
|
} |
| 480 |
|
else |
| 481 |
|
{ |
| 482 |
55849 |
if (nucleotide) |
| 483 |
|
{ |
| 484 |
0 |
System.err.println( |
| 485 |
|
"Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!"); |
| 486 |
|
} |
| 487 |
55849 |
seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]); |
| 488 |
|
} |
| 489 |
55856 |
count++; |
| 490 |
|
} |
| 491 |
|
} |
| 492 |
|
|
| 493 |
375 |
if (id.length() < 1) |
| 494 |
|
{ |
| 495 |
0 |
id = " "; |
| 496 |
|
} |
| 497 |
375 |
isNa = nucleotide; |
| 498 |
375 |
sequence = new Sequence(id, seq.toString(), offset, resNumber - 1); |
| 499 |
|
|
| 500 |
|
|
| 501 |
|
|
| 502 |
|
|
| 503 |
|
|
| 504 |
|
|
| 505 |
|
|
| 506 |
|
|
| 507 |
|
|
| 508 |
375 |
if (StructureImportSettings.isShowSeqFeatures()) |
| 509 |
|
{ |
| 510 |
361 |
iSize = resFeatures.size(); |
| 511 |
52865 |
for (int i = 0; i < iSize; i++) |
| 512 |
|
{ |
| 513 |
52504 |
sequence.addSequenceFeature(resFeatures.elementAt(i)); |
| 514 |
52504 |
resFeatures.setElementAt(null, i); |
| 515 |
|
} |
| 516 |
|
} |
| 517 |
375 |
if (visibleChainAnnotation) |
| 518 |
|
{ |
| 519 |
235 |
Annotation[] annots = new Annotation[resAnnotation.size()]; |
| 520 |
235 |
float max = 0f; |
| 521 |
235 |
float min = 0f; |
| 522 |
235 |
iSize = annots.length; |
| 523 |
37275 |
for (int i = 0; i < iSize; i++) |
| 524 |
|
{ |
| 525 |
37040 |
annots[i] = resAnnotation.elementAt(i); |
| 526 |
37040 |
tfacTemplate.processAnnotation(annots[i]); |
| 527 |
37040 |
max = Math.max(max, annots[i].value); |
| 528 |
37040 |
min = Math.min(min, annots[i].value); |
| 529 |
37040 |
resAnnotation.setElementAt(null, i); |
| 530 |
|
} |
| 531 |
235 |
if (tfacTemplate.isHasMinMax()) |
| 532 |
|
{ |
| 533 |
44 |
max = tfacTemplate.getMax(); |
| 534 |
44 |
min = tfacTemplate.getMin(); |
| 535 |
|
} |
| 536 |
|
|
| 537 |
235 |
AlignmentAnnotation tfactorann = new AlignmentAnnotation( |
| 538 |
|
tfacTemplate.getName(), |
| 539 |
235 |
(tfacTemplate.isHasDescription() |
| 540 |
|
? tfacTemplate.getDescription() |
| 541 |
|
: tfacTemplate.getName()) + " for " + pdbid + id, |
| 542 |
|
annots, min, max, AlignmentAnnotation.LINE_GRAPH); |
| 543 |
235 |
tfactorann.setTFType(tfacTemplate.getTFType()); |
| 544 |
235 |
tfactorann.setCalcId(getClass().getName()); |
| 545 |
235 |
tfactorann.setProperty(Constants.PDBID, pdbid); |
| 546 |
235 |
tfactorann.setProperty(Constants.CHAINID, id); |
| 547 |
|
|
| 548 |
235 |
tfactorann.setSequenceRef(sequence); |
| 549 |
235 |
sequence.addAlignmentAnnotation(tfactorann); |
| 550 |
|
} |
| 551 |
|
} |
| 552 |
|
|
| 553 |
|
|
| 554 |
|
|
| 555 |
|
|
| 556 |
|
|
| 557 |
|
|
| 558 |
|
|
| 559 |
|
|
| 560 |
|
|
| 561 |
|
|
| |
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 562 |
1 |
public void setChargeColours()... |
| 563 |
|
{ |
| 564 |
1 |
for (Bond b : bonds) |
| 565 |
|
{ |
| 566 |
3 |
if (b.at1 != null && b.at2 != null) |
| 567 |
|
{ |
| 568 |
3 |
b.startCol = getChargeColour(b.at1.resName); |
| 569 |
3 |
b.endCol = getChargeColour(b.at2.resName); |
| 570 |
|
} |
| 571 |
|
else |
| 572 |
|
{ |
| 573 |
0 |
b.startCol = Color.gray; |
| 574 |
0 |
b.endCol = Color.gray; |
| 575 |
|
} |
| 576 |
|
} |
| 577 |
|
} |
| 578 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 6 |
Complexity Density: 0.75 |
|
| 579 |
13 |
public static Color getChargeColour(String resName)... |
| 580 |
|
{ |
| 581 |
13 |
Color result = Color.lightGray; |
| 582 |
13 |
if ("ASP".equals(resName) || "GLU".equals(resName)) |
| 583 |
|
{ |
| 584 |
3 |
result = Color.red; |
| 585 |
|
} |
| 586 |
10 |
else if ("LYS".equals(resName) || "ARG".equals(resName)) |
| 587 |
|
{ |
| 588 |
4 |
result = Color.blue; |
| 589 |
|
} |
| 590 |
6 |
else if ("CYS".equals(resName)) |
| 591 |
|
{ |
| 592 |
3 |
result = Color.yellow; |
| 593 |
|
} |
| 594 |
13 |
return result; |
| 595 |
|
} |
| 596 |
|
|
| 597 |
|
|
| 598 |
|
|
| 599 |
|
|
| 600 |
|
|
| 601 |
|
|
| 602 |
|
@param |
| 603 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.22 |
|
| 604 |
1 |
public void setChainColours(ColourSchemeI cs)... |
| 605 |
|
{ |
| 606 |
1 |
int index; |
| 607 |
1 |
for (Bond b : bonds) |
| 608 |
|
{ |
| 609 |
3 |
try |
| 610 |
|
{ |
| 611 |
3 |
index = ResidueProperties.aa3Hash.get(b.at1.resName).intValue(); |
| 612 |
3 |
b.startCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0, |
| 613 |
|
null, null, 0f); |
| 614 |
|
|
| 615 |
3 |
index = ResidueProperties.aa3Hash.get(b.at2.resName).intValue(); |
| 616 |
2 |
b.endCol = cs.findColour(ResidueProperties.aa[index].charAt(0), 0, |
| 617 |
|
null, null, 0f); |
| 618 |
|
|
| 619 |
|
} catch (Exception e) |
| 620 |
|
{ |
| 621 |
1 |
b.startCol = Color.gray; |
| 622 |
1 |
b.endCol = Color.gray; |
| 623 |
|
} |
| 624 |
|
} |
| 625 |
|
} |
| 626 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 627 |
1 |
public void setChainColours(Color col)... |
| 628 |
|
{ |
| 629 |
1 |
for (Bond b : bonds) |
| 630 |
|
{ |
| 631 |
2 |
b.startCol = col; |
| 632 |
2 |
b.endCol = col; |
| 633 |
|
} |
| 634 |
|
} |
| 635 |
|
|
| 636 |
|
|
| 637 |
|
|
| 638 |
|
|
| 639 |
|
|
| 640 |
|
@param |
| 641 |
|
|
| 642 |
|
@param |
| 643 |
|
|
| 644 |
|
@return |
| 645 |
|
|
| |
|
| 42.5% |
Uncovered Elements: 42 (73) |
Complexity: 19 |
Complexity Density: 0.4 |
|
| 646 |
261 |
public void transferResidueAnnotation(... |
| 647 |
|
StructureMapping mapping, jalview.datamodel.Mapping sqmpping) |
| 648 |
|
{ |
| 649 |
261 |
SequenceI sq = mapping.getSequence(); |
| 650 |
261 |
SequenceI dsq = sq; |
| 651 |
261 |
if (sqmpping == null) |
| 652 |
|
{ |
| 653 |
|
|
| 654 |
|
|
| 655 |
0 |
sqmpping = mapping.getSeqToPdbMapping(); |
| 656 |
|
} |
| 657 |
261 |
if (sq != null) |
| 658 |
|
{ |
| 659 |
520 |
while (dsq.getDatasetSequence() != null) |
| 660 |
|
{ |
| 661 |
259 |
dsq = dsq.getDatasetSequence(); |
| 662 |
|
} |
| 663 |
|
|
| 664 |
|
|
| 665 |
261 |
if (shadow != null && shadow.getAnnotation() != null) |
| 666 |
|
{ |
| 667 |
|
|
| 668 |
0 |
for (AlignmentAnnotation ana : shadow.getAnnotation()) |
| 669 |
|
{ |
| 670 |
|
|
| 671 |
|
|
| 672 |
0 |
List<AlignmentAnnotation> transfer = sq.getAlignmentAnnotations( |
| 673 |
|
ana.getCalcId(), ana.label, ana.description); |
| 674 |
0 |
if (transfer == null || transfer.size() == 0) |
| 675 |
|
{ |
| 676 |
0 |
ContactMatrixI cm = shadow.getContactMatrixFor(ana); |
| 677 |
0 |
ana = new AlignmentAnnotation(ana); |
| 678 |
0 |
addMetadata(ana); |
| 679 |
|
|
| 680 |
0 |
ana.liftOver(sequence, shadowMap); |
| 681 |
0 |
ana.liftOver(dsq, sqmpping); |
| 682 |
0 |
dsq.addAlignmentAnnotation(ana); |
| 683 |
0 |
if (cm != null) |
| 684 |
|
{ |
| 685 |
0 |
dsq.addContactListFor(ana, cm); |
| 686 |
|
} |
| 687 |
|
} |
| 688 |
|
else |
| 689 |
|
{ |
| 690 |
0 |
continue; |
| 691 |
|
} |
| 692 |
|
} |
| 693 |
|
} |
| 694 |
|
else |
| 695 |
|
{ |
| 696 |
261 |
if (sequence != null && sequence.getAnnotation() != null) |
| 697 |
|
{ |
| 698 |
204 |
for (AlignmentAnnotation ana : sequence.getAnnotation()) |
| 699 |
|
{ |
| 700 |
|
|
| 701 |
|
|
| 702 |
420 |
List<AlignmentAnnotation> transfer = dsq |
| 703 |
|
.getAlignmentAnnotations(ana.getCalcId(), ana.label, |
| 704 |
|
ana.description); |
| 705 |
420 |
if (transfer == null || transfer.size() == 0) |
| 706 |
|
{ |
| 707 |
228 |
ContactMatrixI cm = sequence.getContactMatrixFor(ana); |
| 708 |
228 |
ana = new AlignmentAnnotation(ana); |
| 709 |
228 |
addMetadata(ana); |
| 710 |
228 |
ana.liftOver(dsq, sqmpping); |
| 711 |
228 |
dsq.addAlignmentAnnotation(ana); |
| 712 |
228 |
if (cm != null && cm instanceof MappableContactMatrixI) |
| 713 |
|
{ |
| 714 |
39 |
dsq.addContactListFor(ana, ((MappableContactMatrixI) cm) |
| 715 |
|
.liftOver(dsq, sqmpping)); |
| 716 |
|
} |
| 717 |
|
} |
| 718 |
|
else |
| 719 |
|
{ |
| 720 |
192 |
continue; |
| 721 |
|
} |
| 722 |
|
} |
| 723 |
|
} |
| 724 |
|
} |
| 725 |
261 |
if (false) |
| 726 |
|
{ |
| 727 |
|
|
| 728 |
0 |
float min = -1, max = 0; |
| 729 |
0 |
Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1]; |
| 730 |
0 |
for (int i = sq.getStart(), j = sq.getEnd(), |
| 731 |
0 |
k = 0; i <= j; i++, k++) |
| 732 |
|
{ |
| 733 |
0 |
int prn = mapping.getPDBResNum(k + 1); |
| 734 |
|
|
| 735 |
0 |
an[k] = new Annotation(prn); |
| 736 |
0 |
if (min == -1) |
| 737 |
|
{ |
| 738 |
0 |
min = k; |
| 739 |
0 |
max = k; |
| 740 |
|
} |
| 741 |
|
else |
| 742 |
|
{ |
| 743 |
0 |
if (min > k) |
| 744 |
|
{ |
| 745 |
0 |
min = k; |
| 746 |
|
} |
| 747 |
0 |
else if (max < k) |
| 748 |
|
{ |
| 749 |
0 |
max = k; |
| 750 |
|
} |
| 751 |
|
} |
| 752 |
|
} |
| 753 |
0 |
AlignmentAnnotation pdbresnumannots = new AlignmentAnnotation( |
| 754 |
|
"PDB.RESNUM", |
| 755 |
|
"PDB Residue Numbering for " + this.pdbid + ":" + this.id, |
| 756 |
|
an, min, max, AlignmentAnnotation.LINE_GRAPH); |
| 757 |
|
|
| 758 |
0 |
sq.addAlignmentAnnotation(pdbresnumannots); |
| 759 |
|
} |
| 760 |
|
} |
| 761 |
|
} |
| 762 |
|
|
| |
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 4 |
Complexity Density: 1 |
|
| 763 |
228 |
private void addMetadata(AlignmentAnnotation ana)... |
| 764 |
|
{ |
| 765 |
228 |
if (pdbid != null && !pdbid.isEmpty()) |
| 766 |
|
{ |
| 767 |
228 |
ana.setProperty(Constants.PDBID, pdbid); |
| 768 |
|
} |
| 769 |
228 |
if (id != null) |
| 770 |
|
{ |
| 771 |
228 |
ana.setProperty(Constants.CHAINID, id); |
| 772 |
|
} |
| 773 |
|
} |
| 774 |
|
} |