Skip to content

Commit 2807d3d

Browse files
committed
Cleanup
1 parent e70f0ef commit 2807d3d

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/contact/TestInterfaceFinder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ public class TestInterfaceFinder {
2222
public void testGetAllInterfaces() throws StructureException, IOException {
2323
Structure s = StructureIO.getStructure("3hbx");
2424

25-
InterfaceFinder finder = new InterfaceFinder(s);
25+
long start = System.currentTimeMillis();
2626

27+
InterfaceFinder finder = new InterfaceFinder(s);
2728
StructureInterfaceList list = finder.getAllInterfaces();
2829

30+
long end = System.currentTimeMillis();
31+
System.out.println("Took " + (end-start) + " ms to calculate interfaces");
32+
2933
assertEquals(12, list.size());
3034

3135
Set<Pair<String>> unique = new HashSet<>();

biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterface.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ protected Atom[] getAtomsForAsa(int cofactorSizeToUse) {
304304
* non-Hydrogen atoms are not included
305305
* @return
306306
*/
307-
private static final Atom[] getAllNonHAtomArray(Atom[] m, int minSizeHetAtomToInclude) {
307+
private static Atom[] getAllNonHAtomArray(Atom[] m, int minSizeHetAtomToInclude) {
308308
List<Atom> atoms = new ArrayList<>();
309309

310310
for (Atom a:m){
@@ -348,7 +348,7 @@ private static boolean isInChain(Group g) {
348348
ChemComp chemComp = g.getChemComp();
349349

350350
if (chemComp==null) {
351-
logger.warn("Warning: can't determine PolymerType for group "+g.getResidueNumber()+" ("+g.getPDBName()+"). Will consider it as non-nucleotide/non-protein type.");
351+
logger.warn("Can't determine PolymerType for group "+g.getResidueNumber()+" ("+g.getPDBName()+"). Will consider it as non-nucleotide/non-protein type.");
352352
return false;
353353
}
354354

@@ -458,8 +458,8 @@ public GroupAsa getSecondGroupAsa(ResidueNumber resNum) {
458458
*/
459459
public Pair<List<Group>> getCoreResidues(double bsaToAsaCutoff, double minAsaForSurface) {
460460

461-
List<Group> core1 = new ArrayList<Group>();
462-
List<Group> core2 = new ArrayList<Group>();
461+
List<Group> core1 = new ArrayList<>();
462+
List<Group> core2 = new ArrayList<>();
463463

464464
for (GroupAsa groupAsa:groupAsas1.values()) {
465465

@@ -482,7 +482,7 @@ public Pair<List<Group>> getCoreResidues(double bsaToAsaCutoff, double minAsaFor
482482
}
483483
}
484484

485-
return new Pair<List<Group>>(core1, core2);
485+
return new Pair<>(core1, core2);
486486
}
487487

488488
/**
@@ -494,8 +494,8 @@ public Pair<List<Group>> getCoreResidues(double bsaToAsaCutoff, double minAsaFor
494494
*/
495495
public Pair<List<Group>> getRimResidues(double bsaToAsaCutoff, double minAsaForSurface) {
496496

497-
List<Group> rim1 = new ArrayList<Group>();
498-
List<Group> rim2 = new ArrayList<Group>();
497+
List<Group> rim1 = new ArrayList<>();
498+
List<Group> rim2 = new ArrayList<>();
499499

500500
for (GroupAsa groupAsa:groupAsas1.values()) {
501501

@@ -529,8 +529,8 @@ public Pair<List<Group>> getRimResidues(double bsaToAsaCutoff, double minAsaForS
529529
*/
530530
public Pair<List<Group>> getInterfacingResidues(double minAsaForSurface) {
531531

532-
List<Group> interf1 = new ArrayList<Group>();
533-
List<Group> interf2 = new ArrayList<Group>();
532+
List<Group> interf1 = new ArrayList<>();
533+
List<Group> interf2 = new ArrayList<>();
534534

535535
for (GroupAsa groupAsa:groupAsas1.values()) {
536536

@@ -545,7 +545,7 @@ public Pair<List<Group>> getInterfacingResidues(double minAsaForSurface) {
545545
}
546546
}
547547

548-
return new Pair<List<Group>>(interf1, interf2);
548+
return new Pair<>(interf1, interf2);
549549
}
550550

551551
/**
@@ -554,8 +554,8 @@ public Pair<List<Group>> getInterfacingResidues(double minAsaForSurface) {
554554
* @return
555555
*/
556556
public Pair<List<Group>> getSurfaceResidues(double minAsaForSurface) {
557-
List<Group> surf1 = new ArrayList<Group>();
558-
List<Group> surf2 = new ArrayList<Group>();
557+
List<Group> surf1 = new ArrayList<>();
558+
List<Group> surf2 = new ArrayList<>();
559559

560560
for (GroupAsa groupAsa:groupAsas1.values()) {
561561

@@ -570,7 +570,7 @@ public Pair<List<Group>> getSurfaceResidues(double minAsaForSurface) {
570570
}
571571
}
572572

573-
return new Pair<List<Group>>(surf1, surf2);
573+
return new Pair<>(surf1, surf2);
574574
}
575575

576576
public StructureInterfaceCluster getCluster() {
@@ -585,12 +585,12 @@ public void setCluster(StructureInterfaceCluster cluster) {
585585
* Calculates the contact overlap score between this StructureInterface and
586586
* the given one.
587587
* The two sides of the given StructureInterface need to match this StructureInterface
588-
* in the sense that they must come from the same Compound (Entity), i.e.
588+
* in the sense that they must come from the same Entity, i.e.
589589
* their residue numbers need to align with 100% identity, except for unobserved
590590
* density residues. The SEQRES indices obtained through {@link EntityInfo#getAlignedResIndex(Group, Chain)} are
591591
* used to match residues, thus if no SEQRES is present or if {@link FileParsingParameters#setAlignSeqRes(boolean)}
592592
* is not used, this calculation is not guaranteed to work properly.
593-
* @param other
593+
* @param other the interface to be compared to this one
594594
* @param invert if false the comparison will be done first-to-first and second-to-second,
595595
* if true the match will be first-to-second and second-to-first
596596
* @return the contact overlap score, range [0.0,1.0]
@@ -668,7 +668,7 @@ public GroupContactSet getGroupContacts() {
668668

669669
/**
670670
* Tell whether the interface is isologous, i.e. it is formed
671-
* by the same patches of same Compound on both sides.
671+
* by the same patches of same entity on both sides.
672672
*
673673
* @return true if isologous, false if heterologous
674674
*/
@@ -691,11 +691,11 @@ public Pair<Chain> getParentChains() {
691691
return null;
692692
}
693693

694-
return new Pair<Chain>(firstMol[0].getGroup().getChain(), secondMol[0].getGroup().getChain());
694+
return new Pair<>(firstMol[0].getGroup().getChain(), secondMol[0].getGroup().getChain());
695695
}
696696

697697
/**
698-
* Finds the parent compounds by looking up the references of first atom of each side of this interface
698+
* Finds the parent entities by looking up the references of first atom of each side of this interface
699699
* @return
700700
*/
701701
public Pair<EntityInfo> getParentCompounds() {
@@ -720,7 +720,7 @@ private Structure getParentStructure() {
720720
* Return a String representing the 2 molecules of this interface in PDB format.
721721
* If the molecule ids (i.e. chain ids) are the same for both molecules, then the second
722722
* one will be replaced by the next letter in alphabet (or A for Z)
723-
* @return
723+
* @return the PDB-formatted string
724724
*/
725725
public String toPDB() {
726726

@@ -758,7 +758,7 @@ public String toPDB() {
758758
* Return a String representing the 2 molecules of this interface in mmCIF format.
759759
* If the molecule ids (i.e. chain ids) are the same for both molecules, then the second
760760
* one will be written as chainId_operatorId (with operatorId taken from {@link #getTransforms()}
761-
* @return
761+
* @return the mmCIF-formatted string
762762
*/
763763
public String toMMCIF() {
764764
StringBuilder sb = new StringBuilder();

biojava-structure/src/test/java/org/biojava/nbio/structure/contact/TestInterfaceFinder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import org.biojava.nbio.structure.StructureImpl;
1313
import org.biojava.nbio.structure.StructureTools;
1414
import org.junit.Test;
15+
import org.slf4j.Logger;
16+
import org.slf4j.LoggerFactory;
17+
1518
import static org.junit.Assert.*;
1619

1720
import javax.vecmath.Point3d;
@@ -22,6 +25,8 @@
2225

2326
public class TestInterfaceFinder {
2427

28+
private static final Logger logger = LoggerFactory.getLogger(TestInterfaceFinder.class);
29+
2530
@Test
2631
public void testGetAllInterfaces() {
2732
Structure s = mockStructure();

0 commit comments

Comments
 (0)