diff --git a/CHANGELOG.md b/CHANGELOG.md index 07be3a5172..9610b211df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ BioJava Changelog ----------------- -BioJava 7.2.3 - future release +BioJava 7.2.4 +============================== +### Fixed +* Edge case in quaternary symmetry calculation #1120 + +BioJava 7.2.3 ============================== ### Fixed * Don't use label_seq_id in mmCIF output for non-polymers #1116 diff --git a/README.md b/README.md index af128cd92c..eddeb65379 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Welcome to ![Build](https://github.com/biojava/biojava/actions/workflows/master.yml/badge.svg) -[![Version](http://img.shields.io/badge/version-7.2.2-blue.svg?style=flat)](https://github.com/biojava/biojava/releases/tag/biojava-7.2.2) [![License](http://img.shields.io/badge/license-LGPL_2.1-blue.svg?style=flat)](https://github.com/biojava/biojava/blob/master/LICENSE) [![Join the chat at https://gitter.im/biojava/biojava](https://badges.gitter.im/biojava/biojava.svg)](https://gitter.im/biojava/biojava?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Version](http://img.shields.io/badge/version-7.2.4-blue.svg?style=flat)](https://github.com/biojava/biojava/releases/tag/biojava-7.2.4) [![License](http://img.shields.io/badge/license-LGPL_2.1-blue.svg?style=flat)](https://github.com/biojava/biojava/blob/master/LICENSE) [![Join the chat at https://gitter.im/biojava/biojava](https://badges.gitter.im/biojava/biojava.svg)](https://gitter.im/biojava/biojava?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) BioJava is an open-source project dedicated to providing a Java framework for **processing biological data**. It provides analytical and statistical routines, parsers for common file formats, reference implementations of popular algorithms, and allows the manipulation of sequences and 3D structures. The goal of the biojava project is to facilitate rapid application development for bioinformatics. @@ -29,7 +29,7 @@ If you are using Maven you can add the BioJava repository by adding the followin org.biojava biojava-core - 7.2.2 + 7.2.4 diff --git a/biojava-aa-prop/pom.xml b/biojava-aa-prop/pom.xml index 0c1016c3b6..cbc82fff7b 100644 --- a/biojava-aa-prop/pom.xml +++ b/biojava-aa-prop/pom.xml @@ -2,7 +2,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT 4.0.0 biojava-aa-prop @@ -70,12 +70,12 @@ org.biojava biojava-core - 7.2.3 + 7.2.5-SNAPSHOT org.biojava biojava-structure - 7.2.3 + 7.2.5-SNAPSHOT diff --git a/biojava-alignment/pom.xml b/biojava-alignment/pom.xml index 7bb6e3b2ee..b1d0bd9097 100644 --- a/biojava-alignment/pom.xml +++ b/biojava-alignment/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-alignment biojava-alignment @@ -47,7 +47,7 @@ org.biojava biojava-core - 7.2.3 + 7.2.5-SNAPSHOT compile diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml index 890ce360bc..909f46f088 100644 --- a/biojava-core/pom.xml +++ b/biojava-core/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT 4.0.0 biojava-core diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java index 331480bbef..99b70c036d 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java @@ -411,7 +411,7 @@ private void setLocation(List steps) { } // combine sublocations into 1 Location - if (sublocations.size() == 0) { + if (sublocations.isEmpty()) { location = null; } else if (sublocations.size() == 1) { location = sublocations.get(0); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java index f0f2662fea..638e4e68d9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java @@ -119,7 +119,7 @@ public void addIntronsUsingExons() throws Exception { if (intronAdded) { //going to assume introns are correct return; } - if (exonSequenceList.size() == 0) { + if (exonSequenceList.isEmpty()) { return; } ExonComparator exonComparator = new ExonComparator(); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/InsdcParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/InsdcParser.java index e49bd22216..2d43a481bf 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/InsdcParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/InsdcParser.java @@ -260,7 +260,9 @@ private List parseLocationString(String string, int versus) { l.setPartialOn3prime(true); } - if (!(accession == null || "".equals(accession))) l.setAccession(new AccessionID(accession)); + if (accession != null && !"".equals(accession)) { + l.setAccession(new AccessionID(accession)); + } boundedLocationsCollection.add(l); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/SequenceAsStringHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/SequenceAsStringHelper.java index c2b02debee..4acd8969f1 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/SequenceAsStringHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/SequenceAsStringHelper.java @@ -44,7 +44,7 @@ public class SequenceAsStringHelper { */ public String getSequenceAsString(List parsedCompounds, CompoundSet compoundSet, Integer bioBegin, Integer bioEnd, Strand strand) { // TODO Optimise/cache. - if(parsedCompounds.size() == 0) + if(parsedCompounds.isEmpty()) return ""; StringBuilder builder = new StringBuilder(); if (strand.equals(Strand.NEGATIVE)) { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/Equals.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/Equals.java index e8f78243ed..7e2c7128c9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/Equals.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/Equals.java @@ -49,7 +49,13 @@ public static boolean equal(boolean one, boolean two) { * @see #classEqual(Object, Object) */ public static boolean equal(Object one, Object two) { - return one == null && two == null || !(one == null || two == null) && (one == two || one.equals(two)); + if (one == two) { + return true; + } + if (one == null || two == null) { + return false; + } + return one.equals(two); } /** @@ -84,6 +90,12 @@ public static boolean equal(Object one, Object two) { * equal at the class level */ public static boolean classEqual(Object one, Object two) { - return one == two || !(one == null || two == null) && one.getClass() == two.getClass(); + if (one == two) { + return true; + } + if (one == null || two == null) { + return false; + } + return one.getClass() == two.getClass(); } } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/PrettyXMLWriter.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/PrettyXMLWriter.java index 437085866f..6e4a7db77c 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/PrettyXMLWriter.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/PrettyXMLWriter.java @@ -72,7 +72,7 @@ public void declareNamespace(String nsURI, String prefixHint) private void handleDeclaredNamespaces() throws IOException { - if (namespacesDeclared.size() == 0) { + if (namespacesDeclared.isEmpty()) { for (Iterator nsi = namespacesDeclared.iterator(); nsi.hasNext(); ) { String nsURI = nsi.next(); if (!namespacePrefixes.containsKey(nsURI)) { diff --git a/biojava-genome/pom.xml b/biojava-genome/pom.xml index 79608afaf4..68575bbb9b 100644 --- a/biojava-genome/pom.xml +++ b/biojava-genome/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT 4.0.0 biojava-genome @@ -70,13 +70,13 @@ org.biojava biojava-core - 7.2.3 + 7.2.5-SNAPSHOT compile org.biojava biojava-alignment - 7.2.3 + 7.2.5-SNAPSHOT compile diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java index 4163be2b56..a28f1019fb 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java @@ -135,7 +135,7 @@ public static Location fromBio( int start, int end, char strand ) int s= start - 1; int e= end; - if( !( strand == '-' || strand == '+' || strand == '.' )) + if( strand != '-' && strand != '+' && strand != '.' ) { throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" ); } @@ -166,7 +166,7 @@ public static Location fromBioExt( int start, int length, char strand, int total int s= start; int e= s + length; - if( !( strand == '-' || strand == '+' || strand == '.' )) + if( strand != '-' && strand != '+' && strand != '.' ) { throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" ); } diff --git a/biojava-integrationtest/pom.xml b/biojava-integrationtest/pom.xml index 41d9be230c..1c21373bd1 100644 --- a/biojava-integrationtest/pom.xml +++ b/biojava-integrationtest/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-integrationtest jar @@ -40,7 +40,7 @@ org.biojava biojava-structure - 7.2.3 + 7.2.5-SNAPSHOT diff --git a/biojava-modfinder/pom.xml b/biojava-modfinder/pom.xml index 876203f207..e8de9e38d9 100644 --- a/biojava-modfinder/pom.xml +++ b/biojava-modfinder/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-modfinder biojava-modfinder @@ -31,7 +31,7 @@ org.biojava biojava-structure - 7.2.3 + 7.2.5-SNAPSHOT jar compile diff --git a/biojava-ontology/pom.xml b/biojava-ontology/pom.xml index 02e4a894d2..6a3fd5cbc4 100644 --- a/biojava-ontology/pom.xml +++ b/biojava-ontology/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-ontology diff --git a/biojava-protein-comparison-tool/pom.xml b/biojava-protein-comparison-tool/pom.xml index b4de1b1e8a..cf8cd570a7 100644 --- a/biojava-protein-comparison-tool/pom.xml +++ b/biojava-protein-comparison-tool/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-protein-comparison-tool @@ -36,23 +36,23 @@ org.biojava biojava-alignment - 7.2.3 + 7.2.5-SNAPSHOT org.biojava biojava-core - 7.2.3 + 7.2.5-SNAPSHOT org.biojava biojava-structure - 7.2.3 + 7.2.5-SNAPSHOT org.biojava biojava-structure-gui - 7.2.3 + 7.2.5-SNAPSHOT net.sourceforge.jmol diff --git a/biojava-protein-disorder/pom.xml b/biojava-protein-disorder/pom.xml index d5e216b60d..7273bbff8f 100644 --- a/biojava-protein-disorder/pom.xml +++ b/biojava-protein-disorder/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-protein-disorder jar @@ -63,7 +63,7 @@ org.biojava biojava-core - 7.2.3 + 7.2.5-SNAPSHOT diff --git a/biojava-structure-gui/pom.xml b/biojava-structure-gui/pom.xml index 62db686d60..581b8a53cc 100644 --- a/biojava-structure-gui/pom.xml +++ b/biojava-structure-gui/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT 4.0.0 biojava-structure-gui @@ -27,13 +27,13 @@ org.biojava biojava-structure - 7.2.3 + 7.2.5-SNAPSHOT compile org.biojava biojava-core - 7.2.3 + 7.2.5-SNAPSHOT compile diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java index 06542e5271..75da6c8e28 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java @@ -126,7 +126,7 @@ private void setPrefSize() { public void setAligMap(List apos){ this.apos = apos; - if ( apos.size() == 0) + if (apos.isEmpty()) return; AlignedPosition last = apos.get(apos.size()-1); diff --git a/biojava-structure/pom.xml b/biojava-structure/pom.xml index aeff7465c0..7fbc64a3c1 100644 --- a/biojava-structure/pom.xml +++ b/biojava-structure/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-structure biojava-structure @@ -51,13 +51,13 @@ org.biojava biojava-alignment - 7.2.3 + 7.2.5-SNAPSHOT compile org.biojava biojava-core - 7.2.3 + 7.2.5-SNAPSHOT compile diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Author.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Author.java index b0d7253507..bd5a01b885 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Author.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Author.java @@ -62,7 +62,7 @@ public boolean equals(Object obj) { if ((this.surname == null) ? (other.surname != null) : !this.surname.equals(other.surname)) { return false; } - return !((this.initials == null) ? (other.initials != null) : !this.initials.equals(other.initials)); + return (this.initials == null) ? other.initials == null : this.initials.equals(other.initials); } @Override diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Element.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Element.java index 2f534b2828..4e2d3e340a 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Element.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Element.java @@ -424,7 +424,7 @@ public boolean isHeavyAtom() { * @return true if Element is not Hydrogen and not Carbon. */ public boolean isHeteroAtom() { - return !(this == C || this == H); + return this != C && this != H; } /** diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java index 373bcf1611..0933198d7b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ClusterAltAligs.java @@ -102,7 +102,7 @@ public static void cluster(AlternativeAlignment[] aligs, int cutoff){ } clusters.add(currentCluster); - if ( remainList.size() == 0) { + if ( remainList.isEmpty()) { break; } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CECalculator.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CECalculator.java index 6c045ba48e..83f16b7982 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CECalculator.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CECalculator.java @@ -1450,7 +1450,7 @@ private int optimizeSuperposition(AFPChain afpChain, int nse1, int nse2, int str //afpChain.setTotalRmsdOpt(rmsd); //System.out.println("rmsd: " + rmsd); - if(!(nAtom= strLen * 0.95 && !isRmsdLenAssigned) { rmsdLen=rmsd; isRmsdLenAssigned=true; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCalculatorEnhanced.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCalculatorEnhanced.java index 4f57161268..cab98b0113 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCalculatorEnhanced.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCalculatorEnhanced.java @@ -1455,7 +1455,7 @@ private int optimizeSuperposition(AFPChain afpChain, int nse1, int nse2, int str //afpChain.setTotalRmsdOpt(rmsd); //System.out.println("rmsd: " + rmsd); - if(!(nAtom= strLen * 0.95 && !isRmsdLenAssigned) { rmsdLen=rmsd; isRmsdLenAssigned=true; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockImpl.java index e0423b6f8f..43da1d7c06 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockImpl.java @@ -127,7 +127,7 @@ public void setAlignRes(List> alignRes) { public int length() { if (alignRes == null) return 0; - if (alignRes.size() == 0) + if (alignRes.isEmpty()) return 0; return alignRes.get(0).size(); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSetImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSetImpl.java index cbbb3ae895..344ee3c239 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSetImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSetImpl.java @@ -179,7 +179,7 @@ public int size() { // Get the size from the variables that can contain the information if (parent != null) return parent.size(); - else if (getBlocks().size() == 0) { + else if (getBlocks().isEmpty()) { throw new IndexOutOfBoundsException( "Empty BlockSet: number of Blocks == 0."); } else @@ -194,7 +194,7 @@ public int getCoreLength() { } protected void updateLength() { - if (getBlocks().size() == 0) { + if (getBlocks().isEmpty()) { throw new IndexOutOfBoundsException( "Empty BlockSet: number of Blocks == 0."); } @@ -207,7 +207,7 @@ protected void updateLength() { } protected void updateCoreLength() { - if (getBlocks().size() == 0) { + if (getBlocks().isEmpty()) { throw new IndexOutOfBoundsException( "Empty BlockSet: number of Blocks == 0."); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentImpl.java index 738eee30c5..06c93a4403 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentImpl.java @@ -207,7 +207,7 @@ public int getCoreLength() { * lengths. */ protected void updateLength() { - if (getBlockSets().size() == 0) { + if (getBlockSets().isEmpty()) { throw new IndexOutOfBoundsException( "Empty MultipleAlignment: blockSets size == 0."); } // Otherwise try to calculate it from the BlockSet information @@ -223,7 +223,7 @@ protected void updateLength() { * BlockSet core lengths. */ protected void updateCoreLength() { - if (getBlockSets().size() == 0) { + if (getBlockSets().isEmpty()) { throw new IndexOutOfBoundsException( "Empty MultipleAlignment: blockSets size == 0."); } // Otherwise try to calculate it from the BlockSet information diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcOptimizer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcOptimizer.java index 052f147fc6..29c7012801 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcOptimizer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcOptimizer.java @@ -153,7 +153,7 @@ public MultipleMcOptimizer(MultipleAlignment seedAln, for (Block b : toDelete) { for (BlockSet bs : msa.getBlockSets()) { bs.getBlocks().remove(b); - if (bs.getBlocks().size() == 0) + if (bs.getBlocks().isEmpty()) emptyBs.add(bs); } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java index 7ac77a602e..fe1c9c411b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java @@ -117,7 +117,7 @@ public void setSubunitMap(Map subunitMap) { "Subunit Map index higher than Subunit List size."); // Update the relation enum - if (subunitMap.size() == 0) { + if (subunitMap.isEmpty()) { relation = QsRelation.DIFFERENT; } else if (subunitMap.keySet().size() == subunits1.size()) { if (subunitMap.values().size() == subunits2.size()) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java index 1435191c2c..71b8a3da22 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java @@ -228,7 +228,7 @@ public Structure getBiologicalAssembly(String pdbId, int bioAssemblyId, boolean throws StructureException, IOException { return getBiologicalAssembly(new PdbId(pdbId), bioAssemblyId, multiModel); } - + /** * Returns the biological assembly for a given PDB ID and bioAssemblyId, by building the * assembly from the biounit annotations found in {@link Structure#getPDBHeader()} @@ -284,7 +284,7 @@ public Structure getBiologicalAssembly(PdbId pdbId, int bioAssemblyId, boolean m asymUnit.getPDBHeader().getBioAssemblies().get(bioAssemblyId).getTransforms(); - if (transformations == null || transformations.size() == 0) { + if (transformations == null || transformations.isEmpty()) { throw new StructureException("Could not load transformations to recreate biological assembly id " + bioAssemblyId + " of " + pdbId); } @@ -339,7 +339,7 @@ public Structure getBiologicalAssembly(String pdbId, boolean multiModel) throws asymUnit.getPDBHeader().getBioAssemblies().get(bioAssemblyId).getTransforms(); - if (transformations == null || transformations.size() == 0) { + if (transformations == null || transformations.isEmpty()) { throw new StructureException("Could not load transformations to recreate biological assembly id " + bioAssemblyId + " of " + pdbId); } @@ -385,7 +385,7 @@ public List getBiologicalAssemblies(String pdbId, boolean multiModel) List transformations = asymUnit.getPDBHeader().getBioAssemblies().get(bioAssemblyId).getTransforms(); - if (transformations == null || transformations.size() == 0) { + if (transformations == null || transformations.isEmpty()) { logger.info("Could not load transformations to recreate biological assembly id {} of {}. Assembly " + "id will be missing in biological assemblies.", bioAssemblyId, pdbId); continue; @@ -807,7 +807,7 @@ public Structure getStructureForPdbId(String id) throws IOException, StructureEx public Structure getStructureForPdbId(PdbId pdbId) throws IOException { if (pdbId == null) return null; - + while (checkLoading(pdbId)) { // waiting for loading to be finished... try { @@ -833,7 +833,7 @@ public Structure getStructureForPdbId(PdbId pdbId) throws IOException { protected Structure loadStructureFromCifByPdbId(String pdbId) throws IOException { return loadStructureFromCifByPdbId(new PdbId(pdbId)); } - + protected Structure loadStructureFromCifByPdbId(PdbId pdbId) throws IOException { logger.debug("Loading structure {} from mmCIF file {}.", pdbId, path); Structure s; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ZipChemCompProvider.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ZipChemCompProvider.java index 4fe19aca58..a68019efb7 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ZipChemCompProvider.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ZipChemCompProvider.java @@ -120,7 +120,7 @@ public ChemComp getChemComp(String recordName) { } // If a null record or an empty chemcomp, return a default ChemComp and blacklist. - if (cc == null || (null == cc.getName() && cc.getAtoms().size() == 0)) { + if (cc == null || (null == cc.getName() && cc.getAtoms().isEmpty())) { s_logger.info("Unable to find or download {} - excluding from future searches.", recordName); unavailable.add(recordName); return getEmptyChemComp(recordName); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitCluster.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitCluster.java index 9a87e92f88..87c3c06e3c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitCluster.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitCluster.java @@ -331,7 +331,7 @@ public boolean mergeIdenticalByEntityId(SubunitCluster other) { } } - if (thisAligned.size() == 0 && otherAligned.size() == 0) { + if (thisAligned.isEmpty() && otherAligned.isEmpty()) { logger.warn("No equivalent aligned atoms found between SubunitClusters {}-{} via entity SEQRES alignment. Is FileParsingParameters.setAlignSeqRes() set?", thisName, otherName); } @@ -507,27 +507,24 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p } } - AFPChain afp = aligner.align(this.subunits.get(this.representative) - .getRepresentativeAtoms(), - other.subunits.get(other.representative) - .getRepresentativeAtoms()); + AFPChain afp = aligner.align(this.subunits.get(this.representative).getRepresentativeAtoms(), + other.subunits.get(other.representative).getRepresentativeAtoms()); + String pairName = this.subunits.get(this.representative).getName() + "-" + other.subunits.get(other.representative).getName(); if (afp.getOptLength() < 1) { // alignment failed (eg if chains were too short) throw new StructureException( - String.format("Subunits failed to align using %s", params.getSuperpositionAlgorithm())); + String.format("Subunits %s failed to align using %s", pairName, params.getSuperpositionAlgorithm())); } // Convert AFPChain to MultipleAlignment for convenience MultipleAlignment msa = new MultipleAlignmentEnsembleImpl( afp, this.subunits.get(this.representative).getRepresentativeAtoms(), - other.subunits.get(other.representative) - .getRepresentativeAtoms(), false) - .getMultipleAlignment(0); + other.subunits.get(other.representative).getRepresentativeAtoms(), + false).getMultipleAlignment(0); - double structureCoverage = Math.min(msa.getCoverages().get(0), msa - .getCoverages().get(1)); + double structureCoverage = Math.min(msa.getCoverages().get(0), msa.getCoverages().get(1)); if(params.isUseStructureCoverage() && structureCoverage < params.getStructureCoverageThreshold()) { return false; @@ -543,8 +540,7 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p return false; } - logger.info(String.format("SubunitClusters are structurally similar with " - + "%.2f RMSD %.2f coverage", rmsd, structureCoverage)); + logger.info("SubunitClusters {} are structurally similar with [ {} ] RMSD and [ {} ] coverage", pairName, String.format("%.2f", rmsd), String.format("%.2f", structureCoverage)); // Merge clusters List> alignedRes = msa.getBlock(0).getAlignRes(); @@ -565,13 +561,18 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p // Only consider residues that are part of the SubunitCluster if (this.subunitEQR.get(this.representative).contains(thisIndex) - && other.subunitEQR.get(other.representative).contains( - otherIndex)) { + && other.subunitEQR.get(other.representative).contains(otherIndex)) { thisAligned.add(thisIndex); otherAligned.add(otherIndex); } } + // this can happen in very rare cases, e.g. 9y9z when merging E_1 into the cluster D_1, OM_1, Y_1 + if (thisAligned.isEmpty() && otherAligned.isEmpty()) { + logger.warn("No equivalent aligned atoms found between SubunitClusters {} via structure alignment. Will not merge the second one into the first.", pairName); + return false; + } + updateEquivResidues(other, thisAligned, otherAligned); this.method = SubunitClustererMethod.STRUCTURE; @@ -602,18 +603,12 @@ private void updateEquivResidues(SubunitCluster other, List thisAligned Collections.sort(otherRemove); Collections.reverse(otherRemove); - for (int t = 0; t < thisRemove.size(); t++) { - for (List eqr : this.subunitEQR) { - int column = thisRemove.get(t); - eqr.remove(column); - } + for (int column : thisRemove) { + this.subunitEQR.forEach(eqr -> eqr.remove(column)); } - for (int t = 0; t < otherRemove.size(); t++) { - for (List eqr : other.subunitEQR) { - int column = otherRemove.get(t); - eqr.remove(column); - } + for (int column : otherRemove) { + other.subunitEQR.forEach(eqr -> eqr.remove(column)); } // The representative is the longest sequence diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClusterer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClusterer.java index 6295f8fdf0..fa63b96d96 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClusterer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClusterer.java @@ -58,7 +58,7 @@ public static Stoichiometry cluster(Structure structure, public static Stoichiometry cluster(List subunits, SubunitClustererParameters params) { List clusters = new ArrayList<>(); - if (subunits.size() == 0) + if (subunits.isEmpty()) return new Stoichiometry(clusters); // First generate a new cluster for each Subunit @@ -83,8 +83,7 @@ public static Stoichiometry cluster(List subunits, SubunitClustererPara } } catch (CompoundNotFoundException e) { - logger.warn("Could not merge by Sequence. {}", - e.getMessage()); + logger.info("Could not merge by Sequence. {}", e.getMessage()); } } } @@ -100,7 +99,7 @@ public static Stoichiometry cluster(List subunits, SubunitClustererPara clusters.remove(c2); } } catch (StructureException e) { - logger.warn("Could not merge by Structure. {}", e.getMessage()); + logger.info("Could not merge by Structure. {}", e.getMessage()); } } } @@ -112,8 +111,7 @@ public static Stoichiometry cluster(List subunits, SubunitClustererPara try { clusters.get(c).divideInternally(params); } catch (StructureException e) { - logger.warn("Error analyzing internal symmetry. {}", - e.getMessage()); + logger.info("Error analyzing internal symmetry. {}", e.getMessage()); } } @@ -125,8 +123,7 @@ public static Stoichiometry cluster(List subunits, SubunitClustererPara if (clusters.get(c1).mergeStructure(clusters.get(c2), params)) clusters.remove(c2); } catch (StructureException e) { - logger.warn("Could not merge by Structure. {}", - e.getMessage()); + logger.info("Could not merge by Structure. {}", e.getMessage()); } } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/MomentsOfInertia.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/MomentsOfInertia.java index 8cfd032daa..5a6e69c4cf 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/MomentsOfInertia.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/MomentsOfInertia.java @@ -72,7 +72,7 @@ public void addPoint(Point3d point, double mass) { public Point3d getCenterOfMass() { - if (points.size() == 0) { + if (points.isEmpty()) { throw new IllegalStateException( "MomentsOfInertia: no points defined"); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java index 176459bbf2..58e4ee6625 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java @@ -1970,7 +1970,7 @@ private Group getCorrectAltLocGroup( Character altLoc, // build it up. if ( groupCode3.equals(currentGroup.getPDBName())) { - if ( currentGroup.getAtoms().size() == 0) { + if ( currentGroup.getAtoms().isEmpty()) { //System.out.println("current group is empty " + current_group + " " + altLoc); return currentGroup; } @@ -2762,7 +2762,7 @@ private void makeCompounds(List compoundList, } // System.out.println("[makeCompounds] adding sources to compounds from sourceLines"); // since we're starting again from the first compound, reset it here - if ( entities.size() == 0){ + if ( entities.isEmpty()){ current_compound = new EntityInfo(); } else { current_compound = entities.get(0); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java index c2830c1685..21ef8bb64c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureReader.java @@ -396,7 +396,7 @@ private Group getCorrectAltLocGroup(Character altLoc) { } // no matching altLoc group found. // build it up. - if (group.getAtoms().size() == 0) { + if (group.getAtoms().isEmpty()) { return group; } Group altLocG = (Group) group.clone(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java index 7c359121de..8f76b2ae61 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java @@ -55,7 +55,7 @@ public static boolean isUnaryExpression(String expression) { if (first < 0 || last < 0) { return true; } - return ! (first == 0 && last > first); + return first != 0 || last <= first; } public static List parseUnaryOperatorExpression(String operatorExpression) { @@ -279,7 +279,7 @@ public static double[] getBiologicalMoleculeCentroid( final Structure asymUnit, return centroid; } - if ( transformations.size() == 0) { + if ( transformations.isEmpty()) { return Calc.getCentroid(atoms).getCoords(); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java index c6ec6bc8ff..9edb8f404c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java @@ -205,7 +205,7 @@ private void addChainMultiModel(Structure s, Chain newChain, String transformId) // multi-model bioassembly - if ( modelIndex.size() == 0) + if (modelIndex.isEmpty()) modelIndex.add("PLACEHOLDER FOR ASYM UNIT"); int modelCount = modelIndex.indexOf(transformId); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucTools.java index 7732c04b80..42191d682d 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucTools.java @@ -57,7 +57,7 @@ public static List getSecStrucInfo(Structure s) { Group g = iter.next(); if (g.hasAminoAtoms()) { Object p = g.getProperty(Group.SEC_STRUC); - if (!(p == null)) { + if (p != null) { SecStrucInfo ss = (SecStrucInfo) p; listSSI.add(ss); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelicalRepeatUnit.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelicalRepeatUnit.java index ff9c77cf13..cd16aa5f87 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelicalRepeatUnit.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelicalRepeatUnit.java @@ -64,7 +64,7 @@ public Map getInteractingRepeatUnits() { private void run() { this.repeatUnitCenters = calcRepeatUnitCenters(); - if (this.repeatUnitCenters.size() == 0) { + if (this.repeatUnitCenters.isEmpty()) { return; } this.repeatUnits = calcRepeatUnits(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java index 70b69afe14..1490d27036 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationGroup.java @@ -98,7 +98,7 @@ public void complete() { public String getPointGroup() { if (modified) { - if (rotations.size() == 0) { + if (rotations.isEmpty()) { return "C1"; } complete(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationSolver.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationSolver.java index 37a44be7ac..b1566a6d2f 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationSolver.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationSolver.java @@ -305,7 +305,7 @@ private boolean isSpherical() { * @return null if invalid, or a rotation if valid */ private Rotation isValidPermutation(List permutation) { - if (permutation.size() == 0) { + if (permutation.isEmpty()) { return null; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/SystematicSolver.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/SystematicSolver.java index d13fa4db16..a449771b58 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/SystematicSolver.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/SystematicSolver.java @@ -145,7 +145,7 @@ private void completeRotationGroup() { } private boolean isValidPermutation(List permutation) { - if (permutation.size() == 0) { + if (permutation.isEmpty()) { return false; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/DistanceBox.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/DistanceBox.java index 2d9b1d6dca..25d37693fb 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/DistanceBox.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/DistanceBox.java @@ -166,7 +166,7 @@ private List getBoxTwo(long location) { } // ensure that boxTwo has no empty element by copying from tempBox of defined size List boxTwo = null; - if (tempBox.size() == 0) { + if (tempBox.isEmpty()) { boxTwo = Collections.emptyList(); } else if (tempBox.size() == 1) { boxTwo = Collections.singletonList(tempBox.get(0)); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SpaceGroup.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SpaceGroup.java index cff84c70f8..852d213bb9 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SpaceGroup.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SpaceGroup.java @@ -645,10 +645,10 @@ public List getTransfAlgebraic() { public void setTransfAlgebraic(List transfAlgebraic) { //System.out.println("setting transfAlgebraic " + transfAlgebraic); - if ( transformations == null || transformations.size() == 0) + if ( transformations == null || transformations.isEmpty()) transformations = new ArrayList(transfAlgebraic.size()); - if ( this.transfAlgebraic == null || this.transfAlgebraic.size() == 0) + if ( this.transfAlgebraic == null || this.transfAlgebraic.isEmpty()) this.transfAlgebraic = new ArrayList<>(transfAlgebraic.size()); for ( String transf : transfAlgebraic){ diff --git a/biojava-survival/pom.xml b/biojava-survival/pom.xml index a1facab532..88f901cdea 100644 --- a/biojava-survival/pom.xml +++ b/biojava-survival/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-survival diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/NumbersAtRiskPanel.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/NumbersAtRiskPanel.java index c4578f1c8b..144942a809 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/NumbersAtRiskPanel.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/NumbersAtRiskPanel.java @@ -76,7 +76,7 @@ private void paintTable(Graphics g) { sfiHashMap = sfi.getStrataInfoHashMap(); } - if(sfiHashMap.size() == 0) + if(sfiHashMap.isEmpty()) return; //int height = this.getHeight(); diff --git a/biojava-ws/pom.xml b/biojava-ws/pom.xml index 23866ccbb1..7e960b4445 100644 --- a/biojava-ws/pom.xml +++ b/biojava-ws/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.2.3 + 7.2.5-SNAPSHOT biojava-ws biojava-ws @@ -19,7 +19,7 @@ org.biojava biojava-core - 7.2.3 + 7.2.5-SNAPSHOT compile diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/HmmerResult.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/HmmerResult.java index 3304e78d4f..373b78cd0a 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/HmmerResult.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/HmmerResult.java @@ -140,7 +140,7 @@ public int compareTo(HmmerResult o) { return(me.getSqFrom().compareTo(other.getSqFrom())); } private boolean emptyDomains(HmmerResult o) { - if ( o.getDomains() == null || o.getDomains().size() == 0) + if ( o.getDomains() == null || o.getDomains().isEmpty()) return true; return false; } diff --git a/pom.xml b/pom.xml index c4dfdd3b74..e9f246202b 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.biojava biojava pom - 7.2.3 + 7.2.5-SNAPSHOT biojava BioJava is an open-source project dedicated to providing a Java framework for processing biological data. It provides analytical and statistical routines, parsers for common file formats and allows the @@ -51,7 +51,7 @@ scm:git:git@github.com:biojava/biojava.git https://github.com/biojava/biojava - biojava-7.2.3 + HEAD