| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 45f1d70 commit 568a8d4
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -325,51 +325,9 @@ public boolean mergeSequence(SubunitCluster other, SubunitClustererParameters pa | |||
| 325 | 325 | } | |
| 326 | 326 | } | |
| 327 | 327 | ||
| 328 | - // Do a List intersection to find out which EQR columns to remove | ||
| 329 | - List<Integer> thisRemove = new ArrayList<>(); | ||
| 330 | - List<Integer> otherRemove = new ArrayList<>(); | ||
| 331 | - | ||
| 332 | - for (int t = 0; t < this.subunitEQR.get(this.representative).size(); t++) { | ||
| 333 | - // If the index is aligned do nothing, otherwise mark as removing | ||
| 334 | - if (!thisAligned.contains(this.subunitEQR.get(this.representative) | ||
| 335 | - .get(t))) | ||
| 336 | - thisRemove.add(t); | ||
| 337 | - } | ||
| 338 | - | ||
| 339 | - for (int t = 0; t < other.subunitEQR.get(other.representative).size(); t++) { | ||
| 340 | - // If the index is aligned do nothing, otherwise mark as removing | ||
| 341 | - if (!otherAligned.contains(other.subunitEQR.get( | ||
| 342 | - other.representative).get(t))) | ||
| 343 | - otherRemove.add(t); | ||
| 344 | - } | ||
| 345 | - // Now remove unaligned columns, from end to start | ||
| 346 | - Collections.sort(thisRemove); | ||
| 347 | - Collections.reverse(thisRemove); | ||
| 348 | - Collections.sort(otherRemove); | ||
| 349 | - Collections.reverse(otherRemove); | ||
| 350 | - | ||
| 351 | - for (Integer column : thisRemove) { | ||
| 352 | - for (List<Integer> eqr : this.subunitEQR) { | ||
| 353 | - eqr.remove(column); | ||
| 354 | - } | ||
| 355 | - } | ||
| 356 | - | ||
| 357 | - for (Integer column : otherRemove) { | ||
| 358 | - for (List<Integer> eqr : other.subunitEQR) { | ||
| 359 | - eqr.remove(column); | ||
| 360 | - } | ||
| 361 | - } | ||
| 362 | - | ||
| 363 | - // The representative is the longest sequence | ||
| 364 | - if (this.subunits.get(this.representative).size() < other.subunits.get( | ||
| 365 | - other.representative).size()) | ||
| 366 | - this.representative = other.representative + subunits.size(); | ||
| 367 | - | ||
| 368 | - this.subunits.addAll(other.subunits); | ||
| 369 | - this.subunitEQR.addAll(other.subunitEQR); | ||
| 328 | + updateEquivResidues(other, thisAligned, otherAligned); | ||
| 370 | 329 | ||
| 371 | 330 | this.method = SubunitClustererMethod.SEQUENCE; | |
| 372 | - | ||
| 373 | 331 | pseudoStoichiometric = !params.isHighConfidenceScores(sequenceIdentity,sequenceCoverage); | |
| 374 | 332 | ||
| 375 | 333 | return true; | |
@@ -443,8 +401,8 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p | |||
| 443 | 401 | ||
| 444 | 402 | // Merge clusters | |
| 445 | 403 | List<List<Integer>> alignedRes = msa.getBlock(0).getAlignRes(); | |
| 446 | - List<Integer> thisAligned = new ArrayList<Integer>(); | ||
| 447 | - List<Integer> otherAligned = new ArrayList<Integer>(); | ||
| 404 | + List<Integer> thisAligned = new ArrayList<>(); | ||
| 405 | + List<Integer> otherAligned = new ArrayList<>(); | ||
| 448 | 406 | ||
| 449 | 407 | // Extract the aligned residues of both Subunit | |
| 450 | 408 | for (int p = 0; p < msa.length(); p++) { | |
@@ -467,24 +425,30 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p | |||
| 467 | 425 | } | |
| 468 | 426 | } | |
| 469 | 427 | ||
| 428 | + updateEquivResidues(other, thisAligned, otherAligned); | ||
| 429 | + | ||
| 430 | + this.method = SubunitClustererMethod.STRUCTURE; | ||
| 431 | + pseudoStoichiometric = true; | ||
| 432 | + | ||
| 433 | + return true; | ||
| 434 | + } | ||
| 435 | + | ||
| 436 | + private void updateEquivResidues(SubunitCluster other, List<Integer> thisAligned, List<Integer> otherAligned) { | ||
| 470 | 437 | // Do a List intersection to find out which EQR columns to remove | |
| 471 | - List<Integer> thisRemove = new ArrayList<Integer>(); | ||
| 472 | - List<Integer> otherRemove = new ArrayList<Integer>(); | ||
| 438 | + List<Integer> thisRemove = new ArrayList<>(); | ||
| 439 | + List<Integer> otherRemove = new ArrayList<>(); | ||
| 473 | 440 | ||
| 474 | 441 | for (int t = 0; t < this.subunitEQR.get(this.representative).size(); t++) { | |
| 475 | 442 | // If the index is aligned do nothing, otherwise mark as removing | |
| 476 | - if (!thisAligned.contains(this.subunitEQR.get(this.representative) | ||
| 477 | - .get(t))) | ||
| 443 | + if (!thisAligned.contains(this.subunitEQR.get(this.representative).get(t))) | ||
| 478 | 444 | thisRemove.add(t); | |
| 479 | 445 | } | |
| 480 | 446 | ||
| 481 | 447 | for (int t = 0; t < other.subunitEQR.get(other.representative).size(); t++) { | |
| 482 | 448 | // If the index is aligned do nothing, otherwise mark as removing | |
| 483 | - if (!otherAligned.contains(other.subunitEQR.get( | ||
| 484 | - other.representative).get(t))) | ||
| 449 | + if (!otherAligned.contains(other.subunitEQR.get(other.representative).get(t))) | ||
| 485 | 450 | otherRemove.add(t); | |
| 486 | 451 | } | |
| 487 | - | ||
| 488 | 452 | // Now remove unaligned columns, from end to start | |
| 489 | 453 | Collections.sort(thisRemove); | |
| 490 | 454 | Collections.reverse(thisRemove); | |
@@ -504,17 +468,12 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p | |||
| 504 | 468 | } | |
| 505 | 469 | ||
| 506 | 470 | // The representative is the longest sequence | |
| 507 | - if (this.subunits.get(this.representative).size() < other.subunits.get( | ||
| 508 | - other.representative).size()) | ||
| 471 | + if (this.subunits.get(this.representative).size() < other.subunits.get(other.representative).size()) | ||
| 509 | 472 | this.representative = other.representative + subunits.size(); | |
| 510 | 473 | ||
| 511 | 474 | this.subunits.addAll(other.subunits); | |
| 512 | 475 | this.subunitEQR.addAll(other.subunitEQR); | |
| 513 | 476 | ||
| 514 | - this.method = SubunitClustererMethod.STRUCTURE; | ||
| 515 | - pseudoStoichiometric = true; | ||
| 516 | - | ||
| 517 | - return true; | ||
| 518 | 477 | } | |
| 519 | 478 | ||
| 520 | 479 | /** | |
@@ -564,9 +523,9 @@ public boolean divideInternally(SubunitClustererParameters clusterParams) | |||
| 564 | 523 | List<List<Integer>> alignedRes = result.getMultipleAlignment() | |
| 565 | 524 | .getBlock(0).getAlignRes(); | |
| 566 | 525 | ||
| 567 | - List<List<Integer>> columns = new ArrayList<List<Integer>>(); | ||
| 526 | + List<List<Integer>> columns = new ArrayList<>(); | ||
| 568 | 527 | for (int s = 0; s < alignedRes.size(); s++) | |
| 569 | - columns.add(new ArrayList<Integer>(alignedRes.get(s).size())); | ||
| 528 | + columns.add(new ArrayList<>(alignedRes.get(s).size())); | ||
| 570 | 529 | ||
| 571 | 530 | // Extract the aligned columns of each repeat in the Subunit | |
| 572 | 531 | for (int col = 0; col < alignedRes.get(0).size(); col++) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,12 +56,8 @@ public static Stoichiometry cluster(Structure structure, | |||
| 56 | 56 | return cluster(subunits, params); | |
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | - public static Stoichiometry cluster(List<Subunit> subunits, | ||
| 60 | - SubunitClustererParameters params) { | ||
| 61 | - | ||
| 62 | - // The collection of clusters to return | ||
| 63 | - List<SubunitCluster> clusters = new ArrayList<SubunitCluster>(); | ||
| 64 | - | ||
| 59 | + public static Stoichiometry cluster(List<Subunit> subunits, SubunitClustererParameters params) { | ||
| 60 | + List<SubunitCluster> clusters = new ArrayList<>(); | ||
| 65 | 61 | if (subunits.size() == 0) | |
| 66 | 62 | return new Stoichiometry(clusters); | |
| 67 | 63 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,8 +52,8 @@ public class TestSubunitCluster { | |||
| 52 | 52 | @Test | |
| 53 | 53 | public void testMergeIdentical() { | |
| 54 | 54 | ||
| 55 | - // Create an Atom Array of ploy-alanine | ||
| 56 | - List<Atom> atoms = new ArrayList<Atom>(10); | ||
| 55 | + // Create an Atom Array of poly-alanine | ||
| 56 | + List<Atom> atoms = new ArrayList<>(10); | ||
| 57 | 57 | for (int i = 0; i < 10; i++) { | |
| 58 | 58 | Group g = new AminoAcidImpl(); | |
| 59 | 59 | g.setPDBName("ALA"); | |
@@ -79,7 +79,7 @@ public void testMergeIdentical() { | |||
| 79 | 79 | assertEquals(sc1.length(), 10); | |
| 80 | 80 | ||
| 81 | 81 | // Create an Atom Array of poly-glycine | |
| 82 | - List<Atom> atoms2 = new ArrayList<Atom>(10); | ||
| 82 | + List<Atom> atoms2 = new ArrayList<>(10); | ||
| 83 | 83 | for (int i = 0; i < 10; i++) { | |
| 84 | 84 | Group g = new AminoAcidImpl(); | |
| 85 | 85 | g.setPDBName("GLY"); | |
@@ -112,7 +112,7 @@ public void testMergeIdentical() { | |||
| 112 | 112 | public void testMergeSequence() throws CompoundNotFoundException { | |
| 113 | 113 | ||
| 114 | 114 | // Create an Atom Array of ploy-alanine | |
| 115 | - List<Atom> atoms = new ArrayList<Atom>(100); | ||
| 115 | + List<Atom> atoms = new ArrayList<>(100); | ||
| 116 | 116 | for (int i = 0; i < 100; i++) { | |
| 117 | 117 | Group g = new AminoAcidImpl(); | |
| 118 | 118 | g.setPDBName("ALA"); | |
@@ -163,7 +163,7 @@ public void testMergeSequence() throws CompoundNotFoundException { | |||
| 163 | 163 | assertEquals(sc1.length(), 100); | |
| 164 | 164 | ||
| 165 | 165 | // Create an Atom Array of 9 glycine and 91 alanine | |
| 166 | - List<Atom> atoms3 = new ArrayList<Atom>(100); | ||
| 166 | + List<Atom> atoms3 = new ArrayList<>(100); | ||
| 167 | 167 | for (int i = 0; i < 9; i++) { | |
| 168 | 168 | Group g = new AminoAcidImpl(); | |
| 169 | 169 | g.setPDBName("GLY"); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments