From c45c3dd05beaed3f214b991526f713d9090b5e1f Mon Sep 17 00:00:00 2001 From: josemduarte Date: Fri, 21 Feb 2025 15:39:16 -0800 Subject: [PATCH 1/3] Bugfix: ASA calculation was by default using all models. Now it will use model 1 by default. Added new constructor to choose model. --- .../nbio/structure/asa/AsaCalculator.java | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java index 84effc3e44..21d6935eb3 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java @@ -126,7 +126,37 @@ static class IndexAndDistance { * Constructs a new AsaCalculator. Subsequently call {@link #calculateAsas()} * or {@link #getGroupAsas()} to calculate the ASAs * Only non-Hydrogen atoms are considered in the calculation. - * @param structure the structure, all non-H atoms will be used + * @param structure the structure, all non-H atoms of given model number will be used + * @param probe the probe size + * @param nSpherePoints the number of points to be used in generating the spherical + * dot-density, the more points the more accurate (and slower) calculation + * @param nThreads the number of parallel threads to use for the calculation + * @param hetAtoms if true HET residues are considered, if false they aren't, equivalent to + * @param modelNr the model number from which we want atoms extracted + * NACCESS' -h option + */ + public AsaCalculator(Structure structure, double probe, int nSpherePoints, int nThreads, boolean hetAtoms, int modelNr) { + this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms, modelNr); + this.atomCoords = Calc.atomsToPoints(atoms); + this.probe = probe; + this.nThreads = nThreads; + + this.useSpatialHashingForNeighbors = DEFAULT_USE_SPATIAL_HASHING; + + // initialising the radii by looking them up through AtomRadii + radii = new double[atomCoords.length]; + for (int i=0;i Date: Fri, 21 Feb 2025 16:33:57 -0800 Subject: [PATCH 2/3] Fix: first model is model index 0 --- .../main/java/org/biojava/nbio/structure/asa/AsaCalculator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java index 21d6935eb3..a47c67db72 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java @@ -165,7 +165,7 @@ public AsaCalculator(Structure structure, double probe, int nSpherePoints, int n * NACCESS' -h option */ public AsaCalculator(Structure structure, double probe, int nSpherePoints, int nThreads, boolean hetAtoms) { - this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms, 1); + this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms, 0); this.atomCoords = Calc.atomsToPoints(atoms); this.probe = probe; this.nThreads = nThreads; From a5b46ab0bb748317516dbdb95f18bb8ab30fb2ca Mon Sep 17 00:00:00 2001 From: josemduarte Date: Fri, 21 Feb 2025 16:36:08 -0800 Subject: [PATCH 3/3] Review comment --- .../biojava/nbio/structure/asa/AsaCalculator.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java index a47c67db72..0f46b7f416 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/AsaCalculator.java @@ -165,20 +165,7 @@ public AsaCalculator(Structure structure, double probe, int nSpherePoints, int n * NACCESS' -h option */ public AsaCalculator(Structure structure, double probe, int nSpherePoints, int nThreads, boolean hetAtoms) { - this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms, 0); - this.atomCoords = Calc.atomsToPoints(atoms); - this.probe = probe; - this.nThreads = nThreads; - - this.useSpatialHashingForNeighbors = DEFAULT_USE_SPATIAL_HASHING; - - // initialising the radii by looking them up through AtomRadii - radii = new double[atomCoords.length]; - for (int i=0;i