diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index f10369d9ab..3e7b8e38fb 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -16,16 +16,17 @@ jobs: # We do one OS only to reduce resource utilization. To do macOS to this would be needed: #os: [ubuntu-20.04, macOS-latest] os: [ubuntu-latest] - java: [11] + java: [21] fail-fast: false max-parallel: 4 name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'oracle' java-version: ${{ matrix.java }} - name: Build, test (no integration) and Sonarqube analyse env: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 078430db7e..a0d31ee08a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -12,7 +12,30 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: - test: + testopenjdk: + runs-on: ${{ matrix.os }} + strategy: + matrix: + # Linux and Windows only (MacOS is quite close to Linux, so less of a risk) + os: [ubuntu-latest, windows-latest] + java: [17, 21] + fail-fast: false + max-parallel: 4 + name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'oracle' + java-version: ${{ matrix.java }} + - name: Build, test and integration test + run: mvn verify --no-transfer-progress + + # Note that 11 is not available in openjdk. So we need to do it with the Zulu distribution (see https://github.com/actions/setup-java) + # When we drop 11, it will be safe to drop the copy-pasted workflow excerpt below + testzulu: runs-on: ${{ matrix.os }} strategy: matrix: @@ -25,10 +48,11 @@ jobs: name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'zulu' java-version: ${{ matrix.java }} - name: Build, test and integration test run: mvn verify --no-transfer-progress diff --git a/CHANGELOG.md b/CHANGELOG.md index 47ae621112..9610b211df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,81 @@ BioJava Changelog ----------------- +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 + +BioJava 7.2.2 +============================== +### Fixed +* mmCIF parsing: entity type should be case insensitive #1109 +* Upgraded to latest version of ciftools-java, fixes mmCIF parsing performance issues in some edge cases https://github.com/rcsb/ciftools-java/issues/13 +* Added safeguards for `Structure.get*Chain*()` methods #1111 + +BioJava 7.2.1 +============================== +### Fixed +* More lenient mmCIF parsing to be able to parse [PDB-IHM](https://pdb-ihm.org/) entries, some more edge cases #1108 + +BioJava 7.2.0 +============================== +### Fixed +* More lenient mmCIF parsing to be able to parse [PDB-IHM](https://pdb-ihm.org/) entries #1106 +* Now AsaCalculator main constructor will use first model only instead of all #1107 + +### Added +* New constructor for AsaCalculator to provide Structure and model #1107 + +BioJava 7.1.4 +============================== +### Fixed +* More lenient mmCIF parsing, now can read files produced by [Gemmi](https://gemmi.readthedocs.io/en/latest/) #1103 +* Javadocs: all javadoc lint errors fixed +* Plugin updates and fixed issues in maven release process + +BioJava 7.1.3 +============================== +### Fixed +* Bug in symmetry detection #1101 and rcsb/symmetry#118 + +BioJava 7.1.2 +============================== +### Fixed +* Brought back a command line argument for protein comparison tool #1096 +* Upgraded the log facade framework to slf4j2 #1094 +* Code smell fixes (Sonar issues S2293, S1319) #1095 #1091 +* Various small fixes +### Removed +* Removed capability of automatic download/caching of PDB archive files in MMTF format, following deprecation +by RCSB PDB. Code to encode/decode in MMTF format is still in place #1099 + +BioJava 7.1.1 +============================== +### Fixed +* Now mmCIF files that have no author fields in atom_site can be read (e.g. from PyMol or ESMAtlas) #775 #1083 +* No evaluations of arguments in debug level log statements #1086 #789 + +### Removed +* Minor removal from biojava-core: FileDownloadUtils::copy, replaced by Files::copy + +BioJava 7.1.0 +============================== +### Added +* Class `FastaStreamer` to read FASTA-formatted files using Java streams + +### Fixed +* Various minor fixes for code smells +* Some dependency upgrades +* Now using Jakarta as the JAXB implementation #1076 +* Fixed SCOP URL #1077 + + BioJava 7.0.2 ============================== ### Added diff --git a/README.md b/README.md index 7f39c65623..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.0.2-blue.svg?style=flat)](https://github.com/biojava/biojava/releases/tag/biojava-7.0.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,12 +29,22 @@ If you are using Maven you can add the BioJava repository by adding the followin org.biojava biojava-core - 7.0.2 + 7.2.4 ``` +### For developers + +Release biojava to maven central: +- `mvn -Prelease release:prepare` +- `mvn -Prelease release:perform` + +Publish new javadocs: +- `mvn -Prelease site` this will write `target/site` +- Push the contents of `target/site/apidocs` to the [biojava.github.io repo](https://github.com/biojava/biojava.github.io) under directory `docs/apiM.m.p` (e.g. docs/api7.1.4) and then link `docs/api` to `docs/apiM.m.p`, for it to be published in biojava.org + ### Mailing Lists BioJava has one main mailing list. In order to avoid SPAM the list only accepts postings from list members. Anybody can become a list member, so please subscribe before you post. If you send without being subscribed your mail might get stuck in the moderation loop, which can cause several weeks of delay (no fun to read through all that spam). diff --git a/biojava-aa-prop/pom.xml b/biojava-aa-prop/pom.xml index 70ab1fa759..cbc82fff7b 100644 --- a/biojava-aa-prop/pom.xml +++ b/biojava-aa-prop/pom.xml @@ -2,7 +2,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT 4.0.0 biojava-aa-prop @@ -70,12 +70,12 @@ org.biojava biojava-core - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT org.biojava biojava-structure - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT @@ -86,7 +86,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j @@ -105,8 +105,8 @@ - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api org.glassfish.jaxb diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/CommandPrompt.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/CommandPrompt.java index 7db641ade9..514ccfbc54 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/CommandPrompt.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/CommandPrompt.java @@ -82,7 +82,7 @@ private static void readInputAndGenerateOutput(String outputLocation, List a = readInputFile(inputLocation, aaTable); + Map a = readInputFile(inputLocation, aaTable); //Need for the last sequence for(Entry entry:a.entrySet()){ compute(output, entry.getValue().getOriginalHeader(), entry.getValue().getSequenceAsString().trim(), delimiter, aaTable, propertyList, specificList, @@ -95,8 +95,8 @@ public static void run(String[] args) throws Exception{ /* * Parse input arguments */ - List propertyList = new ArrayList(); - List specificList = new ArrayList(); + List propertyList = new ArrayList<>(); + List specificList = new ArrayList<>(); String inputLocation = null; String outputLocation = null; String aminoAcidCompositionLocation = null; @@ -116,8 +116,8 @@ public static void run(String[] args) throws Exception{ case 'o': outputLocation = args[++i]; break; case 'f': i++; - if(args[i].equalsIgnoreCase("csv")) delimiter = ","; - else if(args[i].equalsIgnoreCase("tsv")) delimiter = "\t"; + if("csv".equalsIgnoreCase(args[i])) delimiter = ","; + else if("tsv".equalsIgnoreCase(args[i])) delimiter = "\t"; else throw new Error("Invalid value for -f: " + args[i] + ". Please choose either csv or tsv only."); break; case 'x': aminoAcidCompositionLocation = args[++i]; break; @@ -169,7 +169,7 @@ public static void run(String[] args) throws Exception{ readInputAndGenerateOutput(outputLocation, propertyList, specificList, delimiter, inputLocation, aaTable, decimalPlace); } - private static LinkedHashMap readInputFile(String inputLocation, AminoAcidCompositionTable aaTable) throws Exception{ + private static Map readInputFile(String inputLocation, AminoAcidCompositionTable aaTable) throws Exception{ FileInputStream inStream = new FileInputStream(inputLocation); CompoundSet set; if(aaTable == null){ @@ -177,16 +177,16 @@ private static LinkedHashMap readInputFile(String input }else{ set = aaTable.getAminoAcidCompoundSet(); } - LinkedHashMap ret; + Map ret; if ( inputLocation.toLowerCase().contains(".gb")) { - GenbankReader genbankReader = new GenbankReader( + GenbankReader genbankReader = new GenbankReader<>( inStream, new GenericGenbankHeaderParser(), new ProteinSequenceCreator(set)); ret = genbankReader.process(); } else { - FastaReader fastaReader = new FastaReader( + FastaReader fastaReader = new FastaReader<>( inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(set)); ret = fastaReader.process(); @@ -214,7 +214,7 @@ private static void printHeader(PrintStream output, List propertyList * 9 Composition of the 20 standard amino acid * 0 Composition of the specific amino acid */ - List sList = new ArrayList(); + List sList = new ArrayList<>(); sList.add("SequenceName"); for(Character c:propertyList){ switch(c){ @@ -277,7 +277,7 @@ private static void compute(PrintStream output, String header, String sequence, IPeptideProperties pp = new PeptidePropertiesImpl(); int specificCount = 0; - List dList = new ArrayList(); + List dList = new ArrayList<>(); for(Character c:propertyList){ switch(c){ case '1': diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Constraints.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Constraints.java index f223eaca23..cecd981223 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Constraints.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Constraints.java @@ -30,7 +30,7 @@ /** * This class is used to support the implementation of properties stated in IPeptideProperties. * It initializes several values that would be needed for the computation of properties such as - *

+ *

* Molecular weight
* Instability index
* Hydropathy value
@@ -64,14 +64,14 @@ public class Constraints { public static AminoAcidCompound Y = aaSet.getCompoundForString("Y"); public static AminoAcidCompound V = aaSet.getCompoundForString("V"); - public static Map aa2ExtinctionCoefficient = new HashMap(); - public static Map aa2MolecularWeight = new HashMap(); - public static Map aa2Hydrophathicity = new HashMap(); - public static Map aa2PKa = new HashMap(); - public static Map diAA2Instability = new HashMap(); + public static Map aa2ExtinctionCoefficient = new HashMap<>(); + public static Map aa2MolecularWeight = new HashMap<>(); + public static Map aa2Hydrophathicity = new HashMap<>(); + public static Map aa2PKa = new HashMap<>(); + public static Map diAA2Instability = new HashMap<>(); - public static Map aa2NTerminalPka = new HashMap(); - public static Map aa2CTerminalPka = new HashMap(); + public static Map aa2NTerminalPka = new HashMap<>(); + public static Map aa2CTerminalPka = new HashMap<>(); static{ initMolecularWeight(); diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/IPeptideProperties.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/IPeptideProperties.java index 5499509820..5342013b61 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/IPeptideProperties.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/IPeptideProperties.java @@ -26,7 +26,7 @@ import org.biojava.nbio.core.sequence.ProteinSequence; import org.biojava.nbio.core.sequence.compound.AminoAcidCompound; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import java.io.File; import java.io.FileNotFoundException; import java.util.Map; @@ -35,7 +35,7 @@ /** * An interface to generate some basic physico-chemical properties of protein sequences.
* The following properties could be generated: - *

+ *

* Molecular weight
* Absorbance
* Extinction coefficient
@@ -258,7 +258,7 @@ public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File elementMas * Returns the net charge of sequence at pH 7. The sequence argument must be * a protein sequence consisting of only non-ambiguous characters. * The net charge will be computed using the approach stated in - * here * * pKa values used will be either * those used by Expasy which referenced "Electrophoresis 1994, 15, 529-539" diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptideProperties.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptideProperties.java index edf76339d9..d14a4d906b 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptideProperties.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptideProperties.java @@ -28,7 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; @@ -37,7 +37,6 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * This is an adaptor class which enable the ease of generating protein properties. @@ -533,7 +532,7 @@ public static final Map getAAComposition(String seque */ public static final Map getAACompositionString(String sequence){ Map aa2Composition = getAAComposition(sequence); - Map aaString2Composition = new HashMap(); + Map aaString2Composition = new HashMap<>(); aaString2Composition = aa2Composition.keySet().stream() .collect(Collectors.toMap(aaCompound -> aaCompound.getShortName(),aaCompound ->aa2Composition.get(aaCompound))); return aaString2Composition; } @@ -551,7 +550,7 @@ public static final Map getAACompositionString(String sequence){ */ public static final Map getAACompositionChar(String sequence){ Map aa2Composition = getAAComposition(sequence); - Map aaChar2Composition = new HashMap(); + Map aaChar2Composition = new HashMap<>(); for(AminoAcidCompound aaCompound:aa2Composition.keySet()){ aaChar2Composition.put(aaCompound.getShortName().charAt(0), aa2Composition.get(aaCompound)); } diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptidePropertiesImpl.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptidePropertiesImpl.java index c75554f9e6..ceb0b234ed 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptidePropertiesImpl.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptidePropertiesImpl.java @@ -29,9 +29,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -210,7 +210,7 @@ private Map getExtinctAACount(ProteinSequence sequen } } AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet(); - Map extinctAA2Count = new HashMap(); + Map extinctAA2Count = new HashMap<>(); //Ignore Case is always true extinctAA2Count.put(aaSet.getCompoundForString("W"), numW + smallW); extinctAA2Count.put(aaSet.getCompoundForString("C"), (int) (numC + smallC)); @@ -532,7 +532,7 @@ private Map getChargedAACount(ProteinSequence sequen } } AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet(); - Map chargedAA2Count = new HashMap(); + Map chargedAA2Count = new HashMap<>(); chargedAA2Count.put(aaSet.getCompoundForString("K"), numK); chargedAA2Count.put(aaSet.getCompoundForString("R"), numR); chargedAA2Count.put(aaSet.getCompoundForString("H"), numH); @@ -558,7 +558,7 @@ public double getEnrichment(ProteinSequence sequence, AminoAcidCompound aminoAci @Override public Map getAAComposition(ProteinSequence sequence) { int validLength = 0; - Map aa2Composition = new HashMap(); + Map aa2Composition = new HashMap<>(); AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet(); for(AminoAcidCompound aa:aaSet.getAllCompounds()){ aa2Composition.put(aa, 0.0); diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java index b66e879d7a..298ad61330 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java @@ -106,7 +106,7 @@ public final static int getNumberOfInvalidChar(String sequence, Set * a new sequence with all invalid characters being replaced by '-'. */ public final static String cleanSequence(String sequence, Set cSet){ - Set invalidCharSet = new HashSet(); + Set invalidCharSet = new HashSet<>(); StringBuilder cleanSeq = new StringBuilder(); if(cSet == null) cSet = PeptideProperties.standardAASet; for(char c:sequence.toCharArray()){ diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/IProfeatProperties.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/IProfeatProperties.java index 0fab96f94a..7f39fff79e 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/IProfeatProperties.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/IProfeatProperties.java @@ -28,7 +28,7 @@ public interface IProfeatProperties { /** * Based on Table 2 of http://nar.oxfordjournals.org/content/34/suppl_2/W32.full.pdf
* An interface class to generate the properties of a protein sequence based on its converted attributes.
- * The seven different attributes are

+ * The seven different attributes are

* Hydrophobicity (Polar, Neutral, Hydrophobicity)
* Normalized van der Waals volume (Range 0 - 2.78, 2.95 - 4.0, 4.03 - 8.08)
* Polarity (Value 4.9 - 6.2, 8.0 - 9.2, 10.4 - 13.0)
@@ -103,8 +103,8 @@ public enum DISTRIBUTION {FIRST, FIRST25, FIRST50, FIRST75, ALL}; * Computes and return the position with respect to the sequence where the given distribution of the grouping can be found.
* Example: "1111122222"
* For the above example,
- * position of the GROUPING.GROUP1 && DISTRIBUTION.FIRST = 0/10 (because the first occurrence of '1' is at position 0)
- * position of the GROUPING.GROUP1 && DISTRIBUTION.ALL = 4/10 (because all occurrences of '1' happens on and before position 4)
+ * position of the GROUPING.GROUP1 & DISTRIBUTION.FIRST = 0/10 (because the first occurrence of '1' is at position 0)
+ * position of the GROUPING.GROUP1 & DISTRIBUTION.ALL = 4/10 (because all occurrences of '1' happens on and before position 4)
* * @param sequence * a protein sequence consisting of non-ambiguous characters only diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java index d8844476f4..dd0d310439 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java @@ -119,8 +119,8 @@ public static Map> getTransition(String seque * An adaptor method which computes and return the position with respect to the sequence where the given distribution of the grouping can be found.
* Example: "1111122222"
* For the above example,
- * position of the GROUPING.GROUP1 && DISTRIBUTION.FIRST = 0/10 (because the first occurrence of '1' is at position 0)
- * position of the GROUPING.GROUP1 && DISTRIBUTION.ALL = 4/10 (because all occurrences of '1' happens on and before position 4)
+ * position of the GROUPING.GROUP1 & DISTRIBUTION.FIRST = 0/10 (because the first occurrence of '1' is at position 0)
+ * position of the GROUPING.GROUP1 & DISTRIBUTION.ALL = 4/10 (because all occurrences of '1' happens on and before position 4)
* * @param sequence * a protein sequence consisting of non-ambiguous characters only diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatPropertiesImpl.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatPropertiesImpl.java index 75b0ff3064..18b63a468b 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatPropertiesImpl.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatPropertiesImpl.java @@ -125,35 +125,35 @@ private Convertor getConvertor(ATTRIBUTE attribute) throws Exception{ @Override public Map getComposition(ProteinSequence sequence, ATTRIBUTE attribute) throws Exception { - Map grouping2Composition = new HashMap(); + Map grouping2Composition = new HashMap<>(); for(GROUPING group:GROUPING.values()) grouping2Composition.put(group, getComposition(sequence, attribute, group)); return grouping2Composition; } @Override public Map> getComposition(ProteinSequence sequence) throws Exception { - Map> attribute2Grouping2Composition = new HashMap>(); + Map> attribute2Grouping2Composition = new HashMap<>(); for(ATTRIBUTE attribute:ATTRIBUTE.values()) attribute2Grouping2Composition.put(attribute, getComposition(sequence, attribute)); return attribute2Grouping2Composition; } @Override public Map getTransition(ProteinSequence sequence, ATTRIBUTE attribute) throws Exception { - Map transition2Double = new HashMap(); + Map transition2Double = new HashMap<>(); for(TRANSITION transition:TRANSITION.values()) transition2Double.put(transition, getTransition(sequence, attribute, transition)); return transition2Double; } @Override public Map> getTransition(ProteinSequence sequence) throws Exception { - Map> attribute2Transition2Double = new HashMap>(); + Map> attribute2Transition2Double = new HashMap<>(); for(ATTRIBUTE attribute:ATTRIBUTE.values()) attribute2Transition2Double.put(attribute, getTransition(sequence, attribute)); return attribute2Transition2Double; } @Override public Map getDistributionPosition(ProteinSequence sequence, ATTRIBUTE attribute, GROUPING group) throws Exception { - Map distribution2Double = new HashMap(); + Map distribution2Double = new HashMap<>(); for(DISTRIBUTION distribution:DISTRIBUTION.values()) distribution2Double.put(distribution, getDistributionPosition(sequence, attribute, group, distribution)); return distribution2Double; @@ -161,7 +161,7 @@ public Map getDistributionPosition(ProteinSequence sequenc @Override public Map> getDistributionPosition(ProteinSequence sequence, ATTRIBUTE attribute) throws Exception { - Map> grouping2Distribution2Double = new HashMap>(); + Map> grouping2Distribution2Double = new HashMap<>(); for(GROUPING group:GROUPING.values()) grouping2Distribution2Double.put(group, getDistributionPosition(sequence, attribute, group)); return grouping2Distribution2Double; @@ -170,7 +170,7 @@ public Map> getDistributionPosition(ProteinS @Override public Map>> getDistributionPosition(ProteinSequence sequence) throws Exception { Map>> attribute2Grouping2Distribution2Double = - new HashMap>>(); + new HashMap<>(); for(ATTRIBUTE attribute:ATTRIBUTE.values()) attribute2Grouping2Distribution2Double.put(attribute, getDistributionPosition(sequence, attribute)); return attribute2Grouping2Distribution2Double; diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/Convertor.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/Convertor.java index a88d93add3..e298ab2520 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/Convertor.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/Convertor.java @@ -28,7 +28,7 @@ public abstract class Convertor { /** * Based on Table 2 of http://nar.oxfordjournals.org/content/34/suppl_2/W32.full.pdf
* An abstract class to convert a protein sequence into representation of different attribute with each attribute having 3 groups.
- * The seven different attributes are

+ * The seven different attributes are

* Hydrophobicity (Polar, Neutral, Hydrophobicity)
* Normalized van der Waals volume (Range 0 - 2.78, 2.95 - 4.0, 4.03 - 8.08)
* Polarity (Value 4.9 - 6.2, 8.0 - 9.2, 10.4 - 13.0)
diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/package-info.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/package-info.java index 22143b53cb..a28076aa41 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/package-info.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/package-info.java @@ -20,7 +20,7 @@ */ /** * Set of classes that enable the conversion protein sequences into various attributes. - * The seven different attributes are

+ * The seven different attributes are

* Hydrophobicity (Polar, Neutral, Hydrophobicity)
* Normalized van der Waals volume (Range 0 - 2.78, 2.95 - 4.0, 4.03 - 8.08)
* Polarity (Value 4.9 - 6.2, 8.0 - 9.2, 10.4 - 13.0)
diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidComposition.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidComposition.java index 9004426ff5..034df5fb12 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidComposition.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidComposition.java @@ -20,7 +20,7 @@ */ package org.biojava.nbio.aaproperties.xml; -import javax.xml.bind.annotation.*; +import jakarta.xml.bind.annotation.*; import java.util.List; @XmlRootElement(name = "compoundcomposition", namespace ="http://biojava.org") diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidCompositionTable.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidCompositionTable.java index 6c90355296..b209859600 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidCompositionTable.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/AminoAcidCompositionTable.java @@ -20,10 +20,10 @@ */ package org.biojava.nbio.aaproperties.xml; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -83,7 +83,7 @@ private void generatesAminoAcidCompoundSet(){ * Stores the mass of elements and isotopes */ public void computeMolecularWeight(ElementTable eTable){ - this.aaSymbol2MolecularWeight = new HashMap(); + this.aaSymbol2MolecularWeight = new HashMap<>(); for(AminoAcidComposition a:aminoacid){ //Check to ensure that the symbol is of single character if(a.getSymbol().length() != 1){ diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/CaseFreeAminoAcidCompoundSet.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/CaseFreeAminoAcidCompoundSet.java index 9b211ab305..7a436d32cd 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/CaseFreeAminoAcidCompoundSet.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/CaseFreeAminoAcidCompoundSet.java @@ -39,9 +39,9 @@ */ public class CaseFreeAminoAcidCompoundSet implements CompoundSet { - private final Map aminoAcidCompoundCache = new HashMap(); + private final Map aminoAcidCompoundCache = new HashMap<>(); private final Map> equivalentsCache = - new HashMap>(); + new HashMap<>(); public CaseFreeAminoAcidCompoundSet() { aminoAcidCompoundCache.put("A", new AminoAcidCompound(null, "A", "Ala", "Alanine", 71.0788f)); @@ -83,7 +83,7 @@ public CaseFreeAminoAcidCompoundSet() { //which then does the actual conversion to Pyl. aminoAcidCompoundCache.put("O", new AminoAcidCompound(null, "O", "Pyl", "Pyrrolysine", 255.3172f)); - Map lowerCaseSet = new HashMap(); + Map lowerCaseSet = new HashMap<>(); for(String s:this.aminoAcidCompoundCache.keySet()){ lowerCaseSet.put(s.toLowerCase(), this.aminoAcidCompoundCache.get(s)); } @@ -144,7 +144,7 @@ public Set getEquivalentCompounds(AminoAcidCompound compound) addAmbiguousEquivalents("I", "L", "J"); // ambiguous gaps AminoAcidCompound gap1, gap2, gap3; - Set gaps = new HashSet(); + Set gaps = new HashSet<>(); gaps.add(gap1 = aminoAcidCompoundCache.get("-")); gaps.add(gap2 = aminoAcidCompoundCache.get(".")); gaps.add(gap3 = aminoAcidCompoundCache.get("_")); @@ -162,18 +162,18 @@ private void addAmbiguousEquivalents(String one, String two, String either) { Set equivalents; AminoAcidCompound cOne, cTwo, cEither; - equivalents = new HashSet(); + equivalents = new HashSet<>(); equivalents.add(cOne = aminoAcidCompoundCache.get(one)); equivalents.add(cTwo = aminoAcidCompoundCache.get(two)); equivalents.add(cEither = aminoAcidCompoundCache.get(either)); equivalentsCache.put(cEither, equivalents); - equivalents = new HashSet(); + equivalents = new HashSet<>(); equivalents.add(cOne); equivalents.add(cEither); equivalentsCache.put(cOne, equivalents); - equivalents = new HashSet(); + equivalents = new HashSet<>(); equivalents.add(cTwo); equivalents.add(cEither); equivalentsCache.put(cTwo, equivalents); @@ -186,7 +186,7 @@ public boolean hasCompound(AminoAcidCompound compound) { @Override public List getAllCompounds() { - return new ArrayList(aminoAcidCompoundCache.values()); + return new ArrayList<>(aminoAcidCompoundCache.values()); } diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Element.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Element.java index b03d15d1ac..c7b9a425fc 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Element.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Element.java @@ -20,10 +20,10 @@ */ package org.biojava.nbio.aaproperties.xml; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -120,7 +120,7 @@ public List getIsotopes() { public void setIsotopes(List isotopes) { this.isotope = isotopes; - this.name2Isotope = new HashMap(); + this.name2Isotope = new HashMap<>(); if(isotopes != null){ for(Isotope i:isotopes){ name2Isotope.put(i.getName(), i); diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ElementTable.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ElementTable.java index efac678f23..e2b30c6211 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ElementTable.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ElementTable.java @@ -20,7 +20,7 @@ */ package org.biojava.nbio.aaproperties.xml; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlRootElement; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -58,8 +58,8 @@ public void setElement(List eList){ * Populate the Maps for quick retrieval */ public void populateMaps(){ - this.elementName2Element = new HashMap(); - this.isotopeName2Isotope = new HashMap(); + this.elementName2Element = new HashMap<>(); + this.isotopeName2Isotope = new HashMap<>(); if(this.element != null){ for(Element e:this.element){ this.elementName2Element.put(e.getName(), e); diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Isotope.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Isotope.java index 493bf938a3..cc0682f084 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Isotope.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Isotope.java @@ -20,10 +20,10 @@ */ package org.biojava.nbio.aaproperties.xml; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; @XmlType(name = "Iostope", propOrder = {"name","neutronsNum","mass"}) diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ModifiedAminoAcidCompoundSet.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ModifiedAminoAcidCompoundSet.java index d9c11c7e66..b1c63e9655 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ModifiedAminoAcidCompoundSet.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/ModifiedAminoAcidCompoundSet.java @@ -28,7 +28,7 @@ public class ModifiedAminoAcidCompoundSet implements CompoundSet { - private final Map aminoAcidCompoundCache = new HashMap(); + private final Map aminoAcidCompoundCache = new HashMap<>(); public ModifiedAminoAcidCompoundSet(List aaList, Map aaSymbol2MolecularWeight) { this.aminoAcidCompoundCache.put("-", new AminoAcidCompound(null, "-", "", "", 0.0f)); @@ -84,7 +84,7 @@ public boolean hasCompound(AminoAcidCompound compound) { @Override public List getAllCompounds() { - return new ArrayList(aminoAcidCompoundCache.values()); + return new ArrayList<>(aminoAcidCompoundCache.values()); } @Override diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/MyValidationEventHandler.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/MyValidationEventHandler.java index 2f49bb5c18..9430090436 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/MyValidationEventHandler.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/MyValidationEventHandler.java @@ -23,9 +23,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.ValidationEventLocator; +import jakarta.xml.bind.ValidationEvent; +import jakarta.xml.bind.ValidationEventHandler; +import jakarta.xml.bind.ValidationEventLocator; public class MyValidationEventHandler implements ValidationEventHandler{ diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Name2Count.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Name2Count.java index 431cc3e48c..b30e4c6dd2 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Name2Count.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/Name2Count.java @@ -20,9 +20,9 @@ */ package org.biojava.nbio.aaproperties.xml; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; @XmlAccessorType(XmlAccessType.FIELD) public class Name2Count{ diff --git a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/SchemaGenerator.java b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/SchemaGenerator.java index 8005bf3bac..5ca2b550ed 100644 --- a/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/SchemaGenerator.java +++ b/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/xml/SchemaGenerator.java @@ -20,7 +20,7 @@ */ package org.biojava.nbio.aaproperties.xml; -import javax.xml.bind.SchemaOutputResolver; +import jakarta.xml.bind.SchemaOutputResolver; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; import java.io.File; diff --git a/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/CookBookTest.java b/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/CookBookTest.java index 25ebf3abed..bbde2c1e30 100644 --- a/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/CookBookTest.java +++ b/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/CookBookTest.java @@ -20,13 +20,12 @@ */ package org.biojava.nbio.aaproperties; -import org.biojava.nbio.aaproperties.PeptideProperties; import org.biojava.nbio.aaproperties.xml.AminoAcidCompositionTable; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import java.io.File; import java.io.FileNotFoundException; import java.util.Map; diff --git a/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/PeptidePropertiesImplTest.java b/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/PeptidePropertiesImplTest.java index 4f0439a5d4..8c79e3b078 100644 --- a/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/PeptidePropertiesImplTest.java +++ b/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/PeptidePropertiesImplTest.java @@ -20,14 +20,12 @@ */ package org.biojava.nbio.aaproperties; -import org.biojava.nbio.aaproperties.PeptideProperties; -import org.biojava.nbio.aaproperties.Utils; import org.biojava.nbio.aaproperties.xml.AminoAcidCompositionTable; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import java.io.File; import java.io.FileNotFoundException; import java.util.Map; diff --git a/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/xml/AminoAcidTest.java b/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/xml/AminoAcidTest.java index 528192dcb4..49947c1f50 100644 --- a/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/xml/AminoAcidTest.java +++ b/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/xml/AminoAcidTest.java @@ -23,10 +23,10 @@ import org.biojava.nbio.aaproperties.PeptideProperties; import org.junit.Test; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.Unmarshaller; import java.io.*; import java.util.ArrayList; import java.util.List; diff --git a/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/xml/ElementTest.java b/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/xml/ElementTest.java index 37376b6bd0..26de47bf03 100644 --- a/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/xml/ElementTest.java +++ b/biojava-aa-prop/src/test/java/org/biojava/nbio/aaproperties/xml/ElementTest.java @@ -20,18 +20,14 @@ */ package org.biojava.nbio.aaproperties.xml; -import org.biojava.nbio.aaproperties.xml.Element; -import org.biojava.nbio.aaproperties.xml.ElementTable; -import org.biojava.nbio.aaproperties.xml.Isotope; -import org.biojava.nbio.aaproperties.xml.SchemaGenerator; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.Unmarshaller; import java.io.*; import java.util.ArrayList; import java.util.List; diff --git a/biojava-alignment/pom.xml b/biojava-alignment/pom.xml index 002fbb6b0b..b1d0bd9097 100644 --- a/biojava-alignment/pom.xml +++ b/biojava-alignment/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-alignment biojava-alignment @@ -47,7 +47,7 @@ org.biojava biojava-core - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT compile @@ -63,7 +63,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-alignment/src/main/java/demo/CookbookMSA.java b/biojava-alignment/src/main/java/demo/CookbookMSA.java index d2952bbeac..c617745539 100644 --- a/biojava-alignment/src/main/java/demo/CookbookMSA.java +++ b/biojava-alignment/src/main/java/demo/CookbookMSA.java @@ -43,7 +43,7 @@ public static void main(String[] args) throws Exception { } private static void multipleSequenceAlignment(String[] ids) throws Exception { - List lst = new ArrayList(); + List lst = new ArrayList<>(); for (String id : ids) { lst.add(getSequenceForId(id)); } diff --git a/biojava-alignment/src/main/java/demo/DemoDistanceTree.java b/biojava-alignment/src/main/java/demo/DemoDistanceTree.java index c9f82d39f7..9215fa43dc 100644 --- a/biojava-alignment/src/main/java/demo/DemoDistanceTree.java +++ b/biojava-alignment/src/main/java/demo/DemoDistanceTree.java @@ -22,6 +22,7 @@ import java.io.InputStream; import java.util.LinkedHashMap; +import java.util.Map; import org.biojava.nbio.core.alignment.matrices.SubstitutionMatrixHelper; import org.biojava.nbio.core.alignment.template.SubstitutionMatrix; @@ -58,19 +59,19 @@ public static void main(String[] args) throws Exception { .getResourceAsStream("/PF00104_small.fasta"); FastaReader fastaReader = - new FastaReader( + new FastaReader<>( inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet .getAminoAcidCompoundSet())); - LinkedHashMap proteinSequences = + Map proteinSequences = fastaReader.process(); inStream.close(); MultipleSequenceAlignment msa = - new MultipleSequenceAlignment(); + new MultipleSequenceAlignment<>(); for (ProteinSequence proteinSequence : proteinSequences.values()) { msa.addAlignedSequence(proteinSequence); diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java index 4ed72d0979..b389504826 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java @@ -122,7 +122,7 @@ private Alignments() { } * {@link ConcurrencyTools} utility. * * @param each {@link Sequence} of an alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param sequences the {@link List} of {@link Sequence}s to align * @param type chosen type from list of pairwise sequence alignment routines * @param gapPenalty the gap penalties used during alignment @@ -189,7 +189,7 @@ public static , C extends Compound> Profile getMulti runPairwiseScorers(scorers); // stage 2: hierarchical clustering into a guide tree - GuideTree tree = new GuideTree(sequences, scorers); + GuideTree tree = new GuideTree<>(sequences, scorers); scorers = null; // stage 3: progressive alignment @@ -203,7 +203,7 @@ public static , C extends Compound> Profile getMulti * Factory method which computes a sequence alignment for the given {@link Sequence} pair. * * @param each {@link Sequence} of the pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param query the first {@link Sequence}s to align * @param target the second {@link Sequence}s to align * @param type chosen type from list of pairwise sequence alignment routines @@ -223,7 +223,7 @@ public static , C extends Compound> SequencePair get * Factory method which sets up a sequence alignment for all {@link Sequence} pairs in the given {@link List}. * * @param each {@link Sequence} of an alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param sequences the {@link List} of {@link Sequence}s to align * @param type chosen type from list of pairwise sequence alignment routines * @param gapPenalty the gap penalties used during alignment @@ -233,7 +233,7 @@ public static , C extends Compound> SequencePair get static , C extends Compound> List> getAllPairsAligners( List sequences, PairwiseSequenceAlignerType type, GapPenalty gapPenalty, SubstitutionMatrix subMatrix) { - List> allPairs = new ArrayList>(); + List> allPairs = new ArrayList<>(); for (int i = 0; i < sequences.size(); i++) { for (int j = i+1; j < sequences.size(); j++) { allPairs.add(getPairwiseAligner(sequences.get(i), sequences.get(j), type, gapPenalty, subMatrix)); @@ -256,7 +256,7 @@ static , C extends Compound> List, C extends Compound> List> getAllPairsScorers( List sequences, PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix subMatrix) { - List> allPairs = new ArrayList>(); + List> allPairs = new ArrayList<>(); for (int i = 0; i < sequences.size(); i++) { for (int j = i+1; j < sequences.size(); j++) { allPairs.add(getPairwiseScorer(sequences.get(i), sequences.get(j), type, gapPenalty, subMatrix)); @@ -291,7 +291,7 @@ public static , C extends Compound> double[] getAllPairsSc * @return calculated elements */ static List getListFromFutures(List> futures) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (Future f : futures) { // TODO when added to ConcurrencyTools, log completions and exceptions instead of printing stack traces try { @@ -309,7 +309,7 @@ static List getListFromFutures(List> futures) { * Factory method which constructs a pairwise sequence aligner. * * @param each {@link Sequence} of an alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param query the first {@link Sequence} to align * @param target the second {@link Sequence} to align * @param type chosen type from list of pairwise sequence alignment routines @@ -326,9 +326,9 @@ public static , C extends Compound> PairwiseSequenceAligne switch (type) { default: case GLOBAL: - return new NeedlemanWunsch(query, target, gapPenalty, subMatrix); + return new NeedlemanWunsch<>(query, target, gapPenalty, subMatrix); case LOCAL: - return new SmithWaterman(query, target, gapPenalty, subMatrix); + return new SmithWaterman<>(query, target, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case LOCAL_LINEAR_SPACE: // TODO other alignment options (Myers-Miller, Thompson) @@ -374,18 +374,18 @@ static , C extends Compound> PairwiseSequenceScorer case GLOBAL: return getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix); case GLOBAL_IDENTITIES: - return new FractionalIdentityScorer(getPairwiseAligner(query, target, + return new FractionalIdentityScorer<>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix)); case GLOBAL_SIMILARITIES: - return new FractionalSimilarityScorer(getPairwiseAligner(query, target, + return new FractionalSimilarityScorer<>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix)); case LOCAL: return getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix); case LOCAL_IDENTITIES: - return new FractionalIdentityScorer(getPairwiseAligner(query, target, + return new FractionalIdentityScorer<>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix)); case LOCAL_SIMILARITIES: - return new FractionalSimilarityScorer(getPairwiseAligner(query, target, + return new FractionalSimilarityScorer<>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix)); case KMERS: case WU_MANBER: @@ -399,7 +399,7 @@ static , C extends Compound> PairwiseSequenceScorer * Factory method which constructs a profile-profile aligner. * * @param each {@link Sequence} of an alignment profile is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param profile1 the first {@link Profile} to align * @param profile2 the second {@link Profile} to align * @param type chosen type from list of profile-profile alignment routines @@ -413,7 +413,7 @@ static , C extends Compound> ProfileProfileAligner g switch (type) { default: case GLOBAL: - return new SimpleProfileProfileAligner(profile1, profile2, gapPenalty, subMatrix); + return new SimpleProfileProfileAligner<>(profile1, profile2, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case GLOBAL_CONSENSUS: case LOCAL: @@ -429,7 +429,7 @@ static , C extends Compound> ProfileProfileAligner g * Factory method which constructs a profile-profile aligner. * * @param each {@link Sequence} of an alignment profile is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param profile1 the first {@link Profile} to align * @param profile2 the second {@link Profile} to align * @param type chosen type from list of profile-profile alignment routines @@ -443,7 +443,7 @@ static , C extends Compound> ProfileProfileAligner g switch (type) { default: case GLOBAL: - return new SimpleProfileProfileAligner(profile1, profile2, gapPenalty, subMatrix); + return new SimpleProfileProfileAligner<>(profile1, profile2, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case GLOBAL_CONSENSUS: case LOCAL: @@ -459,7 +459,7 @@ static , C extends Compound> ProfileProfileAligner g * Factory method which constructs a profile-profile aligner. * * @param each {@link Sequence} of an alignment profile is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param profile1 the first {@link Profile} to align * @param profile2 the second {@link Profile} to align * @param type chosen type from list of profile-profile alignment routines @@ -473,7 +473,7 @@ static , C extends Compound> ProfileProfileAligner g switch (type) { default: case GLOBAL: - return new SimpleProfileProfileAligner(profile1, profile2, gapPenalty, subMatrix); + return new SimpleProfileProfileAligner<>(profile1, profile2, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case GLOBAL_CONSENSUS: case LOCAL: @@ -489,7 +489,7 @@ static , C extends Compound> ProfileProfileAligner g * Factory method which constructs a profile-profile aligner. * * @param each {@link Sequence} of an alignment profile is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param profile1 the first {@link Profile} to align * @param profile2 the second {@link Profile} to align * @param type chosen type from list of profile-profile alignment routines @@ -503,7 +503,7 @@ static , C extends Compound> ProfileProfileAligner g switch (type) { default: case GLOBAL: - return new SimpleProfileProfileAligner(profile1, profile2, gapPenalty, subMatrix); + return new SimpleProfileProfileAligner<>(profile1, profile2, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case GLOBAL_CONSENSUS: case LOCAL: @@ -519,7 +519,7 @@ static , C extends Compound> ProfileProfileAligner g * Factory method which computes a profile alignment for the given {@link Profile} pair. * * @param each {@link Sequence} of the {@link Profile} pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param profile1 the first {@link Profile} to align * @param profile2 the second {@link Profile} to align * @param type chosen type from list of profile-profile alignment routines @@ -539,7 +539,7 @@ static , C extends Compound> ProfilePair getProfileP * of the {@link ConcurrencyTools} utility. * * @param each {@link Sequence} of the {@link Profile} pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param tree guide tree to follow aligning profiles from leaves to root * @param type chosen type from list of profile-profile alignment routines * @param gapPenalty the gap penalties used during alignment @@ -550,7 +550,7 @@ public static , C extends Compound> Profile getProgr ProfileProfileAlignerType type, GapPenalty gapPenalty, SubstitutionMatrix subMatrix) { // find inner nodes in post-order traversal of tree (each leaf node has a single sequence profile) - List> innerNodes = new ArrayList>(); + List> innerNodes = new ArrayList<>(); for (GuideTreeNode n : tree) { if (n.getProfile() == null) { innerNodes.add(n); @@ -592,14 +592,14 @@ public static , C extends Compound> Profile getProgr * submitting all of the alignment tasks to the shared thread pool of the {@link ConcurrencyTools} utility. * * @param each {@link Sequence} of an alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param aligners list of alignments to run * @return list of {@link SequencePair} results from running alignments */ static , C extends Compound> List> runPairwiseAligners(List> aligners) { int n = 1, all = aligners.size(); - List>> futures = new ArrayList>>(); + List>> futures = new ArrayList<>(); for (PairwiseSequenceAligner aligner : aligners) { futures.add(ConcurrencyTools.submit(new CallablePairwiseSequenceAligner(aligner), String.format("Aligning pair %d of %d", n++, all))); @@ -612,14 +612,14 @@ public static , C extends Compound> Profile getProgr * all of the scoring tasks to the shared thread pool of the {@link ConcurrencyTools} utility. * * @param each {@link Sequence} of an alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param scorers list of scorers to run * @return list of score results from running scorers */ public static , C extends Compound> double[] runPairwiseScorers( List> scorers) { int n = 1, all = scorers.size(); - List> futures = new ArrayList>(); + List> futures = new ArrayList<>(); for (PairwiseSequenceScorer scorer : scorers) { futures.add(ConcurrencyTools.submit(new CallablePairwiseSequenceScorer(scorer), String.format("Scoring pair %d of %d", n++, all))); @@ -637,14 +637,14 @@ public static , C extends Compound> double[] runPairwiseSc * submitting all of the alignment tasks to the shared thread pool of the {@link ConcurrencyTools} utility. * * @param each {@link Sequence} of the {@link Profile} pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C * @param aligners list of alignments to run * @return list of {@link ProfilePair} results from running alignments */ static , C extends Compound> List> runProfileAligners(List> aligners) { int n = 1, all = aligners.size(); - List>> futures = new ArrayList>>(); + List>> futures = new ArrayList<>(); for (ProfileProfileAligner aligner : aligners) { futures.add(ConcurrencyTools.submit(new CallableProfileProfileAligner(aligner), String.format("Aligning pair %d of %d", n++, all))); diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/FractionalIdentityScorer.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/FractionalIdentityScorer.java index 4b494db779..d66105681d 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/FractionalIdentityScorer.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/FractionalIdentityScorer.java @@ -34,7 +34,7 @@ * * @author Mark Chapman * @param each {@link Sequence} of the alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public class FractionalIdentityScorer, C extends Compound> extends AbstractScorer implements PairwiseSequenceScorer { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/FractionalSimilarityScorer.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/FractionalSimilarityScorer.java index 05911367f8..e9581f1f96 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/FractionalSimilarityScorer.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/FractionalSimilarityScorer.java @@ -34,7 +34,7 @@ * * @author Mark Chapman * @param each {@link Sequence} of the alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public class FractionalSimilarityScorer, C extends Compound> extends AbstractScorer implements PairwiseSequenceScorer { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/GuideTree.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/GuideTree.java index ecbcf66e79..c67caa8a4f 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/GuideTree.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/GuideTree.java @@ -182,7 +182,7 @@ private Node(PhylogenyNode node, Node parent) { distance = node.getDistanceToParent(); name = node.getName(); if(isLeaf = node.isExternal()) { - profile = new SimpleProfile(sequences.get(distances.getIndex(name))); + profile = new SimpleProfile<>(sequences.get(distances.getIndex(name))); } else { child1 = new Node(node.getChildNode1(), this); child2 = new Node(node.getChildNode2(), this); @@ -237,7 +237,7 @@ public void setProfileFuture(Future> profileFuture) { @Override public Enumeration> children() { - Vector> children = new Vector>(); + Vector> children = new Vector<>(); children.add(getChild1()); children.add(getChild2()); return children.elements(); @@ -305,7 +305,7 @@ private class PostOrderIterator implements Iterator> { private PostOrderIterator() { getRoot().clearVisited(); - nodes = new Stack(); + nodes = new Stack<>(); nodes.push(getRoot()); } diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SimpleProfileProfileAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SimpleProfileProfileAligner.java index 73579ab8f4..ff94041bb8 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SimpleProfileProfileAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SimpleProfileProfileAligner.java @@ -41,7 +41,7 @@ * * @author Mark Chapman * @param each {@link Sequence} in the pair of alignment {@link Profile}s is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public class SimpleProfileProfileAligner, C extends Compound> extends AbstractProfileProfileAligner { @@ -110,7 +110,7 @@ public SimpleProfileProfileAligner(Future> query, Profile sx, List sy) { - profile = pair = new SimpleProfilePair(getQuery(), getTarget(), sx, sy); + profile = pair = new SimpleProfilePair<>(getQuery(), getTarget(), sx, sy); } } diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SmithWaterman.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SmithWaterman.java index 7d7e017694..819d8f5187 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SmithWaterman.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SmithWaterman.java @@ -69,7 +69,7 @@ public SmithWaterman(S query, S target, GapPenalty gapPenalty, SubstitutionMatri @Override protected void setProfile(List sx, List sy) { - profile = pair = new SimpleSequencePair(getQuery(), getTarget(), sx, xyStart[0], + profile = pair = new SimpleSequencePair<>(getQuery(), getTarget(), sx, xyStart[0], getQuery().getLength() - xyMax[0], sy, xyStart[1], getTarget().getLength() - xyMax[1]); } diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileAnnotation.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileAnnotation.java index 80389ca000..5b7ff9899b 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileAnnotation.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileAnnotation.java @@ -125,7 +125,7 @@ public void setRefLocation(String refLocation) { private Set dbReferences; private StringBuffer refComment; /**TODO When implementing toString(), the function should loop on the vector */ - private Vector references = new Vector(); + private Vector references = new Vector<>(); private StringBuffer keywords; private CharSequence comment; private StringBuffer pfamAccession; @@ -137,7 +137,7 @@ public void setRefLocation(String refLocation) { private float falseDiscoveryRate; public StockholmFileAnnotation() { - embTrees = new HashMap>(); + embTrees = new HashMap<>(); } public StringBuffer getDbComment() { @@ -160,11 +160,11 @@ public void setDbReferences(Set dbReferences) { this.dbReferences = dbReferences; } /** - * @param dbReference the string without the initial annotation identifier ( #=GS DR ) + * @param dbReferenceRepresentingString the string without the initial annotation identifier ( #=GS DR ) */ public void addDBReference(String dbReferenceRepresentingString) { if (this.dbReferences == null) { - this.dbReferences = new HashSet(); + this.dbReferences = new HashSet<>(); } dbReferences.add(new DatabaseReference(dbReferenceRepresentingString)); } @@ -492,7 +492,7 @@ public void setGFMembership(String membership) { public void addGFNewHampshire(String newHampshire) { List hampshireTree = embTrees.get(TREE_DEFAULT_ID); if (hampshireTree == null) { - hampshireTree = new ArrayList(); + hampshireTree = new ArrayList<>(); } hampshireTree.add(newHampshire); embTrees.put(TREE_DEFAULT_ID, hampshireTree); diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileParser.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileParser.java index 9af9731c28..83afc9d5a0 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileParser.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmFileParser.java @@ -356,7 +356,7 @@ public List parse(InputStream inStream, int max) throws IOEx if (internalScanner == null) { internalScanner = new Scanner(inStream); } - ArrayList structures = new ArrayList(); + ArrayList structures = new ArrayList<>(); while (max != INFINITY && max-- > 0) { StockholmStructure structure = parse(internalScanner); if (structure != null) { @@ -471,7 +471,7 @@ StockholmStructure parse(Scanner scanner) throws IOException { this.stockholmStructure = new StockholmStructure(); this.stockholmStructure.getFileAnnotation().setFormat(header[1]); this.stockholmStructure.getFileAnnotation().setVersion(header[2]); - } else if (line.trim().equals("//")) { + } else if ("//".equals(line.trim())) { // status = STATUS_OUTSIDE_FILE; break;// should we just break immediately or jump next empty lines? } else /* if (!line.startsWith("#")) */{ diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmSequenceAnnotation.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmSequenceAnnotation.java index 4b36dc192e..6c203bfc5b 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmSequenceAnnotation.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmSequenceAnnotation.java @@ -74,7 +74,7 @@ public void setDbReferences(Set dbReferences) { */ public void addDBReference(String dbReferenceRepresentingString) { if (this.dbReferences == null) { - this.dbReferences = new HashSet(); + this.dbReferences = new HashSet<>(); } dbReferences.add(new DatabaseReference(dbReferenceRepresentingString)); } diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java index 97261433b7..a70e751df5 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java @@ -38,7 +38,8 @@ * In general, Stockholm File contains the alignment mark-up lines.
*
* - * + *
+ * * * * @@ -56,18 +57,24 @@ * Sequence letters may include any characters except whitespace. Gaps may be indicated by "." or "-".
* Mark-up lines may include any characters except whitespace. Use underscore ("_") instead of space.
* - *
Header Section
+ *
+ * + * * * + * * * * + * * * * + * * * * + * * * * @@ -94,9 +101,9 @@ public class StockholmStructure { public StockholmStructure() { fileAnnotation = new StockholmFileAnnotation(); consAnnotation = new StockholmConsensusAnnotation(); - sequences = new HashMap(); - seqsAnnotation = new HashMap(); - resAnnotation = new HashMap(); + sequences = new HashMap<>(); + seqsAnnotation = new HashMap<>(); + resAnnotation = new HashMap<>(); } public StockholmFileAnnotation getFileAnnotation() { @@ -235,7 +242,7 @@ public List> getBioSequences(boolea if (forcedSequenceType != null && !(forcedSequenceType.equals(PFAM) || forcedSequenceType.equals(RFAM))) { throw new IllegalArgumentException("Illegal Argument " + forcedSequenceType); } - List> seqs = new ArrayList>(); + List> seqs = new ArrayList<>(); for (String sequencename : sequences.keySet()) { AbstractSequence seq = null; String sequence = sequences.get(sequencename).toString(); @@ -256,9 +263,8 @@ else if (forcedSequenceType.equals(PFAM)) } String[] seqDetails = splitSeqName(sequencename); seq.setDescription(seqDetails[0]); - seq.setBioBegin((seqDetails[1] == null || seqDetails[1].trim().equals("") ? null : new Integer( - seqDetails[1]))); - seq.setBioEnd((seqDetails[2] == null || seqDetails[2].trim().equals("") ? null : new Integer(seqDetails[2]))); + seq.setBioBegin((seqDetails[1] == null || "".equals(seqDetails[1].trim()) ? null : Integer.valueOf(seqDetails[1]))); + seq.setBioEnd((seqDetails[2] == null || "".equals(seqDetails[2].trim()) ? null : Integer.valueOf(seqDetails[2]))); seqs.add(seq); } diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java index f00ce2101f..e53fe56c05 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java @@ -268,7 +268,7 @@ public Subproblem(int queryStartIndex, int targetStartIndex, int queryEndIndex, */ public static List getSubproblems(List anchors, int querySequenceLength, int targetSequenceLength) { Collections.sort(anchors, new Anchor.QueryIndexComparator()); - List list = new ArrayList(); + List list = new ArrayList<>(); Anchor last = new Anchor(-1, -1); // sentinal anchor boolean isAnchored = false; for (int i = 0; i < anchors.size(); i++) { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AnchoredPairwiseSequenceAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AnchoredPairwiseSequenceAligner.java index 41b9502782..8533ecc91e 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AnchoredPairwiseSequenceAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AnchoredPairwiseSequenceAligner.java @@ -42,7 +42,7 @@ * will connect the query sequence to the target sequence at the anchors. This class performs such global * sequence comparisons efficiently by dynamic programming with a space requirement reduced from quadratic (a multiple * of query sequence length times target sequence length) to only linear (a multiple of query sequence length). The - * counterpoint to this reduction in space complexity is a modest (a multiple < 2) increase in time. + * counterpoint to this reduction in space complexity is a modest (a multiple < 2) increase in time. * * @author Mark Chapman * @author Daniel Cameron @@ -67,7 +67,6 @@ public AnchoredPairwiseSequenceAligner() { * @param target the second {@link Sequence} of the pair to align * @param gapPenalty the gap penalties used during alignment * @param subMatrix the set of substitution scores used during alignment - * @param cutsPerSection the number of cuts added to each section during each pass */ public AnchoredPairwiseSequenceAligner(S query, S target, GapPenalty gapPenalty, SubstitutionMatrix subMatrix) { this(query, target, gapPenalty, subMatrix, null); @@ -80,7 +79,6 @@ public AnchoredPairwiseSequenceAligner(S query, S target, GapPenalty gapPenalty, * @param target the second {@link Sequence} of the pair to align * @param gapPenalty the gap penalties used during alignment * @param subMatrix the set of substitution scores used during alignment - * @param cutsPerSection the number of cuts added to each section during each pass * @param anchors the initial list of anchors */ public AnchoredPairwiseSequenceAligner(S query, S target, GapPenalty gapPenalty, SubstitutionMatrix subMatrix, int[] anchors) { @@ -111,7 +109,7 @@ public int[] getAnchors() { * @param anchors list of points that are tied to the given indices in the target */ public void setAnchors(int[] anchors) { - super.anchors = new ArrayList(); + super.anchors = new ArrayList<>(); if (anchors != null) { for (int i = 0; i < anchors.length; i++) { if (anchors[i] >= 0) { @@ -133,7 +131,7 @@ public void addAnchor(int queryIndex, int targetIndex) { @Override protected void setProfile(List sx, List sy) { - profile = pair = new SimpleSequencePair(getQuery(), getTarget(), sx, sy); + profile = pair = new SimpleSequencePair<>(getQuery(), getTarget(), sx, sy); } } diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/GuanUberbacher.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/GuanUberbacher.java index 3ff44d8a8c..7e2d739db9 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/GuanUberbacher.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/GuanUberbacher.java @@ -34,7 +34,7 @@ * {@link Compound} of each {@link Sequence}). This class performs such global sequence comparisons efficiently by * dynamic programming with a space requirement reduced from quadratic (a multiple of query sequence length times * target sequence length) to only linear (a multiple of query sequence length). The counterpoint to this reduction in - * space complexity is a modest (a multiple < 2) increase in time. + * space complexity is a modest (a multiple < 2) increase in time. * * @author Mark Chapman * @param each {@link Sequence} of the alignment pair is of type S diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java index b5e6f6188c..1ea2e0de81 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java @@ -46,7 +46,7 @@ * @author Mark Chapman * @author Daniel Cameron * @param each element of the alignment {@link Profile} is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public abstract class AbstractMatrixAligner, C extends Compound> extends AbstractScorer implements MatrixAligner { @@ -55,7 +55,7 @@ public abstract class AbstractMatrixAligner, C extends Com protected GapPenalty gapPenalty; private SubstitutionMatrix subMatrix; private boolean local, storingScoreMatrix; - protected List anchors = new ArrayList(); + protected List anchors = new ArrayList<>(); protected int cutsPerSection; // output fields @@ -312,7 +312,7 @@ protected void align() { } boolean linear = (gapPenalty.getType() == GapPenalty.Type.LINEAR); Last[][][] traceback = new Last[dim[0]][][]; - List sx = new ArrayList(), sy = new ArrayList(); + List sx = new ArrayList<>(), sy = new ArrayList<>(); if (!local) { xyMax = new int[] { dim[0] - 1, dim[1] - 1 }; diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractPairwiseSequenceAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractPairwiseSequenceAligner.java index 8c86470608..699ff77d36 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractPairwiseSequenceAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractPairwiseSequenceAligner.java @@ -37,7 +37,7 @@ * * @author Mark Chapman * @param each {@link Sequence} of the alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public abstract class AbstractPairwiseSequenceAligner, C extends Compound> extends AbstractMatrixAligner implements PairwiseSequenceAligner { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java index 01cba48463..140627de9c 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java @@ -43,7 +43,7 @@ * * @author Mark Chapman * @param each {@link Sequence} in the pair of alignment {@link Profile}s is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public abstract class AbstractProfileProfileAligner, C extends Compound> extends AbstractMatrixAligner implements ProfileProfileAligner { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/Aligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/Aligner.java index 75ec8b4df8..76e735c031 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/Aligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/Aligner.java @@ -32,7 +32,7 @@ * * @author Mark Chapman * @param each element of the alignment {@link Profile} is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public interface Aligner, C extends Compound> extends Scorer { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/CallablePairwiseSequenceAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/CallablePairwiseSequenceAligner.java index e1c4616620..7201513800 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/CallablePairwiseSequenceAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/CallablePairwiseSequenceAligner.java @@ -34,7 +34,7 @@ * * @author Mark Chapman * @param each {@link Sequence} of the alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public class CallablePairwiseSequenceAligner, C extends Compound> implements Callable> { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/CallableProfileProfileAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/CallableProfileProfileAligner.java index 063426a91a..042138f144 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/CallableProfileProfileAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/CallableProfileProfileAligner.java @@ -33,8 +33,8 @@ * Implements a concurrency wrapper for a {@link ProfileProfileAligner}. * * @author Mark Chapman - * @param each {@link Sequence} of the {@link Profile} pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each {@link Sequence} of the profile pair is of type S + * @param each element of a sequence is a {@link Compound} of type C */ public class CallableProfileProfileAligner, C extends Compound> implements Callable> { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/MatrixAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/MatrixAligner.java index 87f9f504ce..dd8e38ceeb 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/MatrixAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/MatrixAligner.java @@ -30,8 +30,8 @@ * Defines an {@link Aligner} which builds a score matrix during computation. * * @author Mark Chapman - * @param each element of the alignment {@link Profile} is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of the alignment profile is of type S + * @param each element of a sequence is a {@link Compound} of type C */ public interface MatrixAligner, C extends Compound> extends Aligner { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PairInProfileScorer.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PairInProfileScorer.java index 094a18bead..4166bcfef4 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PairInProfileScorer.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PairInProfileScorer.java @@ -32,7 +32,7 @@ * * @author Mark Chapman * @param each {@link Sequence} of the alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public interface PairInProfileScorer, C extends Compound> extends PairwiseSequenceScorer { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PairwiseSequenceAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PairwiseSequenceAligner.java index 696ff6ecd8..960c3a527b 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PairwiseSequenceAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PairwiseSequenceAligner.java @@ -32,7 +32,7 @@ * * @author Mark Chapman * @param each {@link Sequence} of the alignment pair is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public interface PairwiseSequenceAligner, C extends Compound> extends Aligner, PairwiseSequenceScorer { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PartitionRefiner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PartitionRefiner.java index 573944b413..124f2ff132 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PartitionRefiner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/PartitionRefiner.java @@ -28,11 +28,11 @@ import org.biojava.nbio.core.sequence.template.Sequence; /** - * Defines an algorithm which computes a new alignment {@link Profile} by splitting a current alignment and realigning. + * Defines an algorithm which computes a new alignment profile by splitting a current alignment and realigning. * * @author Mark Chapman - * @param each element of the alignment {@link Profile} is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of the alignment profile is of type S + * @param each element of a sequence is a {@link Compound} of type C */ public interface PartitionRefiner, C extends Compound> extends Aligner, ProfileProfileScorer { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/ProfileProfileAligner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/ProfileProfileAligner.java index 6df23e0909..1e6fe7cccf 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/ProfileProfileAligner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/ProfileProfileAligner.java @@ -28,11 +28,11 @@ import org.biojava.nbio.core.sequence.template.Sequence; /** - * Defines an {@link Aligner} for a pair of {@link Profile}s. + * Defines an {@link Aligner} for a pair of profiles. * * @author Mark Chapman - * @param each {@link Sequence} in the pair of alignment {@link Profile}s is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each {@link Sequence} in the pair of alignment profiles is of type S + * @param each element of a sequence is a {@link Compound} of type C */ public interface ProfileProfileAligner, C extends Compound> extends Aligner, ProfileProfileScorer { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/ProfileProfileScorer.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/ProfileProfileScorer.java index 1d114841ee..c525b9c75a 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/ProfileProfileScorer.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/ProfileProfileScorer.java @@ -32,7 +32,7 @@ * * @author Mark Chapman * @param each {@link Sequence} in the pair of alignment {@link Profile}s is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of a sequence is a {@link Compound} of type C */ public interface ProfileProfileScorer, C extends Compound> extends Scorer { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/RescoreRefiner.java b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/RescoreRefiner.java index dba02a028c..f93c000380 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/RescoreRefiner.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/RescoreRefiner.java @@ -29,12 +29,12 @@ import org.biojava.nbio.core.sequence.template.Sequence; /** - * Defines an algorithm which computes a new alignment {@link Profile} by rescoring all pairs in an alignment and + * Defines an algorithm which computes a new alignment profile by rescoring all pairs in an alignment and * realigning. * * @author Mark Chapman - * @param each element of the alignment {@link Profile} is of type S - * @param each element of an {@link AlignedSequence} is a {@link Compound} of type C + * @param each element of the alignment profile is of type S + * @param each element of a sequence is a {@link Compound} of type C */ public interface RescoreRefiner, C extends Compound> extends Aligner { diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/phylo/Comparison.java b/biojava-alignment/src/main/java/org/biojava/nbio/phylo/Comparison.java index dc8ead79a7..9cae7734cb 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/phylo/Comparison.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/phylo/Comparison.java @@ -38,9 +38,9 @@ public class Comparison { /** * this is a gapped PID calculation * - * @param s1 + * @param seq1 * SequenceI - * @param s2 + * @param seq2 * SequenceI * @return float */ diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/phylo/DistanceMatrixCalculator.java b/biojava-alignment/src/main/java/org/biojava/nbio/phylo/DistanceMatrixCalculator.java index d0464bae8b..922f301a8c 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/phylo/DistanceMatrixCalculator.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/phylo/DistanceMatrixCalculator.java @@ -54,9 +54,9 @@ private DistanceMatrixCalculator() {} * that differ between two aligned sequences. The percentage of identity * (PID) is the fraction of identical sites between two aligned sequences. * - *
+	 * 
 	 * D = 1 - PID
-	 * 
+ * * * The gapped positons in the alignment are ignored in the calculation. This * method is a wrapper to the forester implementation of the calculation: @@ -65,7 +65,7 @@ private DistanceMatrixCalculator() {} * @param msa * MultipleSequenceAlignment * @return DistanceMatrix - * @throws Exception + * @throws IOException */ public static , D extends Compound> DistanceMatrix fractionalDissimilarity( MultipleSequenceAlignment msa) throws IOException { @@ -81,9 +81,9 @@ public static , D extends Compound> DistanceMatrix fractio * The Poisson (correction) evolutionary distance (d) is a function of the * fractional dissimilarity (D), given by: * - *
+	 * 
 	 * d = -log(1 - D)
-	 * 
+ * * * The gapped positons in the alignment are ignored in the calculation. This * method is a wrapper to the forester implementation of the calculation: @@ -109,14 +109,14 @@ public static , D extends Compound> DistanceMatrix poisson * dissimilarity (D) specially needed for large evolutionary distances. It * is given by: * - *
+	 * 
 	 * d = -log(1 - D - 0.2 * D2)
-	 * 
+ * * * The equation is derived by fitting the relationship between the * evolutionary distance (d) and the fractional dissimilarity (D) according * to the PAM model of evolution (it is an empirical approximation for the - * method {@link #pamDistance(MultipleSequenceAlignment}). The gapped + * method {@link #pamMLdistance(MultipleSequenceAlignment)}). The gapped * positons in the alignment are ignored in the calculation. This method is * a wrapper to the forester implementation of the calculation: * {@link PairwiseDistanceCalculator#calcKimuraDistances(Msa)}. @@ -190,9 +190,9 @@ public static , D extends Compound> DistanceMatrix percent * The fractional dissimilarity score (Ds) is a relative measure of the * dissimilarity between two aligned sequences. It is calculated as: * - *
+	 * 
 	 * Ds = sum( max(M) - Mai,bi ) / (max(M)-min(M)) ) / L
-	 * 
+ * * * Where the sum through i runs for all the alignment positions, ai and bi * are the AA at position i in the first and second aligned sequences, @@ -270,9 +270,9 @@ public static , D extends Compound> DistanceMatrix fractio * maximum similarity score between self-alignments (each sequence against * itself). Calculation of the score is as follows: * - *
+	 * 
 	 * Ds = maxScore - sumi(Mai,bi)
-	 * 
+ * * * It is recommended to use the method * {@link #fractionalDissimilarityScore(MultipleSequenceAlignment, SubstitutionMatrix)} @@ -362,9 +362,9 @@ public static , D extends Compound> DistanceMatrix dissimi * substitution rate of 1% per site. The fractional dissimilarity (D) of two * aligned sequences is related with the PAM distance (d) by the equation: * - *
+	 * 
 	 * D = sum(fi * (1 - Miid))
-	 * 
+ * * * Where the sum is for all 20 AA, fi denotes the natural fraction of the * given AA and M is the substitution matrix (in this case the PAM1 matrix). @@ -373,9 +373,9 @@ public static , D extends Compound> DistanceMatrix dissimi * likelihood (ML) approach is used, which consists in finding d that * maximazies the function: * - *
+	 * 
 	 * L(d) = product(fai * (1 - Mai,bid))
-	 * 
+ * * * Where the product is for every position i in the alignment, and ai and bi * are the AA at position i in the first and second aligned sequences, @@ -400,11 +400,11 @@ public static , D extends Compound> DistanceMatrix pamMLdi * strutures. It is based on the diffusive model for protein fold evolution * (Grishin 1995). The structural deviations are captured as RMS deviations. * - *
+	 * 
 	 * dSij = (rmsdmax2 / alpha2) *
 	 *        ln( (rmsdmax2 - rmsd02) /
 	 *        (rmsdmax2 - (rmsdij2) )
-	 * 
+ * * * @param rmsdMat * RMSD matrix for all structure pairs (symmetric matrix) diff --git a/biojava-alignment/src/main/java/org/biojava/nbio/phylo/ForesterWrapper.java b/biojava-alignment/src/main/java/org/biojava/nbio/phylo/ForesterWrapper.java index 74cdf2e2f4..5ad8b2f2e0 100644 --- a/biojava-alignment/src/main/java/org/biojava/nbio/phylo/ForesterWrapper.java +++ b/biojava-alignment/src/main/java/org/biojava/nbio/phylo/ForesterWrapper.java @@ -64,7 +64,7 @@ public static , D extends Compound> Msa convert( // Convert the biojava MSA to a FASTA String OutputStream os = new ByteArrayOutputStream(); - FastaWriter fastaW = new FastaWriter(os, + FastaWriter fastaW = new FastaWriter<>(os, msa.getAlignedSequences(), new FastaHeaderFormatInterface() { @Override diff --git a/biojava-alignment/src/test/java/org/biojava/nbio/alignment/TestDNAAlignment.java b/biojava-alignment/src/test/java/org/biojava/nbio/alignment/TestDNAAlignment.java index 169babaf04..aeb839747f 100644 --- a/biojava-alignment/src/test/java/org/biojava/nbio/alignment/TestDNAAlignment.java +++ b/biojava-alignment/src/test/java/org/biojava/nbio/alignment/TestDNAAlignment.java @@ -43,6 +43,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; public class TestDNAAlignment { @@ -75,7 +76,7 @@ public void testDNAAlignment() { private static List getDNAFASTAFile() throws Exception { InputStream inStream = TestDNAAlignment.class.getResourceAsStream(String.format("/dna-fasta.txt")); - LinkedHashMap fastas = FastaReaderHelper.readFastaDNASequence(inStream); + Map fastas = FastaReaderHelper.readFastaDNASequence(inStream); List sequences = new ArrayList(); diff --git a/biojava-alignment/src/test/java/org/biojava/nbio/phylo/TestForesterWrapper.java b/biojava-alignment/src/test/java/org/biojava/nbio/phylo/TestForesterWrapper.java index c4fe468852..6f7d749a0a 100644 --- a/biojava-alignment/src/test/java/org/biojava/nbio/phylo/TestForesterWrapper.java +++ b/biojava-alignment/src/test/java/org/biojava/nbio/phylo/TestForesterWrapper.java @@ -24,6 +24,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.LinkedHashMap; +import java.util.Map; import org.biojava.nbio.core.sequence.MultipleSequenceAlignment; import org.biojava.nbio.core.sequence.ProteinSequence; @@ -61,7 +62,7 @@ public void testMSAconversion() throws Exception { new ProteinSequenceCreator(AminoAcidCompoundSet .getAminoAcidCompoundSet())); - LinkedHashMap proteinSequences = fastaReader + Map proteinSequences = fastaReader .process(); inStream.close(); diff --git a/biojava-core/pom.xml b/biojava-core/pom.xml index 0fe122bf49..909f46f088 100644 --- a/biojava-core/pom.xml +++ b/biojava-core/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT 4.0.0 biojava-core @@ -63,7 +63,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j @@ -74,8 +74,8 @@ log4j-core - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api org.glassfish.jaxb diff --git a/biojava-core/src/main/java/demo/DemoSixFrameTranslation.java b/biojava-core/src/main/java/demo/DemoSixFrameTranslation.java index 354e0bea26..57b1560841 100644 --- a/biojava-core/src/main/java/demo/DemoSixFrameTranslation.java +++ b/biojava-core/src/main/java/demo/DemoSixFrameTranslation.java @@ -106,13 +106,13 @@ public static void main(String[] args){ CompoundSet nucleotideCompoundSet = AmbiguityRNACompoundSet.getRNACompoundSet(); FastaReader proxy = - new FastaReader( + new FastaReader<>( stream, new GenericFastaHeaderParser(), new DNASequenceCreator(ambiguityDNACompoundSet)); // has only one entry in this example, but could be easily extended to parse a FASTA file with multiple sequences - LinkedHashMap dnaSequences = proxy.process(); + Map dnaSequences = proxy.process(); // Initialize the Transcription Engine TranscriptionEngine engine = new diff --git a/biojava-core/src/main/java/demo/ParseFastaFileDemo.java b/biojava-core/src/main/java/demo/ParseFastaFileDemo.java index 5951ed3ad6..9ad1bacbb4 100644 --- a/biojava-core/src/main/java/demo/ParseFastaFileDemo.java +++ b/biojava-core/src/main/java/demo/ParseFastaFileDemo.java @@ -24,6 +24,8 @@ import java.io.File; import java.io.InputStream; import java.util.LinkedHashMap; +import java.util.Map; + import org.biojava.nbio.core.sequence.ProteinSequence; import org.biojava.nbio.core.sequence.compound.AminoAcidCompound; import org.biojava.nbio.core.sequence.compound.AminoAcidCompoundSet; @@ -94,12 +96,12 @@ public static void main(String[] args) throws Exception { InputStream inStream = isp.getInputStream(f); - FastaReader fastaReader = new FastaReader( + FastaReader fastaReader = new FastaReader<>( inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); - LinkedHashMap b; + Map b; int nrSeq = 0; diff --git a/biojava-core/src/main/java/demo/UncompressFile.java b/biojava-core/src/main/java/demo/UncompressFile.java index bd36ee5983..7258d6d18b 100644 --- a/biojava-core/src/main/java/demo/UncompressFile.java +++ b/biojava-core/src/main/java/demo/UncompressFile.java @@ -38,7 +38,7 @@ public class UncompressFile { * Reads a file, uncompresses it, and sends the result to stdout. * Also writes trivial statistics to stderr. * @param args An array with one String element, the name of the file to read. - * @throws IOException for any failure + * @throws Exception for any failure */ public static void main(String[] args) throws Exception { 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 8980fdad7b..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 @@ -44,6 +44,7 @@ * * @author Mark Chapman * @param each element of the {@link Sequence} is a {@link Compound} of type C + * @param the sequence type */ public class SimpleAlignedSequence, C extends Compound> implements Serializable, AlignedSequence { @@ -285,7 +286,7 @@ public AccessionID getAccession() { @Override public List getAsList() { - List compounds = new ArrayList(); + List compounds = new ArrayList<>(); for (int i = 1; i <= length; i++) { compounds.add(getCompoundAt(i)); } @@ -382,7 +383,7 @@ public String toString() { // helper method to initialize the location private void setLocation(List steps) { - List sublocations = new ArrayList(); + List sublocations = new ArrayList<>(); int start = 0, step = 0, oStep = numBefore+numAfter, oMax = this.original.getLength(), pStep = 0, pMax = (prev == null) ? 0 : prev.getLength(); boolean inGap = true; @@ -410,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/alignment/SimpleProfile.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleProfile.java index 7cd7ef1bf5..7cfdb7dedc 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleProfile.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleProfile.java @@ -70,11 +70,11 @@ protected SimpleProfile(AlignedSequence query, AlignedSequence targe if (query.getLength() != target.getLength()) { throw new IllegalArgumentException("Aligned sequences differ in size"); } - list = new ArrayList>(); + list = new ArrayList<>(); list.add(query); list.add(target); list = Collections.unmodifiableList(list); - originals = new ArrayList(); + originals = new ArrayList<>(); originals.add(query.getOriginalSequence()); originals.add(target.getOriginalSequence()); originals = Collections.unmodifiableList(originals); @@ -87,14 +87,14 @@ protected SimpleProfile(AlignedSequence query, AlignedSequence targe * @param sequence sequence to seed profile */ public SimpleProfile(S sequence) { - List s = new ArrayList(); + List s = new ArrayList<>(); for (int i = 0; i < sequence.getLength(); i++) { s.add(Step.COMPOUND); } - list = new ArrayList>(); + list = new ArrayList<>(); list.add(new SimpleAlignedSequence(sequence, s)); list = Collections.unmodifiableList(list); - originals = new ArrayList(); + originals = new ArrayList<>(); originals.add(sequence); originals = Collections.unmodifiableList(originals); length = sequence.getLength(); @@ -117,11 +117,11 @@ protected SimpleProfile(S query, S target, List sx, int xb, int xa, List>(); + list = new ArrayList<>(); list.add(new SimpleAlignedSequence(query, sx, xb, xa)); list.add(new SimpleAlignedSequence(target, sy, yb, ya)); list = Collections.unmodifiableList(list); - originals = new ArrayList(); + originals = new ArrayList<>(); originals.add(query); originals.add(target); originals = Collections.unmodifiableList(originals); @@ -141,7 +141,7 @@ protected SimpleProfile(Profile query, Profile target, List sx if (sx.size() != sy.size()) { throw new IllegalArgumentException("Alignments differ in size"); } - list = new ArrayList>(); + list = new ArrayList<>(); for (AlignedSequence s : query) { list.add(new SimpleAlignedSequence(s, sx)); } @@ -149,7 +149,7 @@ protected SimpleProfile(Profile query, Profile target, List sx list.add(new SimpleAlignedSequence(s, sy)); } list = Collections.unmodifiableList(list); - originals = new ArrayList(); + originals = new ArrayList<>(); originals.addAll(query.getOriginalSequences()); originals.addAll(target.getOriginalSequences()); originals = Collections.unmodifiableList(originals); @@ -159,12 +159,12 @@ protected SimpleProfile(Profile query, Profile target, List sx /** * Creates a profile for the already aligned sequences. * @param alignedSequences the already aligned sequences - * @throws IllegalArgument if aligned sequences differ in length or + * @throws IllegalArgumentException if aligned sequences differ in length or * collection is empty. */ public SimpleProfile(Collection> alignedSequences) { - list = new ArrayList>(); - originals = new ArrayList(); + list = new ArrayList<>(); + originals = new ArrayList<>(); Iterator> itr = alignedSequences.iterator(); if(!itr.hasNext()) { @@ -213,7 +213,7 @@ public List> getAlignedSequences() { @Override public List> getAlignedSequences(int... listIndices) { - List> tempList = new ArrayList>(); + List> tempList = new ArrayList<>(); for (int i : listIndices) { tempList.add(getAlignedSequence(i)); } @@ -222,7 +222,7 @@ public List> getAlignedSequences(int... listIndices) { @Override public List> getAlignedSequences(S... sequences) { - List> tempList = new ArrayList>(); + List> tempList = new ArrayList<>(); for (S s : sequences) { tempList.add(getAlignedSequence(s)); } @@ -262,7 +262,7 @@ public int[] getCompoundCountsAt(int alignmentIndex, List compounds) { @Override public List getCompoundsAt(int alignmentIndex) { // TODO handle circular alignments - List column = new ArrayList(); + List column = new ArrayList<>(); for (AlignedSequence s : list) { column.add(s.getCompoundAt(alignmentIndex)); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/AAIndexFileParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/AAIndexFileParser.java index 843014c685..606b913e59 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/AAIndexFileParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/AAIndexFileParser.java @@ -52,7 +52,7 @@ public class AAIndexFileParser { boolean symmetricMatrix ; public AAIndexFileParser(){ - matrices = new HashMap>(); + matrices = new HashMap<>(); } /** Parse an inputStream that points to an AAINDEX database file @@ -107,7 +107,7 @@ private void processScores(String line) { } // special case: MEHP950101 - if (values[i].equals("-")) { + if ("-".equals(values[i])) { values[i] = "0"; } if ( scale == -1 ) { @@ -154,8 +154,8 @@ private void initMatrix(String line) { matrix = new short[nrRows][nrCols]; - rows = new ArrayList(); - cols = new ArrayList(); + rows = new ArrayList<>(); + cols = new ArrayList<>(); //System.out.println(">" + currentRows+"<"); AminoAcidCompoundSet compoundSet = AminoAcidCompoundSet.getAminoAcidCompoundSet(); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/ScaledSubstitutionMatrix.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/ScaledSubstitutionMatrix.java index ee26384bfa..9d18d50b36 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/ScaledSubstitutionMatrix.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/ScaledSubstitutionMatrix.java @@ -216,7 +216,7 @@ public SubstitutionMatrix normalizeMatrix(short scale) { @Override public Map getRow(AminoAcidCompound row) { int rowIndex = rows.indexOf(row); - Map map = new HashMap(); + Map map = new HashMap<>(); for (int colIndex = 0; colIndex < matrix[rowIndex].length; colIndex++) { map.put(cols.get(colIndex), matrix[rowIndex][colIndex]); } @@ -226,7 +226,7 @@ public Map getRow(AminoAcidCompound row) { @Override public Map getColumn(AminoAcidCompound column) { int colIndex = cols.indexOf(column); - Map map = new HashMap(); + Map map = new HashMap<>(); for (int i = 0; i < matrix.length; i++) { map.put(rows.get(i), matrix[i][colIndex]); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SimpleSubstitutionMatrix.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SimpleSubstitutionMatrix.java index 8eb897219e..9da982dbf1 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SimpleSubstitutionMatrix.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SimpleSubstitutionMatrix.java @@ -57,7 +57,7 @@ public class SimpleSubstitutionMatrix implements Substitutio private List rows, cols; public static SubstitutionMatrix getBlosum62() { - return new SimpleSubstitutionMatrix(AminoAcidCompoundSet.getAminoAcidCompoundSet(), new InputStreamReader( + return new SimpleSubstitutionMatrix<>(AminoAcidCompoundSet.getAminoAcidCompoundSet(), new InputStreamReader( SimpleSubstitutionMatrix.class.getResourceAsStream("/matrices/blosum62.txt")), "blosum62"); } @@ -126,10 +126,10 @@ private SimpleSubstitutionMatrix(CompoundSet compoundSet, Scanner input, Stri this.name = name; max = Short.MIN_VALUE; min = Short.MAX_VALUE; - rows = new ArrayList(); - cols = new ArrayList(); + rows = new ArrayList<>(); + cols = new ArrayList<>(); StringBuilder descriptionIn = new StringBuilder(); - List matrixIn = new ArrayList(); + List matrixIn = new ArrayList<>(); while(input.hasNextLine()) { String line = input.nextLine(); if (line.startsWith(comment)) { @@ -288,7 +288,7 @@ public String toString() { @Override public Map getRow(C row) { int rowIndex = rows.indexOf(row); - Map map = new HashMap(); + Map map = new HashMap<>(); for (int colIndex = 0; colIndex < matrix[rowIndex].length; colIndex++) { map.put(cols.get(colIndex), matrix[rowIndex][colIndex]); } @@ -298,7 +298,7 @@ public Map getRow(C row) { @Override public Map getColumn(C column) { int colIndex = cols.indexOf(column); - Map map = new HashMap(); + Map map = new HashMap<>(); for (int i = 0; i < matrix.length; i++) { map.put(rows.get(i), matrix[i][colIndex]); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java index ca93b1818f..ab737b536e 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java @@ -50,9 +50,9 @@ public class SubstitutionMatrixHelper implements Serializable { private static final long serialVersionUID = 148491724604653225L; private static Map> aminoAcidMatrices = - new HashMap>(); + new HashMap<>(); private static Map> nucleotideMatrices = - new HashMap>(); + new HashMap<>(); // prevents instantiation private SubstitutionMatrixHelper() { } @@ -78,7 +78,7 @@ public static SubstitutionMatrix getIdentity() { } /** - * Returns Blosum 100 matrix by Henikoff & Henikoff + * Returns Blosum 100 matrix by Henikoff & Henikoff * @return Blosum 100 matrix */ public static SubstitutionMatrix getBlosum100() { @@ -86,7 +86,7 @@ public static SubstitutionMatrix getBlosum100() { } /** - * Returns Blosum 30 matrix by Henikoff & Henikoff + * Returns Blosum 30 matrix by Henikoff & Henikoff * @return Blosum 30 matrix */ public static SubstitutionMatrix getBlosum30() { @@ -94,7 +94,7 @@ public static SubstitutionMatrix getBlosum30() { } /** - * Returns Blosum 35 matrix by Henikoff & Henikoff + * Returns Blosum 35 matrix by Henikoff & Henikoff * @return Blosum 35 matrix */ public static SubstitutionMatrix getBlosum35() { @@ -102,7 +102,7 @@ public static SubstitutionMatrix getBlosum35() { } /** - * Returns Blosum 40 matrix by Henikoff & Henikoff + * Returns Blosum 40 matrix by Henikoff & Henikoff * @return Blosum 40 matrix */ public static SubstitutionMatrix getBlosum40() { @@ -110,7 +110,7 @@ public static SubstitutionMatrix getBlosum40() { } /** - * Returns Blosum 45 matrix by Henikoff & Henikoff + * Returns Blosum 45 matrix by Henikoff & Henikoff * @return Blosum 45 matrix */ public static SubstitutionMatrix getBlosum45() { @@ -118,7 +118,7 @@ public static SubstitutionMatrix getBlosum45() { } /** - * Returns Blosum 50 matrix by Henikoff & Henikoff + * Returns Blosum 50 matrix by Henikoff & Henikoff * @return Blosum 50 matrix */ public static SubstitutionMatrix getBlosum50() { @@ -126,7 +126,7 @@ public static SubstitutionMatrix getBlosum50() { } /** - * Returns Blosum 55 matrix by Henikoff & Henikoff + * Returns Blosum 55 matrix by Henikoff & Henikoff * @return Blosum 55 matrix */ public static SubstitutionMatrix getBlosum55() { @@ -134,7 +134,7 @@ public static SubstitutionMatrix getBlosum55() { } /** - * Returns Blosum 60 matrix by Henikoff & Henikoff + * Returns Blosum 60 matrix by Henikoff & Henikoff * @return Blosum 60 matrix */ public static SubstitutionMatrix getBlosum60() { @@ -142,7 +142,7 @@ public static SubstitutionMatrix getBlosum60() { } /** - * Returns Blosum 62 matrix by Henikoff & Henikoff + * Returns Blosum 62 matrix by Henikoff & Henikoff * @return Blosum 62 matrix */ public static SubstitutionMatrix getBlosum62() { @@ -150,7 +150,7 @@ public static SubstitutionMatrix getBlosum62() { } /** - * Returns Blosum 65 matrix by Henikoff & Henikoff + * Returns Blosum 65 matrix by Henikoff & Henikoff * @return Blosum 65 matrix */ public static SubstitutionMatrix getBlosum65() { @@ -158,7 +158,7 @@ public static SubstitutionMatrix getBlosum65() { } /** - * Returns Blosum 70 matrix by Henikoff & Henikoff + * Returns Blosum 70 matrix by Henikoff & Henikoff * @return Blosum 70 matrix */ public static SubstitutionMatrix getBlosum70() { @@ -166,7 +166,7 @@ public static SubstitutionMatrix getBlosum70() { } /** - * Returns Blosum 75 matrix by Henikoff & Henikoff + * Returns Blosum 75 matrix by Henikoff & Henikoff * @return Blosum 75 matrix */ public static SubstitutionMatrix getBlosum75() { @@ -174,7 +174,7 @@ public static SubstitutionMatrix getBlosum75() { } /** - * Returns Blosum 80 matrix by Henikoff & Henikoff + * Returns Blosum 80 matrix by Henikoff & Henikoff * @return Blosum 80 matrix */ public static SubstitutionMatrix getBlosum80() { @@ -182,7 +182,7 @@ public static SubstitutionMatrix getBlosum80() { } /** - * Returns Blosum 85 matrix by Henikoff & Henikoff + * Returns Blosum 85 matrix by Henikoff & Henikoff * @return Blosum 85 matrix */ public static SubstitutionMatrix getBlosum85() { @@ -190,7 +190,7 @@ public static SubstitutionMatrix getBlosum85() { } /** - * Returns Blosum 90 matrix by Henikoff & Henikoff + * Returns Blosum 90 matrix by Henikoff & Henikoff * @return Blosum 90 matrix */ public static SubstitutionMatrix getBlosum90() { @@ -198,7 +198,7 @@ public static SubstitutionMatrix getBlosum90() { } /** - * Returns PAM 250 matrix by Gonnet, Cohen & Benner + * Returns PAM 250 matrix by Gonnet, Cohen & Benner * @return Gonnet 250 matrix */ public static SubstitutionMatrix getGonnet250() { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/AlignedSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/AlignedSequence.java index bc64496810..cbb959fd25 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/AlignedSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/AlignedSequence.java @@ -34,11 +34,12 @@ * @author Mark Chapman * @author Paolo Pavan * @param each element of the {@link Sequence} is a {@link Compound} of type C + * @param the sequence type */ public interface AlignedSequence, C extends Compound> extends Sequence { /** - * Defines an alignment step in order to pass alignment information from an {@link Aligner} to a constructor. + * Defines an alignment step in order to pass alignment information from an Aligner to a constructor. */ enum Step { COMPOUND, GAP } @@ -65,7 +66,7 @@ enum Step { COMPOUND, GAP } * * @param sequenceIndex index in the original {@link Sequence} * @return column index within an alignment - * @throws IndexOutOfBoundsException if sequenceIndex < 1 or sequenceIndex > + * @throws IndexOutOfBoundsException if sequenceIndex < 1 or sequenceIndex > * {@link #getOriginalSequence()}.{@link #getLength()} */ int getAlignmentIndexAt(int sequenceIndex); @@ -130,7 +131,7 @@ enum Step { COMPOUND, GAP } * * @param alignmentIndex column index within an alignment * @return index in the original {@link Sequence} - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ int getSequenceIndexAt(int alignmentIndex); @@ -154,7 +155,7 @@ enum Step { COMPOUND, GAP } * * @param alignmentIndex column index within an alignment * @return true if this column has a gap - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ boolean isGap(int alignmentIndex); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/MutableAlignedSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/MutableAlignedSequence.java index cfe85f7d33..edef1d54b7 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/MutableAlignedSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/MutableAlignedSequence.java @@ -34,6 +34,7 @@ * @author Mark Chapman * @author Paolo Pavan * @param each element of the {@link AlignedSequence} is a {@link Compound} of type C + * @param the sequence type */ public interface MutableAlignedSequence, C extends Compound> extends AlignedSequence { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/Profile.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/Profile.java index 811de73b31..62575a1bf2 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/Profile.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/Profile.java @@ -58,7 +58,7 @@ enum StringFormat { * * @param listIndex index of sequence in profile * @return desired sequence - * @throws IndexOutOfBoundsException if listIndex < 1 or listIndex > number of sequences + * @throws IndexOutOfBoundsException if listIndex < 1 or listIndex > number of sequences */ AlignedSequence getAlignedSequence(int listIndex); @@ -101,8 +101,8 @@ enum StringFormat { * @param listIndex index of sequence in profile * @param alignmentIndex column index within an alignment * @return the sequence element - * @throws IndexOutOfBoundsException if listIndex < 1, listIndex > number of sequences, alignmentIndex < 1, or - * alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if listIndex < 1, listIndex > number of sequences, alignmentIndex < 1, or + * alignmentIndex > {@link #getLength()} */ C getCompoundAt(int listIndex, int alignmentIndex); @@ -113,7 +113,7 @@ enum StringFormat { * @param sequence either an {@link AlignedSequence} or an original {@link Sequence} * @param alignmentIndex column index within an alignment * @return the sequence element - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ C getCompoundAt(S sequence, int alignmentIndex); @@ -122,7 +122,7 @@ enum StringFormat { * * @param alignmentIndex column index within an alignment * @return list of counts - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ int[] getCompoundCountsAt(int alignmentIndex); @@ -132,7 +132,7 @@ enum StringFormat { * @param alignmentIndex column index within an alignment * @param compounds list of compounds to count * @return corresponding list of counts - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ int[] getCompoundCountsAt(int alignmentIndex, List compounds); @@ -141,7 +141,7 @@ enum StringFormat { * * @param alignmentIndex column index within an alignment * @return the sequence elements - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ List getCompoundsAt(int alignmentIndex); @@ -157,7 +157,7 @@ enum StringFormat { * * @param alignmentIndex column index within an alignment * @return list of fractional weights - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ float[] getCompoundWeightsAt(int alignmentIndex); @@ -167,7 +167,7 @@ enum StringFormat { * @param alignmentIndex column index within an alignment * @param compounds list of compounds to count * @return corresponding list of fractional weights - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ float[] getCompoundWeightsAt(int alignmentIndex, List compounds); @@ -177,7 +177,7 @@ enum StringFormat { * * @param alignmentIndex column index within an alignment * @return the sequence indices - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ int[] getIndicesAt(int alignmentIndex); @@ -236,7 +236,7 @@ enum StringFormat { * * @param alignmentIndex column index within an alignment * @return true if any {@link AlignedSequence} has a gap at the given index - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ boolean hasGap(int alignmentIndex); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/SequencePair.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/SequencePair.java index 24f2315e00..1367fb6be9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/SequencePair.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/SequencePair.java @@ -41,7 +41,7 @@ public interface SequencePair, C extends Compound> extends * * @param alignmentIndex column index in alignment * @return the query sequence element - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ C getCompoundInQueryAt(int alignmentIndex); @@ -50,7 +50,7 @@ public interface SequencePair, C extends Compound> extends * * @param alignmentIndex column index in alignment * @return the target sequence element - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ C getCompoundInTargetAt(int alignmentIndex); @@ -59,7 +59,7 @@ public interface SequencePair, C extends Compound> extends * * @param alignmentIndex column index in alignment * @return index in query {@link Sequence} - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ int getIndexInQueryAt(int alignmentIndex); @@ -68,7 +68,7 @@ public interface SequencePair, C extends Compound> extends * * @param targetIndex index in target {@link Sequence} * @return index in query {@link Sequence} - * @throws IndexOutOfBoundsException if targetIndex < 1 or targetIndex > {@link #getTarget()}.getLength() + * @throws IndexOutOfBoundsException if targetIndex < 1 or targetIndex > {@link #getTarget()}.getLength() */ int getIndexInQueryForTargetAt(int targetIndex); @@ -77,7 +77,7 @@ public interface SequencePair, C extends Compound> extends * * @param alignmentIndex column index in alignment * @return index in target {@link Sequence} - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ int getIndexInTargetAt(int alignmentIndex); @@ -86,7 +86,7 @@ public interface SequencePair, C extends Compound> extends * * @param queryIndex index in query {@link Sequence} * @return index in target {@link Sequence} - * @throws IndexOutOfBoundsException if queryIndex < 1 or queryIndex > {@link #getQuery()}.getLength() + * @throws IndexOutOfBoundsException if queryIndex < 1 or queryIndex > {@link #getQuery()}.getLength() */ int getIndexInTargetForQueryAt(int queryIndex); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/SubstitutionMatrix.java b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/SubstitutionMatrix.java index 22a8de5f5c..436fc7a44b 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/SubstitutionMatrix.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/alignment/template/SubstitutionMatrix.java @@ -103,7 +103,7 @@ public interface SubstitutionMatrix { * Rescales the matrix so that to {@link #getMaxValue()} - {@link #getMinValue()} = scale. * * @param scale new normalization scale of this matrix - * @throws IllegalArgumentException if scale < 1 + * @throws IllegalArgumentException if scale < 1 */ SubstitutionMatrix normalizeMatrix(short scale); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/exceptions/ParserException.java b/biojava-core/src/main/java/org/biojava/nbio/core/exceptions/ParserException.java index acd8cc47fb..5afaa7c412 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/exceptions/ParserException.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/exceptions/ParserException.java @@ -23,7 +23,7 @@ */ /** * General abstraction of different parsing errors - * @author Scooter Willis + * @author Scooter Willis */ public class ParserException extends RuntimeException { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/Hsp.java b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/Hsp.java index 8245c635c3..832997bb2b 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/Hsp.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/Hsp.java @@ -40,15 +40,16 @@ /** * This class models a search Hsp. * You will retrieve a list of this using iterator of a Hit - * + *

* Designed by Paolo Pavan. * You may want to find my contacts on Github and LinkedIn for code info * or discuss major changes. * https://github.com/paolopavan * * @author Paolo Pavan + * @param the compound type + * @param the sequence type */ - public abstract class Hsp , C extends Compound> { private static final Logger logger = LoggerFactory.getLogger(Hsp.class); private Integer hspNum; @@ -120,7 +121,7 @@ public SequencePair getAlignment(){ alignedQuery = new SimpleAlignedSequence(getSequence(hspQseq), getAlignmentsSteps(hspQseq)); alignedHit = new SimpleAlignedSequence(getSequence(hspHseq), getAlignmentsSteps(hspHseq)); - returnAln = new SimpleSequencePair(alignedQuery, alignedHit); + returnAln = new SimpleSequencePair<>(alignedQuery, alignedHit); return returnAln; } @@ -145,7 +146,7 @@ else if (sequenceString.matches("^[ACUG]+$")) } private List getAlignmentsSteps(String gappedSequenceString){ - List returnList = new ArrayList(); + List returnList = new ArrayList<>(); for (char c: gappedSequenceString.toCharArray()){ if (c=='-') returnList.add(Step.GAP); else returnList.add(Step.COMPOUND); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/Result.java b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/Result.java index aa1b432b57..bebdfea5ff 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/Result.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/Result.java @@ -27,6 +27,7 @@ import java.util.NoSuchElementException; import org.biojava.nbio.core.sequence.template.Sequence; +import java.util.Map; /** * This class models a search result. @@ -46,7 +47,7 @@ public abstract class Result implements Iterable{ private String reference; private String dbFile; - private HashMap programSpecificParameters; + private Map programSpecificParameters; private int iterationNumber; private String queryID; @@ -56,7 +57,7 @@ public abstract class Result implements Iterable{ private List hits; private int hitCounter = -1; - public Result(String program, String version, String reference, String dbFile, HashMap programSpecificParameters, int iterationNumber, String queryID, String queryDef, int queryLength, List hits, Sequence querySequence) { + public Result(String program, String version, String reference, String dbFile, Map programSpecificParameters, int iterationNumber, String queryID, String queryDef, int queryLength, List hits, Sequence querySequence) { this.program = program; this.version = version; this.reference = reference; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/ResultFactory.java b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/ResultFactory.java index 479df1ac4d..d9279b8cce 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/ResultFactory.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/ResultFactory.java @@ -34,7 +34,6 @@ * * @author Paolo Pavan */ - public interface ResultFactory { /** * returns a list of file extensions associated to this ResultFactory @@ -49,7 +48,8 @@ public interface ResultFactory { * * @param maxEScore * @return - * @throws Exception + * @throws IOException + * @throws ParseException */ List createObjects(double maxEScore) throws IOException, ParseException; /** @@ -57,7 +57,8 @@ public interface ResultFactory { * to a file in the same format that it is able to read. * * @param results - * @throws Exception + * @throws IOException + * @throws ParseException */ void storeObjects(List results) throws IOException, ParseException; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/SearchIO.java b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/SearchIO.java index 52654720d9..e864068afd 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/SearchIO.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/SearchIO.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.ServiceLoader; import java.util.NoSuchElementException; +import java.util.Map; /** * Designed by Paolo Pavan. @@ -39,7 +40,7 @@ */ public class SearchIO implements Iterable{ - static private HashMap extensionFactoryAssociation; + static private Map extensionFactoryAssociation; final private ResultFactory factory; final private File file; @@ -63,7 +64,6 @@ public class SearchIO implements Iterable{ * file extension. * * @param f - * @throws Exception */ public SearchIO (File f) throws IOException, ParseException{ factory = guessFactory(f); @@ -140,7 +140,7 @@ public void writeResults() throws IOException, ParseException { */ private ResultFactory guessFactory(File f){ if (extensionFactoryAssociation == null){ - extensionFactoryAssociation = new HashMap(); + extensionFactoryAssociation = new HashMap<>(); ServiceLoader impl = ServiceLoader.load(ResultFactory.class); for (ResultFactory loadedImpl : impl) { List fileExtensions = loadedImpl.getFileExtensions(); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastResult.java b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastResult.java index bcacdde20d..9410becea0 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastResult.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastResult.java @@ -25,6 +25,7 @@ import java.util.HashMap; import java.util.List; import org.biojava.nbio.core.sequence.template.Sequence; +import java.util.Map; /** * This class models a Blast/Blast plus result. @@ -39,7 +40,7 @@ * */ public class BlastResult extends Result{ - public BlastResult(String program, String version, String reference, String dbFile, HashMap programSpecificParameters, int iterationNumber, String queryID, String queryDef, int queryLength, List hits, Sequence querySequence) { + public BlastResult(String program, String version, String reference, String dbFile, Map programSpecificParameters, int iterationNumber, String queryID, String queryDef, int queryLength, List hits, Sequence querySequence) { super(program, version, reference, dbFile, programSpecificParameters, iterationNumber, queryID, queryDef, queryLength, hits, querySequence); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastResultBuilder.java b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastResultBuilder.java index 8d7e06a89e..5c26f4b63a 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastResultBuilder.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastResultBuilder.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.List; import org.biojava.nbio.core.sequence.template.Sequence; +import java.util.Map; /** * Designed by Paolo Pavan. @@ -39,7 +40,7 @@ public class BlastResultBuilder { private String version; private String reference; private String dbFile; - private HashMap programSpecificParameters; + private Map programSpecificParameters; private int iterationNumber; private String queryID; private String queryDef; @@ -70,7 +71,7 @@ public BlastResultBuilder setDbFile(String dbFile) { return this; } - public BlastResultBuilder setProgramSpecificParameters(HashMap programSpecificParameters) { + public BlastResultBuilder setProgramSpecificParameters(Map programSpecificParameters) { this.programSpecificParameters = programSpecificParameters; return this; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastTabularParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastTabularParser.java index 410fad0fce..03c4b6ba64 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastTabularParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastTabularParser.java @@ -37,6 +37,7 @@ import org.biojava.nbio.core.sequence.template.Sequence; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Map; /** * Designed by Paolo Pavan. @@ -71,7 +72,7 @@ private enum PARSING_CONSISTENCY { // data imported private: int queryIdNumber = 0; - HashMap queryIdMapping = new HashMap(); + Map queryIdMapping = new HashMap<>(); String programName=null, queryName = null, databaseFile = null; private String queryId ; private String subjectId ; @@ -89,7 +90,7 @@ private enum PARSING_CONSISTENCY { @Override public List getFileExtensions() { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add("blasttabular"); l.add("blasttxt"); return l; @@ -102,7 +103,7 @@ public void setFile(File f) { @Override public List createObjects(double maxEScore) throws IOException, ParseException { - List results = new ArrayList(); + List results = new ArrayList<>(); log.info("Query for hits"); LineNumberReader lnr = new LineNumberReader(new FileReader(targetFile)); @@ -126,33 +127,33 @@ public List createObjects(double maxEScore) throws IOException, ParseExc .setQueryDef(queryName) .setReference(blastReference); - List hits = new ArrayList(); + List hits = new ArrayList<>(); String currentQueryId = queryId; while (currentQueryId.equals(queryId) && lineNumber < fileLinesCount){ BlastHitBuilder hitBuilder = new BlastHitBuilder(); - List hsps = new ArrayList(); + List hsps = new ArrayList<>(); String currentSubjectId=subjectId; while (currentSubjectId.equals(subjectId) && lineNumber < fileLinesCount){ - if (new Double(evalue) > maxEScore) { + if (Double.valueOf(evalue) > maxEScore) { line = fetchData(scanner); lineNumber++; continue; } BlastHspBuilder hspBuilder = new BlastHspBuilder(); hspBuilder - .setHspAlignLen(new Integer(alnLength)) - .setHspGaps(new Integer(gapOpenCount)) - .setHspQueryFrom(new Integer(queryStart)) - .setHspQueryTo(new Integer(queryEnd)) - .setHspHitFrom(new Integer(subjectStart)) - .setHspHitTo(new Integer(subjectEnd)) - .setHspEvalue(new Double(evalue)) - .setHspBitScore(new Double(bitScore)) - .setPercentageIdentity(new Double(percIdentity)/100) - .setMismatchCount(new Integer(mismatchCount)); + .setHspAlignLen(Integer.valueOf(alnLength)) + .setHspGaps(Integer.valueOf(gapOpenCount)) + .setHspQueryFrom(Integer.valueOf(queryStart)) + .setHspQueryTo(Integer.valueOf(queryEnd)) + .setHspHitFrom(Integer.valueOf(subjectStart)) + .setHspHitTo(Integer.valueOf(subjectEnd)) + .setHspEvalue(Double.valueOf(evalue)) + .setHspBitScore(Double.valueOf(bitScore)) + .setPercentageIdentity(Double.valueOf(percIdentity)/100) + .setMismatchCount(Integer.valueOf(mismatchCount)); hsps.add(hspBuilder.createBlastHsp()); if (scanner.hasNext()) line = fetchData(scanner); lineNumber++; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastXMLParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastXMLParser.java index 1b30639b80..5ccd89f459 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastXMLParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/search/io/blast/BlastXMLParser.java @@ -43,7 +43,7 @@ /** * Re-designed by Paolo Pavan on the footprint of: - * org.biojava.nbio.genome.query.BlastXMLQuery by Scooter Willis + * org.biojava.nbio.genome.query.BlastXMLQuery by Scooter Willis * * You may want to find my contacts on Github and LinkedIn for code info * or discuss major changes. @@ -90,9 +90,9 @@ public List createObjects(double maxEScore) throws IOException, ParseExc // create mappings between sequences and blast id mapIds(); - ArrayList resultsCollection; - ArrayList hitsCollection; - ArrayList hspsCollection; + List resultsCollection; + List hitsCollection; + List hspsCollection; try { // select top level elements @@ -102,10 +102,10 @@ public List createObjects(double maxEScore) throws IOException, ParseExc String dbFile = XMLHelper.selectSingleElement(blastDoc.getDocumentElement(),"BlastOutput_db").getTextContent(); logger.info("Query for hits in "+ targetFile); - ArrayList IterationsList = XMLHelper.selectElements(blastDoc.getDocumentElement(), "BlastOutput_iterations/Iteration[Iteration_hits]"); + List IterationsList = XMLHelper.selectElements(blastDoc.getDocumentElement(), "BlastOutput_iterations/Iteration[Iteration_hits]"); logger.info(IterationsList.size() + " results"); - resultsCollection = new ArrayList(); + resultsCollection = new ArrayList<>(); for (Element element : IterationsList) { BlastResultBuilder resultBuilder = new BlastResultBuilder(); // will add BlastOutput* key sections in the result object @@ -117,10 +117,10 @@ public List createObjects(double maxEScore) throws IOException, ParseExc // Iteration* section keys: resultBuilder - .setIterationNumber(new Integer(XMLHelper.selectSingleElement(element,"Iteration_iter-num").getTextContent())) + .setIterationNumber(Integer.valueOf(XMLHelper.selectSingleElement(element,"Iteration_iter-num").getTextContent())) .setQueryID(XMLHelper.selectSingleElement(element,"Iteration_query-ID").getTextContent()) .setQueryDef(XMLHelper.selectSingleElement(element, "Iteration_query-def").getTextContent()) - .setQueryLength(new Integer(XMLHelper.selectSingleElement(element,"Iteration_query-len").getTextContent())); + .setQueryLength(Integer.valueOf(XMLHelper.selectSingleElement(element,"Iteration_query-len").getTextContent())); if (queryReferences != null) resultBuilder.setQuerySequence(queryReferencesMap.get( XMLHelper.selectSingleElement(element,"Iteration_query-ID").getTextContent() @@ -129,47 +129,47 @@ public List createObjects(double maxEScore) throws IOException, ParseExc Element iterationHitsElement = XMLHelper.selectSingleElement(element, "Iteration_hits"); - ArrayList hitList = XMLHelper.selectElements(iterationHitsElement, "Hit"); + List hitList = XMLHelper.selectElements(iterationHitsElement, "Hit"); - hitsCollection = new ArrayList(); + hitsCollection = new ArrayList<>(); for (Element hitElement : hitList) { BlastHitBuilder blastHitBuilder = new BlastHitBuilder(); blastHitBuilder - .setHitNum(new Integer(XMLHelper.selectSingleElement(hitElement, "Hit_num").getTextContent())) + .setHitNum(Integer.valueOf(XMLHelper.selectSingleElement(hitElement, "Hit_num").getTextContent())) .setHitId(XMLHelper.selectSingleElement(hitElement, "Hit_id").getTextContent()) .setHitDef(XMLHelper.selectSingleElement(hitElement, "Hit_def").getTextContent()) .setHitAccession(XMLHelper.selectSingleElement(hitElement, "Hit_accession").getTextContent()) - .setHitLen(new Integer(XMLHelper.selectSingleElement(hitElement, "Hit_len").getTextContent())); + .setHitLen(Integer.valueOf(XMLHelper.selectSingleElement(hitElement, "Hit_len").getTextContent())); if (databaseReferences != null) blastHitBuilder.setHitSequence(databaseReferencesMap.get( XMLHelper.selectSingleElement(hitElement, "Hit_id").getTextContent() )); Element hithspsElement = XMLHelper.selectSingleElement(hitElement, "Hit_hsps"); - ArrayList hspList = XMLHelper.selectElements(hithspsElement, "Hsp"); + List hspList = XMLHelper.selectElements(hithspsElement, "Hsp"); - hspsCollection = new ArrayList(); + hspsCollection = new ArrayList<>(); for (Element hspElement : hspList) { - Double evalue = new Double(XMLHelper.selectSingleElement(hspElement, "Hsp_evalue").getTextContent()); + Double evalue = Double.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_evalue").getTextContent()); // add the new hsp only if it pass the specified threshold. It can save lot of memory and some parsing time if (evalue <= maxEScore) { BlastHspBuilder blastHspBuilder = new BlastHspBuilder(); blastHspBuilder - .setHspNum(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_num").getTextContent())) - .setHspBitScore(new Double(XMLHelper.selectSingleElement(hspElement, "Hsp_bit-score").getTextContent())) - .setHspScore(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_score").getTextContent())) + .setHspNum(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_num").getTextContent())) + .setHspBitScore(Double.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_bit-score").getTextContent())) + .setHspScore(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_score").getTextContent())) .setHspEvalue(evalue) - .setHspQueryFrom(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_query-from").getTextContent())) - .setHspQueryTo(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_query-to").getTextContent())) - .setHspHitFrom(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_hit-from").getTextContent())) - .setHspHitTo(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_hit-to").getTextContent())) - .setHspQueryFrame(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_query-frame").getTextContent())) - .setHspHitFrame(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_hit-frame").getTextContent())) - .setHspIdentity(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_identity").getTextContent())) - .setHspPositive(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_positive").getTextContent())) - .setHspGaps(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_gaps").getTextContent())) - .setHspAlignLen(new Integer(XMLHelper.selectSingleElement(hspElement, "Hsp_align-len").getTextContent())) + .setHspQueryFrom(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_query-from").getTextContent())) + .setHspQueryTo(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_query-to").getTextContent())) + .setHspHitFrom(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_hit-from").getTextContent())) + .setHspHitTo(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_hit-to").getTextContent())) + .setHspQueryFrame(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_query-frame").getTextContent())) + .setHspHitFrame(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_hit-frame").getTextContent())) + .setHspIdentity(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_identity").getTextContent())) + .setHspPositive(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_positive").getTextContent())) + .setHspGaps(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_gaps").getTextContent())) + .setHspAlignLen(Integer.valueOf(XMLHelper.selectSingleElement(hspElement, "Hsp_align-len").getTextContent())) .setHspQseq(XMLHelper.selectSingleElement(hspElement, "Hsp_qseq").getTextContent()) .setHspHseq(XMLHelper.selectSingleElement(hspElement, "Hsp_hseq").getTextContent()) .setHspIdentityString(XMLHelper.selectSingleElement(hspElement, "Hsp_midline").getTextContent()); @@ -195,7 +195,7 @@ public List createObjects(double maxEScore) throws IOException, ParseExc @Override public List getFileExtensions(){ - ArrayList extensions = new ArrayList(1); + List extensions = new ArrayList<>(1); extensions.add("blastxml"); return extensions; } @@ -215,7 +215,7 @@ public void setDatabaseReferences(List sequences) { */ private void mapIds() { if (queryReferences != null) { - queryReferencesMap = new HashMap(queryReferences.size()); + queryReferencesMap = new HashMap<>(queryReferences.size()); for (int counter=0; counter < queryReferences.size() ; counter ++){ String id = "Query_"+(counter+1); queryReferencesMap.put(id, queryReferences.get(counter)); @@ -223,7 +223,7 @@ private void mapIds() { } if (databaseReferences != null) { - databaseReferencesMap = new HashMap(databaseReferences.size()); + databaseReferencesMap = new HashMap<>(databaseReferences.size()); for (int counter=0; counter < databaseReferences.size() ; counter ++){ // this is strange: while Query_id are 1 based, Hit (database) id are 0 based String id = "gnl|BL_ORD_ID|"+(counter); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java index 8acb7a7e83..0342ec7a46 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java @@ -18,7 +18,7 @@ * http://www.biojava.org/ * * Created on 3/1/2010 - * @author Scooter Willis + * @author Scooter Willis */ package org.biojava.nbio.core.sequence; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSSequence.java index f897622f3c..2fbd638b82 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSSequence.java @@ -32,7 +32,7 @@ * Represents a exon or coding sequence in a gene. It has a parent {@link TranscriptSequence} * where a TranscriptSequence is the child of a GeneSequence * Not important for protein construction but the phase is used if outputting the gene - * to a gff3 file. {@link http://www.sequenceontology.org/gff3.shtml} + * to a gff3 file. http://www.sequenceontology.org/gff3.shtml * @author Scooter Willis */ public class CDSSequence extends DNASequence { @@ -90,8 +90,8 @@ public Strand getStrand() { * A CDS sequence if negative stranded needs to be reverse complement * to represent the actual coding sequence. When getting a ProteinSequence * from a TranscriptSequence this method is callled for each CDSSequence - * {@link http://www.sequenceontology.org/gff3.shtml} - * {@link http://biowiki.org/~yam/bioe131/GFF.ppt} + * http://www.sequenceontology.org/gff3.shtml + * http://biowiki.org/~yam/bioe131/GFF.ppt * @return coding sequence */ public String getCodingSequence() { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ChromosomeSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ChromosomeSequence.java index 8b16c66472..4a7e1ec575 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ChromosomeSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ChromosomeSequence.java @@ -29,6 +29,7 @@ import org.biojava.nbio.core.sequence.template.SequenceReader; import java.util.LinkedHashMap; +import java.util.Map; /** * A ChromosomeSequence is a DNASequence but keeps track of geneSequences @@ -37,7 +38,7 @@ public class ChromosomeSequence extends DNASequence { private int chromosomeNumber; - private LinkedHashMap geneSequenceHashMap = new LinkedHashMap(); + private Map geneSequenceHashMap = new LinkedHashMap<>(); /** * Empty constructor used by tools that need a proper Bean that allows the actual @@ -106,7 +107,7 @@ public void setChromosomeNumber(int chromosomeNumber) { * @return */ - public LinkedHashMap getGeneSequences() { + public Map getGeneSequences() { return geneSequenceHashMap; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/DNASequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/DNASequence.java index 215e3c8a26..08352cb009 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/DNASequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/DNASequence.java @@ -136,14 +136,14 @@ public int getGCCount() { * Returns a Sequence which runs in the current reverse order */ public SequenceView getReverse() { - return new ReversedSequenceView(this); + return new ReversedSequenceView<>(this); } /** * Returns a Sequence which will complement every base */ public SequenceView getComplement() { - return new ComplementSequenceView(this); + return new ComplementSequenceView<>(this); } /** diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/DataSource.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/DataSource.java index 000adce936..9086382155 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/DataSource.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/DataSource.java @@ -35,8 +35,8 @@ * General database identifier gnl|database|identifier * NCBI Reference Sequence ref|accession|locus * Local Sequence identifier lcl|identifier - * - * @author Scooter Willis + * + * @author Scooter Willis */ public enum DataSource { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ExonComparator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ExonComparator.java index 64495b251f..43389f433c 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ExonComparator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ExonComparator.java @@ -30,7 +30,7 @@ /** * Sort Exon where it is a little confusing if exons should always be ordered left to right * where a negative stranded gene should go the other direction. Need to think about this? - * @author Scooter Willis + * @author Scooter Willis */ public class ExonComparator implements Comparator, Serializable{ private static final long serialVersionUID = 1; 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 34f1ec3986..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 @@ -32,6 +32,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; +import java.util.Map; +import java.util.List; /** * @@ -41,11 +43,11 @@ public class GeneSequence extends DNASequence { private final static Logger logger = LoggerFactory.getLogger(GeneSequence.class); - private final LinkedHashMap transcriptSequenceHashMap = new LinkedHashMap(); - private final LinkedHashMap intronSequenceHashMap = new LinkedHashMap(); - private final LinkedHashMap exonSequenceHashMap = new LinkedHashMap(); - private final ArrayList intronSequenceList = new ArrayList(); - private final ArrayList exonSequenceList = new ArrayList(); + private final Map transcriptSequenceHashMap = new LinkedHashMap<>(); + private final Map intronSequenceHashMap = new LinkedHashMap<>(); + private final Map exonSequenceHashMap = new LinkedHashMap<>(); + private final List intronSequenceList = new ArrayList<>(); + private final List exonSequenceList = new ArrayList<>(); boolean intronAdded = false; // need to deal with the problem that typically introns are not added when validating the list and adding in introns as the regions not included in exons private Strand strand = Strand.UNDEFINED; private ChromosomeSequence chromosomeSequence; @@ -117,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(); @@ -179,7 +181,7 @@ public TranscriptSequence getTranscript(String accession) { * Get the collection of transcription sequences assigned to this gene * @return transcripts */ - public LinkedHashMap getTranscripts() { + public Map getTranscripts() { return transcriptSequenceHashMap; } @@ -294,7 +296,7 @@ public ExonSequence addExon(AccessionID accession, int begin, int end) { * Get the exons as an ArrayList. Modifying this list will not modify the underlying collection * @return exons */ - public ArrayList getExonSequences() { + public List getExonSequences() { return new ArrayList<>(exonSequenceList); } @@ -302,7 +304,7 @@ public ArrayList getExonSequences() { * Get the introns as an ArrayList. Modifying this list will not modify the underlying collection * @return introns */ - public ArrayList getIntronSequences() { + public List getIntronSequences() { return new ArrayList<>(intronSequenceList); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/MultipleSequenceAlignment.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/MultipleSequenceAlignment.java index 6633cd717a..47355db090 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/MultipleSequenceAlignment.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/MultipleSequenceAlignment.java @@ -42,7 +42,7 @@ */ public class MultipleSequenceAlignment, C extends Compound> implements LightweightProfile { - private List sequences = new ArrayList(); + private List sequences = new ArrayList<>(); private Integer length = null; /** @@ -98,7 +98,7 @@ public List getAlignedSequences() { */ @Override public List getCompoundsAt(int alignmentIndex) { - List column = new ArrayList(); + List column = new ArrayList<>(); for (S s : sequences) { column.add(s.getCompoundAt(alignmentIndex)); } @@ -304,7 +304,7 @@ private void printConservation(StringBuilder s, String idFormat, int start, int if (idFormat != null) { AccessionID ac1 = sequences.get(0).getAccession(); String id1 = (ac1 == null) ? "null" : ac1.getID(); - id1 = id1.replaceAll(".", " "); + id1 = id1.replaceAll("\\.", " "); s.append(String.format(idFormat, id1)); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ProteinSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ProteinSequence.java index 2e44cd12c7..f4194bc662 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ProteinSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ProteinSequence.java @@ -42,6 +42,7 @@ import java.util.LinkedHashMap; import java.util.List; import org.biojava.nbio.core.sequence.features.Qualifier; +import java.util.Map; /** * The representation of a ProteinSequence @@ -160,10 +161,10 @@ private DNASequence getRawParentSequence(String accessId) throws IOException { InputStream is = url.openConnection().getInputStream(); FastaReader parentReader - = new FastaReader(is, + = new FastaReader<>(is, new PlainFastaHeaderParser(), new DNASequenceCreator(AmbiguityDNACompoundSet.getDNACompoundSet())); - LinkedHashMap seq = parentReader.process(); + Map seq = parentReader.process(); DNASequence parentSeq = null; if (seq.size() == 1) { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/RNASequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/RNASequence.java index a3e706716b..318df7cf9f 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/RNASequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/RNASequence.java @@ -39,7 +39,7 @@ /** * RNASequence where RNACompoundSet are the allowed values - * @author Scooter Willis + * @author Scooter Willis */ public class RNASequence extends AbstractSequence { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/SequenceComparator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/SequenceComparator.java index 066aa930de..742b47bfce 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/SequenceComparator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/SequenceComparator.java @@ -29,7 +29,7 @@ /** * Used to sort sequences in ascending order of bioBegin property. - * @author Scooter Willis + * @author Scooter Willis */ public class SequenceComparator implements Comparator>, Serializable{ private static final long serialVersionUID = 1; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java index 83e50474bd..5fa81ecf7f 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java @@ -31,6 +31,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * This is the sequence if you want to go from a gene sequence to a protein sequence. Need to start with a @@ -41,8 +43,8 @@ public class TranscriptSequence extends DNASequence { private final static Logger logger = LoggerFactory.getLogger(TranscriptSequence.class); - private final ArrayList cdsSequenceList = new ArrayList(); - private final LinkedHashMap cdsSequenceHashMap = new LinkedHashMap(); + private final List cdsSequenceList = new ArrayList<>(); + private final Map cdsSequenceHashMap = new LinkedHashMap<>(); private StartCodonSequence startCodonSequence = null; private StopCodonSequence stopCodonSequence = null; private GeneSequence parentGeneSequence = null; @@ -110,7 +112,7 @@ public CDSSequence removeCDS(String accession) { * Get the CDS sequences that have been added to the TranscriptSequences * @return */ - public LinkedHashMap getCDSSequences() { + public Map getCDSSequences() { return cdsSequenceHashMap; } @@ -152,8 +154,8 @@ public CDSSequence addCDS(AccessionID accession, int begin, int end, int phase) * * @return */ - public ArrayList getProteinCDSSequences() { - ArrayList proteinSequenceList = new ArrayList(); + public List getProteinCDSSequences() { + List proteinSequenceList = new ArrayList<>(); for (int i = 0; i < cdsSequenceList.size(); i++) { CDSSequence cdsSequence = cdsSequenceList.get(i); String codingSequence = cdsSequence.getCodingSequence(); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/compound/AminoAcidCompoundSet.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/compound/AminoAcidCompoundSet.java index 8252f27198..82546b5a56 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/compound/AminoAcidCompoundSet.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/compound/AminoAcidCompoundSet.java @@ -44,11 +44,11 @@ public class AminoAcidCompoundSet implements CompoundSet, Ser * */ private static final long serialVersionUID = 4000344194364133456L; - private final Map aminoAcidCompoundCache = new HashMap(); - private final Map aminoAcidCompoundCache3Letter = new HashMap(); + private final Map aminoAcidCompoundCache = new HashMap<>(); + private final Map aminoAcidCompoundCache3Letter = new HashMap<>(); private final Map> equivalentsCache = - new HashMap>(); + new HashMap<>(); public AminoAcidCompoundSet() { aminoAcidCompoundCache.put("A", new AminoAcidCompound(this, "A", "Ala", "Alanine", 71.0788f)); @@ -154,7 +154,7 @@ public Set getEquivalentCompounds(AminoAcidCompound compound) addAmbiguousEquivalents("I", "L", "J"); // ambiguous gaps AminoAcidCompound gap1, gap2, gap3; - Set gaps = new HashSet(); + Set gaps = new HashSet<>(); gaps.add(gap1 = aminoAcidCompoundCache.get("-")); gaps.add(gap2 = aminoAcidCompoundCache.get(".")); gaps.add(gap3 = aminoAcidCompoundCache.get("_")); @@ -172,18 +172,18 @@ private void addAmbiguousEquivalents(String one, String two, String either) { Set equivalents; AminoAcidCompound cOne, cTwo, cEither; - equivalents = new HashSet(); + equivalents = new HashSet<>(); equivalents.add(cOne = aminoAcidCompoundCache.get(one)); equivalents.add(cTwo = aminoAcidCompoundCache.get(two)); equivalents.add(cEither = aminoAcidCompoundCache.get(either)); equivalentsCache.put(cEither, equivalents); - equivalents = new HashSet(); + equivalents = new HashSet<>(); equivalents.add(cOne); equivalents.add(cEither); equivalentsCache.put(cOne, equivalents); - equivalents = new HashSet(); + equivalents = new HashSet<>(); equivalents.add(cTwo); equivalents.add(cEither); equivalentsCache.put(cTwo, equivalents); @@ -206,7 +206,7 @@ public boolean isValidSequence(Sequence sequence) { @Override public List getAllCompounds() { - return new ArrayList(aminoAcidCompoundCache.values()); + return new ArrayList<>(aminoAcidCompoundCache.values()); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/edits/Edit.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/edits/Edit.java index 19923effed..e0d06eb0c7 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/edits/Edit.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/edits/Edit.java @@ -78,13 +78,13 @@ public static abstract class AbstractEdit implements Edit @Override public Sequence edit(Sequence editingSequence) { Sequence targetSequence = getTargetSequence(editingSequence); - List> sequences = new ArrayList>(); + List> sequences = new ArrayList<>(); sequences.add(getFivePrime(editingSequence)); sequences.add(targetSequence); sequences.add(getThreePrime(editingSequence)); - return new JoiningSequenceReader(sequences); + return new JoiningSequenceReader<>(sequences); } private int start = -1; private int end = -1; @@ -114,12 +114,12 @@ protected void setSequence(Sequence sequence) { * @param editingSequence Asked for in-case we need to do String to * Sequence conversion so we need a CompoundSet which is given * by the Sequence we are editing - * @return The Sequence object we wish to insert + * @return The {@link Sequence} object we wish to insert */ public Sequence getTargetSequence(Sequence editingSequence) { if (sequence == null && stringSequence != null) { try { - sequence = new BasicSequence( + sequence = new BasicSequence<>( stringSequence, editingSequence.getCompoundSet()); } catch (CompoundNotFoundException e) { // TODO is there a better way to handle this exception? @@ -136,7 +136,7 @@ public Sequence getTargetSequence(Sequence editingSequence) { protected Sequence getEmptySequence(Sequence editingSequence) { Sequence s = null; try { - s = new BasicSequence("", editingSequence.getCompoundSet()); + s = new BasicSequence<>("", editingSequence.getCompoundSet()); } catch (CompoundNotFoundException e) { // should not happen logger.error("Could not construct empty sequence. {}. This is most likely a bug.", e.getMessage()); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/AbstractFeature.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/AbstractFeature.java index d601c573b0..5f0ed8043f 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/AbstractFeature.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/AbstractFeature.java @@ -36,11 +36,11 @@ * A feature is currently any descriptive item that can be associated with a sequence position(s) * A feature has a type and a source which is currently a string to allow flexibility for the user * Ideally well defined features should have a class to describe attributes of that feature - * @author Scooter Willis + * @author Scooter Willis */ public abstract class AbstractFeature, C extends Compound> implements FeatureInterface { - List> childrenFeatures = new ArrayList>(); + List> childrenFeatures = new ArrayList<>(); FeatureInterface parentFeature; AbstractLocation sequenceLocation; String type = ""; @@ -48,7 +48,7 @@ public abstract class AbstractFeature, C extends C private String description = ""; private String shortDescription = ""; private Object userObject = null; - private Map> Qualifiers = new HashMap>(); + private Map> Qualifiers = new HashMap<>(); /** * A feature has a type and a source @@ -292,7 +292,7 @@ public void addQualifier(String key, Qualifier qualifier) { vals.add(qualifier); Qualifiers.put(key, vals); } else { - List vals = new ArrayList(); + List vals = new ArrayList<>(); vals.add(qualifier); Qualifiers.put(key, vals); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/DBReferenceInfo.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/DBReferenceInfo.java index fc9f7fc8f6..3cc8b8897a 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/DBReferenceInfo.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/DBReferenceInfo.java @@ -25,6 +25,7 @@ import org.biojava.nbio.core.sequence.loader.UniprotProxySequenceReader; import java.util.LinkedHashMap; +import java.util.Map; /** * If you have a uniprot ID then it is possible to get a collection @@ -33,11 +34,11 @@ * Currently implement when the {@link UniprotProxySequenceReader} is used * to load a protein sequence * - * @author Scooter Willis + * @author Scooter Willis * @author Paolo Pavan */ public class DBReferenceInfo extends Qualifier { - private LinkedHashMap properties = new LinkedHashMap(); + private Map properties = new LinkedHashMap<>(); private String database = ""; private String id = ""; @@ -66,14 +67,14 @@ public void addProperty(String type, String value){ * Get the properties * @return the properties */ - public LinkedHashMap getProperties() { + public Map getProperties() { return properties; } /** * @param properties the properties to set */ - public void setProperties(LinkedHashMap properties) { + public void setProperties(Map properties) { this.properties = properties; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/DatabaseReferenceInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/DatabaseReferenceInterface.java index 20c00034dd..a302d08857 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/DatabaseReferenceInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/DatabaseReferenceInterface.java @@ -30,7 +30,7 @@ /** * If a SequenceProxyReader implements this interface then that external source * has a list of cross reference id(s) - * @author Scooter Willis + * @author Scooter Willis */ public interface DatabaseReferenceInterface { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeatureDbReferenceInfo.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeatureDbReferenceInfo.java index c270cc74e7..68b518b051 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeatureDbReferenceInfo.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeatureDbReferenceInfo.java @@ -11,7 +11,7 @@ * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * - * @author Jacek Grzebyta + * @author Jacek Grzebyta <github:jgrzebyta> * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page @@ -46,11 +46,11 @@ public class FeatureDbReferenceInfo, C extends Com private AbstractLocation location; private FeatureInterface parentFeature; - private List> childrenFeatures = new ArrayList>(); + private List> childrenFeatures = new ArrayList<>(); private String description = ""; private String shortDescription = ""; private Object userObject; - private Map> qualifiers = new HashMap>(); + private Map> qualifiers = new HashMap<>(); public FeatureDbReferenceInfo(String database, String id) { @@ -150,7 +150,7 @@ public void setQualifiers(Map> qualifiers) { @Override public void addQualifier(String key, Qualifier qualifier) { if (qualifiers == null) { - qualifiers = new HashMap>(); + qualifiers = new HashMap<>(); } // Check for key. Update list of values if (qualifiers.containsKey(key)){ @@ -158,7 +158,7 @@ public void addQualifier(String key, Qualifier qualifier) { vals.add(qualifier); qualifiers.put(key, vals); } else { - List vals = new ArrayList(); + List vals = new ArrayList<>(); vals.add(qualifier); qualifiers.put(key, vals); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeatureInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeatureInterface.java index 47564bcefa..8976953fd0 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeatureInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeatureInterface.java @@ -33,11 +33,11 @@ * the surface of a protein where different sequence positions make up that feature. Ligand binding pocket is another example. * The location in its current form knows the start and stop position in a sequence and thus should contain knowledge about the * actual sequence. - * + *

* A feature can contain features to handle cases where a domain is a feature and the secondary structures covered by that domain * and other requirements for grouping. * - * @author Scooter Willis + * @author Scooter Willis * @author Paolo Pavan */ public interface FeatureInterface, C extends Compound> { @@ -46,32 +46,26 @@ public interface FeatureInterface, C extends Compo * Get the short description that can be used to describe the feature * @return */ - - public String getShortDescription(); + String getShortDescription(); /** * Set the short description that can be used to describe the feature * @param shortDescription */ + void setShortDescription(String shortDescription); - public void setShortDescription(String shortDescription); - - /** + /** * Get the description that can be used to describe the feature * @return */ + String getDescription(); - public String getDescription(); - - - /** + /** * Set the description that can be used to describe the feature - * @return */ + void setDescription(String description); - public void setDescription(String description); - - /** + /** * The location(s) of this feature where the location should contain a reference to parent and sequence etc. *

* The location may be complicated, or simply a range. @@ -80,7 +74,7 @@ public interface FeatureInterface, C extends Compo * * @return a Location anchoring this feature */ - public AbstractLocation getLocations(); + AbstractLocation getLocations(); /** * The new location for this feature. @@ -93,14 +87,14 @@ public interface FeatureInterface, C extends Compo * @param loc the new Location for this feature * */ - public void setLocation(AbstractLocation loc); + void setLocation(AbstractLocation loc); - /** + /** * The type of the feature. * * @return the type of this sequence */ - public String getType(); + String getType(); /** * Change the type of this feature. @@ -108,15 +102,15 @@ public interface FeatureInterface, C extends Compo * @param type new type String * */ - public void setType(String type); + void setType(String type); - /** + /** * The source of the feature. This may be a program or process. * * @return the source, or generator */ - public String getSource(); + String getSource(); /** * Change the source of the FeatureInterface. @@ -124,66 +118,60 @@ public interface FeatureInterface, C extends Compo * @param source the new source String * */ - public void setSource(String source); + void setSource(String source); /** * Set the parent feature * @param feature */ - - public void setParentFeature(FeatureInterface feature); + void setParentFeature(FeatureInterface feature); /** * Get the parent feature * @return */ - - public FeatureInterface getParentFeature(); + FeatureInterface getParentFeature(); /** * Get the features contained by this feature * @return */ - - public List> getChildrenFeatures(); + List> getChildrenFeatures(); /** * Set the children features * @param features */ + void setChildrenFeatures(List> features); - public void setChildrenFeatures(List> features); - - /** + /** * @return the userObject */ - public Object getUserObject(); + Object getUserObject(); /** * @param userObject the userObject to set */ - public void setUserObject(Object userObject); - + void setUserObject(Object userObject); /** * Get the qualifiers for this feature * @return */ - public Map> getQualifiers(); + Map> getQualifiers(); /** * Set the qualifiers * @param qualifiers */ + void setQualifiers(Map> qualifiers); - public void setQualifiers(Map> qualifiers); /** * Add a qualifier * @param qualifier */ - - public void addQualifier(String key, Qualifier qualifier); + void addQualifier(String key, Qualifier qualifier); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeaturesKeyWordInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeaturesKeyWordInterface.java index 1b1acd994e..e7bef35d6c 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeaturesKeyWordInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/FeaturesKeyWordInterface.java @@ -28,7 +28,7 @@ * Models the keywords that are annotated for a protein sequence at Uniprot. If a ProxySequenceReader * implements this interface then the sequence will call this method * - * @author Scooter Willis + * @author Scooter Willis */ public interface FeaturesKeyWordInterface { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/QualityFeature.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/QualityFeature.java index 7eec33a62a..0e7da9a97b 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/QualityFeature.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/QualityFeature.java @@ -37,7 +37,7 @@ */ public class QualityFeature, C extends Compound> extends AbstractFeature { - private List qualities = new ArrayList(); + private List qualities = new ArrayList<>(); /** * @param type diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/QuantityFeature.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/QuantityFeature.java index bce00e2729..3e6304c5c6 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/QuantityFeature.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/QuantityFeature.java @@ -31,11 +31,11 @@ * It is common to have a numerical value or values associated with a feature. This can then * be used in heat maps or other visual indicators when viewing a sequence. Multiple quantities * could represent a time corse study and display a color gradient - * @author Scooter Willis + * @author Scooter Willis */ public class QuantityFeature, C extends Compound> extends AbstractFeature { - private List quantities = new ArrayList(); + private List quantities = new ArrayList<>(); /** * diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/TextFeature.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/TextFeature.java index 2b8cf26b59..5634e065a9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/TextFeature.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/features/TextFeature.java @@ -26,7 +26,7 @@ /** * A implmentation of AbstractFeature - * @author Scooter Willis + * @author Scooter Willis */ public class TextFeature, C extends Compound> extends AbstractFeature { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java index d2cebd7cd1..9561e21660 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java @@ -171,9 +171,9 @@ public int[] getQcalls() { } /** - * Returns the original programmatically determined (unedited) sequence as a AbstractSequence. + * Returns the original programmatically determined (unedited) sequence as a {@link AbstractSequence}. * - * @return AbstractSequence sequence + * @return sequence */ public AbstractSequence getSequence() throws CompoundNotFoundException { DNASequenceCreator creator = new DNASequenceCreator(ABITracerCompoundSet.getABITracerCompoundSet()); @@ -191,13 +191,13 @@ public AbstractSequence getSequence() throws CompoundNotFoun * @throws CompoundNotFoundException if the base is not valid */ public int[] getTrace (String base) throws CompoundNotFoundException { - if (base.equals("A")) { + if ("A".equals(base)) { return A; - } else if (base.equals("C")) { + } else if ("C".equals(base)) { return C; - } else if (base.equals("G")) { + } else if ("G".equals(base)) { return G; - } else if (base.equals("T")) { + } else if ("T".equals(base)) { return T; } else { throw new CompoundNotFoundException("Don't know base: " + base); @@ -434,7 +434,7 @@ private void setSeq() { for (int x = 0; x <= seqLength - 1; ++x) { tempseq[x] = (char) traceData[PBAS2 + x]; } - sequence = new String(tempseq); + sequence = String.valueOf(tempseq); } /** @@ -492,9 +492,9 @@ private void setIndex() { for (int record = 0; record <= NumRecords - 1; record++) { getSubArray(RecNameArray, (indexBase + (record * 28))); RecName = new String(RecNameArray); - if (RecName.equals("FWO_")) + if ("FWO_".equals(RecName)) FWO = indexBase + (record * 28) + 20; - if (RecName.equals("DATA")) { + if ("DATA".equals(RecName)) { ++DataCounter; if (DataCounter == 9) DATA9 = indexBase + (record * 28) + 20; @@ -505,17 +505,17 @@ private void setIndex() { if (DataCounter == 12) DATA12 = indexBase + (record * 28) + 20; } - if (RecName.equals("PBAS")) { + if ("PBAS".equals(RecName)) { ++PBASCounter; if (PBASCounter == 2) PBAS2 = indexBase + (record * 28) + 20; } - if (RecName.equals("PLOC")) { + if ("PLOC".equals(RecName)) { ++PLOCCounter; if (PLOCCounter == 2) PLOC = indexBase + (record * 28) + 20; } - if (RecName.equals("PCON")) { + if ("PCON".equals(RecName)) { ++PCONCounter; if (PCONCounter == 2) PCON = indexBase + (record * 28) + 20; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/BufferedReaderBytesRead.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/BufferedReaderBytesRead.java index e8b56ba29b..30aa52c5d7 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/BufferedReaderBytesRead.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/BufferedReaderBytesRead.java @@ -76,8 +76,8 @@ public class BufferedReaderBytesRead extends Reader { private boolean skipLF = false; /** The skipLF flag when the mark was set */ private boolean markedSkipLF = false; - private static int defaultCharBufferSize = 8192; - private static int defaultExpectedLineLength = 80; + private static final int defaultCharBufferSize = 8192; + private static final int defaultExpectedLineLength = 80; long bytesRead = 0; /** @@ -174,7 +174,7 @@ private void fill() throws IOException { * Reads a single character. * * @return The character read, as an integer in the range - * 0 to 65535 (0x00-0xffff), or -1 if the + * 0 to 65535 (0x00-0xffff), or -1 if the * end of the stream has been reached * @exception IOException If an I/O error occurs */ @@ -451,7 +451,7 @@ public long skip(long n) throws IOException { nextChar++; } } - long d = nChars - nextChar; + long d = (long)nChars - nextChar; if (r <= d) { nextChar += r; r = 0; @@ -521,7 +521,7 @@ public boolean markSupported() { * whose size is no smaller than limit. * Therefore large values should be used with care. * - * @exception IllegalArgumentException If readAheadLimit is < 0 + * @exception IllegalArgumentException If readAheadLimit is < 0 * @exception IOException If an I/O error occurs */ @Override diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/CasePreservingProteinSequenceCreator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/CasePreservingProteinSequenceCreator.java index 1a6c20eba1..0fb731ab10 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/CasePreservingProteinSequenceCreator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/CasePreservingProteinSequenceCreator.java @@ -41,14 +41,15 @@ *

The user collection will be the same length as the resulting ProteinSequence. * Each object can be cast to a Boolean. If true, the corresponding position in * the input file was uppercase. - * - *

Example

- *
CasePreservingProteinSequenceCreator creator =
+ * 

+ * Example + * + * CasePreservingProteinSequenceCreator creator = * new CasePreservingProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()); - *AbstractSequence seq = creator.getSequence("aaAA",0); - *System.out.println(seq.getSequenceAsString()); //"AAAA" - *System.out.println(seq.getUserCollection()); //"[false, false, true, true]" - *

+ * AbstractSequence<AminoAcidCompound> seq = creator.getSequence("aaAA",0); + * System.out.println(seq.getSequenceAsString()); //"AAAA" + * System.out.println(seq.getUserCollection()); //"[false, false, true, true]" + *
*/ public class CasePreservingProteinSequenceCreator extends ProteinSequenceCreator { @@ -90,7 +91,7 @@ public AbstractSequence getSequence(String sequence, public AbstractSequence getSequence( List list) { AbstractSequence seq =super.getSequence(list); - Collection strCase = new ArrayList(seq.getLength()); + Collection strCase = new ArrayList<>(seq.getLength()); for(int i=0;i getSequence( * This list contains only Booleans. */ private static List getStringCase(String str) { - List types = new ArrayList(str.length()); + List types = new ArrayList<>(str.length()); for(int i=0;i + * @author Scooter Willis */ public class DNASequenceCreator implements SequenceCreatorInterface { @@ -83,7 +83,7 @@ public AbstractSequence getSequence( @Override public AbstractSequence getSequence( List list) { - ArrayListProxySequenceReader store = new ArrayListProxySequenceReader(); + ArrayListProxySequenceReader store = new ArrayListProxySequenceReader<>(); store.setCompoundSet(compoundSet); store.setContents(list); return new DNASequence(store); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaGeneWriter.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaGeneWriter.java index 2297e5e070..065bfff79a 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaGeneWriter.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaGeneWriter.java @@ -35,7 +35,7 @@ * A Gene sequence has a Positive or Negative Strand where we want to write out to a stream the 5 to 3 prime version. * It is also an option to write out the gene sequence where the exon regions are upper case * 6/22/2010 FastaWriter needs to be sequence aware to handle writing out a GeneSequence which is negative Strand with the proper sequence - * @author Scooter Willis + * @author Scooter Willis */ public class FastaGeneWriter { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReader.java index d7c4bde215..f818adddd0 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReader.java @@ -35,6 +35,7 @@ import java.io.*; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.Map; /** * Use FastaReaderHelper as an example of how to use this class where FastaReaderHelper should be the @@ -104,8 +105,8 @@ public FastaReader(File file, SequenceHeaderParserInterface headerParser, * present, starting current fileIndex onwards. * @throws IOException if an error occurs reading the input file */ - public LinkedHashMap process() throws IOException { - LinkedHashMap sequences = process(-1); + public Map process() throws IOException { + Map sequences = process(-1); close(); return sequences; @@ -131,7 +132,7 @@ public LinkedHashMap process() throws IOException { * present, starting current fileIndex onwards. * @throws IOException if an error occurs reading the input file */ - public LinkedHashMap process(int max) throws IOException { + public Map process(int max) throws IOException { String line = ""; @@ -148,7 +149,7 @@ public LinkedHashMap process(int max) throws IOException { boolean keepGoing = true; - LinkedHashMap sequences = new LinkedHashMap(); + Map sequences = new LinkedHashMap<>(); do { line = line.trim(); // nice to have but probably not needed diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java index e250a8d4f9..973a2813c6 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java @@ -35,10 +35,11 @@ import java.io.IOException; import java.io.InputStream; import java.util.LinkedHashMap; +import java.util.Map; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class FastaReaderHelper { @@ -51,13 +52,13 @@ public class FastaReaderHelper { * @return * @throws IOException */ - public static LinkedHashMap readFastaDNASequence(File file, boolean lazySequenceLoad) throws IOException { + public static Map readFastaDNASequence(File file, boolean lazySequenceLoad) throws IOException { if (!lazySequenceLoad) { return readFastaDNASequence(file); } FastaReader fastaProxyReader = - new FastaReader( + new FastaReader<>( file, new GenericFastaHeaderParser(), new FileProxyDNASequenceCreator( @@ -79,13 +80,13 @@ public static LinkedHashMap readFastaDNASequence(File file, * @return * @throws IOException */ - public static LinkedHashMap readFastaRNASequence(File file, boolean lazySequenceLoad) throws IOException { + public static Map readFastaRNASequence(File file, boolean lazySequenceLoad) throws IOException { if (!lazySequenceLoad) { return readFastaRNASequence(file); } FastaReader fastaProxyReader = - new FastaReader( + new FastaReader<>( file, new GenericFastaHeaderParser(), new FileProxyRNASequenceCreator( @@ -106,10 +107,10 @@ public static LinkedHashMap readFastaRNASequence(File file, * @return * @throws IOException */ - public static LinkedHashMap readFastaProteinSequence( + public static Map readFastaProteinSequence( File file) throws IOException { FileInputStream inStream = new FileInputStream(file); - LinkedHashMap proteinSequences = readFastaProteinSequence(inStream); + Map proteinSequences = readFastaProteinSequence(inStream); inStream.close(); return proteinSequences; } @@ -122,9 +123,9 @@ public static LinkedHashMap readFastaProteinSequence( * @return * @throws IOException */ - public static LinkedHashMap readFastaProteinSequence( + public static Map readFastaProteinSequence( InputStream inStream) throws IOException { - FastaReader fastaReader = new FastaReader( + FastaReader fastaReader = new FastaReader<>( inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); @@ -137,9 +138,9 @@ public static LinkedHashMap readFastaProteinSequence( * @return * @throws IOException */ - public static LinkedHashMap readFastaDNASequence( + public static Map readFastaDNASequence( InputStream inStream) throws IOException { - FastaReader fastaReader = new FastaReader( + FastaReader fastaReader = new FastaReader<>( inStream, new GenericFastaHeaderParser(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet())); @@ -152,10 +153,10 @@ public static LinkedHashMap readFastaDNASequence( * @return * @throws IOException */ - public static LinkedHashMap readFastaDNASequence( + public static Map readFastaDNASequence( File file) throws IOException { FileInputStream inStream = new FileInputStream(file); - LinkedHashMap dnaSequences = readFastaDNASequence(inStream); + Map dnaSequences = readFastaDNASequence(inStream); inStream.close(); return dnaSequences; } @@ -166,9 +167,9 @@ public static LinkedHashMap readFastaDNASequence( * @return * @throws IOException */ - public static LinkedHashMap readFastaRNASequence( + public static Map readFastaRNASequence( InputStream inStream) throws IOException { - FastaReader fastaReader = new FastaReader( + FastaReader fastaReader = new FastaReader<>( inStream, new GenericFastaHeaderParser(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet())); @@ -181,10 +182,10 @@ public static LinkedHashMap readFastaRNASequence( * @return * @throws IOException */ - public static LinkedHashMap readFastaRNASequence( + public static Map readFastaRNASequence( File file) throws IOException { FileInputStream inStream = new FileInputStream(file); - LinkedHashMap rnaSequences = readFastaRNASequence(inStream); + Map rnaSequences = readFastaRNASequence(inStream); inStream.close(); return rnaSequences; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaSequenceParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaSequenceParser.java index 35043c93bc..7140c094c5 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaSequenceParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaSequenceParser.java @@ -28,7 +28,7 @@ /** * Used to parse a stream of a fasta file to get the sequence - * @author Scooter Willis + * @author Scooter Willis */ public class FastaSequenceParser implements SequenceParserInterface { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaStreamer.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaStreamer.java new file mode 100644 index 0000000000..00829869b9 --- /dev/null +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaStreamer.java @@ -0,0 +1,179 @@ +package org.biojava.nbio.core.sequence.io; + +import org.biojava.nbio.core.sequence.ProteinSequence; +import org.biojava.nbio.core.sequence.compound.AminoAcidCompound; +import org.biojava.nbio.core.sequence.compound.AminoAcidCompoundSet; +import org.biojava.nbio.core.sequence.io.template.SequenceCreatorInterface; +import org.biojava.nbio.core.sequence.io.template.SequenceHeaderParserInterface; +import org.biojava.nbio.core.util.InputStreamProvider; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.nio.file.Path; +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; +import java.util.Spliterator; +import java.util.Spliterators; +import java.util.function.Consumer; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +/** + * Read from a FASTA file (or gzipped FASTA file) and create a Java stream of {@link ProteinSequence} objects + * for use in a functional programming paradigm. + * + * @author Gary Murphy + * @since 7.1.0 + */ +public class FastaStreamer { + + private final Path path; + private int batchSize = 1_000; + private SequenceHeaderParserInterface headerParser; + private SequenceCreatorInterface sequenceCreator; + private Map chunk = new LinkedHashMap<>(); + private Iterator> iterator = Collections.emptyIterator(); + private boolean closed = false; + + /** + * The constructor is private. Created via the from(...) static factory method + * + * @param path the path to the file containing the FASTA content (possibly GZipped) + */ + private FastaStreamer(final Path path) { + this.path = path; + } + + public static FastaStreamer from(final Path path) { + return new FastaStreamer(path); + } + + public static FastaStreamer from(File file) { + return from(file.toPath()); + } + + public FastaStreamer withHeaderParser(SequenceHeaderParserInterface headerParser) { + this.headerParser = headerParser; + return this; + } + + public FastaStreamer withSequenceCreator(SequenceCreatorInterface sequenceCreator) { + this.sequenceCreator = sequenceCreator; + return this; + } + + public FastaStreamer batchSize(int size) { + this.batchSize = size; + return this; + } + + /** + * Enable iteration through the proteins in the file using syntax such as: + *
+	 *     for(ProteinSequence sequence : FastaStreamer.from(path).each()) {
+	 *         .
+	 *         .
+	 *         .
+	 *     }
+	 * 
+ * + * @return an iterable suitable for an iteration loop + */ + public Iterable each() { + return () -> stream().iterator(); + } + + /** + * Create a stream of protein sequences from the contents of the path + * @return the stream + */ + public Stream stream() { + InputStreamProvider provider = new InputStreamProvider(); + InputStream input; + try { + input = provider.getInputStream(getPath().toFile()); + } catch (IOException exception) { + throw new UncheckedIOException(exception); + } + FastaReader reader = new FastaReader<>(input, getHeaderParser(), getSequenceCreator()); + Spliterator source = new Spliterators.AbstractSpliterator<>(Integer.MAX_VALUE, Spliterator.IMMUTABLE | Spliterator.NONNULL) { + @Override + public boolean tryAdvance(Consumer action) { + if (closed) { + return false; + } + ProteinSequence protein = next(reader); + if (null == protein) { + return false; + } + action.accept(protein); + return true; + } + + /** + * Fetch the next header/protein tuple from the cache. If the cache is empty, fetch another + * batch from the source file + * + * @param reader + * the input stream from which the FASTA content is read + * @return the protein sequence + */ + private ProteinSequence next(FastaReader reader) { + try { + if (!iterator.hasNext()) { + chunk = reader.process(getBatchSize()); + if (null == chunk) { + closed = true; + reader.close(); + return null; + } + iterator = chunk.entrySet().iterator(); + } + if (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + return createSequence(entry.getValue()); + } + closed = true; + reader.close(); + } catch (IOException exception) { + throw new UncheckedIOException(String.format("I/O error reading the FASTA file from '%s'", getPath()), exception); + } + return null; + } + }; // Spliterator + return StreamSupport.stream(source, false); + } + + /** + * Create the sequence with the information from the header. This implementation return the sequence as-is, but + * this is an opportunity for the implementer to build specific information into the user collection space + * of the sequence + * + * @param sequence the protein sequence + * @return the sequence + */ + protected ProteinSequence createSequence(ProteinSequence sequence) { + return sequence; + } + + protected Path getPath() { + return path; + } + + protected int getBatchSize() { + return batchSize; + } + + protected SequenceHeaderParserInterface getHeaderParser() { + return Optional.ofNullable(headerParser).orElse(new GenericFastaHeaderParser<>()); + } + + public SequenceCreatorInterface getSequenceCreator() { + return Optional.ofNullable(sequenceCreator).orElse(new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); + } +} diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriter.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriter.java index ff425bde49..f0fc191ff2 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriter.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriter.java @@ -44,7 +44,7 @@ * and that is used when writing to the stream. This behavior can be overwritten by implementing * a custom FastaHeaderFormatInterface. * - * @author Scooter Willis + * @author Scooter Willis */ public class FastaWriter, C extends Compound> { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java index 966d723728..364260d9a2 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaWriterHelper.java @@ -39,7 +39,7 @@ /** * The class that should be used to write out fasta file of a sequence collection - * @author Scooter Willis + * @author Scooter Willis */ public class FastaWriterHelper { @@ -71,7 +71,7 @@ public static void writeProteinSequence(File file, public static void writeProteinSequence(OutputStream outputStream, Collection proteinSequences) throws Exception { - FastaWriter fastaWriter = new FastaWriter( + FastaWriter fastaWriter = new FastaWriter<>( outputStream, proteinSequences, new GenericFastaHeaderFormat()); fastaWriter.process(); @@ -96,7 +96,7 @@ public static void writeGeneSequence(File file, Collection geneSeq /** * Write a collection of GeneSequences to a file where if the gene is negative strand it will flip and complement the sequence * @param outputStream - * @param dnaSequences + * @param geneSequences * @throws Exception */ @@ -132,7 +132,7 @@ public static void writeNucleotideSequence(File file, Collection dn */ public static void writeNucleotideSequence(OutputStream outputStream, Collection dnaSequences) throws Exception { - FastaWriter fastaWriter = new FastaWriter( + FastaWriter fastaWriter = new FastaWriter<>( outputStream, dnaSequences, new GenericFastaHeaderFormat()); fastaWriter.process(); @@ -170,7 +170,7 @@ public static void writeSequence(OutputStream outputStream, Sequence sequence */ private static Collection> singleSeqToCollection(Sequence sequence) { - Collection> sequences = new ArrayList>(); + Collection> sequences = new ArrayList<>(); sequences.add(sequence); return sequences; } @@ -199,7 +199,7 @@ public String getHeader(Sequence sequence) { }; FastaWriter, Compound> fastaWriter = - new FastaWriter, Compound>(outputStream, + new FastaWriter<>(outputStream, sequences, fhfi); fastaWriter.process(); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyDNASequenceCreator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyDNASequenceCreator.java index fb89f1c4e3..96317cecdd 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyDNASequenceCreator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyDNASequenceCreator.java @@ -45,7 +45,7 @@ * Same approach can be used for genome sequence data stored in a local fasta file, in a database or via http * interface to a remote server * - * @author Scooter Willis + * @author Scooter Willis */ public class FileProxyDNASequenceCreator implements SequenceCreatorInterface { @@ -56,8 +56,9 @@ public class FileProxyDNASequenceCreator implements /** * Need File so that we can store full path name in SequenceFileProxyLoader for Random File access as a quick read - * @param fastaFile + * @param file * @param compoundSet + * @param sequenceParser */ public FileProxyDNASequenceCreator(File file, CompoundSet compoundSet, @@ -78,7 +79,7 @@ public FileProxyDNASequenceCreator(File file, */ @Override public AbstractSequence getSequence(String sequence, long index ) throws CompoundNotFoundException, IOException { - SequenceFileProxyLoader sequenceFileProxyLoader = new SequenceFileProxyLoader( + SequenceFileProxyLoader sequenceFileProxyLoader = new SequenceFileProxyLoader<>( file, sequenceParser, index, diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyProteinSequenceCreator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyProteinSequenceCreator.java index 7db550683f..f7e1cc7ab6 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyProteinSequenceCreator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyProteinSequenceCreator.java @@ -55,7 +55,7 @@ public class FileProxyProteinSequenceCreator implements SequenceCreatorInterface /** * Need File so that we can store full path name in SequenceFileProxyLoader for Random File access as a quick read - * @param fastaFile + * @param file * @param compoundSet */ public FileProxyProteinSequenceCreator(File file, CompoundSet compoundSet, SequenceParserInterface sequenceParser ) { @@ -76,7 +76,7 @@ public FileProxyProteinSequenceCreator(File file, CompoundSet @Override public AbstractSequence getSequence(String sequence, long index) throws CompoundNotFoundException, IOException { SequenceFileProxyLoader sequenceFileProxyLoader = - new SequenceFileProxyLoader( + new SequenceFileProxyLoader<>( file, sequenceParser, index, diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyRNASequenceCreator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyRNASequenceCreator.java index 4be68696fb..53de88bb06 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyRNASequenceCreator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyRNASequenceCreator.java @@ -45,7 +45,7 @@ * Same approach can be used for genome sequence data stored in a local fasta file, in a database or via http * interface to a remote server * - * @author Scooter Willis + * @author Scooter Willis */ public class FileProxyRNASequenceCreator implements SequenceCreatorInterface { @@ -56,7 +56,7 @@ public class FileProxyRNASequenceCreator implements /** * Need File so that we can store full path name in SequenceFileProxyLoader for Random File access as a quick read - * @param fastaFile + * @param file * @param compoundSet */ public FileProxyRNASequenceCreator(File file, @@ -78,7 +78,7 @@ public FileProxyRNASequenceCreator(File file, */ @Override public AbstractSequence getSequence(String sequence, long index ) throws CompoundNotFoundException, IOException { - SequenceFileProxyLoader sequenceFileProxyLoader = new SequenceFileProxyLoader( + SequenceFileProxyLoader sequenceFileProxyLoader = new SequenceFileProxyLoader<>( file, sequenceParser, index, diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReader.java index 1b182f02dc..7f67918377 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReader.java @@ -12,7 +12,7 @@ * authors. These should be listed in @author doc comments. * * @author Scooter Willis ;lt;willishf at gmail dot com> - * @author Karl Nicholas + * @author Karl Nicholas <github:karlnicholas> * @author Paolo Pavan * * For more information on the BioJava project and its aims, @@ -48,11 +48,13 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; /** * Use {@link GenbankReaderHelper} as an example of how to use this class where {@link GenbankReaderHelper} should be the * primary class used to read Genbank files - * + * @param the sequence type + * @param the compound type */ public class GenbankReader, C extends Compound> { @@ -119,8 +121,8 @@ public GenbankReader( * @throws CompoundNotFoundException * @throws OutOfMemoryError if the input resource is larger than the allocated heap. */ - public LinkedHashMap process() throws IOException, CompoundNotFoundException { - LinkedHashMap result = process(-1); + public Map process() throws IOException, CompoundNotFoundException { + Map result = process(-1); close(); return result; } @@ -147,13 +149,13 @@ public LinkedHashMap process() throws IOException, CompoundNotFoundExc * @throws IOException * @throws CompoundNotFoundException */ - public LinkedHashMap process(final int max) throws IOException, CompoundNotFoundException { + public Map process(final int max) throws IOException, CompoundNotFoundException { if(closed){ throw new IOException("Cannot perform action: resource has been closed."); } - LinkedHashMap sequences = new LinkedHashMap<>(); + Map sequences = new LinkedHashMap<>(); int i=0; while(true) { if(max>0 && i>=max) break; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java index 638e570cc5..7d382ce6b9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java @@ -37,10 +37,11 @@ import java.io.FileInputStream; import java.io.InputStream; import java.util.LinkedHashMap; +import java.util.Map; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GenbankReaderHelper { @@ -55,13 +56,13 @@ public class GenbankReaderHelper { * @return * @throws Exception */ - public static LinkedHashMap readGenbankDNASequence(File file, boolean lazySequenceLoad) throws Exception { + public static Map readGenbankDNASequence(File file, boolean lazySequenceLoad) throws Exception { if (!lazySequenceLoad) { return readGenbankDNASequence(file); } GenbankReader GenbankProxyReader = - new GenbankReader( + new GenbankReader<>( file, new GenericGenbankHeaderParser(), new FileProxyDNASequenceCreator( @@ -83,13 +84,13 @@ public static LinkedHashMap readGenbankDNASequence(File fil * @return * @throws Exception */ - public static LinkedHashMap readGenbankProteinSequence(File file, boolean lazySequenceLoad) throws Exception { + public static Map readGenbankProteinSequence(File file, boolean lazySequenceLoad) throws Exception { if (!lazySequenceLoad) { return readGenbankProteinSequence(file); } GenbankReader GenbankProxyReader = - new GenbankReader( + new GenbankReader<>( file, new GenericGenbankHeaderParser(), new FileProxyProteinSequenceCreator( @@ -111,13 +112,13 @@ public static LinkedHashMap readGenbankProteinSequence( * @return * @throws Exception */ - public static LinkedHashMap readGenbankRNASequence(File file, boolean lazySequenceLoad) throws Exception { + public static Map readGenbankRNASequence(File file, boolean lazySequenceLoad) throws Exception { if (!lazySequenceLoad) { return readGenbankRNASequence(file); } GenbankReader GenbankProxyReader = - new GenbankReader( + new GenbankReader<>( file, new GenericGenbankHeaderParser(), new FileProxyRNASequenceCreator( @@ -138,10 +139,10 @@ public static LinkedHashMap readGenbankRNASequence(File fil * @return * @throws Exception */ - public static LinkedHashMap readGenbankProteinSequence( + public static Map readGenbankProteinSequence( File file) throws Exception { FileInputStream inStream = new FileInputStream(file); - LinkedHashMap proteinSequences = readGenbankProteinSequence(inStream); + Map proteinSequences = readGenbankProteinSequence(inStream); inStream.close(); return proteinSequences; } @@ -154,9 +155,9 @@ public static LinkedHashMap readGenbankProteinSequence( * @return * @throws Exception */ - public static LinkedHashMap readGenbankProteinSequence( + public static Map readGenbankProteinSequence( InputStream inStream) throws Exception { - GenbankReader GenbankReader = new GenbankReader( + GenbankReader GenbankReader = new GenbankReader<>( inStream, new GenericGenbankHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); @@ -169,9 +170,9 @@ public static LinkedHashMap readGenbankProteinSequence( * @return * @throws Exception */ - public static LinkedHashMap readGenbankDNASequence( + public static Map readGenbankDNASequence( InputStream inStream) throws Exception { - GenbankReader GenbankReader = new GenbankReader( + GenbankReader GenbankReader = new GenbankReader<>( inStream, new GenericGenbankHeaderParser(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet())); @@ -184,10 +185,10 @@ public static LinkedHashMap readGenbankDNASequence( * @return * @throws Exception */ - public static LinkedHashMap readGenbankDNASequence( + public static Map readGenbankDNASequence( File file) throws Exception { FileInputStream inStream = new FileInputStream(file); - LinkedHashMap dnaSequences = readGenbankDNASequence(inStream); + Map dnaSequences = readGenbankDNASequence(inStream); inStream.close(); return dnaSequences; } @@ -197,9 +198,9 @@ public static LinkedHashMap readGenbankDNASequence( * @return * @throws Exception */ - public static LinkedHashMap readGenbankRNASequence( + public static Map readGenbankRNASequence( InputStream inStream) throws Exception { - GenbankReader GenbankReader = new GenbankReader( + GenbankReader GenbankReader = new GenbankReader<>( inStream, new GenericGenbankHeaderParser(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet())); @@ -212,10 +213,10 @@ public static LinkedHashMap readGenbankRNASequence( * @return * @throws Exception */ - public static LinkedHashMap readGenbankRNASequence( + public static Map readGenbankRNASequence( File file) throws Exception { FileInputStream inStream = new FileInputStream(file); - LinkedHashMap rnaSequences = readGenbankRNASequence(inStream); + Map rnaSequences = readGenbankRNASequence(inStream); inStream.close(); return rnaSequences; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankSequenceParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankSequenceParser.java index 2673d9af75..7b7f0e1450 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankSequenceParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankSequenceParser.java @@ -17,7 +17,7 @@ * @author Bubba Puryear * @author George Waldon * @author Deepak Sheoran - * @author Karl Nicholas + * @author Karl Nicholas <github:karlnicholas> * @author Jacek Grzebyta * @author Paolo Pavan * @@ -145,7 +145,7 @@ private String parse(BufferedReader bufferedReader) { sectionKey = section.get(0)[0]; if (sectionKey == null) { //if we reach the end of the file, section contains empty strings - if(section.get(0)[1]==null || section.get(0)[1].equals("") || + if(section.get(0)[1]==null || "".equals(section.get(0)[1]) || section.get(0)[1].length()==0) { throw new ParserException(Messages.ENDOFFILE); } @@ -208,7 +208,7 @@ private void parseFeatureTag(List section) { needsQuotes = true; // as the value has quotes then set that it needs quotes when written back out } // parameter on old feature - if (key.equals("db_xref")) { + if ("db_xref".equals(key)) { Matcher m = dbxp.matcher(val); if (m.matches()) { String dbname = m.group(1); @@ -217,18 +217,18 @@ private void parseFeatureTag(List section) { xref.setNeedsQuotes(needsQuotes); gbFeature.addQualifier(key, xref); - ArrayList listDBEntry = new ArrayList<>(); + List listDBEntry = new ArrayList<>(); listDBEntry.add(xref); mapDB.put(key, listDBEntry); } else { throw new ParserException("Bad dbxref"); } - } else if (key.equalsIgnoreCase("organism")) { + } else if ("organism".equalsIgnoreCase(key)) { Qualifier q = new Qualifier(key, val.replace('\n', ' '), needsQuotes); gbFeature.addQualifier(key, q); } else { - if (key.equalsIgnoreCase("translation") || key.equals("anticodon") - || key.equals("transl_except")) { + if ("translation".equalsIgnoreCase(key) || "anticodon".equals(key) + || "transl_except".equals(key)) { // strip spaces from sequence val = val.replaceAll("\\s+", ""); Qualifier q = new Qualifier(key, val, needsQuotes); @@ -319,9 +319,9 @@ private void parseLocusTag(List section) { String lengthUnits = m.group(3); String type = m.group(6); - if (lengthUnits.equalsIgnoreCase("aa")) { + if ("aa".equalsIgnoreCase(lengthUnits)) { compoundType = AminoAcidCompoundSet.getAminoAcidCompoundSet(); - } else if (lengthUnits.equalsIgnoreCase("bp")) { + } else if ("bp".equalsIgnoreCase(lengthUnits)) { if (type != null) { if (type.contains("RNA")) { compoundType = RNACompoundSet.getRNACompoundSet(); @@ -333,7 +333,7 @@ private void parseLocusTag(List section) { } } - if (m.group(7) != null) isCircularSequence = m.group(7).equalsIgnoreCase("circular"); + if (m.group(7) != null) isCircularSequence = "circular".equalsIgnoreCase(m.group(7)); // configure location parser with needed information locationParser.setSequenceLength(sequenceLength); @@ -349,9 +349,9 @@ private void parseLocusTag(List section) { String lengthUnits = m2.group(2); String type = m2.group(5); - if (lengthUnits.equalsIgnoreCase("aa")) { + if ("aa".equalsIgnoreCase(lengthUnits)) { compoundType = AminoAcidCompoundSet.getAminoAcidCompoundSet(); - } else if (lengthUnits.equalsIgnoreCase("bp")) { + } else if ("bp".equalsIgnoreCase(lengthUnits)) { if (type != null) { if (type.contains("RNA")) { compoundType = RNACompoundSet.getRNACompoundSet(); @@ -363,7 +363,7 @@ private void parseLocusTag(List section) { } } - if (m2.group(6) != null) isCircularSequence = m2.group(6).equalsIgnoreCase("circular"); + if (m2.group(6) != null) isCircularSequence = "circular".equalsIgnoreCase(m2.group(6)); // configure location parser with needed information locationParser.setSequenceLength(sequenceLength); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriter.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriter.java index c99a9c23fd..9d47db3bbd 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriter.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriter.java @@ -69,7 +69,6 @@ public GenbankWriter(OutputStream os, Collection sequences, * @param headerFormat * @param lineLength */ - public GenbankWriter(OutputStream os, Collection sequences, GenbankHeaderFormatInterface headerFormat, int lineLength) { this.os = os; @@ -82,9 +81,7 @@ public GenbankWriter(OutputStream os, Collection sequences, * Allow an override of operating system line separator for programs that * needs a specific CRLF or CR or LF option * - * @param lineSeparator */ - public void process() throws Exception { // Loosely based on code from Howard Salis // TODO - Force lower case? diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriterHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriterHelper.java index a0ba83aec0..97cfe557ad 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriterHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriterHelper.java @@ -76,7 +76,7 @@ public static void writeProteinSequence(File file, public static void writeProteinSequence(OutputStream outputStream, Collection proteinSequences) throws Exception { - GenbankWriter genbankWriter = new GenbankWriter( + GenbankWriter genbankWriter = new GenbankWriter<>( outputStream, proteinSequences, new GenericGenbankHeaderFormat()); @@ -126,10 +126,10 @@ public static void writeNucleotideSequence(OutputStream outputStream, public static void writeNucleotideSequence(OutputStream outputStream, Collection dnaSequences, String seqType) throws Exception { - GenericGenbankHeaderFormat genericGenbankHeaderFormat = new GenericGenbankHeaderFormat( + GenericGenbankHeaderFormat genericGenbankHeaderFormat = new GenericGenbankHeaderFormat<>( seqType); // genericGenbankHeaderFormat.setLineSeparator(lineSep); - GenbankWriter genbankWriter = new GenbankWriter( + GenbankWriter genbankWriter = new GenbankWriter<>( outputStream, dnaSequences, genericGenbankHeaderFormat); // genbankWriter.setLineSeparator(lineSep); genbankWriter.process(); @@ -146,9 +146,9 @@ public static void writeNucleotideSequence(OutputStream outputStream, public static void writeNucleotideSequenceOriginal(OutputStream outputStream, Collection dnaSequences) throws Exception { - GenericGenbankHeaderFormat genericGenbankHeaderFormat = new GenericGenbankHeaderFormat( + GenericGenbankHeaderFormat genericGenbankHeaderFormat = new GenericGenbankHeaderFormat<>( true); - GenbankWriter genbankWriter = new GenbankWriter( + GenbankWriter genbankWriter = new GenbankWriter<>( outputStream, dnaSequences, genericGenbankHeaderFormat); genbankWriter.process(); } @@ -189,7 +189,7 @@ public static void writeSequence(OutputStream outputStream, private static Collection> singleSeqToCollection( Sequence sequence) { - Collection> sequences = new ArrayList>(); + Collection> sequences = new ArrayList<>(); sequences.add(sequence); return sequences; } @@ -219,7 +219,7 @@ public String getHeader(Sequence sequence) { ; }; - GenbankWriter, Compound> genbankWriter = new GenbankWriter, Compound>( + GenbankWriter, Compound> genbankWriter = new GenbankWriter<>( outputStream, sequences, fhfi); genbankWriter.process(); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderFormat.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderFormat.java index a007af0a61..c26b8362da 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderFormat.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderFormat.java @@ -32,7 +32,7 @@ * use the accession id. This allows the implementation by the user to write out complex header * with id notes etc without rewriting the fasta writer * - * @author Scooter Willis + * @author Scooter Willis */ public class GenericFastaHeaderFormat, C extends Compound> implements FastaHeaderFormatInterface { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParser.java index aa7c17bbd7..f4c8ea3416 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParser.java @@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import java.util.List; /** * The default fasta header parser where some headers are well defined based on the source @@ -58,7 +59,7 @@ * NCBI Reference Sequence ref|accession|locus * Local Sequence identifier lcl|identifier * - * @author Scooter Willis + * @author Scooter Willis */ public class GenericFastaHeaderParser, C extends Compound> implements SequenceHeaderParserInterface { @@ -71,7 +72,7 @@ public class GenericFastaHeaderParser, C extends C */ private String[] getHeaderValues(String header) { String[] data = new String[0]; - ArrayList values = new ArrayList(); + List values = new ArrayList<>(); StringBuffer sb = new StringBuffer(); //commented out 1/11/2012 to resolve an issue where headers do contain a length= at the end that are not recognized //if(header.indexOf("length=") != -1){ @@ -93,9 +94,9 @@ private String[] getHeaderValues(String header) { sb.append(header.charAt(i)); } - data = new String[values.size()]; - values.toArray(data); } + data = new String[values.size()]; + values.toArray(data); } else { data = header.split(" "); } @@ -116,8 +117,8 @@ public void parseHeader(String header, S sequence) { if (data.length == 1) { sequence.setAccession(new AccessionID(data[0])); - } else if (data[0].equalsIgnoreCase("sp") || data[0].equalsIgnoreCase("tr")) { - if (data[0].equalsIgnoreCase("sp")) { + } else if ("sp".equalsIgnoreCase(data[0]) || "tr".equalsIgnoreCase(data[0])) { + if ("sp".equalsIgnoreCase(data[0])) { sequence.setAnnotationType(AnnotationType.CURATED); } else { sequence.setAnnotationType(AnnotationType.PREDICTED); @@ -128,41 +129,41 @@ public void parseHeader(String header, S sequence) { sequence.setDescription(data[2]); } - } else if (data[0].equalsIgnoreCase("gi")) { + } else if ("gi".equalsIgnoreCase(data[0])) { DataSource giSource = DataSource.UNKNOWN; if (data.length >= 3) { - if (data[2].equalsIgnoreCase("gb")) { + if ("gb".equalsIgnoreCase(data[2])) { giSource = DataSource.GENBANK; - } else if (data[2].equalsIgnoreCase("emb")) { + } else if ("emb".equalsIgnoreCase(data[2])) { giSource = DataSource.ENA; - } else if (data[2].equalsIgnoreCase("dbj")) { + } else if ("dbj".equalsIgnoreCase(data[2])) { giSource = DataSource.DDBJ; } sequence.setAccession(new AccessionID(data[3], giSource)); } else { sequence.setAccession(new AccessionID(header, giSource)); } - } else if (data[0].equalsIgnoreCase("pir")) { + } else if ("pir".equalsIgnoreCase(data[0])) { sequence.setAccession(new AccessionID(data[2], DataSource.NBRF)); - } else if (data[0].equalsIgnoreCase("prf")) { + } else if ("prf".equalsIgnoreCase(data[0])) { sequence.setAccession(new AccessionID(data[2], DataSource.PRF)); - } else if (data[0].equalsIgnoreCase("pdb")) { + } else if ("pdb".equalsIgnoreCase(data[0])) { sequence.setAccession(new AccessionID(data[1] + ":" + data[2], DataSource.PDB1)); } else if (data[0].startsWith("PDB")) { String[] pdbe = data[0].split(" "); String[] pdbaccession = pdbe[0].split(":"); sequence.setAccession(new AccessionID(pdbaccession[1], DataSource.PDBe)); - } else if (data[0].indexOf(":") != -1 && data.length > 1 && data[1].equals("PDBID")) { + } else if (data[0].indexOf(":") != -1 && data.length > 1 && "PDBID".equals(data[1])) { sequence.setAccession(new AccessionID(data[0], DataSource.PDB2)); - } else if (data[0].equalsIgnoreCase("pat")) { + } else if ("pat".equalsIgnoreCase(data[0])) { sequence.setAccession(new AccessionID(data[2], DataSource.PATENTS)); - } else if (data[0].equalsIgnoreCase("bbs")) { + } else if ("bbs".equalsIgnoreCase(data[0])) { sequence.setAccession(new AccessionID(data[1], DataSource.GENINFO)); - } else if (data[0].equalsIgnoreCase("gnl")) { + } else if ("gnl".equalsIgnoreCase(data[0])) { sequence.setAccession(new AccessionID(data[2], DataSource.GENERAL)); - } else if (data[0].equalsIgnoreCase("ref")) { + } else if ("ref".equalsIgnoreCase(data[0])) { sequence.setAccession(new AccessionID(data[1], DataSource.NCBI)); - } else if (data[0].equalsIgnoreCase("lcl")) { + } else if ("lcl".equalsIgnoreCase(data[0])) { sequence.setAccession(new AccessionID(data[1], DataSource.LOCAL)); } else { sequence.setAccession(new AccessionID(data[0])); // avoid the common problem of picking up all the comments original header in getOriginalHeader diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderFormat.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderFormat.java index 5732561718..036f8d2ab5 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderFormat.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderFormat.java @@ -37,7 +37,7 @@ public class GenericGenbankHeaderFormat, C extends extends GenericInsdcHeaderFormat implements GenbankHeaderFormatInterface { private static final int HEADER_WIDTH = 12; - private static final String lineSep = "%n"; + private static final String lineSep = System.lineSeparator(); private String seqType = null; private boolean useOriginalHeader = false; @@ -76,7 +76,7 @@ private String _write_multi_line(String tag, String text) { text = ""; } int max_len = MAX_WIDTH - HEADER_WIDTH; - ArrayList lines = _split_multi_line(text, max_len); + List lines = _split_multi_line(text, max_len); String output = _write_single_line(tag, lines.get(0)); for (int i = 1; i < lines.size(); i++) { output += _write_single_line("", lines.get(i)); @@ -254,7 +254,7 @@ private String _write_original_first_line(S sequence) { * @param sequence */ private String _write_comment(S sequence) { - ArrayList comments = sequence.getNotesList(); + List comments = sequence.getNotesList(); String output = _write_multi_line("COMMENT", comments.remove(0)); for (String comment : comments) { output += _write_multi_line("", comment); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java index bc196c9150..4fd6354110 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java @@ -11,7 +11,7 @@ * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * - * @author Karl Nicholas + * @author Karl Nicholas <github:karlnicholas> * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page @@ -67,7 +67,7 @@ public class GenericGenbankHeaderParser, C extends private boolean versionSeen; - private ArrayList comments = new ArrayList<>(); + private List comments = new ArrayList<>(); /** * Publications by the authors of the sequence that discuss the data reported in @@ -134,7 +134,7 @@ public int getVersion() { return version; } - public ArrayList getComments() { + public List getComments() { return comments; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java index 973403a2b5..ccc7dc2055 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java @@ -49,7 +49,7 @@ public class GenericInsdcHeaderFormat, C extends C protected static final int QUALIFIER_INDENT = 21; protected static final String QUALIFIER_INDENT_STR = " "; protected static final String QUALIFIER_INDENT_TMP = " %s "; - private static final String lineSep = "%n"; + private static final String lineSep = System.lineSeparator(); /** * Format a feature qualifier using the MAX_WIDTH (default 80) @@ -208,7 +208,7 @@ private String _insdc_feature_location_string(FeatureInterface locations = new ArrayList(); + List locations = new ArrayList<>(); for(Location l : feature.getLocations().getSubLocations()) { locations.add(_insdc_location_string_ignoring_strand_and_subfeatures((AbstractLocation) l, record_length)); } @@ -223,7 +223,7 @@ private String _insdc_feature_location_string(FeatureInterface locations = new ArrayList(); + List locations = new ArrayList<>(); for(Location l : feature.getLocations().getSubLocations()) { locations.add(_insdc_location_string_ignoring_strand_and_subfeatures((AbstractLocation) l, record_length)); } @@ -248,7 +248,7 @@ private String _insdc_feature_location_string(FeatureInterface locations = new ArrayList(); + List locations = new ArrayList<>(); for(FeatureInterface, C> f : feature.getChildrenFeatures()) { locations.add(_insdc_location_string_ignoring_strand_and_subfeatures(f.getLocations(), record_length)); } @@ -261,7 +261,7 @@ private String _insdc_feature_location_string(FeatureInterface locations = new ArrayList(); + List locations = new ArrayList<>(); for(FeatureInterface, C> f : feature.getChildrenFeatures()) { locations.add(_insdc_location_string_ignoring_strand_and_subfeatures(f.getLocations(), record_length)); } @@ -404,16 +404,16 @@ raise ValueError("Expected a SeqFeature position object.") * @param text * @param max_len */ - protected ArrayList _split_multi_line(String text, int max_len) { + protected List _split_multi_line(String text, int max_len) { // TODO Auto-generated method stub - ArrayList output = new ArrayList(); + List output = new ArrayList<>(); text = text.trim(); if(text.length() <= max_len) { output.add(text); return output; } - ArrayList words = new ArrayList(); + List words = new ArrayList<>(); Collections.addAll(words, text.split("\\s+")); while(!words.isEmpty()) { text = words.remove(0); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/IUPACParser.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/IUPACParser.java index d6c1b76ada..65e9d96830 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/IUPACParser.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/IUPACParser.java @@ -134,8 +134,8 @@ public IUPACTable getTable(Integer id) { private void populateLookups() { if(nameLookup == null) { - nameLookup = new HashMap(); - idLookup = new HashMap(); + nameLookup = new HashMap<>(); + idLookup = new HashMap<>(); for(IUPACTable t: getTables()) { nameLookup.put(t.getName(), t); idLookup.put(t.getId(), t); @@ -144,13 +144,13 @@ private void populateLookups() { } private List parseTables() { - List localTables = new ArrayList(); + List localTables = new ArrayList<>(); List lines = IOUtils.getList(is); Integer id = null; String name, aa, starts, baseone, basetwo, basethree; name = aa = starts = baseone = basetwo = basethree = null; for (String line : lines) { - if (line.equalsIgnoreCase("//")) { + if ("//".equalsIgnoreCase(line)) { localTables.add(new IUPACTable(name, id, aa, starts, baseone, basetwo, basethree)); name = aa = starts = baseone = basetwo = basethree = null; @@ -158,19 +158,19 @@ private List parseTables() { } else { String[] keyValue = line.split("\\s*=\\s*"); - if (keyValue[0].equals("AAs")) { + if ("AAs".equals(keyValue[0])) { aa = keyValue[1]; } - else if (keyValue[0].equals("Starts")) { + else if ("Starts".equals(keyValue[0])) { starts = keyValue[1]; } - else if (keyValue[0].equals("Base1")) { + else if ("Base1".equals(keyValue[0])) { baseone = keyValue[1]; } - else if (keyValue[0].equals("Base2")) { + else if ("Base2".equals(keyValue[0])) { basetwo = keyValue[1]; } - else if (keyValue[0].equals("Base3")) { + else if ("Base3".equals(keyValue[0])) { basethree = keyValue[1]; } else { @@ -198,7 +198,7 @@ public static class IUPACTable implements Table { private final String baseTwo; private final String baseThree; - private final List codons = new ArrayList(); + private final List codons = new ArrayList<>(); private CompoundSet compounds = null; public IUPACTable(String name, int id, String aminoAcidString, @@ -266,7 +266,7 @@ public boolean isStart(AminoAcidCompound compound) { * @param aminoAcids The target amino acid compounds objects */ @Override - public List getCodons(CompoundSet nucelotides, + public List getCodons(CompoundSet nucleotides, CompoundSet aminoAcids) { if (this.codons.isEmpty()) { @@ -277,9 +277,9 @@ public List getCodons(CompoundSet nucelotides, for (int i = 0; i < aminoAcidStrings.size(); i++) { List codonString = codonStrings.get(i); - NucleotideCompound one = getCompound(codonString, 0, nucelotides); - NucleotideCompound two = getCompound(codonString, 1, nucelotides); - NucleotideCompound three = getCompound(codonString, 2, nucelotides); + NucleotideCompound one = getCompound(codonString, 0, nucleotides); + NucleotideCompound two = getCompound(codonString, 1, nucleotides); + NucleotideCompound three = getCompound(codonString, 2, nucleotides); boolean start = ("M".equals(startCodonStrings.get(i))); boolean stop = ("*".equals(aminoAcidStrings.get(i))); AminoAcidCompound aminoAcid = aminoAcids @@ -328,7 +328,7 @@ public CompoundSet getCodonCompoundSet( } private List> codonStrings() { - List> codons = new ArrayList>(); + List> codons = new ArrayList<>(); for (int i = 0; i < baseOne.length(); i++) { List codon = Arrays.asList(Character .toString(baseOne.charAt(i)), @@ -348,7 +348,7 @@ private List startCodons() { } private List split(String string) { - List split = new ArrayList(); + List split = new ArrayList<>(); for (int i = 0; i < string.length(); i++) { split.add(Character.toString(string.charAt(i))); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ProteinSequenceCreator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ProteinSequenceCreator.java index c40e3efa2a..6f4e839ca7 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ProteinSequenceCreator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ProteinSequenceCreator.java @@ -37,7 +37,7 @@ * Used to create a ProteinSequence from a String to allow for details * about the location of the sequence etc. * - * @author Scooter Willis + * @author Scooter Willis */ public class ProteinSequenceCreator implements SequenceCreatorInterface { @@ -70,7 +70,7 @@ public AbstractSequence getSequence(String sequence, @Override public AbstractSequence getSequence( List list) { - ArrayListProxySequenceReader store = new ArrayListProxySequenceReader(); + ArrayListProxySequenceReader store = new ArrayListProxySequenceReader<>(); store.setCompoundSet(compoundSet); store.setContents(list); return new ProteinSequence(store); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/RNASequenceCreator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/RNASequenceCreator.java index 96abe9cd35..16f69cbf74 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/RNASequenceCreator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/RNASequenceCreator.java @@ -35,7 +35,7 @@ /** * Used to create a RNA sequence * - * @author Scooter Willis + * @author Scooter Willis */ public class RNASequenceCreator implements SequenceCreatorInterface { @@ -78,7 +78,7 @@ public AbstractSequence getSequence( @Override public AbstractSequence getSequence(List list) { ArrayListProxySequenceReader store = - new ArrayListProxySequenceReader(); + new ArrayListProxySequenceReader<>(); store.setCompoundSet(compoundSet); store.setContents(list); return new RNASequence(store); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/embl/EmblReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/embl/EmblReader.java index 45e50cd9ea..7c818c0e51 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/embl/EmblReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/embl/EmblReader.java @@ -67,46 +67,46 @@ public static EmblRecord process(File file) throws IOException { if (line.length() > 1) { lineInfo = line.substring(2, line.length()).trim(); lineIdentifier = line.substring(0, 2); - if (lineIdentifier.equals("ID")) + if ("ID".equals(lineIdentifier)) emblRecord.setEmblId(populateID(lineInfo)); - else if (lineIdentifier.equals("AC")) + else if ("AC".equals(lineIdentifier)) populateAccessionNumber(line, accessionNumber); - else if (lineIdentifier.equals("DT") && line.contains("Created")) + else if ("DT".equals(lineIdentifier) && line.contains("Created")) emblRecord.setCreatedDate(lineInfo); - else if (lineIdentifier.equals("DT") && line.contains("updated")) + else if ("DT".equals(lineIdentifier) && line.contains("updated")) emblRecord.setLastUpdatedDate(lineInfo); - else if (lineIdentifier.equals("DE")) + else if ("DE".equals(lineIdentifier)) emblRecord.setSequenceDescription(lineInfo); - else if (lineIdentifier.equals("KW")) + else if ("KW".equals(lineIdentifier)) keyword.add(lineInfo); - else if (lineIdentifier.equals("OS")) + else if ("OS".equals(lineIdentifier)) emblRecord.setOrganismSpecies(lineInfo); - else if (lineIdentifier.equals("OC")) + else if ("OC".equals(lineIdentifier)) emblRecord.setOrganismClassification(lineInfo); - else if (lineIdentifier.equals("OG")) + else if ("OG".equals(lineIdentifier)) emblRecord.setOrGanelle(lineInfo); - else if (lineIdentifier.equals("RN") || lineIdentifier.equals("RP") - || lineIdentifier.equals("RX") || lineIdentifier.equals("RG") - || lineIdentifier.equals("RA") || lineIdentifier.equals("RT") - || lineIdentifier.equals("RL")) + else if ("RN".equals(lineIdentifier) || "RP".equals(lineIdentifier) + || "RX".equals(lineIdentifier) || "RG".equals(lineIdentifier) + || "RA".equals(lineIdentifier) || "RT".equals(lineIdentifier) + || "RL".equals(lineIdentifier)) populateEmblReferences(lineIdentifier, lineInfo, emblReference, emblReferences); - else if (lineIdentifier.equals("DR")) + else if ("DR".equals(lineIdentifier)) emblRecord.setDatabaseCrossReference(lineInfo); - else if (lineIdentifier.equals("AH")) + else if ("AH".equals(lineIdentifier)) emblRecord.setAssemblyHeader(lineInfo); - else if (lineIdentifier.equals("AS")) + else if ("AS".equals(lineIdentifier)) emblRecord.setAssemblyInformation(lineInfo); - else if (lineIdentifier.equals("CO")) + else if ("CO".equals(lineIdentifier)) emblRecord.setConstructedSequence(lineInfo); - else if (lineIdentifier.equals("FH")) + else if ("FH".equals(lineIdentifier)) emblRecord.setFeatureHeader(lineInfo); - else if (lineIdentifier.equals("FT")) + else if ("FT".equals(lineIdentifier)) emblRecord.setFeatureTable(lineInfo); - else if (lineIdentifier.equals("SQ")) + else if ("SQ".equals(lineIdentifier)) emblRecord.setSequenceHeader(lineInfo); - else if (lineIdentifier.equals(" ") && !lineIdentifier.equals("//")) + else if (" ".equals(lineIdentifier) && !"//".equals(lineIdentifier)) populateSequence(line, sequence); - else if (lineIdentifier.equals("//")) { + else if ("//".equals(lineIdentifier)) { emblRecord.setKeyword(keyword); emblRecord.setEmblReference(emblReferences); emblRecord.setAccessionNumber(accessionNumber); @@ -129,19 +129,19 @@ private static void populateSequence(String line, StringBuilder sequence) { private static void populateEmblReferences(String lineIdentifier, String lineInfo, EmblReference emblReference , LinkedList emblReferences) { - if (lineIdentifier.equals("RN")) + if ("RN".equals(lineIdentifier)) emblReference.setReferenceNumber(lineInfo); - else if (lineIdentifier.equals("RP")) + else if ("RP".equals(lineIdentifier)) emblReference.setReferencePosition(lineInfo); - else if (lineIdentifier.equals("RX")) + else if ("RX".equals(lineIdentifier)) emblReference.setReferenceCrossReference(lineInfo); - else if (lineIdentifier.equals("RG")) + else if ("RG".equals(lineIdentifier)) emblReference.setReferenceGroup(lineInfo); - else if (lineIdentifier.equals("RA")) + else if ("RA".equals(lineIdentifier)) emblReference.setReferenceAuthor(lineInfo); - else if (lineIdentifier.equals("RT")) + else if ("RT".equals(lineIdentifier)) emblReference.setReferenceTitle(lineInfo); - else if (lineIdentifier.equals("RL")) { + else if ("RL".equals(lineIdentifier)) { emblReference.setReferenceLocation(lineInfo); emblReferences.add(emblReference.copyEmblReference(emblReference)); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/embl/EmblRecord.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/embl/EmblRecord.java index 1e84382b54..46497b5a0d 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/embl/EmblRecord.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/embl/EmblRecord.java @@ -64,7 +64,7 @@ public class EmblRecord { * 6. Taxonomic division * 7. Sequence length * - * @return EmblId + * @return */ public EmblId getEmblId() { return emblId; @@ -80,7 +80,7 @@ public void setEmblId(EmblId emblId) { * The citations provide access to the papers from which the data has been * abstracted. * - * @return EmblReference + * @return */ public List getEmblReference() { return emblReference; @@ -94,7 +94,7 @@ public void setEmblReference(List emblReference) { * The AC (Accession number) line lists the accession numbers associated with * the entry. * - * @return List + * @return */ public List getAccessionNumber() { return accessionNumber; @@ -119,7 +119,7 @@ public void setProjectIdentifier(String projectIdentifier) { * The OG (OrGanelle) linetype indicates the sub-cellular location of non-nuclear * sequences. * - * @return String + * @return */ public String getOrGanelle() { return orGanelle; @@ -132,7 +132,7 @@ public void setOrGanelle(String orGanelle) { /** * The DT line shows when an entry first appeared in the database * - * @return String + * @return */ public String getCreatedDate() { return createdDate; @@ -146,7 +146,7 @@ public void setCreatedDate(String createdDate) { * The FH (Feature Header) lines are present only to improve readability of * an entry when it is printed or displayed on a terminal screen. * - * @return String + * @return */ public String getFeatureHeader() { return featureHeader; @@ -161,7 +161,7 @@ public void setFeatureHeader(String featureHeader) { * sequence data. Regions or sites in the sequence which are of interest are * listed in the table. * - * @return String + * @return */ public String getFeatureTable() { return featureTable; @@ -190,7 +190,7 @@ public void setLastUpdatedDate(String lastUpdatedDate) { * sequence codes, the region of the genome from which it is derived, or other * information which helps to identify the sequence. * - * @return String + * @return */ public String getSequenceDescription() { return sequenceDescription; @@ -205,7 +205,7 @@ public void setSequenceDescription(String sequenceDescription) { * cross-reference indexes of the sequence entries based on functional, * structural, or other categories deemed important. * - * @return List + * @return */ public List getKeyword() { return keyword; @@ -235,7 +235,7 @@ public void setOrganismSpecies(String organismSpecies) { * The OC (Organism Classification) lines contain the taxonomic classification * Of the source organism * - * @return String + * @return */ public String getOrganismClassification() { return organismClassification; @@ -249,7 +249,7 @@ public void setOrganismClassification(String organismClassification) { * The DR (Database Cross-reference) line cross-references other databases which * contain information related to the entry in which the DR line appears. * - * @return String + * @return */ public String getDatabaseCrossReference() { return databaseCrossReference; @@ -262,7 +262,7 @@ public void setDatabaseCrossReference(String databaseCrossReference) { /** * The AH (Assembly Header) line provides column headings for the assembly information. * - * @return String + * @return */ public String getAssemblyHeader() { return assemblyHeader; @@ -290,7 +290,7 @@ public void setAssemblyInformation(String assemblyInformation) { * Con(structed) sequences in the CON data classes represent complete * chromosomes, genomes and other long sequences constructed from segment entries. * - * @return String + * @return */ public String getConstructedSequence() { return constructedSequence; @@ -304,7 +304,7 @@ public void setConstructedSequence(String constructedSequence) { * The SQ (SeQuence header) line marks the beginning of the sequence data and * Gives a summary of its content. * - * @return String + * @return */ public String getSequenceHeader() { return sequenceHeader; @@ -317,7 +317,7 @@ public void setSequenceHeader(String sequenceHeader) { /** * The Sequence Data Line * - * @return String + * @return */ public String getSequence() { return sequence; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/FastaHeaderFormatInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/FastaHeaderFormatInterface.java index a0bb6af6d3..bfd3092357 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/FastaHeaderFormatInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/FastaHeaderFormatInterface.java @@ -27,13 +27,16 @@ /** * - * @author Scooter Willis + * @author Scooter Willis + * @param the compound type + * @param the sequence type */ public interface FastaHeaderFormatInterface, C extends Compound> { + /** * * @param sequence * @return */ - public String getHeader(S sequence); + String getHeader(S sequence); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/GenbankHeaderFormatInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/GenbankHeaderFormatInterface.java index 5e08a424bf..0dff2d40eb 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/GenbankHeaderFormatInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/GenbankHeaderFormatInterface.java @@ -28,16 +28,18 @@ /** * @author mckeee1 - * + * @param the compound type + * @param the sequence type */ public interface GenbankHeaderFormatInterface, C extends Compound> { + + public static final String UNKNOWN_DNA = "UNK"; + /** * * @param sequence * @return */ - public static final String UNKNOWN_DNA = "UNK"; - - public String getHeader(S sequence); + String getHeader(S sequence); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceCreatorInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceCreatorInterface.java index 9ec26dc225..c03900055b 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceCreatorInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceCreatorInterface.java @@ -32,7 +32,8 @@ /** * - * @author Scooter Willis + * @author Scooter Willis + * @param the compound type */ public interface SequenceCreatorInterface { /** diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceHeaderParserInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceHeaderParserInterface.java index dba9d7ca3d..a49e27c754 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceHeaderParserInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceHeaderParserInterface.java @@ -27,7 +27,9 @@ /** * - * @author Scooter Willis + * @author Scooter Willis + * @param the compound type + * @param the sequence type */ public interface SequenceHeaderParserInterface, C extends Compound> { /** diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceParserInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceParserInterface.java index fd536e2802..82b2cab38b 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceParserInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/template/SequenceParserInterface.java @@ -27,15 +27,15 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public interface SequenceParserInterface { /** * - * @param dataInput + * @param bufferedReader * @param sequenceLength * @return - * @throws Exception + * @throws IOException */ - public String getSequence(BufferedReader bufferedReader,int sequenceLength) throws IOException; + String getSequence(BufferedReader bufferedReader,int sequenceLength) throws IOException; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java index 4f807c5799..fe3dfcd42a 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/util/IOUtils.java @@ -110,7 +110,7 @@ public static void processReader(BufferedReader br, ReaderProcessor processor) { * @throws ParserException Can throw this if we cannot parse the given reader */ public static List getList(BufferedReader br) { - final List list = new ArrayList(); + final List list = new ArrayList<>(); processReader(br, new ReaderProcessor() { @Override public void process(String line) { @@ -157,7 +157,7 @@ public static List getList(File file) throws IOException { * * @param file File which may or may not be GZipped * @return The final stream - * @throws IOExceptio n + * @throws IOException */ public static InputStream openFile(File file) throws IOException { final InputStream is; @@ -178,7 +178,7 @@ public static InputStream openFile(File file) throws IOException { /** * Closure interface used when working with - * {@link IOUtils#processReader(String)}. Each time a line is encountered + * {@link IOUtils#processReader(BufferedReader, ReaderProcessor)}. Each time a line is encountered * the object that implements this interface will be invoked. * * @author ayates diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReader.java index 006827f321..f443472aad 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReader.java @@ -11,7 +11,7 @@ * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * - * @author Karl Nicholas + * @author Karl Nicholas <github:karlnicholas> * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page @@ -42,8 +42,8 @@ import java.util.Map; /** - * @author Karl Nicholas - * @author Jacek Grzebyta + * @author Karl Nicholas <github:karlnicholas> + * @author Jacek Grzebyta <github:jgrzebyta> */ public class GenbankProxySequenceReader extends StringProxySequenceReader implements FeaturesKeyWordInterface, DatabaseReferenceInterface, FeatureRetriever { @@ -74,7 +74,7 @@ public GenbankProxySequenceReader( String db = compoundSet instanceof AminoAcidCompoundSet ? "protein" : "nuccore"; InputStream inStream = getBufferedInputStream(accessionID, db); - genbankParser = new GenbankSequenceParser, C>(); + genbankParser = new GenbankSequenceParser<>(); setContents(genbankParser.getSequence(new BufferedReader(new InputStreamReader(inStream)), 0)); headerParser = genbankParser.getSequenceHeaderParser(); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/SequenceFileProxyLoader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/SequenceFileProxyLoader.java index fa7d81f4e9..ef4bf016cb 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/SequenceFileProxyLoader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/SequenceFileProxyLoader.java @@ -50,14 +50,14 @@ * data was loaded and then after X amount of time clear the contents to free up memory. * * - * @author Scooter Willis - * @param + * @author Scooter Willis + * @param the compound type */ public class SequenceFileProxyLoader implements ProxySequenceReader { SequenceParserInterface sequenceParser; private CompoundSet compoundSet; - private List parsedCompounds = new ArrayList(); + private List parsedCompounds = new ArrayList<>(); File file; long sequenceStartIndex = -1; int sequenceLength = -1; @@ -204,7 +204,7 @@ public String getSequenceAsString() { */ public String getSequenceAsString(Integer bioBegin, Integer bioEnd, Strand strand) { - SequenceAsStringHelper sequenceAsStringHelper = new SequenceAsStringHelper(); + SequenceAsStringHelper sequenceAsStringHelper = new SequenceAsStringHelper<>(); return sequenceAsStringHelper.getSequenceAsString(this.parsedCompounds, compoundSet, bioBegin, bioEnd, strand); } @@ -260,7 +260,7 @@ public int hashCode(){ @Override public SequenceView getSubSequence(final Integer bioBegin, final Integer bioEnd) { - return new SequenceProxyView(SequenceFileProxyLoader.this, bioBegin, bioEnd); + return new SequenceProxyView<>(SequenceFileProxyLoader.this, bioBegin, bioEnd); } /** diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/StringProxySequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/StringProxySequenceReader.java index 57c793ddc1..86323d1289 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/StringProxySequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/StringProxySequenceReader.java @@ -38,15 +38,14 @@ /** * An example of a ProxySequenceReader that is created from a String. Used for testing - * @author Scooter Willis - * @param + * @author Scooter Willis + * @param the compound type */ - public class StringProxySequenceReader implements ProxySequenceReader { private String sequence; private CompoundSet compoundSet; - private List parsedCompounds = new ArrayList(); + private List parsedCompounds = new ArrayList<>(); public StringProxySequenceReader() {} @@ -83,7 +82,7 @@ public void setContents(String sequence) throws CompoundNotFoundException { } } - public void setContents(String sequence, ArrayList features) throws CompoundNotFoundException{ + public void setContents(String sequence, List features) throws CompoundNotFoundException{ setContents(sequence); } @@ -126,13 +125,13 @@ public List getAsList() { public String getSequenceAsString(Integer bioBegin, Integer bioEnd,Strand strand) { - SequenceAsStringHelper sequenceAsStringHelper = new SequenceAsStringHelper(); + SequenceAsStringHelper sequenceAsStringHelper = new SequenceAsStringHelper<>(); return sequenceAsStringHelper.getSequenceAsString(this.parsedCompounds, compoundSet, bioBegin, bioEnd, strand); } @Override public SequenceView getSubSequence(final Integer bioBegin, final Integer bioEnd) { - return new SequenceProxyView(StringProxySequenceReader.this,bioBegin,bioEnd); + return new SequenceProxyView<>(StringProxySequenceReader.this,bioBegin,bioEnd); } @Override diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java index 4ca7204bbd..38feabdbf5 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java @@ -79,7 +79,7 @@ public class UniprotProxySequenceReader implements ProxySequ private static String uniprotDirectoryCache = null; private String sequence; private CompoundSet compoundSet; - private List parsedCompounds = new ArrayList(); + private List parsedCompounds = new ArrayList<>(); Document uniprotDoc; /** @@ -120,12 +120,11 @@ public UniprotProxySequenceReader(Document document, CompoundSet compoundSet) * @param xml * @param compoundSet * @return UniprotProxySequenceReader - * @throws Exception */ public static UniprotProxySequenceReader parseUniprotXMLString(String xml, CompoundSet compoundSet) { try { Document document = XMLHelper.inputStreamToDocument(new ByteArrayInputStream(xml.getBytes())); - return new UniprotProxySequenceReader(document, compoundSet); + return new UniprotProxySequenceReader<>(document, compoundSet); } catch (Exception e) { logger.error("Exception on xml parse of: {}", xml); } @@ -281,7 +280,7 @@ public SequenceView getInverse() { * @return */ public String getSequenceAsString(Integer bioBegin, Integer bioEnd, Strand strand) { - SequenceAsStringHelper sequenceAsStringHelper = new SequenceAsStringHelper(); + SequenceAsStringHelper sequenceAsStringHelper = new SequenceAsStringHelper<>(); return sequenceAsStringHelper.getSequenceAsString(this.parsedCompounds, compoundSet, bioBegin, bioEnd, strand); } @@ -293,7 +292,7 @@ public String getSequenceAsString(Integer bioBegin, Integer bioEnd, Strand stran */ @Override public SequenceView getSubSequence(final Integer bioBegin, final Integer bioEnd) { - return new SequenceProxyView(UniprotProxySequenceReader.this, bioBegin, bioEnd); + return new SequenceProxyView<>(UniprotProxySequenceReader.this, bioBegin, bioEnd); } /** @@ -340,14 +339,14 @@ public AccessionID getAccession() { * @return * @throws XPathExpressionException */ - public ArrayList getAccessions() throws XPathExpressionException { - ArrayList accessionList = new ArrayList(); + public List getAccessions() throws XPathExpressionException { + List accessionList = new ArrayList<>(); if (uniprotDoc == null) { return accessionList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); - ArrayList keyWordElementList = XMLHelper.selectElements(entryElement, "accession"); + List keyWordElementList = XMLHelper.selectElements(entryElement, "accession"); for (Element element : keyWordElementList) { AccessionID accessionID = new AccessionID(element.getTextContent(), DataSource.UNIPROT); accessionList.add(accessionID); @@ -363,7 +362,7 @@ public ArrayList getAccessions() throws XPathExpressionException { * @return * @throws XPathExpressionException */ - public ArrayList getAliases() throws XPathExpressionException { + public List getAliases() throws XPathExpressionException { return getProteinAliases(); } @@ -372,8 +371,8 @@ public ArrayList getAliases() throws XPathExpressionException { * @return * @throws XPathExpressionException */ - public ArrayList getProteinAliases() throws XPathExpressionException { - ArrayList aliasList = new ArrayList(); + public List getProteinAliases() throws XPathExpressionException { + List aliasList = new ArrayList<>(); if (uniprotDoc == null) { return aliasList; } @@ -381,7 +380,7 @@ public ArrayList getProteinAliases() throws XPathExpressionException { Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); Element proteinElement = XMLHelper.selectSingleElement(entryElement, "protein"); - ArrayList keyWordElementList; + List keyWordElementList; getProteinAliasesFromNameGroup(aliasList, proteinElement); keyWordElementList = XMLHelper.selectElements(proteinElement, "component"); @@ -439,9 +438,9 @@ public ArrayList getProteinAliases() throws XPathExpressionException { * @param proteinElement * @throws XPathExpressionException */ - private void getProteinAliasesFromNameGroup(ArrayList aliasList, Element proteinElement) + private void getProteinAliasesFromNameGroup(List aliasList, Element proteinElement) throws XPathExpressionException { - ArrayList keyWordElementList = XMLHelper.selectElements(proteinElement, "alternativeName"); + List keyWordElementList = XMLHelper.selectElements(proteinElement, "alternativeName"); for (Element element : keyWordElementList) { getProteinAliasesFromElement(aliasList, element); } @@ -457,7 +456,7 @@ private void getProteinAliasesFromNameGroup(ArrayList aliasList, Element * @param element * @throws XPathExpressionException */ - private void getProteinAliasesFromElement(ArrayList aliasList, Element element) + private void getProteinAliasesFromElement(List aliasList, Element element) throws XPathExpressionException { Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName"); aliasList.add(fullNameElement.getTextContent()); @@ -475,16 +474,16 @@ private void getProteinAliasesFromElement(ArrayList aliasList, Element e * @return * @throws XPathExpressionException */ - public ArrayList getGeneAliases() throws XPathExpressionException { - ArrayList aliasList = new ArrayList(); + public List getGeneAliases() throws XPathExpressionException { + List aliasList = new ArrayList<>(); if (uniprotDoc == null) { return aliasList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); - ArrayList proteinElements = XMLHelper.selectElements(entryElement, "gene"); + List proteinElements = XMLHelper.selectElements(entryElement, "gene"); for(Element proteinElement : proteinElements) { - ArrayList keyWordElementList = XMLHelper.selectElements(proteinElement, "name"); + List keyWordElementList = XMLHelper.selectElements(proteinElement, "name"); for (Element element : keyWordElementList) { aliasList.add(element.getTextContent()); } @@ -609,7 +608,7 @@ private StringBuilder fetchUniprotXML(String uniprotURL) StringBuilder sb = new StringBuilder(); URL uniprot = new URL(uniprotURL); int attempt = 5; - List errorCodes = new ArrayList(); + List errorCodes = new ArrayList<>(); while(attempt > 0) { HttpURLConnection uniprotConnection = openURLConnection(uniprot); int statusCode = uniprotConnection.getResponseCode(); @@ -774,8 +773,8 @@ public String getOrganismName() { * @return */ @Override - public ArrayList getKeyWords() { - ArrayList keyWordsList = new ArrayList(); + public List getKeyWords() { + List keyWordsList = new ArrayList<>(); if (uniprotDoc == null) { return keyWordsList; } @@ -783,13 +782,13 @@ public ArrayList getKeyWords() { Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); - ArrayList keyWordElementList = XMLHelper.selectElements(entryElement, "keyword"); + List keyWordElementList = XMLHelper.selectElements(entryElement, "keyword"); for (Element element : keyWordElementList) { keyWordsList.add(element.getTextContent()); } } catch (XPathExpressionException e) { logger.error("Problems while parsing keywords in UniProt XML: {}. No keywords will be available.",e.getMessage()); - return new ArrayList(); + return new ArrayList<>(); } return keyWordsList; @@ -809,17 +808,17 @@ public Map> getDatabaseReferences() { try { Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); - ArrayList dbreferenceElementList = XMLHelper.selectElements(entryElement, "dbReference"); + List dbreferenceElementList = XMLHelper.selectElements(entryElement, "dbReference"); for (Element element : dbreferenceElementList) { String type = element.getAttribute("type"); String id = element.getAttribute("id"); List idlist = databaseReferencesHashMap.get(type); if (idlist == null) { - idlist = new ArrayList(); + idlist = new ArrayList<>(); databaseReferencesHashMap.put(type, idlist); } DBReferenceInfo dbreferenceInfo = new DBReferenceInfo(type, id); - ArrayList propertyElementList = XMLHelper.selectElements(element, "property"); + List propertyElementList = XMLHelper.selectElements(element, "property"); for (Element propertyElement : propertyElementList) { String propertyType = propertyElement.getAttribute("type"); String propertyValue = propertyElement.getAttribute("value"); 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 17a1bdefc7..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 @@ -153,7 +153,7 @@ public Location parse(String locationString) { private List parseLocationString(String string, int versus) { Matcher m; - List boundedLocationsCollection = new ArrayList(); + List boundedLocationsCollection = new ArrayList<>(); List tokens = splitString(string); for (String t : tokens) { @@ -167,7 +167,7 @@ private List parseLocationString(String string, int versus) { if (!splitQualifier.isEmpty()) { //recursive case - int localVersus = splitQualifier.equalsIgnoreCase("complement") ? -1 : 1; + int localVersus = "complement".equalsIgnoreCase(splitQualifier) ? -1 : 1; List subLocations = parseLocationString( splitString, versus * localVersus); @@ -187,13 +187,13 @@ private List parseLocationString(String string, int versus) { max ); - if (splitQualifier.equalsIgnoreCase("join")) { + if ("join".equalsIgnoreCase(splitQualifier)) { motherLocation = new InsdcLocations.GroupLocation(subLocations); } - if (splitQualifier.equalsIgnoreCase("order")) { + if ("order".equalsIgnoreCase(splitQualifier)) { motherLocation = new InsdcLocations.OrderLocation(subLocations); } - if (splitQualifier.equalsIgnoreCase("bond")) { + if ("bond".equalsIgnoreCase(splitQualifier)) { motherLocation = new InsdcLocations.BondLocation(subLocations); } motherLocation.setStrand(getGroupLocationStrand(subLocations)); @@ -251,16 +251,18 @@ private List parseLocationString(String string, int versus) { } - if(m.group(4) != null && m.group(4).equals("^")) l.setBetweenCompounds(true); + if("^".equals(m.group(4))) l.setBetweenCompounds(true); - if (m.group(2).equals("<")) { + if ("<".equals(m.group(2))) { l.setPartialOn5prime(true); } - if (m.group(5) != null && (m.group(5).equals(">") || m.group(7).equals(">"))) { + if (m.group(5) != null && (">".equals(m.group(5)) || ">".equals(m.group(7)))) { 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); @@ -272,7 +274,7 @@ private List parseLocationString(String string, int versus) { private List splitString(String input) { - List result = new ArrayList(); + List result = new ArrayList<>(); int start = 0; int openedParenthesis = 0; for (int current = 0; current < input.length(); current++) { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java index efb02f6c64..38f96d7d08 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java @@ -113,7 +113,7 @@ public static Location location(int start, int end, Strand strand, int length) { * other location builder this allows you to express your input * location on the reverse strand * - * @param location The location which currently expresses the outer + * @param start The location which currently expresses the outer * bounds of a circular location. * @param length The length of the circular genomic unit * @return The circular location; can optionally return a normal non @@ -153,7 +153,7 @@ public static Location circularLocation(int start, int end, Strand strand, int l end = (length * (numberOfPasses + 1)) + modEnd; } - List locations = new ArrayList(); + List locations = new ArrayList<>(); locations.add(new SimpleLocation(modStart, length, strand)); for (int i = 0; i < numberOfPasses; i++) { locations.add(new SimpleLocation(1, length, strand)); @@ -283,7 +283,7 @@ public static boolean detectCicular(List subLocations) { * @return Returns a boolean indicating if this is consistently accessioned */ public static boolean consistentAccessions(List subLocations) { - Set set = new HashSet(); + Set set = new HashSet<>(); for(Location sub: subLocations) { set.add(sub.getAccession()); } @@ -307,7 +307,7 @@ public static Strand detectStrand(List subLocations) { } /** - * Assumes that the first element is the start & clones it + * Assumes that the first element is the start & clones it */ public static Point detectStart(List subLocations) { return subLocations.get(0).getStart().clonePoint(); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/SequenceLocation.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/SequenceLocation.java index 443f7d9f06..beb03e3be7 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/SequenceLocation.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/SequenceLocation.java @@ -31,7 +31,7 @@ import java.util.List; /** * A location in a sequence that keeps a reference to its parent sequence - * @author Scooter Willis + * @author Scooter Willis * @author Paolo Pavan */ public class SequenceLocation, C extends Compound> extends SimpleLocation { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java index efe1cc6d6f..03dcf54a74 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java @@ -224,7 +224,7 @@ public Iterator iterator() { list = getSubLocations(); } else { - list = new ArrayList(); + list = new ArrayList<>(); list.add(this); } return list.iterator(); @@ -245,7 +245,7 @@ public List getRelevantSubLocations() { * Here to allow for recursion */ private List getAllSubLocations(Location location) { - List flatSubLocations = new ArrayList(); + List flatSubLocations = new ArrayList<>(); for (Location l : location.getSubLocations()) { if (l.isComplex()) { flatSubLocations.addAll(getAllSubLocations(l)); @@ -312,11 +312,11 @@ public boolean isBetweenCompounds() { @Override public Sequence getSubSequence(Sequence sequence) { if(isCircular()) { - List> sequences = new ArrayList>(); + List> sequences = new ArrayList<>(); for(Location l: this) { sequences.add(l.getSubSequence(sequence)); } - return new JoiningSequenceReader(sequence.getCompoundSet(), sequences); + return new JoiningSequenceReader<>(sequence.getCompoundSet(), sequences); } return reverseSequence(sequence.getSubSequence( getStart().getPosition(), getEnd().getPosition())); @@ -328,11 +328,11 @@ public Sequence getSubSequence(Sequence sequence) { @Override public Sequence getRelevantSubSequence(Sequence sequence) { - List> sequences = new ArrayList>(); + List> sequences = new ArrayList<>(); for(Location l: getRelevantSubLocations()) { sequences.add(l.getSubSequence(sequence)); } - return new JoiningSequenceReader(sequence.getCompoundSet(), sequences); + return new JoiningSequenceReader<>(sequence.getCompoundSet(), sequences); } /** @@ -346,12 +346,12 @@ protected Sequence reverseSequence(Sequence sequence) return sequence; } - Sequence reversed = new ReversedSequenceView(sequence); + Sequence reversed = new ReversedSequenceView<>(sequence); // "safe" operation as we have tried to check this if(canComplement(sequence)) { Sequence casted = (Sequence) reversed; ComplementSequenceView complement = - new ComplementSequenceView(casted); + new ComplementSequenceView<>(casted); return (Sequence)complement; } return reversed; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/Location.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/Location.java index 25cdf48f05..266f9a6f1b 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/Location.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/Location.java @@ -71,7 +71,7 @@ public interface Location extends Iterable, Accessioned { /** * Gives access to the sub locations for this location. However this does * not return sub-locations of sub-locations. For that functionality use - * {@link #getAllSubLocations()}. + * {@link #getRelevantSubLocations()}. * * @return A list of a single level of sub-locations */ @@ -107,7 +107,7 @@ public interface Location extends Iterable, Accessioned { * Will return a SequenceReader object which represents the outer bounds * of this Location * - * @param <C> The type of compound to use + * @param The type of compound to use * @param sequence The sequence object to work with * @return The sequence */ @@ -118,7 +118,7 @@ public interface Location extends Iterable, Accessioned { * locations i.e. those locations which are not complex and define the * true Sequence represented * - * @param <C> The type of compound to use + * @param The type of compound to use * @param sequence The sequence object to work with * @return The full assembled sequence */ @@ -166,7 +166,7 @@ public static Location location(int start, int end, Strand strand, int length) { * other location builder this allows you to express your input * location on the reverse strand * - * @param location The location which currently expresses the outer + * @param start The location which currently expresses the outer * bounds of a circular location. * @param length The length of the circular genomic unit * @return The circular location; can optionally return a normal non @@ -206,7 +206,7 @@ public static Location circularLocation(int start, int end, Strand strand, int l end = (length * (numberOfPasses + 1)) + modEnd; } - List locations = new ArrayList(); + List locations = new ArrayList<>(); locations.add(new SimpleLocation(modStart, length, strand)); for (int i = 0; i < numberOfPasses; i++) { locations.add(new SimpleLocation(1, length, strand)); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/AbstractReference.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/AbstractReference.java index 64c9792a0b..3c9958cb5c 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/AbstractReference.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/AbstractReference.java @@ -22,7 +22,7 @@ /** * @since 5.0.0 - * @Author Jim Tang + * @author Jim Tang */ public abstract class AbstractReference implements ReferenceInterface { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/GenbankReference.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/GenbankReference.java index 9e67dcb0fa..ff8db13727 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/GenbankReference.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/GenbankReference.java @@ -24,7 +24,7 @@ * For Genbank format file only. * * @since 5.0.0 - * @Author Jim Tang + * @author Jim Tang */ public class GenbankReference extends AbstractReference { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/ReferenceInterface.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/ReferenceInterface.java index 2c3b8fa457..6c86cca96d 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/ReferenceInterface.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/reference/ReferenceInterface.java @@ -22,7 +22,7 @@ /** * @since 5.0.0 - * @Author Jim Tang + * @author Jim Tang */ public interface ReferenceInterface { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/ArrayListSequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/ArrayListSequenceReader.java index 48ecb8aff4..1cfc068fbb 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/ArrayListSequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/ArrayListSequenceReader.java @@ -39,12 +39,12 @@ /** * Stores a Sequence as a collection of compounds in an ArrayList * - * @param + * @param the compound type */ public class ArrayListSequenceReader implements SequenceReader { private CompoundSet compoundSet; - private ArrayList parsedCompounds = new ArrayList(); + private ArrayList parsedCompounds = new ArrayList<>(); private volatile Integer hashcode = null; @@ -95,7 +95,7 @@ public String getSequenceAsString() { */ public String getSequenceAsString(Integer begin, Integer end, Strand strand) { // TODO Optimise/cache. - SequenceAsStringHelper sequenceAsStringHelper = new SequenceAsStringHelper(); + SequenceAsStringHelper sequenceAsStringHelper = new SequenceAsStringHelper<>(); return sequenceAsStringHelper.getSequenceAsString(this.parsedCompounds, compoundSet, begin, end, strand); } @@ -232,7 +232,7 @@ public void setContents(List list) { */ @Override public SequenceView getSubSequence(final Integer bioBegin, final Integer bioEnd) { - return new SequenceProxyView(ArrayListSequenceReader.this, bioBegin, bioEnd); + return new SequenceProxyView<>(ArrayListSequenceReader.this, bioBegin, bioEnd); } /** diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/BitSequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/BitSequenceReader.java index 4c1f064ea6..8ca85aeec3 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/BitSequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/BitSequenceReader.java @@ -64,7 +64,7 @@ public BitSequenceReader(BitArrayWorker worker, AccessionID accession) { } /** - * Class is immutable & so this is unsupported + * Class is immutable, so this is unsupported */ @Override public void setCompoundSet(CompoundSet compoundSet) { @@ -72,7 +72,7 @@ public void setCompoundSet(CompoundSet compoundSet) { } /** - * Class is immutable & so this is unsupported + * Class is immutable, so this is unsupported */ @Override public void setContents(String sequence) throws CompoundNotFoundException { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/FourBitSequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/FourBitSequenceReader.java index 83f4c5dfd2..49e4c2f8ec 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/FourBitSequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/FourBitSequenceReader.java @@ -114,7 +114,7 @@ protected int compoundsPerDatatype() { @Override protected Map generateCompoundsToIndex() { final CompoundSet cs = getCompoundSet(); - Map map = new HashMap(); + Map map = new HashMap<>(); int index = 0; for (C currentCompound : sortedCompounds(cs)) { C upperCasedCompound = getOptionalUpperCasedCompound(currentCompound, cs); @@ -143,7 +143,7 @@ private C getOptionalUpperCasedCompound(C currentCompound, CompoundSet cs) { } private List sortedCompounds(final CompoundSet cs) { - List compounds = new ArrayList(cs.getAllCompounds()); + List compounds = new ArrayList<>(cs.getAllCompounds()); Collections.sort(compounds, new Comparator() { @@ -165,7 +165,7 @@ public int compare(C o1, C o2) { protected List generateIndexToCompounds() { CompoundSet cs = getCompoundSet(); Map lookup = getCompoundsToIndexLookup(); - Map tempMap = new HashMap(); + Map tempMap = new HashMap<>(); //First get the reverse lookup working for (C compound : lookup.keySet()) { C upperCasedCompound = getOptionalUpperCasedCompound(compound, cs); @@ -174,8 +174,8 @@ protected List generateIndexToCompounds() { } //Then populate the results by going back through the sorted integer keys - List compounds = new ArrayList(); - List keys = new ArrayList(tempMap.keySet()); + List compounds = new ArrayList<>(); + List keys = new ArrayList<>(tempMap.keySet()); Collections.sort(keys); for (Integer key : keys) { compounds.add(tempMap.get(key)); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/JoiningSequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/JoiningSequenceReader.java index a18d406d73..ae1471b52c 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/JoiningSequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/JoiningSequenceReader.java @@ -56,7 +56,7 @@ public class JoiningSequenceReader implements ProxySequenceR private int[] minSequenceIndex; /** - * Allows creation of the store from Vargs Sequence objects. CompoundSet + * Allows creation of the store from Vargs {@link Sequence} objects. CompoundSet * defaults to the first element of the array (assuming there are elements * available during construction otherwise we will throw an illegal * state exception). @@ -66,7 +66,7 @@ public JoiningSequenceReader(Sequence... sequences) { } /** - * Allows creation of the store from List>. CompoundSet + * Allows creation of the store from {@link List>}. CompoundSet * defaults to the first element of the List (assuming there are elements * available during construction otherwise we will throw an illegal * state exception). @@ -86,7 +86,7 @@ public JoiningSequenceReader(CompoundSet compoundSet, List> seque } private List> grepSequences(List> sequences) { - List> seqs = new ArrayList>(); + List> seqs = new ArrayList<>(); for (Sequence s : sequences) { if (s.getLength() != 0) { seqs.add(s); @@ -217,7 +217,7 @@ else if (midMinPosition > position && midMaxPosition > position) { /** * Iterator implementation which attempts to move through the 2D structure - * attempting to skip onto the next sequence as & when it is asked to + * attempting to skip onto the next sequence as & when it is asked to */ @Override 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 995a358ef0..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 @@ -29,7 +29,7 @@ /** * This is a common method that can be used across multiple storage/proxy implementations to * handle Negative strand and other interesting elements of sequence data. - * @author Scooter Willis + * @author Scooter Willis */ public class SequenceAsStringHelper { @@ -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/sequence/storage/SingleCompoundSequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/SingleCompoundSequenceReader.java index 554b7b8361..fd492f1bf9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/SingleCompoundSequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/SingleCompoundSequenceReader.java @@ -146,7 +146,7 @@ public List getAsList() { @Override public SequenceView getSubSequence(Integer start, Integer end) { - return new SequenceProxyView(this, start, end); + return new SequenceProxyView<>(this, start, end); } /** @@ -168,7 +168,7 @@ public AccessionID getAccession() { } /** - * Delegates to {@link SequenceMixin#countCompounds(org.biojava.nbio.core.sequence.template.Sequence, C[]) } + * Delegates to {@link SequenceMixin#countCompounds} */ @Override @@ -182,7 +182,7 @@ public int countCompounds(C... compounds) { @Override public Iterator iterator() { - return new SequenceMixin.SequenceIterator(this); + return new SequenceMixin.SequenceIterator<>(this); } @Override diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/TwoBitSequenceReader.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/TwoBitSequenceReader.java index c73482d04b..6384638557 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/TwoBitSequenceReader.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/storage/TwoBitSequenceReader.java @@ -114,22 +114,17 @@ protected int compoundsPerDatatype() { * Returns a Map which encodes TCAG into positions 0,1,2,3. */ @Override - @SuppressWarnings("serial") protected Map generateCompoundsToIndex() { final CompoundSet cs = getCompoundSet(); - return new HashMap() { - - { - put(cs.getCompoundForString("T"), 0); - put(cs.getCompoundForString("C"), 1); - put(cs.getCompoundForString("A"), 2); - put(cs.getCompoundForString("G"), 3); - put(cs.getCompoundForString("t"), 0); - put(cs.getCompoundForString("c"), 1); - put(cs.getCompoundForString("a"), 2); - put(cs.getCompoundForString("g"), 3); - } - }; + return Map.of( + cs.getCompoundForString("T"), 0, + cs.getCompoundForString("C"), 1, + cs.getCompoundForString("A"), 2, + cs.getCompoundForString("G"), 3, + cs.getCompoundForString("t"), 0, + cs.getCompoundForString("c"), 1, + cs.getCompoundForString("a"), 2, + cs.getCompoundForString("g"), 3); } /** @@ -138,10 +133,9 @@ protected Map generateCompoundsToIndex() { @Override protected List generateIndexToCompounds() { CompoundSet cs = getCompoundSet(); - List result = new ArrayList(); + List result = new ArrayList<>(); result.add( cs.getCompoundForString("T")); - result.add( cs.getCompoundForString("C")); result.add( cs.getCompoundForString("A")); result.add( cs.getCompoundForString("G")); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractCompoundSet.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractCompoundSet.java index 579153a2fd..f7be44c572 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractCompoundSet.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractCompoundSet.java @@ -39,11 +39,11 @@ public abstract class AbstractCompoundSet implements Compoun private final static Logger logger = LoggerFactory.getLogger(AbstractCompoundSet.class); - private Map charSeqToCompound = new HashMap(); + private Map charSeqToCompound = new HashMap<>(); private int maxCompoundCharSequenceLength = -1; private Boolean compoundStringLengthEqual = null; - Map> equivalentsMap = new HashMap>(); + Map> equivalentsMap = new HashMap<>(); protected void addCompound(C compound, C lowerCasedCompound, Iterable equivalents) { addCompound(compound); @@ -61,7 +61,7 @@ protected void addCompound(C compound, C lowerCasedCompound, Iterable equival } protected void addCompound(C compound, C lowerCasedCompound, C... equivalents) { - List equiv = new ArrayList(equivalents.length); + List equiv = new ArrayList<>(equivalents.length); equiv.addAll(Arrays.asList(equivalents)); addCompound(compound, lowerCasedCompound, equiv); } @@ -69,7 +69,7 @@ protected void addCompound(C compound, C lowerCasedCompound, C... equivalents) { protected void addEquivalent(C compound, C equivalent) { Set s = equivalentsMap.get(compound); if ( s == null){ - s = new HashSet(); + s = new HashSet<>(); equivalentsMap.put(compound, s); } @@ -170,7 +170,7 @@ public boolean isValidSequence(Sequence sequence) { @Override public List getAllCompounds() { - return new ArrayList(charSeqToCompound.values()); + return new ArrayList<>(charSeqToCompound.values()); } private void assertCompound(C compound) { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractCompoundTranslator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractCompoundTranslator.java index e11af2b1de..3320a5edc6 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractCompoundTranslator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractCompoundTranslator.java @@ -37,7 +37,7 @@ public abstract class AbstractCompoundTranslator creator, CompoundSet fromCompoundSet, CompoundSet toCompoundSet) { this.creator = creator; - this.mapper = new HashMap>(); + this.mapper = new HashMap<>(); this.fromCompoundSet = fromCompoundSet; this.toCompoundSet = toCompoundSet; } @@ -66,7 +66,7 @@ protected void addCompounds(F source, T... targets) { List l = mapper.get(source); if ( l == null) { - l = new ArrayList(); + l = new ArrayList<>(); mapper.put(source, l); } l.addAll(Arrays.asList(targets)); @@ -97,7 +97,7 @@ else if (compounds.size() > 1) { @Override public List> createSequences(Sequence originalSequence) { - List> workingList = new ArrayList>(); + List> workingList = new ArrayList<>(); for (F source : originalSequence) { List compounds = translateMany(source); @@ -126,7 +126,7 @@ public List> createSequences(Sequence originalSequence) { protected void addCompoundsToList(List compounds, List> workingList) { int size = compounds.size(); - List> currentWorkingList = new ArrayList>(); + List> currentWorkingList = new ArrayList<>(); for (int i = 0; i < size; i++) { boolean last = (i == (size - 1)); // If last run we add the compound to the top set of lists & then @@ -147,7 +147,7 @@ protected void addCompoundsToList(List compounds, List> workingList) } protected List> workingListToSequences(List> workingList) { - List> sequences = new ArrayList>(); + List> sequences = new ArrayList<>(); for (List seqList : workingList) { sequences.add(getCreator().getSequence(seqList)); } @@ -155,7 +155,7 @@ protected List> workingListToSequences(List> workingList) { } private List> duplicateList(List> incoming) { - List> outgoing = new ArrayList>(); + List> outgoing = new ArrayList<>(); for (List current : incoming) { outgoing.add(new ArrayList(current)); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractNucleotideCompoundSet.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractNucleotideCompoundSet.java index af6a8768e3..27e9721182 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractNucleotideCompoundSet.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractNucleotideCompoundSet.java @@ -46,7 +46,7 @@ protected void addNucleotideCompound(String base, String complement, String... e C upper = newNucleotideCompound(base.toUpperCase(), complement.toUpperCase(), upperEquivalents); C lower = newNucleotideCompound(base.toLowerCase(), complement.toLowerCase(), lowerEquivalents); - List equivalentCompounds = new ArrayList(); + List equivalentCompounds = new ArrayList<>(); for(int i=0; i> equivalentsMap = new HashMap>(); + Map> equivalentsMap = new HashMap<>(); List ambiguousCompounds = getAllCompounds().stream() .filter(compound -> compound.isAmbiguous()) @@ -116,7 +116,7 @@ private void checkAdd( List listS = equivalentsMap.get(key); if ( listS == null){ - listS = new ArrayList(); + listS = new ArrayList<>(); equivalentsMap.put(key, listS); } listS.add(value); @@ -137,7 +137,7 @@ private NucleotideCompound toLowerCase(NucleotideCompound compound) { * @return The ambiguity symbol which represents this set of nucleotides best */ public NucleotideCompound getAmbiguity(NucleotideCompound... compounds) { - Set settedCompounds = new HashSet(); + Set settedCompounds = new HashSet<>(); for(NucleotideCompound compound: compounds) { for(NucleotideCompound subCompound: compound.getConstituents()) { settedCompounds.add(getCompoundForString(subCompound.getBase().toUpperCase())); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractSequence.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractSequence.java index f68d7614cb..38cf55d09c 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractSequence.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractSequence.java @@ -47,7 +47,7 @@ /** * * The base class for DNA, RNA and Protein sequences. - * @param + * @param the compound type */ public abstract class AbstractSequence implements Sequence { @@ -65,15 +65,15 @@ public abstract class AbstractSequence implements Sequence parentSequence = null; private String source = null; - private ArrayList notesList = new ArrayList(); + private List notesList = new ArrayList<>(); private Double sequenceScore = null; private FeaturesKeyWordInterface featuresKeyWord = null; private DatabaseReferenceInterface databaseReferences = null; private FeatureRetriever featureRetriever = null; - private ArrayList, C>> features = - new ArrayList, C>>(); - private LinkedHashMap, C>>> groupedFeatures = - new LinkedHashMap, C>>>(); + private List, C>> features = + new ArrayList<>(); + private Map, C>>> groupedFeatures = + new LinkedHashMap<>(); private List comments = new ArrayList<>(); private List references; @@ -93,7 +93,7 @@ public AbstractSequence(String seqString, CompoundSet compoundSet) throws Com // so it can be called from subclass constructors protected void initSequenceStorage(String seqString) throws CompoundNotFoundException { - sequenceStorage = new ArrayListSequenceReader(); + sequenceStorage = new ArrayListSequenceReader<>(); sequenceStorage.setCompoundSet(this.getCompoundSet()); sequenceStorage.setContents(seqString); } @@ -139,7 +139,7 @@ public void setProxySequenceReader(SequenceReader proxyLoader) { } // success of next statement guaranteed because source is a compulsory field //DBReferenceInfo dbQualifier = (DBReferenceInfo)ff.get("source").get(0).getQualifiers().get("db_xref"); - ArrayList dbQualifiers = (ArrayList)ff.get("source").get(0).getQualifiers().get("db_xref"); + List dbQualifiers = (ArrayList)ff.get("source").get(0).getQualifiers().get("db_xref"); DBReferenceInfo dbQualifier = dbQualifiers.get(0); if (dbQualifier != null) this.setTaxonomy(new TaxonomyID(dbQualifier.getDatabase()+":"+dbQualifier.getId(), DataSource.UNKNOWN)); @@ -303,14 +303,14 @@ public void removeNote(String note) { /** * @return the notesList */ - public ArrayList getNotesList() { + public List getNotesList() { return notesList; } /** * @param notesList the notesList to set */ - public void setNotesList(ArrayList notesList) { + public void setNotesList(List notesList) { this.notesList = notesList; } @@ -353,8 +353,8 @@ public void setReferences(List references) { * @return */ public List, C>> getFeatures(String featureType, int bioSequencePosition) { - ArrayList, C>> featureHits = - new ArrayList, C>>(); + List, C>> featureHits = + new ArrayList<>(); List, C>> features = getFeaturesByType(featureType); if (features != null) { for (FeatureInterface, C> feature : features) { @@ -372,8 +372,8 @@ public List, C>> getFeatures(String feature * @return */ public List, C>> getFeatures(int bioSequencePosition) { - ArrayList, C>> featureHits = - new ArrayList, C>>(); + List, C>> featureHits = + new ArrayList<>(); if (features != null) { for (FeatureInterface, C> feature : features) { if (bioSequencePosition >= feature.getLocations().getStart().getPosition() && bioSequencePosition <= feature.getLocations().getEnd().getPosition()) { @@ -401,7 +401,7 @@ public List, C>> getFeatures() { */ public void addFeature(int bioStart, int bioEnd, FeatureInterface, C> feature) { SequenceLocation, C> sequenceLocation = - new SequenceLocation, C>(bioStart, bioEnd, this); + new SequenceLocation<>(bioStart, bioEnd, this); feature.setLocation(sequenceLocation); addFeature(feature); } @@ -414,9 +414,9 @@ public void addFeature(int bioStart, int bioEnd, FeatureInterface, C> feature) { features.add(feature); - ArrayList, C>> featureList = groupedFeatures.get(feature.getType()); + List, C>> featureList = groupedFeatures.get(feature.getType()); if (featureList == null) { - featureList = new ArrayList, C>>(); + featureList = new ArrayList<>(); groupedFeatures.put(feature.getType(), featureList); } featureList.add(feature); @@ -430,7 +430,7 @@ public void addFeature(FeatureInterface, C> feature) { */ public void removeFeature(FeatureInterface, C> feature) { features.remove(feature); - ArrayList, C>> featureList = groupedFeatures.get(feature.getType()); + List, C>> featureList = groupedFeatures.get(feature.getType()); if (featureList != null) { featureList.remove(feature); if (featureList.isEmpty()) { @@ -447,7 +447,7 @@ public void removeFeature(FeatureInterface, C> feature) { public List, C>> getFeaturesByType(String type) { List, C>> features = groupedFeatures.get(type); if (features == null) { - features = new ArrayList, C>>(); + features = new ArrayList<>(); } return features; } @@ -609,7 +609,7 @@ private SequenceReader getSequenceStorage() { //return parentSequence.getSequenceStorage(); if ( this.compoundSet.equals(parentSequence.getCompoundSet())){ - sequenceStorage = new ArrayListSequenceReader(); + sequenceStorage = new ArrayListSequenceReader<>(); sequenceStorage.setCompoundSet(this.getCompoundSet()); try { sequenceStorage.setContents(parentSequence.getSequenceAsString()); @@ -706,7 +706,7 @@ public int getLength() { */ @Override public SequenceView getSubSequence(final Integer bioStart, final Integer bioEnd) { - return new SequenceProxyView(this, bioStart, bioEnd); + return new SequenceProxyView<>(this, bioStart, bioEnd); } /** diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/Compound.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/Compound.java index 6dbeda2208..aa04cb8c8a 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/Compound.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/Compound.java @@ -28,21 +28,23 @@ public interface Compound { - public boolean equalsIgnoreCase(Compound compound); + boolean equalsIgnoreCase(Compound compound); - public String getDescription(); + String getDescription(); - public void setDescription(String description); + void setDescription(String description); - public String getShortName(); + String getShortName(); - public void setShortName(String shortName); + void setShortName(String shortName); - public String getLongName(); + String getLongName(); - public void setLongName(String longName); + void setLongName(String longName); - public Float getMolecularWeight(); + Float getMolecularWeight(); - public void setMolecularWeight(Float molecularWeight); + void setMolecularWeight(Float molecularWeight); + + String toString(); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/LightweightProfile.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/LightweightProfile.java index e6f632224b..033fa84e85 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/LightweightProfile.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/LightweightProfile.java @@ -52,7 +52,7 @@ enum StringFormat { * * @param listIndex index of sequence in profile * @return desired sequence - * @throws IndexOutOfBoundsException if listIndex < 1 or listIndex > number of sequences + * @throws IndexOutOfBoundsException if listIndex < 1 or listIndex > number of sequences */ S getAlignedSequence(int listIndex); @@ -68,7 +68,7 @@ enum StringFormat { * * @param alignmentIndex column index within an alignment * @return the sequence elements - * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} + * @throws IndexOutOfBoundsException if alignmentIndex < 1 or alignmentIndex > {@link #getLength()} */ List getCompoundsAt(int alignmentIndex); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java index d6efc03817..a71c9ba6f8 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java @@ -113,7 +113,7 @@ public static int countAT(Sequence sequence) { * sequence. Any compound not in the Map will return a fraction of 0. */ public static Map getDistribution(Sequence sequence) { - Map results = new HashMap(); + Map results = new HashMap<>(); Map composition = getComposition(sequence); double length = sequence.getLength(); for (Map.Entry entry : composition.entrySet()) { @@ -133,7 +133,7 @@ public static Map getDistribution(Sequence se * @return Counts for the instances of all compounds in the sequence */ public static Map getComposition(Sequence sequence) { - Map results = new HashMap(); + Map results = new HashMap<>(); for (C currentCompound : sequence) { Integer currentInteger = results.get(currentCompound); @@ -150,7 +150,7 @@ public static Map getComposition(Sequence se * converting to a full length String and then writing the data out * * @param Type of compound - * @param writer The writer to send data to + * @param appendable The writer to send data to * @param sequence The sequence to write out * @throws IOException Thrown if we encounter a problem */ @@ -187,7 +187,7 @@ public static String toString(Sequence sequence) { * the Compounds of that {@link Sequence}. */ public static List toList(Sequence sequence) { - List list = new ArrayList(sequence.getLength()); + List list = new ArrayList<>(sequence.getLength()); for (C compound : sequence) { list.add(compound); } @@ -229,7 +229,7 @@ public static int lastIndexOf(Sequence sequence, */ public static Iterator createIterator( Sequence sequence) { - return new SequenceIterator(sequence); + return new SequenceIterator<>(sequence); } /** @@ -237,20 +237,20 @@ public static Iterator createIterator( */ public static SequenceView createSubSequence( Sequence sequence, int start, int end) { - return new SequenceProxyView(sequence, start, end); + return new SequenceProxyView<>(sequence, start, end); } /** * Implements sequence shuffling by first materializing the given * {@link Sequence} into a {@link List}, applying * {@link Collections#shuffle(List)} and then returning the shuffled - * elements in a new instance of {@link SequenceBackingStore} which behaves + * elements in a new instance of {@link Sequence} which behaves * as a {@link Sequence}. */ public static Sequence shuffle(Sequence sequence) { List compounds = sequence.getAsList(); Collections.shuffle(compounds); - return new ArrayListSequenceReader(compounds, + return new ArrayListSequenceReader<>(compounds, sequence.getCompoundSet()); } @@ -275,8 +275,8 @@ public static String checksum(Sequence sequence) { * @return The list of non-overlapping K-mers */ public static List> nonOverlappingKmers(Sequence sequence, int kmer) { - List> l = new ArrayList>(); - WindowedSequence w = new WindowedSequence(sequence, kmer); + List> l = new ArrayList<>(); + WindowedSequence w = new WindowedSequence<>(sequence, kmer); for(SequenceView view: w) { l.add(view); } @@ -285,7 +285,7 @@ public static List> nonOverlappingKmers(Seq /** * Used to generate overlapping k-mers such i.e. ATGTA will give rise to - * ATG, TGT & GTA + * ATG, TGT & GTA * * @param Compound to use * @param sequence Sequence to build from @@ -293,9 +293,9 @@ public static List> nonOverlappingKmers(Seq * @return The list of overlapping K-mers */ public static List> overlappingKmers(Sequence sequence, int kmer) { - List> l = new ArrayList>(); + List> l = new ArrayList<>(); List>> windows - = new ArrayList>>(); + = new ArrayList<>(); for(int i=1; i<=kmer; i++) { if(i == 1) { @@ -333,7 +333,7 @@ public static List> overlappingKmers(Sequen */ @SuppressWarnings({ "unchecked" }) public static SequenceView inverse(Sequence sequence) { - SequenceView reverse = new ReversedSequenceView(sequence); + SequenceView reverse = new ReversedSequenceView<>(sequence); if(sequence.getCompoundSet().isComplementable()) { return new ComplementSequenceView(reverse); } @@ -343,7 +343,7 @@ public static SequenceView inverse(Sequence sequence) /** * A case-insensitive manner of comparing two sequence objects together. * We will throw out any compounds which fail to match on their sequence - * length & compound sets used. The code will also bail out the moment + * length & compound sets used. The code will also bail out the moment * we find something is wrong with a Sequence. Cost to run is linear to * the length of the Sequence. * @@ -359,7 +359,7 @@ public static boolean sequenceEqualityIgnoreCase(Sequence getCompoundSet() { @Override public SequenceView getSubSequence(final Integer bioStart, final Integer bioEnd) { - return new SequenceProxyView(this, bioStart, bioEnd); + return new SequenceProxyView<>(this, bioStart, bioEnd); } @Override public Iterator iterator() { - return new SequenceMixin.SequenceIterator(this); + return new SequenceMixin.SequenceIterator<>(this); } @Override diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/DNAToRNATranslator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/DNAToRNATranslator.java index 0016c86507..baafa9419d 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/DNAToRNATranslator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/DNAToRNATranslator.java @@ -65,7 +65,7 @@ public DNAToRNATranslator(SequenceCreatorInterface rnaCreato @Override public List> createSequences(Sequence originalSequence) { if(shortCutTranslation) { - List> result = new ArrayList>(1); + List> result = new ArrayList<>(1); result.add(wrapToRna(originalSequence)); return result; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/Frame.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/Frame.java index 8f35c0eb03..eb0f4a91c6 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/Frame.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/Frame.java @@ -83,7 +83,7 @@ public static Frame[] getAllFrames() { public Sequence wrap(Sequence incoming) { Sequence reversed; if(reverse) { - reversed = new ComplementSequenceView(new ReversedSequenceView(incoming)); + reversed = new ComplementSequenceView<>(new ReversedSequenceView(incoming)); } else { reversed = incoming; diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/RNAToAminoAcidTranslator.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/RNAToAminoAcidTranslator.java index e748b41387..f6d9f7ca84 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/RNAToAminoAcidTranslator.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/RNAToAminoAcidTranslator.java @@ -81,9 +81,9 @@ public RNAToAminoAcidTranslator( this.initMetOnly = initMetOnly; this.translateNCodons = translateNCodons; - quickLookup = new HashMap(codons + quickLookup = new HashMap<>(codons .getAllCompounds().size()); - aminoAcidToCodon = new HashMap>(); + aminoAcidToCodon = new HashMap<>(); List codonList = table.getCodons(nucleotides, aminoAcids); for (Codon codon : codonList) { @@ -92,7 +92,7 @@ public RNAToAminoAcidTranslator( List codonL = aminoAcidToCodon.get(codon.getAminoAcid()); if (codonL == null) { - codonL = new ArrayList(); + codonL = new ArrayList<>(); aminoAcidToCodon.put(codon.getAminoAcid(), codonL); } codonL.add(codon); @@ -114,7 +114,7 @@ public RNAToAminoAcidTranslator( public List> createSequences( Sequence originalSequence) { - List> workingList = new ArrayList>(); + List> workingList = new ArrayList<>(); Iterable> iter = new WindowedSequence( originalSequence, 3); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/Table.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/Table.java index 7d75a10d6a..bb86de83c9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/Table.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/Table.java @@ -57,8 +57,8 @@ CompoundSet getCodonCompoundSet( /** * Instance of a Codon which is 3 {@link NucleotideCompound}s, its * corresponding {@link AminoAcidCompound} and if it is a start or stop codon. - * The object implements hashCode & equals but according to the nucleotide - * compounds & not to the designation of it being a start, stop & amino + * The object implements hashCode & equals but according to the nucleotide + * compounds & not to the designation of it being a start, stop & amino * acid compound * * @author ayates diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/TranscriptionEngine.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/TranscriptionEngine.java index 0ca5bc6f1a..f79bd0465e 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/TranscriptionEngine.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/TranscriptionEngine.java @@ -39,7 +39,7 @@ * Protein sequence. * * In order to build one look at @ TranscriptionEngine.Builder} which provides - * intelligent defaults & allows you to build an engine which is nearly the same + * intelligent defaults and allows you to build an engine which is nearly the same * as the default one but with a few changes. All of the engine is customisable. * * By default the code will attempt to: @@ -48,7 +48,7 @@ *
  • Trim Stops
  • *
  • Convert initiating codons to M
  • *
  • Allow for the fuzzy translation of Codons i.e. if it contains an N that - * produces a {@link Sequence}<{@link{AminoAcidCompound}> with an X at + * produces a {@link Sequence} with an X at * that position * * @@ -125,7 +125,7 @@ public Sequence translate( */ public Map> multipleFrameTranslation( Sequence dna, Frame... frames) { - Map> results = new EnumMap>( + Map> results = new EnumMap<>( Frame.class); for (Frame frame : frames) { Sequence rna = getDnaRnaTranslator() @@ -170,7 +170,7 @@ public CompoundSet getAminoAcidCompounds() { } /** - * This class is the way to create a {@link TranslationEngine}. + * This class is the way to create a {@link TranscriptionEngine}. */ public static class Builder { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/views/RnaSequenceView.java b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/views/RnaSequenceView.java index b0c00d6a60..cdb08052fd 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/sequence/views/RnaSequenceView.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/sequence/views/RnaSequenceView.java @@ -90,9 +90,9 @@ public Map getDnaToRna() { protected void buildTranslators() { Map localDnaToRna = - new HashMap(); + new HashMap<>(); Map localRnaToDna = - new HashMap(); + new HashMap<>(); NucleotideCompound thymine = getViewedSequence().getCompoundSet().getCompoundForString("T"); 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/FileDownloadUtils.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java index 8c3a691e0f..0b132b180e 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java @@ -22,7 +22,6 @@ package org.biojava.nbio.core.util; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FilenameFilter; @@ -34,13 +33,8 @@ import java.net.URL; import java.net.URLConnection; import java.nio.channels.Channels; -import java.nio.channels.FileChannel; import java.nio.channels.ReadableByteChannel; -import java.nio.file.FileVisitResult; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.SimpleFileVisitor; +import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; import java.util.Scanner; @@ -57,39 +51,6 @@ public enum Hash{ MD5, SHA1, SHA256, UNKNOWN } - /** - * Copy the content of file src to dst TODO since java 1.7 this is provided - * in java.nio.file.Files - * - * @param src - * @param dst - * @throws IOException - */ - @SuppressWarnings("resource") - public static void copy(File src, File dst) throws IOException { - - // Took following recipe from - // http://stackoverflow.com/questions/106770/standard-concise-way-to-copy-a-file-in-java - // The nio package seems to be the most efficient way to copy a file - FileChannel source = null; - FileChannel destination = null; - - try { - // we need the supress warnings here (the warning that the stream is not closed is harmless) - // see http://stackoverflow.com/questions/12970407/does-filechannel-close-close-the-underlying-stream - source = new FileInputStream(src).getChannel(); - destination = new FileOutputStream(dst).getChannel(); - destination.transferFrom(source, 0, source.size()); - } finally { - if (source != null) { - source.close(); - } - if (destination != null) { - destination.close(); - } - } - } - /** * Gets the file extension of a file, excluding '.'. * If the file name has no extension the file name is returned. @@ -100,7 +61,7 @@ public static String getFileExtension(File f) { String fileName = f.getName(); String ext = ""; int mid = fileName.lastIndexOf("."); - ext = fileName.substring(mid + 1, fileName.length()); + ext = fileName.substring(mid + 1); return ext; } @@ -165,7 +126,7 @@ public static void downloadFile(URL url, File destination) throws IOException { } logger.debug("Copying temp file [{}] to final location [{}]", tempFile, destination); - copy(tempFile, destination); + Files.copy(tempFile.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING); // delete the tmp file tempFile.delete(); @@ -210,15 +171,14 @@ public static void createValidationFiles(URL url, File localDestination, URL has public static void createValidationFiles(URLConnection resourceUrlConnection, File localDestination, URL hashURL, Hash hash){ long size = resourceUrlConnection.getContentLengthLong(); if(size == -1) { - logger.warn("could not find expected file size for resource {}.", resourceUrlConnection.getURL()); + logger.debug("Could not find expected file size for resource {}. Size validation metadata file won't be available for this download.", resourceUrlConnection.getURL()); } else { - logger.debug("Content-Length: " + size); + logger.debug("Content-Length: {}", size); File sizeFile = new File(localDestination.getParentFile(), localDestination.getName() + SIZE_EXT); try (PrintStream sizePrintStream = new PrintStream(sizeFile)) { sizePrintStream.print(size); - sizePrintStream.close(); } catch (FileNotFoundException e) { - logger.warn("could not write size validation file due to exception: {}", e.getMessage()); + logger.warn("Could not write size validation metadata file due to exception: {}", e.getMessage()); } } @@ -231,7 +191,7 @@ public static void createValidationFiles(URLConnection resourceUrlConnection, Fi File hashFile = new File(localDestination.getParentFile(), String.format("%s%s_%s", localDestination.getName(), HASH_EXT, hash)); downloadFile(hashURL, hashFile); } catch (IOException e) { - logger.warn("could not write validation hash file due to exception: {}", e.getMessage()); + logger.warn("Could not write validation hash file due to exception: {}", e.getMessage()); } } @@ -252,24 +212,20 @@ public static void createValidationFiles(URLConnection resourceUrlConnection, Fi public static boolean validateFile(File localFile) { File sizeFile = new File(localFile.getParentFile(), localFile.getName() + SIZE_EXT); if(sizeFile.exists()) { - Scanner scanner = null; - try { - scanner = new Scanner(sizeFile); - long expectedSize = scanner.nextLong(); - long actualLSize = localFile.length(); - if (expectedSize != actualLSize) { - logger.warn("File [{}] size ({}) does not match expected size ({}).", localFile, actualLSize, expectedSize); - return false; - } - } catch (FileNotFoundException e) { - logger.warn("could not validate size of file [{}] because no size metadata file exists.", localFile); - } finally { - scanner.close(); - } + try (Scanner scanner = new Scanner(sizeFile)) { + long expectedSize = scanner.nextLong(); + long actualSize = localFile.length(); + if (expectedSize != actualSize) { + logger.warn("File [{}] size ({}) does not match expected size ({}).", localFile, actualSize, expectedSize); + return false; + } + } catch (FileNotFoundException e) { + logger.warn("could not validate size of file [{}] because no size metadata file exists.", localFile); + } } File[] hashFiles = localFile.getParentFile().listFiles(new FilenameFilter() { - String hashPattern = String.format("%s%s_(%s|%s|%s)", localFile.getName(), HASH_EXT, Hash.MD5, Hash.SHA1, Hash.SHA256); + final String hashPattern = String.format("%s%s_(%s|%s|%s)", localFile.getName(), HASH_EXT, Hash.MD5, Hash.SHA1, Hash.SHA256); @Override public boolean accept(File dir, String name) { return name.matches(hashPattern); @@ -380,8 +336,8 @@ public static boolean ping(String url, int timeout) { * *

    * - * NB. User should execute connect() method before getting input - * stream. + * NB. User should execute connect() method before getting input + * stream. * @return * @throws IOException * @author Jacek Grzebyta @@ -394,14 +350,14 @@ public static URLConnection prepareURLConnection(String url, int timeout) throws } /** - * Recursively delete a folder & contents + * Recursively delete a folder & contents * * @param dir directory to delete */ public static void deleteDirectory(Path dir) throws IOException { if(dir == null || !Files.exists(dir)) return; - Files.walkFileTree(dir, new SimpleFileVisitor() { + Files.walkFileTree(dir, new SimpleFileVisitor<>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); @@ -419,7 +375,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOExce }); } /** - * Recursively delete a folder & contents + * Recursively delete a folder & contents * * @param dir directory to delete */ diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/FlatFileCache.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/FlatFileCache.java index 6808ef01fb..5df00ea661 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/FlatFileCache.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/FlatFileCache.java @@ -48,7 +48,7 @@ public class FlatFileCache { /** * The cache singleton. */ - private static SoftHashMap cache = new SoftHashMap(0); + private static SoftHashMap cache = new SoftHashMap<>(0); // no public constructor; @@ -58,7 +58,7 @@ private FlatFileCache(){ /** * The file is read and the bytes stored immediately. - *

    + *

    * Once added, {@code fileToCache} can be modified or deleted and the cached values will not change. * @param key * @param fileToCache A readable file, of Integer.MAX bytes length or less. @@ -123,7 +123,7 @@ public static InputStream getInputStream(String key){ /** * Returns the number of items in the cache. - * If the cache is {@}, returns -1 + * If the cache is empty, returns -1 * @return */ public static int size() { diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/InputStreamProvider.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/InputStreamProvider.java index f5977407e4..f9b9941286 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/InputStreamProvider.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/InputStreamProvider.java @@ -71,7 +71,7 @@ public InputStreamProvider() { cacheRawFiles = false; String prop = System.getProperty(CACHE_PROPERTY); - if ( prop != null && prop.equals("true")) { + if ( "true".equals(prop)) { cacheRawFiles = true; } @@ -119,7 +119,7 @@ private int getMagicNumber(InputStream in) public InputStream getInputStream(URL u) throws IOException{ - if (u.getProtocol().equals("file")) { + if ("file".equals(u.getProtocol())) { try { return getInputStream(new File(u.toURI().getPath())); } catch (URISyntaxException e) { 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 27485db5f5..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 @@ -41,10 +41,10 @@ public class PrettyXMLWriter implements XMLWriter { private boolean afterNewline = true; private int indent = 0; - private Map namespacePrefixes = new HashMap(); + private Map namespacePrefixes = new HashMap<>(); private int namespaceSeed = 0; - private LinkedList> namespaceBindings = new LinkedList>(); - private List namespacesDeclared = new ArrayList(); + private LinkedList> namespaceBindings = new LinkedList<>(); + private List namespacesDeclared = new ArrayList<>(); public PrettyXMLWriter(PrintWriter writer) { this.writer = writer; @@ -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)) { @@ -113,7 +113,7 @@ private String allocPrefix(String nsURI) { namespacePrefixes.put(nsURI, prefix); List bindings = namespaceBindings.getLast(); if (bindings == null) { - bindings = new ArrayList(); + bindings = new ArrayList<>(); namespaceBindings.removeLast(); namespaceBindings.add(bindings); } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/SingleLinkageClusterer.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/SingleLinkageClusterer.java index 7c4b15f65a..ad252374d9 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/SingleLinkageClusterer.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/SingleLinkageClusterer.java @@ -87,7 +87,7 @@ public String toString() { //private Set toSkip; - private ArrayList indicesToCheck; + private List indicesToCheck; /** @@ -135,7 +135,7 @@ private void clusterIt() { dendrogram = new LinkedPair[numItems-1]; - logger.debug("Initial matrix: \n"+matrixToString()); + logger.debug("Initial matrix: \n{}", matrixToString()); for (int m=0;m(numItems); + indicesToCheck = new ArrayList<>(numItems); for (int i=0;i> getClusters(double cutoff) { clusterIt(); } - Map> clusters = new TreeMap>(); + Map> clusters = new TreeMap<>(); int clusterId = 1; @@ -276,7 +276,7 @@ public Map> getClusters(double cutoff) { if (firstClusterId==-1 && secondClusterId==-1) { // neither member is in a cluster yet, let's assign a new cluster and put them both in - Set members = new TreeSet(); + Set members = new TreeSet<>(); members.add(dendrogram[i].getFirst()); members.add(dendrogram[i].getSecond()); clusters.put(clusterId, members); @@ -309,17 +309,17 @@ public Map> getClusters(double cutoff) { } } - logger.debug("Within cutoff: "+dendrogram[i]); + logger.debug("Within cutoff: {}", dendrogram[i]); } else { - logger.debug("Not within cutoff: "+dendrogram[i]); + logger.debug("Not within cutoff: {}", dendrogram[i]); } } // reassigning cluster numbers by creating a new map (there can be gaps in the numbering if cluster-joining happened) - Map> finalClusters = new TreeMap>(); + Map> finalClusters = new TreeMap<>(); int newClusterId = 1; for (int oldClusterId:clusters.keySet()) { finalClusters.put(newClusterId, clusters.get(oldClusterId)); @@ -336,7 +336,7 @@ public Map> getClusters(double cutoff) { } } if (!isAlreadyClustered) { - Set members = new TreeSet(); + Set members = new TreeSet<>(); members.add(i); finalClusters.put(newClusterId, members); newClusterId++; @@ -344,7 +344,7 @@ public Map> getClusters(double cutoff) { } - logger.debug("Clusters: \n"+clustersToString(finalClusters)); + logger.debug("Clusters: \n{}", clustersToString(finalClusters)); return finalClusters; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/SoftHashMap.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/SoftHashMap.java index b0ac87519c..2c10948b55 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/SoftHashMap.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/SoftHashMap.java @@ -31,13 +31,16 @@ import org.slf4j.LoggerFactory; -/** A in memory cache using soft references. (can be garbage collected) +/** + * An in memory cache using soft references. (can be garbage collected) * This code is based on: http://java-interview-faqs.blogspot.com/2008/09/building-faster-and-efficient-cache.html - *

    + *

    * Note that entrySet() is not implemented and therefore many methods such as keySet(), * containsKey(), values() etc do not work. - *

    + *

    * This class is therefore best used as a cache simply to put and get items by a known key + * @param the key type + * @param the value type */ public class SoftHashMap extends AbstractMap { @@ -46,16 +49,16 @@ public class SoftHashMap extends AbstractMap { public static final int DEFAULT_LIMIT = 1; /** The internal HashMap that stores SoftReference to actual data. */ - private final Map> map = new HashMap>(); + private final Map> map = new HashMap<>(); /** Maximum Number of references you dont want GC to collect. */ private final int max_limit; /** The FIFO list of hard references, order of last access. */ - private final LinkedList hardCache = new LinkedList(); + private final LinkedList hardCache = new LinkedList<>(); /** Reference queue for cleared SoftReference objects. */ - private final ReferenceQueue queue = new ReferenceQueue(); + private final ReferenceQueue queue = new ReferenceQueue<>(); public SoftHashMap() { this(1000); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java index 1fe985d0ba..1ddadf695c 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/StringManipulationHelper.java @@ -77,7 +77,7 @@ private StringManipulationHelper() { *

  • Any IOException reading the stream is 'squashed' and not made * available to caller *
  • An additional newline is appended at the end of the string. - *
      + *
    * @author andreas * @param stream * @return a possibly empty but non-null String @@ -202,9 +202,9 @@ public static boolean equalsToXml(String expected, String actual) { /** * Adds padding to left of supplied string * @param s The String to pad - * @param n an integer >= 1 + * @param n an integer >= 1 * @return The left-padded string. - * @throws IllegalArgumentException if n <= 0 + * @throws IllegalArgumentException if n <= 0 */ public static String padLeft(String s, int n) { validatePadding(n); @@ -214,9 +214,9 @@ public static String padLeft(String s, int n) { /** * Adds padding to right of supplied string * @param s The String to pad - * @param n an integer >= 1 + * @param n an integer >= 1 * @return The right-padded string. - * @throws IllegalArgumentException if n <= 0 + * @throws IllegalArgumentException if n <= 0 */ public static String padRight(String s, int n) { validatePadding(n); diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/XMLHelper.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/XMLHelper.java index d4eab71660..9b895ef492 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/XMLHelper.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/XMLHelper.java @@ -44,6 +44,7 @@ import static org.biojava.nbio.core.sequence.io.util.IOUtils.close; import static org.biojava.nbio.core.sequence.io.util.IOUtils.openFile; +import java.util.List; /** * Helper methods to simplify boilerplate XML parsing code for {@code}org.w3c.dom{@code} XML objects @@ -163,7 +164,7 @@ public static Element selectParentElement(Element element, String parentName) { /** * If {@code}xpathExpression{@code} is a plain string with no '/' characterr, this is * interpreted as a child element name to search for. - * + *

    * If {@code}xpathExpression{@code} is an XPath expression, this is evaluated and is assumed * to identify a single element. * @param element @@ -206,8 +207,8 @@ public static Element selectSingleElement(Element element, String xpathExpressio * @return A possibly empty but non-null {@code}ArrayList{@code} * @throws XPathExpressionException */ - public static ArrayList selectElements(Element element, String xpathExpression) throws XPathExpressionException { - ArrayList resultVector = new ArrayList(); + public static List selectElements(Element element, String xpathExpression) throws XPathExpressionException { + List resultVector = new ArrayList<>(); if (element == null) { return resultVector; } diff --git a/biojava-core/src/main/java/org/biojava/nbio/core/util/XMLWriter.java b/biojava-core/src/main/java/org/biojava/nbio/core/util/XMLWriter.java index 141ddba640..7b799818df 100644 --- a/biojava-core/src/main/java/org/biojava/nbio/core/util/XMLWriter.java +++ b/biojava-core/src/main/java/org/biojava/nbio/core/util/XMLWriter.java @@ -113,7 +113,7 @@ public interface XMLWriter { * avoid namespaces that are used only in leaf-nodes of a tree being re-defined * every time they are used. The XMLWriter will generally try to use the * suggested prefix for this namespace, but there is no guarantee of this. - *

    + *

    * * In particular, if the namespace is already in use, the current prefix will still * be used. Similarly if the suggested prefix has already been used for another diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/fasta/TestFASTAReader.java b/biojava-core/src/test/java/org/biojava/nbio/core/fasta/TestFASTAReader.java index 75992962d1..e8a9d34ec9 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/fasta/TestFASTAReader.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/fasta/TestFASTAReader.java @@ -22,6 +22,7 @@ import java.io.InputStream; import java.util.LinkedHashMap; +import java.util.Map; import static org.junit.Assert.* ; import static org.hamcrest.CoreMatchers.* ; @@ -46,7 +47,7 @@ private void testProcessAll(String path) throws Exception { inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); - LinkedHashMap sequences = fastaReader.process(); + Map sequences = fastaReader.process(); assertThat(sequences,is(notNullValue())); assertThat(sequences.size(),is(1)); assertThat(sequences.containsKey("P02768"),is(true)); @@ -86,12 +87,12 @@ private void testProcess1(String path) throws Exception { inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); - LinkedHashMap out1 = fastaReader.process(1); + Map out1 = fastaReader.process(1); assertThat(out1,is(notNullValue())); assertThat(out1.size(),is(1)); assertThat(out1.containsKey("P02768"),is(true)); assertThat(out1.get("P02768").getLength(),is(609)); - LinkedHashMap out2 = fastaReader.process(1); + Map out2 = fastaReader.process(1); assertThat(out2,is(nullValue())); } finally { if(fastaReader != null) fastaReader.close(); @@ -128,17 +129,17 @@ private void testProcess2(String path) throws Exception { inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); - LinkedHashMap out1 = fastaReader.process(1); + Map out1 = fastaReader.process(1); assertThat(out1,is(notNullValue())); assertThat(out1.size(),is(1)); assertThat(out1.containsKey("P02768"),is(true)); assertThat(out1.get("P02768").getLength(),is(609)); - LinkedHashMap out2 = fastaReader.process(1); + Map out2 = fastaReader.process(1); assertThat(out2,is(notNullValue())); assertThat(out2.size(),is(1)); assertThat(out2.containsKey("P00698"),is(true)); assertThat(out2.get("P00698").getLength(),is(147)); - LinkedHashMap out3 = fastaReader.process(1); + Map out3 = fastaReader.process(1); assertThat(out3,is(nullValue())); } finally { if(fastaReader != null) fastaReader.close(); diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/GeneSequenceTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/GeneSequenceTest.java index ecb1e7d1b2..e2cb30459a 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/GeneSequenceTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/GeneSequenceTest.java @@ -129,7 +129,7 @@ void returnedIntronCollectionsAreNotMutable() throws Exception { geneSequence.addExon(new AccessionID("a"), 20, 50); geneSequence.addExon(new AccessionID("b"), 80, 100); geneSequence.addIntronsUsingExons(); - ArrayList introns = geneSequence.getIntronSequences(); + List introns = geneSequence.getIntronSequences(); assertEquals(1, introns.size()); introns.remove(0); assertEquals(1, geneSequence.getIntronSequences().size()); diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/FastaReaderTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/FastaReaderTest.java index 0222b54c47..466cabaa94 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/FastaReaderTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/FastaReaderTest.java @@ -30,11 +30,12 @@ import java.io.IOException; import java.io.InputStream; import java.util.LinkedHashMap; +import java.util.Map; import java.util.logging.Level; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class FastaReaderTest { @@ -70,7 +71,7 @@ public void testProcess() throws Exception { FastaReader fastaReader = new FastaReader(inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); - LinkedHashMap proteinSequences = fastaReader.process(); + Map proteinSequences = fastaReader.process(); inStream.close(); //Should have 282 sequences @@ -107,7 +108,7 @@ public void processIntTest() throws Exception { InputStream inStream = this.getClass().getResourceAsStream("/PF00104_small.fasta"); Assert.assertNotNull(inStream); FastaReader fastaReader = new FastaReader(inStream, new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); - LinkedHashMap proteinSequences = fastaReader.process(200); + Map proteinSequences = fastaReader.process(200); //Should have 200 sequences //logger.debug("Expecting 200 got " + proteinSequences.size()); @@ -169,7 +170,7 @@ public void testSmallFasta() throws IOException { new GenericFastaHeaderParser(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); - LinkedHashMap b; + Map b; int nrSeq = 0; @@ -200,7 +201,7 @@ public void testSmallFasta2() throws IOException { int nrSeq = 0; - LinkedHashMap b = fastaReader.process(); + Map b = fastaReader.process(); Assert.assertNotNull(b); diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/FastaStreamerTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/FastaStreamerTest.java new file mode 100644 index 0000000000..6c93c912c1 --- /dev/null +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/FastaStreamerTest.java @@ -0,0 +1,52 @@ +package org.biojava.nbio.core.sequence.io; + +import org.biojava.nbio.core.sequence.ProteinSequence; +import org.junit.Assert; +import org.junit.Test; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Test the functionality of the {@link FastaStreamer} code + */ +public class FastaStreamerTest { + + @Test + public void stream() throws IOException, URISyntaxException { + URI fileUri = this.getClass().getResource("PF00104_small.fasta.gz").toURI(); + Path path = Paths.get(fileUri); + List sequences; + + sequences = FastaStreamer.from(path).stream().collect(Collectors.toList()); + Assert.assertEquals("Count", 283, sequences.size()); + + ProteinSequence sequence; + sequence = sequences.get(0); + Assert.assertEquals("A2D504_ATEGE/1-46", sequence.getOriginalHeader()); + sequence = sequences.get(sequences.size()-1); + Assert.assertEquals("Q98SJ1_CHICK/15-61", sequence.getOriginalHeader()); + + sequences = FastaStreamer.from(path) + .batchSize(2) // Ensure there isn't an edge condition loading the next buffer + .stream() + .collect(Collectors.toList()); + Assert.assertEquals("Count", 283, sequences.size()); + } + + @Test + public void iterate() throws URISyntaxException { + URI fileUri = this.getClass().getResource("PF00104_small.fasta.gz").toURI(); + Path path = Paths.get(fileUri); + int count = 0; + for (ProteinSequence sequence : FastaStreamer.from(path).each()) { + count++; + } + Assert.assertEquals("Count", 283, count); + } +} diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java index d6018a5eaf..06459579a7 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java @@ -33,10 +33,11 @@ import org.slf4j.LoggerFactory; import java.util.LinkedHashMap; +import java.util.Map; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GenbankCookbookTest { @@ -90,12 +91,12 @@ public void testProcess() throws Throwable { //File protFile = new File("src/test/resources/BondFeature.gb"); ClasspathResource protResource = new ClasspathResource("BondFeature.gb"); - LinkedHashMap dnaSequences = GenbankReaderHelper.readGenbankDNASequence(dnaResource.getInputStream()); + Map dnaSequences = GenbankReaderHelper.readGenbankDNASequence(dnaResource.getInputStream()); for (DNASequence sequence : dnaSequences.values()) { logger.debug("DNA Sequence: {}", sequence.getSequenceAsString()); } - LinkedHashMap protSequences = GenbankReaderHelper.readGenbankProteinSequence(protResource.getInputStream()); + Map protSequences = GenbankReaderHelper.readGenbankProteinSequence(protResource.getInputStream()); for (ProteinSequence sequence : protSequences.values()) { logger.debug("Protein Sequence: {}", sequence.getSequenceAsString()); } diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java index 325e07a5ef..0a03c85586 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java @@ -43,7 +43,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis * @author Jacek Grzebyta * @author Philippe Soares */ @@ -68,7 +68,7 @@ public void testProcess() throws Exception { new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()) ); - LinkedHashMap proteinSequences = genbankProtein.process(); + Map proteinSequences = genbankProtein.process(); assertThat(proteinSequences.get("NP_000257").getComments().get(0),is( "VALIDATED REFSEQ: This record has undergone validation or\n" + @@ -114,7 +114,7 @@ public void testProcess() throws Exception { new GenericGenbankHeaderParser<>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) ); - LinkedHashMap dnaSequences = genbankDNA.process(); + Map dnaSequences = genbankDNA.process(); assertNotNull(dnaSequences); assertEquals(1, dnaSequences.size()); @@ -144,7 +144,7 @@ public void testPartialProcess() throws IOException, CompoundNotFoundException { ); // First call to process(1) returns the first sequence - LinkedHashMap dnaSequences = genbankDNA.process(1); + Map dnaSequences = genbankDNA.process(1); assertFalse(inStream.isclosed()); assertNotNull(dnaSequences); @@ -177,7 +177,7 @@ public void CDStest() throws Exception { new GenericGenbankHeaderParser<>(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()) ); - LinkedHashMap proteinSequences = GenbankProtein.process(); + Map proteinSequences = GenbankProtein.process(); assertTrue(inStream.isclosed()); @@ -206,7 +206,7 @@ private DNASequence readGenbankResource(final String resource) throws IOExceptio new GenericGenbankHeaderParser<>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) ); - LinkedHashMap dnaSequences = genbankDNA.process(); + Map dnaSequences = genbankDNA.process(); return dnaSequences.values().iterator().next(); } @@ -218,7 +218,7 @@ private RNASequence readGenbankRNAResource(final String resource) throws IOExcep new GenericGenbankHeaderParser<>(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet()) ); - LinkedHashMap rnaSequences = genbankRNA.process(); + Map rnaSequences = genbankRNA.process(); return rnaSequences.values().iterator().next(); } @@ -230,7 +230,7 @@ private ProteinSequence readGenbankProteinResource(final String resource) throws new GenericGenbankHeaderParser<>(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()) ); - LinkedHashMap proteinSequences = genbankProtein.process(); + Map proteinSequences = genbankProtein.process(); return proteinSequences.values().iterator().next(); } @@ -346,7 +346,7 @@ public void testGithub843() throws Exception { new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) ); - LinkedHashMap dnaSequences = genbankDNA.process(); + Map dnaSequences = genbankDNA.process(); assertNotNull(dnaSequences); DNASequence dna = new ArrayList<>(dnaSequences.values()).get(0); diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankWriterTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankWriterTest.java index cdd466f6f0..0eb3995046 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankWriterTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankWriterTest.java @@ -63,7 +63,7 @@ public void testProcess() throws Exception { InputStream inStream = GenbankWriterTest.class.getResourceAsStream("/NM_000266.gb"); //File dnaFile = new File("src/test/resources/NM_000266.gb"); - LinkedHashMap dnaSequences = GenbankReaderHelper.readGenbankDNASequence( inStream ); + Map dnaSequences = GenbankReaderHelper.readGenbankDNASequence( inStream ); ByteArrayOutputStream fragwriter = new ByteArrayOutputStream(); ArrayList seqs = new ArrayList(); for(DNASequence seq : dnaSequences.values()) { diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParserTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParserTest.java index 4d8ae7e8bd..b5e5598722 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParserTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParserTest.java @@ -32,7 +32,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GenericFastaHeaderParserTest { @@ -52,7 +52,7 @@ public class GenericFastaHeaderParserTest { * NCBI Reference Sequence ref|accession|locus * Local Sequence identifier lcl|identifier * - * @author Scooter Willis + * @author Scooter Willis */ @Test public void testParseHeader() throws CompoundNotFoundException { diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/SimpleGenbankProxySequenceReaderTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/SimpleGenbankProxySequenceReaderTest.java index 4150e90ffc..072e25a1e4 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/SimpleGenbankProxySequenceReaderTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/SimpleGenbankProxySequenceReaderTest.java @@ -34,7 +34,6 @@ * * @author Jacek Grzebyta * @author Paolo Pavan - * @see InfoTask */ public class SimpleGenbankProxySequenceReaderTest { diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/util/FileDownloadUtilsTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/util/FileDownloadUtilsTest.java index 33825e19a5..201ad88e48 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/util/FileDownloadUtilsTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/util/FileDownloadUtilsTest.java @@ -8,8 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.net.URL; @@ -20,43 +18,6 @@ class FileDownloadUtilsTest { - @Nested - class FileCopy { - - private File createSrcFile () throws IOException { - byte [] toSave = new byte []{1,2,3,4,5}; - File src = Files.createTempFile("test", ".dat").toFile(); - try (FileOutputStream fos = new FileOutputStream(src);){ - fos.write(toSave); - } - return src; - } - - @Test - void copyFile() throws IOException { - File src = createSrcFile(); - //sanity check - assertEquals(5, src.length()); - File dest = Files.createTempFile("dest", ".dat").toFile(); - assertEquals(0, dest.length()); - FileDownloadUtils.copy(src, dest); - assertEquals(5, dest.length()); - - //original is unaffected - assertEquals(5, src.length()); - - // bytes are identical - try (FileInputStream fis1 = new FileInputStream(src); - FileInputStream fis2 = new FileInputStream(dest)) { - int b = -1; - while (( b = fis1.read()) != -1) { - int b2 = fis2.read(); - assertEquals (b, b2); - } - } - } - } - @Nested class FileExtension { @Test @@ -199,7 +160,7 @@ class CreateValidationFiles{ @Test void testValidationFiles() throws IOException{ - URL sourceUrl = new URL("https://ftp.wwpdb.org/pub/pdb/data/structures/divided/mmCIF/45/145d.cif.gz"); + URL sourceUrl = new URL("https://files.wwpdb.org/pub/pdb/data/structures/divided/mmCIF/45/145d.cif.gz"); File destFile = new File(System.getProperty("java.io.tmpdir"), "145d.cif.gz"); File sizeFile = new File(destFile.getParentFile(), destFile.getName()+".size"); File hashFile = new File(destFile.getParentFile(), destFile.getName()+".hash_MD5"); diff --git a/biojava-core/src/test/java/org/biojava/nbio/core/util/XMLHelperTest.java b/biojava-core/src/test/java/org/biojava/nbio/core/util/XMLHelperTest.java index 0a9ace033f..d9eb23589d 100644 --- a/biojava-core/src/test/java/org/biojava/nbio/core/util/XMLHelperTest.java +++ b/biojava-core/src/test/java/org/biojava/nbio/core/util/XMLHelperTest.java @@ -12,6 +12,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.List; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; @@ -148,7 +149,7 @@ void before() throws SAXException, IOException, ParserConfigurationException { @Test void selectMultipleElementsWithXPath() throws XPathExpressionException { - ArrayList selected = XMLHelper.selectElements(root, "/root/list/a"); + List selected = XMLHelper.selectElements(root, "/root/list/a"); assertEquals(2, selected.size()); } @@ -157,7 +158,7 @@ void selectMultipleElementsWithXPathSearchesWholeTree() throws XPathExpressionException { Element a1 = (Element) doc.getElementsByTagName("a").item(0); - ArrayList selected = XMLHelper.selectElements(a1, "/root"); + List selected = XMLHelper.selectElements(a1, "/root"); assertEquals(1, selected.size()); assertEquals("root", selected.get(0).getTagName()); } diff --git a/biojava-core/src/test/resources/org/biojava/nbio/core/sequence/io/PF00104_small.fasta.gz b/biojava-core/src/test/resources/org/biojava/nbio/core/sequence/io/PF00104_small.fasta.gz new file mode 100644 index 0000000000..d4a340c73d Binary files /dev/null and b/biojava-core/src/test/resources/org/biojava/nbio/core/sequence/io/PF00104_small.fasta.gz differ diff --git a/biojava-core/src/test/resources/org/biojava/nbio/core/util/example.gz b/biojava-core/src/test/resources/org/biojava/nbio/core/util/example.gz new file mode 100644 index 0000000000..0864558ee2 Binary files /dev/null and b/biojava-core/src/test/resources/org/biojava/nbio/core/util/example.gz differ diff --git a/biojava-genome/pom.xml b/biojava-genome/pom.xml index 2b213d7de5..68575bbb9b 100644 --- a/biojava-genome/pom.xml +++ b/biojava-genome/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT 4.0.0 biojava-genome @@ -61,7 +61,6 @@ com.google.guava guava compile - 32.0.1-jre junit @@ -71,13 +70,13 @@ org.biojava biojava-core - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT compile org.biojava biojava-alignment - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT compile @@ -104,7 +103,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java index 7f7294801e..c9786b3ad0 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java @@ -32,18 +32,19 @@ import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; +import java.util.Map; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GeneFeatureHelper { private static final Logger logger = LoggerFactory.getLogger(GeneFeatureHelper.class); static public LinkedHashMap loadFastaAddGeneFeaturesFromUpperCaseExonFastaFile(File fastaSequenceFile, File uppercaseFastaFile, boolean throwExceptionGeneNotFound) throws Exception { - LinkedHashMap chromosomeSequenceList = new LinkedHashMap(); - LinkedHashMap dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); + LinkedHashMap chromosomeSequenceList = new LinkedHashMap<>(); + Map dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); for (String accession : dnaSequenceList.keySet()) { DNASequence contigSequence = dnaSequenceList.get(accession); ChromosomeSequence chromsomeSequence = new ChromosomeSequence(contigSequence.getSequenceAsString()); @@ -52,7 +53,7 @@ static public LinkedHashMap loadFastaAddGeneFeatures } - LinkedHashMap geneSequenceList = FastaReaderHelper.readFastaDNASequence(uppercaseFastaFile); + Map geneSequenceList = FastaReaderHelper.readFastaDNASequence(uppercaseFastaFile); for (DNASequence dnaSequence : geneSequenceList.values()) { String geneSequence = dnaSequence.getSequenceAsString(); String lcGeneSequence = geneSequence.toLowerCase(); @@ -91,7 +92,7 @@ static public LinkedHashMap loadFastaAddGeneFeatures dnaSequence.getAccession().toString(), contigDNASequence.getAccession().toString(), bioStart, bioEnd, strand); ChromosomeSequence chromosomeSequence = chromosomeSequenceList.get(accession); - ArrayList exonBoundries = new ArrayList(); + ArrayList exonBoundries = new ArrayList<>(); //look for transitions from lowercase to upper case for (int i = 0; i < geneSequence.length(); i++) { @@ -162,7 +163,7 @@ static public LinkedHashMap loadFastaAddGeneFeatures * @throws Exception */ static public void outputFastaSequenceLengthGFF3(File fastaSequenceFile, File gffFile) throws Exception { - LinkedHashMap dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); + Map dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); String fileName = fastaSequenceFile.getName(); FileWriter fw = new FileWriter(gffFile); String newLine = System.getProperty("line.separator"); @@ -182,9 +183,9 @@ static public void outputFastaSequenceLengthGFF3(File fastaSequenceFile, File gf * @return * @throws Exception */ - static public LinkedHashMap loadFastaAddGeneFeaturesFromGeneIDGFF2(File fastaSequenceFile, File gffFile) throws Exception { - LinkedHashMap dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); - LinkedHashMap chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); + static public Map loadFastaAddGeneFeaturesFromGeneIDGFF2(File fastaSequenceFile, File gffFile) throws Exception { + Map dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); + Map chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); FeatureList listGenes = GeneIDGFF2Reader.read(gffFile.getAbsolutePath()); addGeneIDGFF2GeneFeatures(chromosomeSequenceList, listGenes); return chromosomeSequenceList; @@ -197,7 +198,7 @@ static public LinkedHashMap loadFastaAddGeneFeatures * @param listGenes * @throws Exception */ - static public void addGeneIDGFF2GeneFeatures(LinkedHashMap chromosomeSequenceList, FeatureList listGenes) throws Exception { + static public void addGeneIDGFF2GeneFeatures(Map chromosomeSequenceList, FeatureList listGenes) throws Exception { Collection geneIds = listGenes.attributeValues("gene_id"); for (String geneid : geneIds) { FeatureList gene = listGenes.selectByAttribute("gene_id", geneid); @@ -313,8 +314,8 @@ static public void addGeneIDGFF2GeneFeatures(LinkedHashMap getChromosomeSequenceFromDNASequence(LinkedHashMap dnaSequenceList) { - LinkedHashMap chromosomeSequenceList = new LinkedHashMap(); + static public Map getChromosomeSequenceFromDNASequence(Map dnaSequenceList) { + LinkedHashMap chromosomeSequenceList = new LinkedHashMap<>(); for (String key : dnaSequenceList.keySet()) { DNASequence dnaSequence = dnaSequenceList.get(key); ChromosomeSequence chromosomeSequence = new ChromosomeSequence(dnaSequence.getProxySequenceReader()); //we want the underlying sequence but don't need storage @@ -334,9 +335,9 @@ static public LinkedHashMap getChromosomeSequenceFro * @return * @throws Exception */ - static public LinkedHashMap loadFastaAddGeneFeaturesFromGmodGFF3(File fastaSequenceFile, File gffFile,boolean lazyloadsequences) throws Exception { - LinkedHashMap dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile,lazyloadsequences); - LinkedHashMap chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); + static public Map loadFastaAddGeneFeaturesFromGmodGFF3(File fastaSequenceFile, File gffFile,boolean lazyloadsequences) throws Exception { + Map dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile,lazyloadsequences); + Map chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); FeatureList listGenes = GFF3Reader.read(gffFile.getAbsolutePath()); addGmodGFF3GeneFeatures(chromosomeSequenceList, listGenes); return chromosomeSequenceList; @@ -348,7 +349,7 @@ static public LinkedHashMap loadFastaAddGeneFeatures * @param listGenes * @throws Exception */ - static public void addGmodGFF3GeneFeatures(LinkedHashMap chromosomeSequenceList, FeatureList listGenes) throws Exception { + static public void addGmodGFF3GeneFeatures(Map chromosomeSequenceList, FeatureList listGenes) throws Exception { // key off mRNA as being a known feature that may or may not have a parent gene @@ -532,15 +533,15 @@ static public void addGmodGFF3GeneFeatures(LinkedHashMap loadFastaAddGeneFeaturesFromGlimmerGFF3(File fastaSequenceFile, File gffFile) throws Exception { - LinkedHashMap dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); - LinkedHashMap chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); + static public Map loadFastaAddGeneFeaturesFromGlimmerGFF3(File fastaSequenceFile, File gffFile) throws Exception { + Map dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); + Map chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); FeatureList listGenes = GFF3Reader.read(gffFile.getAbsolutePath()); addGlimmerGFF3GeneFeatures(chromosomeSequenceList, listGenes); return chromosomeSequenceList; } - static public void addGlimmerGFF3GeneFeatures(LinkedHashMap chromosomeSequenceList, FeatureList listGenes) throws Exception { + static public void addGlimmerGFF3GeneFeatures(Map chromosomeSequenceList, FeatureList listGenes) throws Exception { FeatureList mRNAFeatures = listGenes.selectByType("mRNA"); for (FeatureI f : mRNAFeatures) { Feature mRNAFeature = (Feature) f; @@ -677,15 +678,15 @@ static public void addGlimmerGFF3GeneFeatures(LinkedHashMap loadFastaAddGeneFeaturesFromGeneMarkGTF(File fastaSequenceFile, File gffFile) throws Exception { - LinkedHashMap dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); - LinkedHashMap chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); + static public Map loadFastaAddGeneFeaturesFromGeneMarkGTF(File fastaSequenceFile, File gffFile) throws Exception { + Map dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); + Map chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); FeatureList listGenes = GeneMarkGTFReader.read(gffFile.getAbsolutePath()); addGeneMarkGTFGeneFeatures(chromosomeSequenceList, listGenes); return chromosomeSequenceList; } - static public void addGeneMarkGTFGeneFeatures(LinkedHashMap chromosomeSequenceList, FeatureList listGenes) throws Exception { + static public void addGeneMarkGTFGeneFeatures(Map chromosomeSequenceList, FeatureList listGenes) throws Exception { Collection geneIds = listGenes.attributeValues("gene_id"); for (String geneid : geneIds) { // if(geneid.equals("45_g")){ @@ -836,7 +837,7 @@ static public void addGeneMarkGTFGeneFeatures(LinkedHashMap getProteinSequences(Collection chromosomeSequences) throws Exception { - LinkedHashMap proteinSequenceHashMap = new LinkedHashMap(); + LinkedHashMap proteinSequenceHashMap = new LinkedHashMap<>(); for (ChromosomeSequence dnaSequence : chromosomeSequences) { for (GeneSequence geneSequence : dnaSequence.getGeneSequences().values()) { for (TranscriptSequence transcriptSequence : geneSequence.getTranscripts().values()) { @@ -865,7 +866,7 @@ static public LinkedHashMap getProteinSequences(Collect } static public LinkedHashMap getGeneSequences(Collection chromosomeSequences) throws Exception { - LinkedHashMap geneSequenceHashMap = new LinkedHashMap(); + LinkedHashMap geneSequenceHashMap = new LinkedHashMap<>(); for (ChromosomeSequence chromosomeSequence : chromosomeSequences) { for (GeneSequence geneSequence : chromosomeSequence.getGeneSequences().values()) { geneSequenceHashMap.put(geneSequence.getAccession().getID(), geneSequence); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/BlastHomologyHits.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/BlastHomologyHits.java index 88881b37eb..9fb2ebce48 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/BlastHomologyHits.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/BlastHomologyHits.java @@ -28,12 +28,12 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class BlastHomologyHits { static public LinkedHashMap> getMatches(File xmlBlastHits, double ecutoff) throws Exception { - LinkedHashMap> homologyHits = new LinkedHashMap>(); + LinkedHashMap> homologyHits = new LinkedHashMap<>(); BlastXMLQuery blastXMLQuery = new BlastXMLQuery(xmlBlastHits.getAbsolutePath()); LinkedHashMap> hits = blastXMLQuery.getHitsQueryDef(ecutoff); for (String accessionid : hits.keySet()) { diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java index 0b11ddb992..67e22bd992 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java @@ -46,7 +46,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis * @author Mark Chapman */ public class GFF3FromUniprotBlastHits { @@ -79,7 +79,7 @@ public void process(LinkedHashMap> hits, LinkedHashMap } ArrayList uniprotProteinHits = hits.get(accessionid); String uniprotBestHit = uniprotProteinHits.get(0); - UniprotProxySequenceReader uniprotSequence = new UniprotProxySequenceReader(uniprotBestHit, AminoAcidCompoundSet.getAminoAcidCompoundSet()); + UniprotProxySequenceReader uniprotSequence = new UniprotProxySequenceReader<>(uniprotBestHit, AminoAcidCompoundSet.getAminoAcidCompoundSet()); ProteinSequence proteinSequence = new ProteinSequence(uniprotSequence); String hitSequence = proteinSequence.getSequenceAsString(); @@ -87,9 +87,9 @@ public void process(LinkedHashMap> hits, LinkedHashMap String predictedProteinSequence = transcriptSequence.getProteinSequence().getSequenceAsString(); - ArrayList cdsProteinList = transcriptSequence.getProteinCDSSequences(); + List cdsProteinList = transcriptSequence.getProteinCDSSequences(); - ArrayList cdsSequenceList = new ArrayList(transcriptSequence.getCDSSequences().values()); + ArrayList cdsSequenceList = new ArrayList<>(transcriptSequence.getCDSSequences().values()); String testSequence = ""; for (ProteinSequence cdsProteinSequence : cdsProteinList) { testSequence = testSequence + cdsProteinSequence.getSequenceAsString(); @@ -166,10 +166,10 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), if (keyWords.size() > 0) { notes = ";Note="; for (String note : keyWords) { - if (note.equals("Complete proteome")) { + if ("Complete proteome".equals(note)) { continue; } - if (note.equals("Direct protein sequencing")) { + if ("Direct protein sequencing".equals(note)) { continue; } @@ -228,9 +228,9 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(), for (DBReferenceInfo note : goList) { notes = notes + " " + note.getId(); geneSequence.addNote(note.getId()); // add note/keyword which can be output in fasta header if needed - LinkedHashMap properties = note.getProperties(); + Map properties = note.getProperties(); for (String propertytype : properties.keySet()) { - if (propertytype.equals("evidence")) { + if ("evidence".equals(propertytype)) { continue; } String property = properties.get(propertytype); @@ -292,7 +292,7 @@ public static void main(String[] args) { */ try { - LinkedHashMap dnaSequenceHashMap = GeneFeatureHelper.loadFastaAddGeneFeaturesFromGlimmerGFF3(new File("/Users/Scooter/scripps/dyadic/analysis/454Scaffolds/454Scaffolds-16.fna"), new File("/Users/Scooter/scripps/dyadic/GlimmerHMM/c1_glimmerhmm-16.gff")); + Map dnaSequenceHashMap = GeneFeatureHelper.loadFastaAddGeneFeaturesFromGlimmerGFF3(new File("/Users/Scooter/scripps/dyadic/analysis/454Scaffolds/454Scaffolds-16.fna"), new File("/Users/Scooter/scripps/dyadic/GlimmerHMM/c1_glimmerhmm-16.gff")); LinkedHashMap geneSequenceList = GeneFeatureHelper.getGeneSequences(dnaSequenceHashMap.values()); FileOutputStream fo = new FileOutputStream("/Users/Scooter/scripps/dyadic/outputGlimmer/genemark_uniprot_match-16.gff3"); LinkedHashMap> blasthits = BlastHomologyHits.getMatches(new File("/Users/Scooter/scripps/dyadic/blastresults/c1_glimmer_in_uniprot.xml"), 1E-10); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java index 437d7bd435..78191a7655 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java @@ -133,7 +133,7 @@ public static QualityFeature, NucleotideCom { throw new IllegalArgumentException("fastq must not be null"); } - QualityFeature, NucleotideCompound> qualityScores = new QualityFeature, NucleotideCompound>("qualityScores", "sequencing"); + QualityFeature, NucleotideCompound> qualityScores = new QualityFeature<>("qualityScores", "sequencing"); qualityScores.setQualities(toList(qualityScores(fastq))); return qualityScores; } @@ -153,7 +153,7 @@ public static QuantityFeature, NucleotideCo { throw new IllegalArgumentException("fastq must not be null"); } - QuantityFeature, NucleotideCompound> errorProbabilities = new QuantityFeature, NucleotideCompound>("errorProbabilities", "sequencing"); + QuantityFeature, NucleotideCompound> errorProbabilities = new QuantityFeature<>("errorProbabilities", "sequencing"); errorProbabilities.setQuantities(toList(errorProbabilities(fastq))); return errorProbabilities; } diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqVariant.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqVariant.java index efffbf4f78..3a93c5c057 100755 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqVariant.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqVariant.java @@ -186,7 +186,7 @@ public double errorProbability(final int qualityScore) /** Map of FASTQ sequence format variants keyed by name and lowercase-with-dashes name. */ - private static final Map FASTQ_VARIANTS = new HashMap(6); + private static final Map FASTQ_VARIANTS = new HashMap<>(6); static { diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/cytoband/CytobandParser.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/cytoband/CytobandParser.java index 560566b0b2..d7ab896b8a 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/cytoband/CytobandParser.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/cytoband/CytobandParser.java @@ -52,7 +52,7 @@ public static void main(String[] args) { try { SortedSet cytobands = me.getAllCytobands(new URL( DEFAULT_LOCATION)); - SortedSet types = new TreeSet(); + SortedSet types = new TreeSet<>(); for (Cytoband c : cytobands) { logger.info("Cytoband: {}", c); if (!types.contains(c.getType())) @@ -77,7 +77,7 @@ public SortedSet getAllCytobands(InputStream instream) BufferedReader reader = new BufferedReader(new InputStreamReader( instream)); String line = null; - SortedSet cytobands = new TreeSet(); + SortedSet cytobands = new TreeSet<>(); while ((line = reader.readLine()) != null) { String[] spl = line.split("\t"); if (spl.length != 5) { diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/geneid/GeneIDXMLReader.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/geneid/GeneIDXMLReader.java index a573a7062d..dc6a97e702 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/geneid/GeneIDXMLReader.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/geneid/GeneIDXMLReader.java @@ -33,10 +33,11 @@ import java.io.File; import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.List; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GeneIDXMLReader { @@ -51,8 +52,8 @@ public GeneIDXMLReader(String geneidXMLFile) throws Exception { } public LinkedHashMap getProteinSequences() throws Exception { - LinkedHashMap proteinSequenceList = new LinkedHashMap(); - ArrayList elementList = XMLHelper.selectElements(geneidDoc.getDocumentElement(), "prediction/gene/protein"); + LinkedHashMap proteinSequenceList = new LinkedHashMap<>(); + List elementList = XMLHelper.selectElements(geneidDoc.getDocumentElement(), "prediction/gene/protein"); logger.info("{} hits", elementList.size()); for (Element proteinElement : elementList) { @@ -68,8 +69,8 @@ public LinkedHashMap getProteinSequences() throws Excep } public LinkedHashMap getDNACodingSequences() throws Exception { - LinkedHashMap dnaSequenceList = new LinkedHashMap(); - ArrayList elementList = XMLHelper.selectElements(geneidDoc.getDocumentElement(), "prediction/gene/cDNA"); + LinkedHashMap dnaSequenceList = new LinkedHashMap<>(); + List elementList = XMLHelper.selectElements(geneidDoc.getDocumentElement(), "prediction/gene/cDNA"); logger.info("{} hits", elementList.size()); for (Element dnaElement : elementList) { diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneChromosomePositionParser.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneChromosomePositionParser.java index df6a1a4373..0ced7c5e00 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneChromosomePositionParser.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneChromosomePositionParser.java @@ -54,7 +54,7 @@ public static void main(String[] args){ logger.info("got {} gene positions", genePositions.size()); for (GeneChromosomePosition pos : genePositions){ - if ( pos.getGeneName().equals("FOLH1")) { + if ( "FOLH1".equals(pos.getGeneName())) { logger.info("Gene Position: {}", pos); break; } @@ -79,7 +79,7 @@ public static List getChromosomeMappings() throws IOExce public static List getChromosomeMappings(InputStream inStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(inStream)); - ArrayList gcps = new ArrayList(); + ArrayList gcps = new ArrayList<>(); String line = null; while ((line = reader.readLine()) != null) { @@ -126,7 +126,7 @@ private static GeneChromosomePosition getGeneChromosomePosition(String line) { private static List getIntegerList(String lst){ String[] spl = lst.split(","); - ArrayList l = new ArrayList(); + ArrayList l = new ArrayList<>(); for (String s : spl){ l.add(Integer.parseInt(s)); } diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneNamesParser.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneNamesParser.java index e9158c015a..1ffba84b52 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneNamesParser.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneNamesParser.java @@ -61,7 +61,7 @@ public static void main(String[] args) { logger.info("got {} gene names", geneNames.size()); for ( GeneName g : geneNames){ - if ( g.getApprovedSymbol().equals("FOLH1")) + if ( "FOLH1".equals(g.getApprovedSymbol())) logger.info("Gene Name: {}", g); } // and returns a list of beans that contains key-value pairs for each gene name @@ -92,7 +92,7 @@ public static List getGeneNames() throws IOException{ */ public static List getGeneNames(InputStream inStream) throws IOException{ - ArrayList geneNames = new ArrayList(); + ArrayList geneNames = new ArrayList<>(); BufferedReader reader = new BufferedReader(new InputStreamReader(inStream)); // skip reading first line (it is the legend) diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Feature.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Feature.java index 9d750f850e..c5c9e07e1e 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Feature.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Feature.java @@ -153,7 +153,7 @@ public Feature(Feature feature) { mFrame = feature.mFrame; mAttributes = feature.mAttributes; initAttributeHashMap(); - mUserMap = new HashMap(feature.mUserMap); + mUserMap = new HashMap<>(feature.mUserMap); } /** @@ -177,7 +177,7 @@ public Feature(String seqname, String source, String type, Location location, Do mFrame = frame; mAttributes = attributes; initAttributeHashMap(); - mUserMap = new HashMap(); + mUserMap = new HashMap<>(); } @@ -199,7 +199,7 @@ public HashMap userData() { return mUserMap; } - HashMap attributeHashMap = new HashMap(); + HashMap attributeHashMap = new HashMap<>(); private void initAttributeHashMap(){ String[] values = mAttributes.split(";"); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureHelper.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureHelper.java index 1383276ce2..f18c14a098 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureHelper.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureHelper.java @@ -25,7 +25,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class FeatureHelper { @@ -38,7 +38,7 @@ public class FeatureHelper { */ static public LinkedHashMap buildFeatureAtrributeIndex(String attribute,FeatureList list){ - LinkedHashMap featureHashMap = new LinkedHashMap(); + LinkedHashMap featureHashMap = new LinkedHashMap<>(); FeatureList featureList = list.selectByAttribute(attribute); for(FeatureI feature : featureList){ String value = feature.getAttribute(attribute); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureList.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureList.java index 19b7afec93..344fe34141 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureList.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureList.java @@ -40,7 +40,7 @@ @SuppressWarnings("serial") public class FeatureList extends ArrayList { - Map>> featindex = new HashMap>>(); + Map>> featindex = new HashMap<>(); Location mLocation; //genomic location (union of feature locations) /** @@ -81,11 +81,11 @@ public boolean add(FeatureI feature) { if (featindex.containsKey(entry.getKey())){ Map> feat = featindex.get(entry.getKey()); if (feat==null){ - feat= new HashMap>(); + feat= new HashMap<>(); } List features = feat.get(entry.getValue()); if (features==null){ - features = new ArrayList(); + features = new ArrayList<>(); } features.add(feature); feat.put(entry.getValue(), features); @@ -185,7 +185,7 @@ public String splice(DNASequence sequence) { * the order of features in the list. */ public Collection groupValues() { - Set set = new HashSet(); + Set set = new HashSet<>(); for (FeatureI f : this) { //enter in a set -- removes duplicates set.add(f.group()); @@ -207,10 +207,10 @@ public Collection attributeValues(String key) { if (featindex.containsKey(key)){ Map> map = featindex.get(key); Collection result = map.keySet(); - if (result == null) result = new HashSet(); + if (result == null) result = new HashSet<>(); return Collections.unmodifiableCollection(result); } - LinkedHashMap hash = new LinkedHashMap(); + LinkedHashMap hash = new LinkedHashMap<>(); for (FeatureI f : this) { //enter as a key -- removes duplicates hash.put(f.getAttribute(key), null); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GCStats.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GCStats.java index 2974a13c9c..8ee0881551 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GCStats.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GCStats.java @@ -26,7 +26,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GCStats { diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Reader.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Reader.java index e1a5f03417..f6e256baa4 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Reader.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Reader.java @@ -83,30 +83,30 @@ public static FeatureList read(Path path, List indexes) throws IOExcepti FeatureList features = new FeatureList(); features.addIndexes(indexes); - BufferedReader br = Files.newBufferedReader(path); + try (BufferedReader br = Files.newBufferedReader(path)) { - String s; - for (s = br.readLine(); null != s; s = br.readLine()) { - s = s.trim(); + String s; + for (s = br.readLine(); null != s; s = br.readLine()) { + s = s.trim(); - if (s.length() > 0) { - if (s.charAt(0) == '#') { - //ignore comment lines - if(s.startsWith("##fasta")) - break; - } else { + if (s.length() > 0) { + if (s.charAt(0) == '#') { + //ignore comment lines + if (s.startsWith("##fasta")) + break; + } else { - FeatureI f = parseLine(s); - if (f != null) { - features.add(f); + FeatureI f = parseLine(s); + if (f != null) { + features.add(f); + } } } + } } - - br.close(); return features; } diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Writer.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Writer.java index c4bc070f21..88af970928 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Writer.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GFF3Writer.java @@ -20,29 +20,28 @@ */ package org.biojava.nbio.genome.parsers.gff; -import org.biojava.nbio.genome.GeneFeatureHelper; import org.biojava.nbio.core.sequence.*; -import java.io.File; -import java.io.FileOutputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GFF3Writer { /** * Output gff3 format for a DNA Sequence - * @param fileName - * @param chromosomeSequence + * @param outputStream + * @param chromosomeSequenceList * @throws Exception */ - public void write(OutputStream outputStream, LinkedHashMap chromosomeSequenceList) throws Exception { + public void write(OutputStream outputStream, Map chromosomeSequenceList) throws Exception { outputStream.write("##gff-version 3\n".getBytes()); for (String key : chromosomeSequenceList.keySet()) { @@ -94,7 +93,7 @@ public void write(OutputStream outputStream, LinkedHashMap cdsSequenceList = new ArrayList(transcriptSequence.getCDSSequences().values()); + ArrayList cdsSequenceList = new ArrayList<>(transcriptSequence.getCDSSequences().values()); Collections.sort(cdsSequenceList, new SequenceComparator()); for (CDSSequence cdsSequence : cdsSequenceList) { gff3line = key + "\t" + cdsSequence.getSource() + "\t" + "CDS" + "\t" + cdsSequence.getBioBegin() + "\t" + cdsSequence.getBioEnd() + "\t"; @@ -118,10 +117,9 @@ public void write(OutputStream outputStream, LinkedHashMap notesList) { + private String getGFF3Note(List notesList) { String notes = ""; if (notesList.size() > 0) { @@ -138,39 +136,4 @@ private String getGFF3Note(ArrayList notesList) { return notes; } - public static void main(String[] args) throws Exception { - - if (true) { - FileOutputStream fo = new FileOutputStream("/Users/Scooter/scripps/dyadic/geneid/geneid/c1-geneid.gff3");//-16 - LinkedHashMap dnaSequenceList = GeneFeatureHelper.loadFastaAddGeneFeaturesFromGeneIDGFF2(new File("/Users/Scooter/scripps/dyadic/analysis/454Scaffolds/454Scaffolds.fna"), new File("/Users/Scooter/scripps/dyadic/geneid/geneid/c1_geneid.gff")); - GFF3Writer gff3Writer = new GFF3Writer(); - gff3Writer.write(fo, dnaSequenceList); - - - // LinkedHashMap proteinSequenceList = GeneFeatureHelper.getProteinSequences(chromosomeSequenceList.values()); - // for(String id : proteinSequenceList.keySet()){ - // ProteinSequence sequence = proteinSequenceList.get(id); - // System.out.println(id + " " + sequence.getSequenceAsString()); - - // } - fo.close(); - } -/* - if (false) { - FileOutputStream fo = new FileOutputStream("/Users/Scooter/scripps/dyadic/analysis/454Scaffolds/genemark_hmm.gff3");//-16 - LinkedHashMap dnaSequenceList = GeneFeatureHelper.loadFastaAddGeneFeaturesFromGeneMarkGTF(new File("/Users/Scooter/scripps/dyadic/analysis/454Scaffolds/454Scaffolds.fna"), new File("/Users/Scooter/scripps/dyadic/analysis/454Scaffolds/genemark_hmm.gtf")); - GFF3Writer gff3Writer = new GFF3Writer(); - gff3Writer.write(fo, dnaSequenceList); - fo.close(); - } - - if (false) { - LinkedHashMap dnaSequenceList = GeneFeatureHelper.loadFastaAddGeneFeaturesFromGlimmerGFF3(new File("/Users/Scooter/scripps/dyadic/analysis/454Scaffolds/454Scaffolds-16.fna"), new File("/Users/Scooter/scripps/dyadic/GlimmerHMM/c1_glimmerhmm-16.gff")); - GFF3Writer gff3Writer = new GFF3Writer(); - gff3Writer.write(System.out, dnaSequenceList); - } - */ -// System.out.println(listGenes); - // GeneMarkGTF.write( list, args[1] ); - } } diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneIDGFF2Reader.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneIDGFF2Reader.java index c7f59de102..f032cea239 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneIDGFF2Reader.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneIDGFF2Reader.java @@ -62,27 +62,27 @@ public static FeatureList read(String filename) throws IOException { logger.info("Reading: {}", filename); FeatureList features = new FeatureList(); - BufferedReader br = new BufferedReader(new FileReader(filename)); + try (BufferedReader br = new BufferedReader(new FileReader(filename))) { - String s; - for (s = br.readLine(); null != s; s = br.readLine()) { - s = s.trim(); + String s; + for (s = br.readLine(); null != s; s = br.readLine()) { + s = s.trim(); - if (s.length() > 0) { - if (s.charAt(0) == '#') { - //ignore comment lines - } else { + if (s.length() > 0) { + if (s.charAt(0) == '#') { + //ignore comment lines + } else { - FeatureI f = parseLine(s); - if (f != null) { - features.add(f); + FeatureI f = parseLine(s); + if (f != null) { + features.add(f); + } } } + } } - - br.close(); return features; } @@ -147,9 +147,9 @@ private static Feature parseLine(String s) { end = s.indexOf('#', start); String attributes = null; if (end < 0) { - attributes = new String(s.substring(start)); + attributes = s.substring(start); } else { - attributes = new String(s.substring(start, end)); + attributes = s.substring(start, end); } //need to add in attribute assignment for geneid where it just provides a gene name and will make it gtf like attributes = "gene_id " + '"' + attributes + '"' + ";"; diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneMarkGTFReader.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneMarkGTFReader.java index 8f0f53b026..4fd3366507 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneMarkGTFReader.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneMarkGTFReader.java @@ -63,27 +63,27 @@ public static FeatureList read(String filename) throws IOException { logger.info("Reading: {}", filename); FeatureList features = new FeatureList(); - BufferedReader br = new BufferedReader(new FileReader(filename)); + try (BufferedReader br = new BufferedReader(new FileReader(filename))) { - String s; - for (s = br.readLine(); null != s; s = br.readLine()) { - s = s.trim(); + String s; + for (s = br.readLine(); null != s; s = br.readLine()) { + s = s.trim(); - if (s.length() > 0) { - if (s.charAt(0) == '#') { - //ignore comment lines - } else { + if (s.length() > 0) { + if (s.charAt(0) == '#') { + //ignore comment lines + } else { - FeatureI f = parseLine(s); - if (f != null) { - features.add(f); + FeatureI f = parseLine(s); + if (f != null) { + features.add(f); + } } } + } } - - br.close(); return features; } @@ -147,9 +147,9 @@ private static Feature parseLine(String s) { end = s.indexOf('#', start); String attributes = null; if (end < 0) { - attributes = new String(s.substring(start)); + attributes = s.substring(start); } else { - attributes = new String(s.substring(start, end)); + attributes = s.substring(start, end); } return new Feature(seqname, source, type, location, score, frame, attributes); 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 91e71463f8..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 '.'" ); } @@ -409,9 +409,9 @@ public LocIterator iterator( int windowSize, int increment ) * The part of this location before the specified position. If position is negative, * count backwards from the end. *

    - * For position >= 0, return Location( start, start + position ). + * For position >= 0, return Location( start, start + position ). *
    - * For position < 0, return Location( start, end + position ). + * For position < 0, return Location( start, end + position ). *
    * @return New location from start of this location to directly before position. * @param position Where the prefix ends. @@ -451,9 +451,9 @@ public Location prefix( int position ) * The part of this location after the specified position. If position is negative, count backwards * from the end. *

    - * For position >= 0, return Location( start + position, end ). + * For position >= 0, return Location( start + position, end ). *
    - * For position < 0, return Location( end - position, end ). + * For position < 0, return Location( end - position, end ). *
    * @return New location from position to end of this location. * @param position Where the suffix starts. @@ -843,7 +843,7 @@ public boolean isSameStrand( Location other ) @Override public String toString() { - return new String( "[L=" + (mEnd - mStart) + "; S=" + mStart + "; E=" + mEnd +"]" ); + return "[L=" + (mEnd - mStart) + "; S=" + mStart + "; E=" + mEnd +"]"; } /* (non-Javadoc) diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitParser.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitParser.java index 4f5733037d..122dc4e6c8 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitParser.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitParser.java @@ -52,7 +52,7 @@ public class TwoBitParser extends InputStream { private File f; private boolean reverse = false; private String[] seq_names; - private HashMap seq2pos = new HashMap(); + private HashMap seq2pos = new HashMap<>(); private String cur_seq_name; private long[][] cur_nn_blocks; private long[][] cur_mask_blocks; @@ -91,7 +91,7 @@ else if(sign==0x4327411A) { int name_len = raf.read(); char[] chars = new char[name_len]; for(int j=0;j 2) { + long start = Long.parseLong(args[2]); + p.skip(start); + } + if (args.length > 3) { + long len = Long.parseLong(args[3]); + p.printFastaSequence(len); + } else { + p.printFastaSequence(); + } p.close(); } + p.closeParser(); } - else { - String name = args[1]; - p.setCurrentSequence(name); - if(args.length>2) { - long start = Long.parseLong(args[2]); - p.skip(start); - } - if(args.length>3) { - long len = Long.parseLong(args[3]); - p.printFastaSequence(len); - } - else { - p.printFastaSequence(); - } - p.close(); - } - p.closeParser(); } } diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/query/BlastXMLQuery.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/query/BlastXMLQuery.java index ff5e1318d0..98f36dd22f 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/query/BlastXMLQuery.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/query/BlastXMLQuery.java @@ -29,10 +29,11 @@ import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.List; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class BlastXMLQuery { @@ -47,21 +48,21 @@ public BlastXMLQuery(String blastFile) throws Exception { } public LinkedHashMap> getHitsQueryDef(double maxEScore) throws Exception { - LinkedHashMap> hitsHashMap = new LinkedHashMap>(); + LinkedHashMap> hitsHashMap = new LinkedHashMap<>(); logger.info("Query for hits"); - ArrayList elementList = XMLHelper.selectElements(blastDoc.getDocumentElement(), "BlastOutput_iterations/Iteration[Iteration_hits]"); + List elementList = XMLHelper.selectElements(blastDoc.getDocumentElement(), "BlastOutput_iterations/Iteration[Iteration_hits]"); logger.info("{} hits", elementList.size()); for (Element element : elementList) { Element iterationquerydefElement = XMLHelper.selectSingleElement(element, "Iteration_query-def"); String querydef = iterationquerydefElement.getTextContent(); Element iterationHitsElement = XMLHelper.selectSingleElement(element, "Iteration_hits"); - ArrayList hitList = XMLHelper.selectElements(iterationHitsElement, "Hit"); + List hitList = XMLHelper.selectElements(iterationHitsElement, "Hit"); for (Element hitElement : hitList) { Element hitaccessionElement = XMLHelper.selectSingleElement(hitElement, "Hit_accession"); String hitaccession = hitaccessionElement.getTextContent(); Element hithspsElement = XMLHelper.selectSingleElement(hitElement, "Hit_hsps"); - ArrayList hspList = XMLHelper.selectElements(hithspsElement, "Hsp"); + List hspList = XMLHelper.selectElements(hithspsElement, "Hsp"); for (Element hspElement : hspList) { Element evalueElement = XMLHelper.selectSingleElement(hspElement, "Hsp_evalue"); String value = evalueElement.getTextContent(); @@ -69,7 +70,7 @@ public LinkedHashMap> getHitsQueryDef(double maxEScore if (evalue <= maxEScore) { ArrayList hits = hitsHashMap.get(querydef); if (hits == null) { - hits = new ArrayList(); + hits = new ArrayList<>(); hitsHashMap.put(querydef, hits); } hits.add(hitaccession); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/query/OutputHitsGFF.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/query/OutputHitsGFF.java index f7ac399455..5ab5e8f13a 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/query/OutputHitsGFF.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/query/OutputHitsGFF.java @@ -33,7 +33,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class OutputHitsGFF { diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/uniprot/UniprotToFasta.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/uniprot/UniprotToFasta.java index 66a9d2a086..2806e83d9d 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/uniprot/UniprotToFasta.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/uniprot/UniprotToFasta.java @@ -67,10 +67,10 @@ public void process( String uniprotDatFileName,String fastaFileName ) throws Exc String line = br.readLine(); String id = ""; StringBuffer sequence = new StringBuffer(); - ArrayList seqCodingRegionsList = new ArrayList(); + ArrayList seqCodingRegionsList = new ArrayList<>(); int count = 0; - HashMap uniqueGenes = new HashMap(); - HashMap uniqueSpecies = new HashMap(); + HashMap uniqueGenes = new HashMap<>(); + HashMap uniqueSpecies = new HashMap<>(); while(line != null){ if(line.startsWith("ID")){ String[] data = line.split(" "); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java index 8d7030f3d4..b19de4657b 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java @@ -231,12 +231,12 @@ public static int getCDSLength(GeneChromosomePosition chromPos) { */ public static ChromPos getChromosomePosForCDScoordinate(int cdsNucleotidePosition, GeneChromosomePosition chromPos) { - logger.debug(" ? Checking chromosome position for CDS position " + cdsNucleotidePosition); + logger.debug(" ? Checking chromosome position for CDS position {}", cdsNucleotidePosition); List exonStarts = chromPos.getExonStarts(); List exonEnds = chromPos.getExonEnds(); - logger.debug(" Exons:" + exonStarts.size()); + logger.debug(" Exons:{}", exonStarts.size()); int cdsStart = chromPos.getCdsStart(); int cdsEnd = chromPos.getCdsEnd(); @@ -378,7 +378,7 @@ public static ChromPos getChromPosReverse(int cdsPos, List exonStarts, if ( tmp > (end - start ) ) { tmp = (end - start ); - logger.debug("changing tmp to " + tmp); + logger.debug("changing tmp to {}", tmp); } logger.debug(" " + cdsPos + " " + codingLength + " | " + (cdsPos - codingLength) + " | " + (end -start) + " | " + tmp); logger.debug(" Exon : " + format(start+1) + " - " + format(end) + " | " + format(end - start) + " | " + codingLength + " | " + (codingLength % 3)); @@ -397,7 +397,7 @@ public static ChromPos getChromPosReverse(int cdsPos, List exonStarts, logger.debug(" coding length: " + codingLength + "(phase:" + (codingLength % 3) + ") CDS POS trying to map:" + cdsPos); } - logger.debug("length exons: " + lengthExons); + logger.debug("length exons: {}", lengthExons); // could not map, or map over the full length?? return new ChromPos(-1,-1); @@ -811,11 +811,11 @@ public static int getCDSPosForward(int chromPos, List exonStarts, List< // the genetic coordinate is not in a coding region if ( (chromPos < (cdsStart+base) ) || ( chromPos > (cdsEnd+base) ) ) { - logger.debug("The "+format(chromPos)+" position is not in a coding region"); + logger.debug("The {} position is not in a coding region", format(chromPos)); return -1; } - logger.debug("looking for CDS position for " +format(chromPos)); + logger.debug("looking for CDS position for {}", format(chromPos)); // map the genetic coordinates of coding region on a stretch of a reverse strand List> cdsRegions = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); @@ -858,11 +858,11 @@ public static int getCDSPosReverse(int chromPos, List exonStarts, List< // the genetic coordinate is not in a coding region if ( (chromPos < (cdsStart+base)) || ( chromPos > (cdsEnd+base) ) ) { - logger.debug("The "+format(chromPos)+" position is not in a coding region"); + logger.debug("The {} position is not in a coding region", format(chromPos)); return -1; } - logger.debug("looking for CDS position for " +format(chromPos)); + logger.debug("looking for CDS position for {}", format(chromPos)); // map the genetic coordinate on a stretch of a reverse strand List> cdsRegions = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); diff --git a/biojava-genome/src/main/java/org/biojava/nbio/genome/util/SplitFasta.java b/biojava-genome/src/main/java/org/biojava/nbio/genome/util/SplitFasta.java index 4948a62c76..a618443d0f 100644 --- a/biojava-genome/src/main/java/org/biojava/nbio/genome/util/SplitFasta.java +++ b/biojava-genome/src/main/java/org/biojava/nbio/genome/util/SplitFasta.java @@ -30,11 +30,12 @@ import java.io.File; import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.Map; /** * Utility to write each Fasta entry to a unique file - * @author Scooter Willis + * @author Scooter Willis */ public class SplitFasta { @@ -44,7 +45,7 @@ public void processNucleotides(File fastaFileName,String uniqueid, File outputDi if(!outputDirectory.exists()) outputDirectory.mkdirs(); - LinkedHashMap dnaSequenceHashMap = FastaReaderHelper.readFastaDNASequence(fastaFileName); + Map dnaSequenceHashMap = FastaReaderHelper.readFastaDNASequence(fastaFileName); for(DNASequence dnaSequence : dnaSequenceHashMap.values()){ String fileName = outputDirectory.getAbsolutePath() + File.separatorChar; if(uniqueid.length() > 0){ @@ -52,7 +53,7 @@ public void processNucleotides(File fastaFileName,String uniqueid, File outputDi }else{ fileName = fileName + uniqueid + dnaSequence.getAccession().getID() + ".fna"; } - ArrayList dnaList = new ArrayList(); + ArrayList dnaList = new ArrayList<>(); dnaList.add(dnaSequence); FastaWriterHelper.writeNucleotideSequence(new File(fileName), dnaList); } diff --git a/biojava-genome/src/test/java/org/biojava/nbio/genome/GeneFeatureHelperTest.java b/biojava-genome/src/test/java/org/biojava/nbio/genome/GeneFeatureHelperTest.java index ba0a5d21a3..3c81c50916 100644 --- a/biojava-genome/src/test/java/org/biojava/nbio/genome/GeneFeatureHelperTest.java +++ b/biojava-genome/src/test/java/org/biojava/nbio/genome/GeneFeatureHelperTest.java @@ -39,10 +39,11 @@ import java.nio.file.Files; import java.util.Collection; import java.util.LinkedHashMap; +import java.util.Map; /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GeneFeatureHelperTest { @@ -112,7 +113,7 @@ public void testOutputFastaSequenceLengthGFF3() throws Exception { @Test public void testAddGFF3Note() throws Exception { - LinkedHashMap chromosomeSequenceList = GeneFeatureHelper + Map chromosomeSequenceList = GeneFeatureHelper .loadFastaAddGeneFeaturesFromGmodGFF3(new File("src/test/resources/volvox_all.fna"), new File( "src/test/resources/volvox.gff3"), false); ChromosomeSequence ctgASequence = chromosomeSequenceList.get("ctgA"); @@ -128,10 +129,10 @@ public void testAddGFF3Note() throws Exception { */ @Test public void testGetProteinSequences() throws Exception { - LinkedHashMap chromosomeSequenceList = GeneFeatureHelper + Map chromosomeSequenceList = GeneFeatureHelper .loadFastaAddGeneFeaturesFromGmodGFF3(new File("src/test/resources/volvox_all.fna"), new File( "src/test/resources/volvox.gff3"), false); - LinkedHashMap proteinSequenceList = GeneFeatureHelper + Map proteinSequenceList = GeneFeatureHelper .getProteinSequences(chromosomeSequenceList.values()); // for(ProteinSequence proteinSequence : proteinSequenceList.values()){ // logger.info("Output={}", proteinSequence.getSequenceAsString()); @@ -149,10 +150,10 @@ public void testGetProteinSequences() throws Exception { @Test public void testGetGeneSequences() throws Exception { // logger.info("getGeneSequences"); - LinkedHashMap chromosomeSequenceList = GeneFeatureHelper + Map chromosomeSequenceList = GeneFeatureHelper .loadFastaAddGeneFeaturesFromGmodGFF3(new File("src/test/resources/volvox_all.fna"), new File( "src/test/resources/volvox.gff3"), true); - LinkedHashMap geneSequenceHashMap = GeneFeatureHelper + Map geneSequenceHashMap = GeneFeatureHelper .getGeneSequences(chromosomeSequenceList.values()); Collection geneSequences = geneSequenceHashMap.values(); diff --git a/biojava-integrationtest/pom.xml b/biojava-integrationtest/pom.xml index d02011571c..1c21373bd1 100644 --- a/biojava-integrationtest/pom.xml +++ b/biojava-integrationtest/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-integrationtest jar @@ -40,7 +40,7 @@ org.biojava biojava-structure - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT @@ -50,7 +50,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestCrystallographicMetadata.java b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestCrystallographicMetadata.java index 58eb09fb42..054d217b2f 100644 --- a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestCrystallographicMetadata.java +++ b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestCrystallographicMetadata.java @@ -88,9 +88,9 @@ public void test1zna() throws Exception { Structure s = StructureIO.getStructure("1zna"); - // 1zna is one of the few entries that has a non-standard SG - assertTrue(s.getCrystallographicInfo().isNonStandardSg()); - assertNull(s.getCrystallographicInfo().getSpaceGroup()); + // 1zna was one of the few entries in a non-standard coordinate frame convention: but after a remediation in July 2023 it was finally fixed + assertFalse(s.getCrystallographicInfo().isNonStandardSg()); + assertNotNull(s.getCrystallographicInfo().getSpaceGroup()); } diff --git a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/scop/ScopDescriptionTest.java b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/scop/ScopDescriptionTest.java index 39f1fdacf2..5976d635c9 100644 --- a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/scop/ScopDescriptionTest.java +++ b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/scop/ScopDescriptionTest.java @@ -30,7 +30,7 @@ /** - * @author Spencer Bliven + * @author Spencer Bliven sbliven@ucsd.edu * */ public class ScopDescriptionTest { diff --git a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/symmetry/TestQuatSymmetryDetectorExamples.java b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/symmetry/TestQuatSymmetryDetectorExamples.java index 08946e3e0a..012cd4af6f 100644 --- a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/symmetry/TestQuatSymmetryDetectorExamples.java +++ b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/symmetry/TestQuatSymmetryDetectorExamples.java @@ -147,7 +147,6 @@ public void testPseudosymmetry() throws IOException, StructureException { public void testLocal() throws IOException, StructureException { AtomCache atomCache = new AtomCache(); - atomCache.setFiletype(StructureFiletype.MMTF); List testIds = new ArrayList<>(); List testStoichiometries = new ArrayList<>(); diff --git a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/util/StringManipulationTestsHelper.java b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/util/StringManipulationTestsHelper.java index 578816efb9..23664c68a3 100644 --- a/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/util/StringManipulationTestsHelper.java +++ b/biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/util/StringManipulationTestsHelper.java @@ -42,7 +42,7 @@ public static void assertEqualsIgnoreEndline(String expected, String actual) { /** * Asserts that two XML-representing strings are equal, by recursively - * comparing each node's set of properties & children nodes. This method + * comparing each node's set of properties and children nodes. This method * should be used when two XMLs are considered identical when all nodes are * identical regardless to their order * diff --git a/biojava-modfinder/pom.xml b/biojava-modfinder/pom.xml index a87767f8a9..e8de9e38d9 100644 --- a/biojava-modfinder/pom.xml +++ b/biojava-modfinder/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-modfinder biojava-modfinder @@ -31,7 +31,7 @@ org.biojava biojava-structure - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT jar compile @@ -43,7 +43,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j @@ -54,8 +54,8 @@ log4j-core - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api org.glassfish.jaxb diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Dataset.java b/biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Dataset.java index 2ad301d112..82a4f46933 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Dataset.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Dataset.java @@ -200,7 +200,7 @@ public static void main(String[] args) { logger.info("Got " + sites.size() + " sites"); for (Site s : sites) { - if (s.getUniprot().equals("P50225") || s.getUniprot().equals("P48025")) { + if ("P50225".equals(s.getUniprot()) || "P48025".equals(s.getUniprot())) { logger.info(s.toString()); } } diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Site.java b/biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Site.java index ca5e4a5f2f..5970b1f332 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Site.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/phosphosite/Site.java @@ -42,15 +42,17 @@ public Site(){ public static List parseSites(File f) throws IOException { - InputStream inStream = new FileInputStream(f); - InputStream gzipStream = new GZIPInputStream(inStream); + InputStream gzipStream; + try (InputStream inStream = new FileInputStream(f)) { + gzipStream = new GZIPInputStream(inStream); + } Reader decoder = new InputStreamReader(gzipStream); BufferedReader buf = new BufferedReader(decoder); String line = null; - List data = new ArrayList(); + List data = new ArrayList<>(); List headerFields = null; @@ -131,7 +133,7 @@ public static List parseSites(File f) throws IOException { private static List parseHeaderFields(String line) { String[] spl = line.split("\t"); - List h = new ArrayList(); + List h = new ArrayList<>(); for (String s: spl){ h.add(s); diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/Component.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/Component.java index ff4b0abb82..08dafb0626 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/Component.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/Component.java @@ -30,7 +30,7 @@ * contains information about a certain Component. * The Component class uses the extensible enum pattern. * You can't instantiate Component directly, instead - * you have to use one of the {@link register} and {@link of} methods. + * you have to use one of the register and {@link #of} methods. * * @author Jianjiong Gao * @since 3.0 @@ -50,10 +50,10 @@ public final class Component { */ private static void lazyInit() { if (components==null) { - components = new HashSet(); - nonTerminalComps = new HashMap, Component>(); - nTerminalAminoAcids = new HashMap, Component>(); - cTerminalAminoAcids = new HashMap, Component>(); + components = new HashSet<>(); + nonTerminalComps = new HashMap<>(); + nTerminalAminoAcids = new HashMap<>(); + cTerminalAminoAcids = new HashMap<>(); } } @@ -109,7 +109,7 @@ public boolean isCTerminal() { /** * Get a Component that does not have to occur at terminals. If the * corresponding component has already been registered, return that one. - * @param pdbccIds possible Protein Data Bank ID. + * @param pdbccId possible Protein Data Bank ID. * @return a component. * @throws IllegalArgumentException if pdbccId or type is null, * or the pdbccId has been registered as a different type. diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationCategory.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationCategory.java index 89d9bd9720..8dcadab400 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationCategory.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationCategory.java @@ -108,7 +108,7 @@ public static ModificationCategory getByLabel(String label) { private static Map mapLabelCat; static { - mapLabelCat = new HashMap(); + mapLabelCat = new HashMap<>(); for (ModificationCategory cat:ModificationCategory.values()) { mapLabelCat.put(cat.label, cat); } diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationConditionImpl.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationConditionImpl.java index 2af28ed33f..5cb7857bdd 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationConditionImpl.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationConditionImpl.java @@ -49,7 +49,7 @@ public ModificationConditionImpl(final List components, if (components.size() > 1) { - Set indices = new HashSet(); + Set indices = new HashSet<>(); for (ModificationLinkage linkage : linkages) { indices.add(linkage.getIndexOfComponent1()); indices.add(linkage.getIndexOfComponent2()); diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationLinkage.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationLinkage.java index 75ddb4c807..8bbccacce3 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationLinkage.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationLinkage.java @@ -54,10 +54,10 @@ public ModificationLinkage( * * @param components {@link Component}s involved in a modification. * @param indexOfComponent1 index of the first component. - * @param labelOfAtomOnComponent1 label of the atom on the first + * @param pdbNameOfAtomsOnComponent1 label of the atom on the first * component. * @param indexOfComponent2 index of the second component. - * @param labelOfAtomOnComponent2 label of the atom on the second + * @param pdbNameOfAtomsOnComponent2 label of the atom on the second * component. */ public ModificationLinkage( @@ -77,10 +77,10 @@ public ModificationLinkage( * * @param components {@link Component}s involved in a modification. * @param indexOfComponent1 index of the first component. - * @param labelOfAtomOnComponent1 label of the atom on the first + * @param pdbNameOfPotentialAtomsOnComponent1 label of the atom on the first * component. * @param indexOfComponent2 index of the second component. - * @param labelOfAtomOnComponent2 label of the atom on the second + * @param pdbNameOfPotentialAtomsOnComponent2 label of the atom on the second * component. */ public ModificationLinkage( diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationOccurrenceType.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationOccurrenceType.java index 30a4bad4e0..3fdcef1e0a 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationOccurrenceType.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ModificationOccurrenceType.java @@ -73,7 +73,7 @@ public static ModificationOccurrenceType getByLabel(String label) { private static Map mapLabelOcc; static { - mapLabelOcc = new HashMap(); + mapLabelOcc = new HashMap<>(); for (ModificationOccurrenceType occ:ModificationOccurrenceType.values()) { mapLabelOcc.put(occ.label, occ); } diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ProteinModificationImpl.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ProteinModificationImpl.java index a06ee41936..dd4f11d41f 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ProteinModificationImpl.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ProteinModificationImpl.java @@ -251,7 +251,7 @@ public static class Builder { private String sysName = null; private String formula = null; - private Set keywords = new LinkedHashSet(); + private Set keywords = new LinkedHashSet<>(); /** * @@ -289,7 +289,7 @@ public Builder(final ProteinModification copyFrom) { this.sysName = copyFrom.getSystematicName(); this.formula = copyFrom.getFormula(); - this.keywords = new LinkedHashSet(copyFrom.getKeywords()); + this.keywords = new LinkedHashSet<>(copyFrom.getKeywords()); } public Builder setCategory(final ModificationCategory cat) { @@ -448,7 +448,7 @@ private ProteinModificationImpl(Builder builder) { this.sysName = builder.sysName; this.formula = builder.formula; - this.keywords = new LinkedHashSet(builder.keywords); + this.keywords = new LinkedHashSet<>(builder.keywords); } @Override diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ProteinModificationRegistry.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ProteinModificationRegistry.java index 54babab8e1..383560ab01 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ProteinModificationRegistry.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/ProteinModificationRegistry.java @@ -109,19 +109,19 @@ private static synchronized void lazyInit() { private static synchronized void lazyInit(InputStream inStream) { if (registry==null) { - registry = new HashSet(); - byId = new HashMap(); - byResidId = new HashMap>(); - byPsimodId = new HashMap>(); - byPdbccId = new HashMap>(); - byKeyword = new HashMap>(); - byComponent = new HashMap>(); - byCategory = new EnumMap>( + registry = new HashSet<>(); + byId = new HashMap<>(); + byResidId = new HashMap<>(); + byPsimodId = new HashMap<>(); + byPdbccId = new HashMap<>(); + byKeyword = new HashMap<>(); + byComponent = new HashMap<>(); + byCategory = new EnumMap<>( ModificationCategory.class); for (ModificationCategory cat:ModificationCategory.values()) { byCategory.put(cat, new HashSet()); } - byOccurrenceType = new EnumMap>( + byOccurrenceType = new EnumMap<>( ModificationOccurrenceType.class); for (ModificationOccurrenceType occ:ModificationOccurrenceType.values()) { byOccurrenceType.put(occ, new HashSet()); @@ -158,7 +158,7 @@ public static void register(final ProteinModification modification) { for (Component comp:comps) { Set mods = byComponent.get(comp); if (mods==null) { - mods = new HashSet(); + mods = new HashSet<>(); byComponent.put(comp, mods); } mods.add(modification); @@ -168,7 +168,7 @@ public static void register(final ProteinModification modification) { if (pdbccId!=null) { Set mods = byPdbccId.get(pdbccId); if (mods==null) { - mods = new HashSet(); + mods = new HashSet<>(); byPdbccId.put(pdbccId, mods); } mods.add(modification); @@ -178,7 +178,7 @@ public static void register(final ProteinModification modification) { if (residId!=null) { Set mods = byResidId.get(residId); if (mods==null) { - mods = new HashSet(); + mods = new HashSet<>(); byResidId.put(residId, mods); } mods.add(modification); @@ -188,7 +188,7 @@ public static void register(final ProteinModification modification) { if (psimodId!=null) { Set mods = byPsimodId.get(psimodId); if (mods==null) { - mods = new HashSet(); + mods = new HashSet<>(); byPsimodId.put(psimodId, mods); } mods.add(modification); @@ -197,7 +197,7 @@ public static void register(final ProteinModification modification) { for (String keyword : modification.getKeywords()) { Set mods = byKeyword.get(keyword); if (mods==null) { - mods = new HashSet(); + mods = new HashSet<>(); byKeyword.put(keyword, mods); } mods.add(modification); @@ -206,7 +206,7 @@ public static void register(final ProteinModification modification) { /** * Remove a modification from registry. - * @param mod + * @param modification */ public static void unregister(ProteinModification modification) { if (modification==null) throw new IllegalArgumentException("modification == null!"); @@ -308,7 +308,7 @@ public static Set getByComponent(final Component comp1, if (comps.length==0) { return Collections.unmodifiableSet(mods); } else { - Set ret = new HashSet(mods); + Set ret = new HashSet<>(mods); for (Component comp:comps) { mods = byComponent.get(comp); if (mods==null) { diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ComponentXMLConverter.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ComponentXMLConverter.java index 138488b650..15d635f4da 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ComponentXMLConverter.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ComponentXMLConverter.java @@ -64,7 +64,7 @@ public static Component fromXML(String xml){ public static Component fromXML(Node componentN) { String name = componentN.getNodeName(); - if ( ! name.equals("component")) + if ( ! "component".equals(name)) throw new RuntimeException("did not get component element, but " + name); //String type = getAttribute(componentN, "type"); @@ -74,7 +74,7 @@ public static Component fromXML(Node componentN) { boolean isNTerminal = Boolean.parseBoolean(nTerminalS); boolean isCTerminal = Boolean.parseBoolean(cTerminalS); - SetpdbccIds = new HashSet(); + SetpdbccIds = new HashSet<>(); NodeList valList = componentN.getChildNodes(); int numChildren = valList.getLength(); @@ -86,7 +86,7 @@ public static Component fromXML(Node componentN) { if(!pdbccN.hasAttributes()) continue; - if ( pdbccN.getNodeName().equals("pdbccID")) { + if ( "pdbccID".equals(pdbccN.getNodeName())) { String id = getAttribute(pdbccN, "id"); pdbccIds.add(id); } diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java index fb76e02340..187e113924 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java @@ -110,7 +110,7 @@ public static ModifiedCompound fromXML(String xml){ ProteinModification modification = null; //Collection linkages = new ArrayList(); StructureAtomLinkage[] linkages = null; - List structureGroups = new ArrayList(); + List structureGroups = new ArrayList<>(); try { //Convert string to XML document @@ -142,14 +142,14 @@ public static ModifiedCompound fromXML(String xml){ if(!listOfConditions.hasAttributes()) continue; - if ( listOfConditions.getNodeName().equals("proteinModification")) { + if ( "proteinModification".equals(listOfConditions.getNodeName())) { //modification = ProteinModificationXMLConverter.fromXML(listOfConditions); String modId = getAttribute(listOfConditions, "id"); modification = ProteinModificationRegistry.getById(modId); if (modification==null) { logger.warn("Error: no modification information."); } - } else if ( listOfConditions.getNodeName().equals("linkage")) { + } else if ( "linkage".equals(listOfConditions.getNodeName())) { double dist = Double.parseDouble(getAttribute(listOfConditions, "distance")); int pos = Integer.parseInt(getAttribute(listOfConditions,"pos")); int total = Integer.parseInt(getAttribute(listOfConditions,"total")); @@ -161,7 +161,7 @@ public static ModifiedCompound fromXML(String xml){ StructureAtomLinkage linkage = new StructureAtomLinkage(atom1, atom2, dist); //linkages.add(linkage); linkages[pos] = linkage; - } else if (listOfConditions.getNodeName().equals("structureGroup")) { + } else if ("structureGroup".equals(listOfConditions.getNodeName())) { StructureGroup group = StructureGroupXMLConverter.fromXML(listOfConditions); structureGroups.add(group); // logger.info("structureGroups size:" + structureGroups.size()); diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ProteinModificationXmlReader.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ProteinModificationXmlReader.java index 0a1c5f36e9..598cd17835 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ProteinModificationXmlReader.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ProteinModificationXmlReader.java @@ -121,14 +121,14 @@ public static void registerProteinModificationFromXml(InputStream isXml) Node compsNode = nodes.get(0); // keep track of the labels of component indices - Map mapLabelComp = new HashMap(); + Map mapLabelComp = new HashMap<>(); Map> compInfoNodes = getChildNodes(compsNode); // components List compNodes = compInfoNodes.get("Component"); int sizeComp = compNodes.size(); - List comps = new ArrayList(sizeComp); + List comps = new ArrayList<>(sizeComp); for (int iComp=0; iComp compIds = new HashSet(); + Set compIds = new HashSet<>(); List compIdNodes = getChildNodes(compNode).get("Id"); if (compIdNodes!=null) { for (Node compIdNode : compIdNodes) { NamedNodeMap compIdNodeAttr = compIdNode.getAttributes(); Node compIdSource = compIdNodeAttr.getNamedItem("source"); - if (compIdSource!=null && compIdSource.getTextContent().equals("PDBCC")) { + if (compIdSource!=null && "PDBCC".equals(compIdSource.getTextContent())) { String strComps = compIdNode.getTextContent(); if (strComps.isEmpty()) { throw new RuntimeException("Empty component." + @@ -178,9 +178,9 @@ public static void registerProteinModificationFromXml(InputStream isXml) "each component. See Modification "+id+"."); } String nc = compTermNode.get(0).getTextContent(); - if (nc.equals("N")) { + if ("N".equals(nc)) { nTerminal = true; - } else if (nc.equals("C")) { + } else if ("C".equals(nc)) { cTerminal = true; } else { throw new RuntimeException("Only N or C is allowed for ." + @@ -199,7 +199,7 @@ public static void registerProteinModificationFromXml(InputStream isXml) List linkages = null; if (bondNodes!=null) { int sizeBonds = bondNodes.size(); - linkages = new ArrayList(sizeBonds); + linkages = new ArrayList<>(sizeBonds); for (int iBond=0; iBond> bondChildNodes = getChildNodes(bondNode); @@ -305,11 +305,11 @@ public static void registerProteinModificationFromXml(InputStream isXml) xrefName = xrefNode.get(0).getTextContent(); } - if (xrefDb.equals("PDBCC")) { + if ("PDBCC".equals(xrefDb)) { modBuilder.setPdbccId(xrefId).setPdbccName(xrefName); - } else if (xrefDb.equals("RESID")) { + } else if ("RESID".equals(xrefDb)) { modBuilder.setResidId(xrefId).setResidName(xrefName); - } else if (xrefDb.equals("PSI-MOD")) { + } else if ("PSI-MOD".equals(xrefDb)) { modBuilder.setPsimodId(xrefId).setPsimodName(xrefName); } } @@ -342,7 +342,7 @@ private static Map> getChildNodes(Node parent) { if (parent==null) return Collections.emptyMap(); - Map> children = new HashMap>(); + Map> children = new HashMap<>(); NodeList nodes = parent.getChildNodes(); int nNodes = nodes.getLength(); @@ -354,7 +354,7 @@ private static Map> getChildNodes(Node parent) { String name = node.getNodeName(); List namesakes = children.get(name); if (namesakes==null) { - namesakes = new ArrayList(); + namesakes = new ArrayList<>(); children.put(name, namesakes); } namesakes.add(node); diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/StructureAtomXMLConverter.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/StructureAtomXMLConverter.java index 08f69725bf..75e88d5c3a 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/StructureAtomXMLConverter.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/StructureAtomXMLConverter.java @@ -55,7 +55,7 @@ public static void toXML(StructureAtom atom, PrettyXMLWriter xml) throws IOExcep public static StructureAtom fromXML(Node structureAtomElement){ String name = structureAtomElement.getNodeName(); - if ( ! name.equals("structureAtom")) + if ( ! "structureAtom".equals(name)) throw new RuntimeException("Node is not a structureAtom, but " +name); String atomName = getAttribute( structureAtomElement,"name"); @@ -70,7 +70,7 @@ public static StructureAtom fromXML(Node structureAtomElement){ if(!nodes.hasAttributes()) continue; - if ( nodes.getNodeName().equals("structureGroup")) { + if ( "structureGroup".equals(nodes.getNodeName())) { group = StructureGroupXMLConverter.fromXML(nodes); } } diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/StructureGroupXMLConverter.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/StructureGroupXMLConverter.java index 61a56e3b6b..f81ea6ddf2 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/StructureGroupXMLConverter.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/StructureGroupXMLConverter.java @@ -53,7 +53,7 @@ public static StructureGroup fromXML(Node n) { ResidueNumber resNum = new ResidueNumber(); resNum.setChainName(chainID); - if ( ( insCode != null) && (! insCode.equals("null")) && insCode.length() == 1) + if ( ( insCode != null) && (! "null".equals(insCode)) && insCode.length() == 1) resNum.setInsCode(insCode.charAt(0)); resNum.setSeqNum(Integer.parseInt(resN)); diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ModifiedCompound.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ModifiedCompound.java index 164c3d86d9..1a65fcdfbc 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ModifiedCompound.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ModifiedCompound.java @@ -47,7 +47,7 @@ public interface ModifiedCompound { /** * - * @return {@link ProteinModificationBean} occurred on the residue. + * @return {@link ProteinModification} occurred on the residue. */ public ProteinModification getModification(); @@ -73,19 +73,18 @@ public interface ModifiedCompound { /** * * @return a set of atom linkages. - * @see #getLinkedGroupPairs * @see StructureAtomLinkage */ public Set getAtomLinkages(); - /** Set atom linkages + /** + * Set atom linkages * - * @return */ public void setAtomLinkages(Set linkages); /** - * Add a linkage. Add new the involved groups first using {@link addGroup}. + * Add a linkage. Add new the involved groups first using addGroup. * @param linkage an atom linkage. * @return true if this linkage was not already contained. * @see StructureAtomLinkage diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ModifiedCompoundImpl.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ModifiedCompoundImpl.java index e42d987e61..435772defd 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ModifiedCompoundImpl.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ModifiedCompoundImpl.java @@ -65,7 +65,6 @@ public ModifiedCompoundImpl(){ * Use this constructor for a modified residue. * @param modification {@link ProteinModification}. * @param modifiedResidue modified group. - * @return a {@link ModifiedCompound}. * @throws IllegalArgumentException if either argument is null. */ public ModifiedCompoundImpl ( @@ -75,7 +74,7 @@ public ModifiedCompoundImpl ( throw new IllegalArgumentException("Null argument(s)"); } - groups = new HashSet(1); + groups = new HashSet<>(1); groups.add(modifiedResidue); // is it possible that components be added by addLinkage later? @@ -101,7 +100,7 @@ public ModifiedCompoundImpl( ProteinModification modification, throw new IllegalArgumentException("at least one linkage."); } - this.groups = new HashSet(); + this.groups = new HashSet<>(); addAtomLinkages(linkages); @@ -128,7 +127,7 @@ else if (originalModification.getCategory()!=ModificationCategory.UNDEFINED) modification = originalModification; else { int nRes = 0; - Set ligands = new HashSet(); + Set ligands = new HashSet<>(); for (StructureGroup group : groups) { if (group.isAminoAcid()) { nRes ++; @@ -174,7 +173,7 @@ public Set getGroups() { @Override public Set getGroups(boolean isAminoAcid) { - Set result = new HashSet(); + Set result = new HashSet<>(); for (StructureGroup group : groups) { if (group.isAminoAcid() == isAminoAcid) { result.add(group); @@ -194,7 +193,7 @@ public Set getAtomLinkages() { if (atomLinkages==null) { return Collections.emptySet(); } else { - Set result = new HashSet(); + Set result = new HashSet<>(); for (Set linkages : atomLinkages.values()) { result.addAll(linkages); } @@ -218,17 +217,17 @@ public boolean addAtomLinkage(StructureAtomLinkage linkage) { throw new IllegalArgumentException("Null linkage"); } - Set gs = new HashSet(2); + Set gs = new HashSet<>(2); gs.add(linkage.getAtom1().getGroup()); gs.add(linkage.getAtom2().getGroup()); if (atomLinkages==null) { - atomLinkages = new HashMap, Set>(); + atomLinkages = new HashMap<>(); } Set linkages = atomLinkages.get(gs); if (linkages == null) { - linkages = new HashSet(); + linkages = new HashSet<>(); atomLinkages.put(gs, linkages); groups.addAll(gs); // it's possible of new groups }; diff --git a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java index fdfd8cf312..c9575a5444 100644 --- a/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java +++ b/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java @@ -267,9 +267,9 @@ public void identify(final List chains, } - residues = new ArrayList(); - List ligands = new ArrayList(); - Map> mapCompGroups = new HashMap>(); + residues = new ArrayList<>(); + List ligands = new ArrayList<>(); + Map> mapCompGroups = new HashMap<>(); for (Chain chain : chains) { @@ -292,7 +292,7 @@ public void identify(final List chains, } logger.warn("No amino acids found for {}. Either you did not parse the PDB file with alignSEQRES records, or this record does not contain any amino acids.", pdbId); } - List modComps = new ArrayList(); + List modComps = new ArrayList<>(); for (ProteinModification mod : potentialModifications) { ModificationCondition condition = mod.getCondition(); @@ -333,10 +333,10 @@ public void identify(final List chains, } private void reset() { - identifiedModifiedCompounds = new LinkedHashSet(); + identifiedModifiedCompounds = new LinkedHashSet<>(); if (recordUnidentifiableModifiedCompounds) { - unidentifiableAtomLinkages = new LinkedHashSet(); - unidentifiableModifiedResidues = new LinkedHashSet(); + unidentifiableAtomLinkages = new LinkedHashSet<>(); + unidentifiableModifiedResidues = new LinkedHashSet<>(); } } @@ -392,7 +392,7 @@ private void identifyAdditionalAttachments(ModifiedCompound mc, // ligands to amino acid bonds for same modification of unknown category // will be combined in mergeModComps() // TODO: how about chain-chain links? - List identifiedGroups = new ArrayList(); + List identifiedGroups = new ArrayList<>(); for (StructureGroup num : mc.getGroups(false)) { Group group; try { @@ -464,7 +464,7 @@ private Group getGroup(StructureGroup num, List chains) throws StructureE * Merge identified modified compounds if linked. */ private void mergeModComps(List modComps) { - TreeSet remove = new TreeSet(); + TreeSet remove = new TreeSet<>(); int n = modComps.size(); for (int icurr=1; icurr modComps, List ligands) { // first put identified linkages in a map for fast query - Set identifiedLinkages = new HashSet(); + Set identifiedLinkages = new HashSet<>(); for (ModifiedCompound mc : modComps) { identifiedLinkages.addAll(mc.getAtomLinkages()); } @@ -555,7 +555,7 @@ private void recordUnidentifiableAtomLinkages(List modComps, } private void recordUnidentifiableModifiedResidues(List modComps) { - Set identifiedComps = new HashSet(); + Set identifiedComps = new HashSet<>(); for (ModifiedCompound mc : modComps) { identifiedComps.addAll(mc.getGroups(true)); } @@ -592,7 +592,7 @@ private void addModificationGroups( throw new IllegalArgumentException("Null argument(s)."); } - Map> mapSingleMultiComps = new HashMap>(); + Map> mapSingleMultiComps = new HashMap<>(); for (ProteinModification mod : modifications) { ModificationCondition condition = mod.getCondition(); for (Component comp : condition.getComponents()) { @@ -601,7 +601,7 @@ private void addModificationGroups( comp.isNTerminal(), comp.isCTerminal()); Set mult = mapSingleMultiComps.get(single); if (mult == null) { - mult = new HashSet(); + mult = new HashSet<>(); mapSingleMultiComps.put(single, mult); } mult.add(comp); @@ -621,7 +621,7 @@ private void addModificationGroups( for (Component comp : unionComponentSet(ligandsWildCard, comps)) { Set gs = saveTo.get(comp); if (gs==null) { - gs = new LinkedHashSet(); + gs = new LinkedHashSet<>(); saveTo.put(comp, gs); } gs.add(group); @@ -647,7 +647,7 @@ private void addModificationGroups( for (Component comp : unionComponentSet(residuesWildCard, comps)) { Set gs = saveTo.get(comp); if (gs==null) { - gs = new LinkedHashSet(); + gs = new LinkedHashSet<>(); saveTo.put(comp, gs); } gs.add(group); @@ -671,7 +671,7 @@ private void addModificationGroups( for (Component comp : unionComponentSet(nTermWildCard, comps)) { Set gs = saveTo.get(comp); if (gs==null) { - gs = new LinkedHashSet(); + gs = new LinkedHashSet<>(); saveTo.put(comp, gs); } gs.add(res); @@ -693,7 +693,7 @@ private void addModificationGroups( for (Component comp : unionComponentSet(cTermWildCard, comps)) { Set gs = saveTo.get(comp); if (gs==null) { - gs = new LinkedHashSet(); + gs = new LinkedHashSet<>(); saveTo.put(comp, gs); } gs.add(res); @@ -712,7 +712,7 @@ private Set unionComponentSet(Set set1, Set set if (set2 == null) return set1; - Set set = new HashSet(set1.size()+set2.size()); + Set set = new HashSet<>(set1.size()+set2.size()); set.addAll(set1); set.addAll(set2); @@ -728,7 +728,7 @@ private List> getMatchedAtomsOfLinkages( int nLink = linkages.size(); List> matchedAtomsOfLinkages = - new ArrayList>(nLink); + new ArrayList<>(nLink); for (int iLink=0; iLink> getMatchedAtomsOfLinkages( Set groups1 = mapCompGroups.get(comp1); Set groups2 = mapCompGroups.get(comp2); - List list = new ArrayList(); + List list = new ArrayList<>(); List potentialNamesOfAtomOnGroup1 = linkage.getPDBNameOfPotentialAtomsOnComponent1(); for (String name : potentialNamesOfAtomOnGroup1) { - if (name.equals("*")) { + if ("*".equals(name)) { // wildcard potentialNamesOfAtomOnGroup1 = null; // search all atoms break; @@ -754,7 +754,7 @@ private List> getMatchedAtomsOfLinkages( List potentialNamesOfAtomOnGroup2 = linkage.getPDBNameOfPotentialAtomsOnComponent2(); for (String name : potentialNamesOfAtomOnGroup2) { - if (name.equals("*")) { + if ("*".equals(name)) { // wildcard potentialNamesOfAtomOnGroup2 = null; // search all atoms break; @@ -810,9 +810,9 @@ private void assembleLinkages(List> matchedAtomsOfLinkages, int nLink = matchedAtomsOfLinkages.size(); int[] indices = new int[nLink]; - Set identifiedCompounds = new HashSet(); + Set identifiedCompounds = new HashSet<>(); while (indices[0] atomLinkages = new ArrayList(nLink); + List atomLinkages = new ArrayList<>(nLink); for (int iLink=0; iLink> matchedAtomsOfLinkages, // matched int n = atomLinkages.size(); - List linkages = new ArrayList(n); + List linkages = new ArrayList<>(n); for (int i=0; i findAtomLinkages(final Group group1, throw new IllegalArgumentException("bondLengthTolerance cannot be negative."); } - List ret = new ArrayList(); + List ret = new ArrayList<>(); if (potentialNamesOfAtomOnGroup1 == null) { // if empty name, search for all atoms @@ -198,8 +198,8 @@ public static List findAtomLinkages(final Group group1, namesOfAtomOnGroup2, bondLengthTolerance); if (atoms != null) { if (ignoreNCLinkage && - ((atoms[0].getName().equals("N") && atoms[1].getName().equals("C")) - || (atoms[0].getName().equals("C") && atoms[1].getName().equals("N"))) + (("N".equals(atoms[0].getName()) && "C".equals(atoms[1].getName())) + || ("C".equals(atoms[0].getName()) && "N".equals(atoms[1].getName()))) ) { continue; } @@ -323,7 +323,7 @@ public static List getAtomNames(Group group) { } int n = atoms.size(); - List ret = new ArrayList(n); + List ret = new ArrayList<>(n); for (int i=0; i org.biojava biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-ontology @@ -33,7 +33,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/IntegerOntology.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/IntegerOntology.java index 25fdf85c30..1bdddb300d 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/IntegerOntology.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/IntegerOntology.java @@ -190,7 +190,7 @@ public boolean containsTerm(String name) { } public IntTerm resolveInt(int val) { - Integer i = new Integer(val); + Integer i = val; IntTerm term = (IntTerm) termCache.get(i); if(term == null) { diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Ontology.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Ontology.java index 2e1f26cf50..5463d3ccee 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Ontology.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Ontology.java @@ -40,7 +40,6 @@ * @author Matthew Pocock * * @since 1.4 - * @see org.biojavax.ontology.ComparableOntology */ public interface Ontology { @@ -129,7 +128,6 @@ public interface Ontology { * some other constraint of this implementation. * @throws AlreadyExistsException if a term of this name already exists * @return The newly created term. - * @throws ChangeVetoException */ public Term createTerm(String name) @@ -148,7 +146,6 @@ public Term createTerm(String name) * some other constraint of this implementation. * @throws AlreadyExistsException if a term of this name already exists * @return The newly created term. - * @throws ChangeVetoException */ public Term createTerm(String name, String description) @@ -168,7 +165,6 @@ public Term createTerm(String name, String description) * some other constraint of this implementation. * @throws AlreadyExistsException if a term of this name already exists * @return The newly created term. - * @throws ChangeVetoException */ public Term createTerm(String name, String description, Object[] synonyms) @@ -187,7 +183,6 @@ public Term createTerm(String name, String description, Object[] synonyms) * some other constraint of this implementation. * @throws AlreadyExistsException if a term of this name already exists * @return The newly created term. - * @throws ChangeVetoException */ public Variable createVariable(String name, String description) @@ -208,7 +203,6 @@ public Variable createVariable(String name, String description) * @param t the Term to import * @param localName the local name to import it under, optionally null * @return a Term - * @throws ChangeVetoException * @throws IllegalArgumentException */ @@ -228,7 +222,6 @@ public Term importTerm(Term t, String localName) * @return a new Triple over these three terms * @throws AlreadyExistsException if a triple already exists with the same * subject, object and predicate, regardless of the name and description - * @throws ChangeVetoException * @throws NullPointerException if subject, object or predicate are null * @throws IllegalArgumentException if subject, object or predicate are not all * from the same ontology @@ -251,7 +244,6 @@ public Triple createTriple(Term subject, Term object, Term predicate, String nam /** * Remove a term from an ontology, together with all triples which refer to it. * @param t - * @throws ChangeVetoException */ public void deleteTerm(Term t) ; @@ -294,13 +286,13 @@ public final class Impl private final OntologyOps ops; { - terms = new HashMap(); - triples = new HashSet(); - subjectTriples = new HashMap>(); - objectTriples = new HashMap>(); - relationTriples = new HashMap>(); - remoteTerms = new HashMap(); - localRemoteTerms = new HashSet(); + terms = new HashMap<>(); + triples = new HashSet<>(); + subjectTriples = new HashMap<>(); + objectTriples = new HashMap<>(); + relationTriples = new HashMap<>(); + remoteTerms = new HashMap<>(); + localRemoteTerms = new HashSet<>(); } public Impl(String name, String description) { @@ -337,7 +329,7 @@ public void setDescription(String description){ @Override public Set getTerms() { - return new HashSet(terms.values()); + return new HashSet<>(terms.values()); } @Override @@ -384,7 +376,7 @@ private Set filterTriples(Set base, Term subject, Term object, T return Collections.unmodifiableSet(new HashSet(base)); } - Set retval = new HashSet(); + Set retval = new HashSet<>(); for (Iterator i = base.iterator(); i.hasNext(); ) { Triple t = i.next(); if (subject != null && t.getSubject() != subject) { @@ -566,7 +558,7 @@ private void addTriple(Triple t) { private void pushTriple(Map> m, Term key, Triple t) { Set s = m.get(key); if (s == null) { - s = new HashSet(); + s = new HashSet<>(); m.put(key, s); } s.add(t); diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Term.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Term.java index 387aa7c17a..df26dcbcba 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Term.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Term.java @@ -32,7 +32,7 @@ /** - * A term in an ontology. This has an {@link org.biojava.nbio.Annotation Annotation} + * A term in an ontology. This has an {@link Annotation Annotation} * which can be used for storing additional human-displayable information. It * is strongly recommended that the Annotation is not used for any machine-readable * data -- this should be represented by relations in the ontology instead. @@ -51,9 +51,7 @@ * @author Thomas Down * @author Matthew Pocock * @since 1.4 - * @see org.biojavax.ontology.ComparableTerm */ - public interface Term extends Annotatable { /** * ChangeType which indicates that this term's ontology has been @@ -113,7 +111,6 @@ public interface Term extends Annotatable { /** * Simple in-memory implementation of an ontology term. - * @see org.biojavax.ontology.SimpleComparableTerm * This can be used to implement Ontology.createTerm */ @@ -155,7 +152,7 @@ public Impl(Ontology ontology, String name, String description, Object[] synonym this.description = description; this.ontology = ontology; - this.synonyms = new TreeSet(); + this.synonyms = new TreeSet<>(); if (synonyms!=null) this.synonyms.addAll(Arrays.asList(synonyms)); } diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Triple.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Triple.java index 550c4d5651..368bfea36e 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Triple.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/Triple.java @@ -41,7 +41,6 @@ * @author Thomas Down * @author Matthew Pocock * @since 1.4 - * @see org.biojavax.ontology.ComparableTriple */ public interface Triple @@ -79,7 +78,6 @@ public interface Triple * If you do not implement hashcode in this way then you have no guarantee * that your Triple objects will be found in an ontology and that they will * not be duplicated. - *

    */ @Override public int hashCode(); @@ -90,7 +88,7 @@ public interface Triple *

    * Two triples are equivalent if they have the same subject, object and * predicate fields. - *

    +	 * 
    {@code
     	 * if (! (o instanceof Triple)) {
     	 *     return false;
     	 * }
    @@ -98,11 +96,10 @@ public interface Triple
     	 * return to.getSubject() == getSubject() &&
     	 *        to.getObject() == getObject() &&
     	 *        to.getPredicate() == getPredicate();
    -	 * 
    + * }
    * If you do not implement equals in this way then you have no guarantee * that your Triple objects will be found in an ontology and that they will * not be duplicated. - *

    */ @Override public boolean equals(Object obj); @@ -111,9 +108,7 @@ public interface Triple * Basic in-memory implementation of a Triple in an ontology * * This can be used to implement Ontology.createTriple - * @see org.biojavax.ontology.SimpleComparableTriple */ - public static final class Impl implements Triple, java.io.Serializable { @@ -182,7 +177,7 @@ public Impl(Term subject, this.name = name; this.description = description; - this.synonyms = new TreeSet(); + this.synonyms = new TreeSet<>(); if (synonyms!=null) this.synonyms.addAll(Arrays.asList(synonyms)); } diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/GOParser.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/GOParser.java index 7754ec130a..000d69740c 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/GOParser.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/GOParser.java @@ -48,7 +48,7 @@ public Ontology parseGO(BufferedReader goFile, Ontology onto = factory.createOntology(ontoName, ontoDescription); Term isa = onto.importTerm(OntoTools.IS_A, null); Term partof = null; // fixme: onto.importTerm(OntoTools.PART_OF, null); - List termStack = new ArrayList(); + List termStack = new ArrayList<>(); String line; while ((line = goFile.readLine()) != null) { int leadSpaces = 0; @@ -63,17 +63,17 @@ public Ontology parseGO(BufferedReader goFile, StringTokenizer toke = new StringTokenizer(line, "%<$", true); String parentRel = toke.nextToken(); Term term = parseTerm(onto, toke.nextToken()); - if (parentRel.equals("%")) { + if ("%".equals(parentRel)) { safeAddTriple(onto, term, termStack.get(leadSpaces - 1), isa); - } else if (parentRel.equals("<")) { + } else if ("<".equals(parentRel)) { safeAddTriple(onto, term, termStack.get(leadSpaces - 1), partof); } while (toke.hasMoreTokens()) { String altRel = toke.nextToken(); Term altTerm = parseTerm(onto, toke.nextToken()); - if (altRel.equals("%")) { + if ("%".equals(altRel)) { safeAddTriple(onto, term, altTerm, isa); - } else if (altRel.equals("<")) { + } else if ("<".equals(altRel)) { safeAddTriple(onto, term, altTerm, partof); } } @@ -122,7 +122,7 @@ private Term parseTerm(Ontology onto, String s) } else { Term t = onto.createTerm(termName, termDesc); if (toke.hasMoreTokens()) { - List secondaries = new ArrayList(); + List secondaries = new ArrayList<>(); while (toke.hasMoreTokens()) { secondaries.add(toke.nextToken()); } diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/TabDelimParser.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/TabDelimParser.java index 2c0ed0a3ae..77259b0e5b 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/TabDelimParser.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/TabDelimParser.java @@ -54,7 +54,7 @@ * the core ontology. *

    * - *
    + * 
      * ...
      * triple	is-a	any
      * triple	has-a	source
    @@ -62,7 +62,7 @@
      * triple	has-a	predicate
      * (triple,has-a,any)	size	3
      * ...
    - * 
    + *
    * *

    * The first four lines just associate triple with some type with a predicate diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/package-info.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/package-info.java index b6aed42304..43c5d532bc 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/package-info.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/package-info.java @@ -19,10 +19,8 @@ * */ /** - * *

    * Tools for loading and saving ontologies. *

    - * */ package org.biojava.nbio.ontology.io; \ No newline at end of file diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/obo/OboFileHandler.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/obo/OboFileHandler.java index aeee6aa627..116ee735d2 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/obo/OboFileHandler.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/obo/OboFileHandler.java @@ -90,7 +90,7 @@ public void documentEnd() { @Override public void documentStart() { - termStack = new ArrayList(); + termStack = new ArrayList<>(); } @Override diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/obo/OboFileParser.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/obo/OboFileParser.java index 76b7d673c2..8e8a16d174 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/obo/OboFileParser.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/obo/OboFileParser.java @@ -33,12 +33,13 @@ import java.util.*; -/** A class to parse the content of an OBO file. It delegates handling of the +/** + * A class to parse the content of an OBO file. It delegates handling of the * content to the OBOFileEventListener implementation. * * This file contains parts of the OBO-Edit file OBOParseEngine, (particularly the encoding and decoding part) * - * http://geneontology.cvs.sourceforge.net/geneontology/go-dev/java/oboedit/sources/org/geneontology/oboedit/dataadapter/OBOParseEngine.java?revision=1.10&view=markup + * See link * Thanks to the OboEdit developers for giving permission to release this in BioJava. * * @@ -61,27 +62,27 @@ public class OboFileParser { protected static final Map escapeChars = - new HashMap(); + new HashMap<>(); protected static final Map unescapeChars = - new HashMap(); + new HashMap<>(); static { - escapeChars.put(new Character('n'), new Character('\n')); - escapeChars.put(new Character('W'), new Character(' ')); - escapeChars.put(new Character('t'), new Character('\t')); - escapeChars.put(new Character(':'), new Character(':')); - escapeChars.put(new Character(','), new Character(',')); - escapeChars.put(new Character('"'), new Character('"')); - escapeChars.put(new Character('\''), new Character('\'')); - escapeChars.put(new Character('\\'), new Character('\\')); - escapeChars.put(new Character('{'), new Character('{')); - escapeChars.put(new Character('}'), new Character('}')); - escapeChars.put(new Character('('), new Character('(')); - escapeChars.put(new Character(')'), new Character(')')); - escapeChars.put(new Character('['), new Character('[')); - escapeChars.put(new Character(']'), new Character(']')); - escapeChars.put(new Character('!'), new Character('!')); + escapeChars.put('n', '\n'); + escapeChars.put('W', ' '); + escapeChars.put('t', '\t'); + escapeChars.put(':', ':'); + escapeChars.put(',', ','); + escapeChars.put('"', '"'); + escapeChars.put('\'', '\''); + escapeChars.put('\\', '\\'); + escapeChars.put('{', '{'); + escapeChars.put('}', '}'); + escapeChars.put('(', '('); + escapeChars.put(')', ')'); + escapeChars.put('[', '['); + escapeChars.put(']', ']'); + escapeChars.put('!', '!'); Iterator it = escapeChars.keySet().iterator(); while (it.hasNext()) { Character key = it.next(); @@ -114,7 +115,7 @@ public SOPair(String str, int index, int endIndex) { public OboFileParser(){ - listeners = new ArrayList(); + listeners = new ArrayList<>(); } @@ -271,15 +272,15 @@ else if ( key.equals(OboFileHandler.NARROW_SYNONYM)) String token = tokenizer.nextToken(); //logger.info("TOKEN:" +token); if (i == 0) { - if (token.equals("RELATED")) + if ("RELATED".equals(token)) scope = Synonym.RELATED_SYNONYM; - else if (token.equals("UNSPECIFIED")) + else if ("UNSPECIFIED".equals(token)) scope = Synonym.RELATED_SYNONYM; - else if (token.equals("EXACT")) + else if ("EXACT".equals(token)) scope = Synonym.EXACT_SYNONYM; - else if (token.equals("BROAD")) + else if ("BROAD".equals(token)) scope = Synonym.BROAD_SYNONYM; - else if (token.equals("NARROW")) + else if ("NARROW".equals(token)) scope = Synonym.NARROW_SYNONYM; else throw new IOException("Found unexpected scope " @@ -316,7 +317,7 @@ else if (token.equals("NARROW")) } protected Map[] getDbxrefList(String line, int startoffset, int endoffset) throws IOException { - Vector> temp = new Vector>(); + Vector> temp = new Vector<>(); boolean stop = false; while (!stop) { int braceIndex = findUnescaped(line, '{', startoffset, endoffset); @@ -381,7 +382,7 @@ protected Map parseXref(String line, } - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("xref",xref_str); m.put("desc",desc_str); return m; @@ -417,7 +418,7 @@ public static String escape(String str, boolean escapespaces) { StringBuffer out = new StringBuffer(); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); - Object o = unescapeChars.get(new Character(c)); + Object o = unescapeChars.get(c); if (o == null) out.append(c); else { @@ -449,7 +450,7 @@ public SOPair unescape(String str, char toChar, int startindex, i++; c = str.charAt(i); Character mapchar = escapeChars - .get(new Character(c)); + .get(c); if (mapchar == null) throw new IOException("Unrecognized escape" + " character " + c + " found."); diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/Annotatable.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/Annotatable.java index 4018aa0655..c1be7a3c99 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/Annotatable.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/Annotatable.java @@ -75,7 +75,6 @@ * @author Matthew Pocock * @author Keith James (docs). * @author Kalle Näslund (docs) - * @see org.biojavax.RichAnnotatable * @since 1.0 */ public interface Annotatable { diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/Annotation.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/Annotation.java index a0cf3ce65a..e0ade9cc6b 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/Annotation.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/Annotation.java @@ -53,7 +53,6 @@ * * @author Matthew Pocock * @author Thomas Down - * @see org.biojavax.RichAnnotation * * * @since 1.0 @@ -96,8 +95,6 @@ public interface Annotation { * @param value the new value for this key * @throws IllegalArgumentException if the property key is not * legal - * @throws ChangeVetoException if this annotation object can't be changed, or - * if the change was vetoed. */ void setProperty(Object key, Object value) ; @@ -108,7 +105,6 @@ void setProperty(Object key, Object value) * * @param key the key object * @throws NoSuchElementException if the property doesn't exist - * @throws ChangeVetoException if the change is vetoed * @since 1.3 * */ @@ -147,7 +143,7 @@ public void removeProperty(Object key) * A really useful empty and immutable annotation object. *

    * - * Be careful when stooring Annotation arguments to + * Be careful when storing Annotation arguments to * constructors. It is possible that you have been passed EMPTY_ANNOTATION but * that code later on will access this object believing it to be * mutable. For example, the SeqIO factory code clones some diff --git a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/EmptyAnnotation.java b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/EmptyAnnotation.java index 99a48861ea..985d55e911 100644 --- a/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/EmptyAnnotation.java +++ b/biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/EmptyAnnotation.java @@ -35,7 +35,6 @@ * * @since 1.0 as part of Annotation * @since 1.4 as top-level class - * @see org.biojavax.EmptyRichAnnotation */ class EmptyAnnotation diff --git a/biojava-ontology/src/main/java/package-info.java b/biojava-ontology/src/main/java/package-info.java index 56cc7e5eba..7cafa32539 100644 --- a/biojava-ontology/src/main/java/package-info.java +++ b/biojava-ontology/src/main/java/package-info.java @@ -19,7 +19,6 @@ * */ /** - * *

    * A general-purpose API for ontologies. * These are directed graphs consisting of Term obects. Each @@ -30,5 +29,4 @@ *

    Some interfaces and implementations from this package are extended in * {@link org.biojavax.ontology biojavax} to better facilitate their persistence to * biosql.

    - * */ \ No newline at end of file diff --git a/biojava-protein-comparison-tool/pom.xml b/biojava-protein-comparison-tool/pom.xml index 36d3ec3b2b..cf8cd570a7 100644 --- a/biojava-protein-comparison-tool/pom.xml +++ b/biojava-protein-comparison-tool/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-protein-comparison-tool @@ -36,23 +36,23 @@ org.biojava biojava-alignment - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT org.biojava biojava-core - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT org.biojava biojava-structure - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT org.biojava biojava-structure-gui - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT net.sourceforge.jmol @@ -67,7 +67,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-protein-disorder/pom.xml b/biojava-protein-disorder/pom.xml index 51053cc428..7273bbff8f 100644 --- a/biojava-protein-disorder/pom.xml +++ b/biojava-protein-disorder/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-protein-disorder jar @@ -63,7 +63,7 @@ org.biojava biojava-core - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT @@ -74,7 +74,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j @@ -85,8 +85,8 @@ log4j-core - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api org.glassfish.jaxb diff --git a/biojava-protein-disorder/src/main/java/demo/PredictDisorder.java b/biojava-protein-disorder/src/main/java/demo/PredictDisorder.java index f6013dadd2..cb8c0fa98e 100644 --- a/biojava-protein-disorder/src/main/java/demo/PredictDisorder.java +++ b/biojava-protein-disorder/src/main/java/demo/PredictDisorder.java @@ -59,7 +59,7 @@ public static void main(String[] args) throws Exception{ private static ProteinSequence getUniprot(String uniProtID) throws Exception { AminoAcidCompoundSet set = AminoAcidCompoundSet.getAminoAcidCompoundSet(); - UniprotProxySequenceReader uniprotSequence = new UniprotProxySequenceReader(uniProtID,set); + UniprotProxySequenceReader uniprotSequence = new UniprotProxySequenceReader<>(uniProtID,set); ProteinSequence seq = new ProteinSequence(uniprotSequence); diff --git a/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/FastaSequence.java b/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/FastaSequence.java index 6af6f13712..f53d236b89 100644 --- a/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/FastaSequence.java +++ b/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/FastaSequence.java @@ -24,8 +24,8 @@ package org.biojava.nbio.data.sequence; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java b/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java index 55b9bc5cc6..de53ae084d 100644 --- a/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java +++ b/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java @@ -250,7 +250,7 @@ public static void writeFasta(final OutputStream outstream, */ public static List readFasta(final InputStream inStream) throws IOException { - final List seqs = new ArrayList(); + final List seqs = new ArrayList<>(); final BufferedReader infasta = new BufferedReader( new InputStreamReader(inStream, "UTF8"), 16000); diff --git a/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/Jronn.java b/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/Jronn.java index 058e47546d..91862f0e36 100644 --- a/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/Jronn.java +++ b/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/Jronn.java @@ -214,7 +214,7 @@ public static Range[] scoresToRanges(float[] scores, float probability) { int count=0; int regionLen=0; - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); for(float score: scores) { count++; // Round to 2 decimal points before comparison @@ -245,7 +245,7 @@ public static Range[] scoresToRanges(float[] scores, float probability) { * @see #getDisorder(FastaSequence) */ public static Map getDisorderScores(List sequences) { - Map results = new TreeMap(); + Map results = new TreeMap<>(); results = sequences.stream().collect(Collectors.toMap(fastaSequence -> fastaSequence, fastaSequence -> predictSerial(fastaSequence))); return results; } @@ -258,7 +258,7 @@ public static Map getDisorderScores(List s * @see #getDisorder(FastaSequence) */ public static Map getDisorder(List sequences) { - Map disorderRanges = new TreeMap(); + Map disorderRanges = new TreeMap<>(); disorderRanges = sequences.stream().collect(Collectors.toMap(fastaSequence -> fastaSequence, fastaSequence -> getDisorder(fastaSequence) )); return disorderRanges; } @@ -270,7 +270,6 @@ public static Map getDisorder(List sequenc * @throws FileNotFoundException if the input file cannot be found * @throws IOException of the system cannot access or read from the input file * @see #getDisorder(FastaSequence) - * @see #Jronn.Range */ public static Map getDisorder(String fastaFile) throws IOException { final List sequences = SequenceUtil.readFasta(new FileInputStream(fastaFile)); diff --git a/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ModelLoader.java b/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ModelLoader.java index e9db4ebdde..ff636c0710 100644 --- a/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ModelLoader.java +++ b/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ModelLoader.java @@ -155,7 +155,7 @@ public String toString() { } - private static final Map models = new HashMap(); + private static final Map models = new HashMap<>(); public Model getModel(final int modelNum) { return ModelLoader.models.get(modelNum); diff --git a/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonn.java b/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonn.java index 7b5b5e7d1a..4d4245cfaf 100644 --- a/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonn.java +++ b/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonn.java @@ -81,8 +81,8 @@ public final class ORonn implements Callable { ORonn(final FastaSequence sequence, final ModelLoader mloader, - final InputParameters params) throws NumberFormatException, - IOException { + final InputParameters params) throws + IOException { this.sequence = sequence; this.mloader = mloader; out = params.getOutputWriter(); @@ -93,8 +93,8 @@ public final class ORonn implements Callable { timer = new Timer(TimeUnit.MILLISECONDS); } //This constructor is for API calls where the caller collects the results directly - ORonn(final FastaSequence sequence, final ModelLoader mloader) throws NumberFormatException, - IOException { + ORonn(final FastaSequence sequence, final ModelLoader mloader) throws +IOException { this.sequence = sequence; this.mloader = mloader; out = new PrintWriter(new NullOutputStream()); diff --git a/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonnModel.java b/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonnModel.java index a78e66f728..f3a5c187cb 100644 --- a/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonnModel.java +++ b/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonnModel.java @@ -169,7 +169,7 @@ private final float[] align(final int sResidue, final int dIndex) { } public ORonnModel(final String sequence, final Model model, - final float disorder) throws NumberFormatException { + final float disorder) { this.disorder_weight = disorder; this.model = model; query = sequence.toCharArray(); diff --git a/biojava-structure-gui/pom.xml b/biojava-structure-gui/pom.xml index 8b3522352b..581b8a53cc 100644 --- a/biojava-structure-gui/pom.xml +++ b/biojava-structure-gui/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT 4.0.0 biojava-structure-gui @@ -27,13 +27,13 @@ org.biojava biojava-structure - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT compile org.biojava biojava-core - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT compile @@ -53,7 +53,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-structure-gui/src/main/java/demo/AFPFromFasta.java b/biojava-structure-gui/src/main/java/demo/AFPFromFasta.java index 97f32828be..5d91f22aa8 100644 --- a/biojava-structure-gui/src/main/java/demo/AFPFromFasta.java +++ b/biojava-structure-gui/src/main/java/demo/AFPFromFasta.java @@ -41,10 +41,9 @@ /** * Demo displaying a structural alignment from a FASTA file using {@link FastaAFPChainConverter}. - * - * @author dmyerstu - * @see {@link DemoAlignmentFromFasta} Also demonstrates the display of {@link StructureAlignment StructureAlignments} from FASTA sequences, but does so using the more general + * See {@link DemoAlignmentFromFasta} Also demonstrates the display of {@link StructureAlignment StructureAlignments} from FASTA sequences, but does so using the more general * {@link FastaStructureParser} + * @author dmyerstu */ public class AFPFromFasta { diff --git a/biojava-structure-gui/src/main/java/demo/DemoAlignmentFromFasta.java b/biojava-structure-gui/src/main/java/demo/DemoAlignmentFromFasta.java index fbd3ecc74d..9bd3e71af4 100644 --- a/biojava-structure-gui/src/main/java/demo/DemoAlignmentFromFasta.java +++ b/biojava-structure-gui/src/main/java/demo/DemoAlignmentFromFasta.java @@ -81,7 +81,7 @@ public static void getAlignmentFromFasta() throws StructureException { // "4HHB.A:1-15" (residue range) // For this example, the built-in fasta parser will extract the correct accession. SequenceHeaderParserInterface headerParser; - headerParser = new GenericFastaHeaderParser(); + headerParser = new GenericFastaHeaderParser<>(); // Create AtomCache to fetch structures from the PDB AtomCache cache = new AtomCache(); diff --git a/biojava-structure-gui/src/main/java/demo/DemoMultipleMC.java b/biojava-structure-gui/src/main/java/demo/DemoMultipleMC.java index 062bc6d8d7..a609d925e3 100644 --- a/biojava-structure-gui/src/main/java/demo/DemoMultipleMC.java +++ b/biojava-structure-gui/src/main/java/demo/DemoMultipleMC.java @@ -97,9 +97,9 @@ public static void main(String[] args) throws IOException, StructureException, I //Load the CA atoms of the structures AtomCache cache = new AtomCache(); - List identifiers = new ArrayList(); + List identifiers = new ArrayList<>(); - List atomArrays = new ArrayList(); + List atomArrays = new ArrayList<>(); for (String name:names) { atomArrays.add(cache.getAtoms(name)); identifiers.add(new SubstructureIdentifier(name)); diff --git a/biojava-structure-gui/src/main/java/demo/DemoStructureFromFasta.java b/biojava-structure-gui/src/main/java/demo/DemoStructureFromFasta.java index c99678d4b9..fd2c15d28a 100644 --- a/biojava-structure-gui/src/main/java/demo/DemoStructureFromFasta.java +++ b/biojava-structure-gui/src/main/java/demo/DemoStructureFromFasta.java @@ -73,7 +73,7 @@ public static void getStructureFromFasta() { // "4HHB.A:1-15" (residue range) // For this example, the built-in fasta parser will extract the correct accession. SequenceHeaderParserInterface headerParser; - headerParser = new GenericFastaHeaderParser(); + headerParser = new GenericFastaHeaderParser<>(); // Create AtomCache to fetch structures from the PDB AtomCache cache = new AtomCache(); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/AlignmentCalc.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/AlignmentCalc.java index 98ed76f7a4..af2f8f9d91 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/AlignmentCalc.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/AlignmentCalc.java @@ -35,13 +35,13 @@ import org.slf4j.LoggerFactory; -/** A class that obtains two structures via DAS and aligns them +/** + * A class that obtains two structures via DAS and aligns them * This is done in a separate thread. * It is possible to register Event listeners to get notification of when the download has finished. * * @author Andreas Prlic * @since 1.7 - * @version %I% %G% */ public class AlignmentCalc implements AlignmentCalculationRunnable { diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java index 03aa7d5084..ff710bafb8 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java @@ -56,7 +56,7 @@ public class DisplayAFP { //TODO: same as getEqrPos??? !!! public static final List getEQRAlignmentPos(AFPChain afpChain){ - List lst = new ArrayList(); + List lst = new ArrayList<>(); char[] s1 = afpChain.getAlnseq1(); char[] s2 = afpChain.getAlnseq2(); @@ -107,7 +107,7 @@ private static boolean isAlignedPosition(int i, char c1, char c2, boolean isFatC * @param ca */ public static final List getPDBresnum(int aligPos, AFPChain afpChain, Atom[] ca){ - List lst = new ArrayList(); + List lst = new ArrayList<>(); if ( aligPos > 1) { System.err.println("multiple alignments not supported yet!"); return lst; @@ -407,7 +407,7 @@ private static final int getUngappedFatCatPos(AFPChain afpChain, int chainNr, in * @throws StructureException */ public static final Atom[] getAtomArray(Atom[] ca,List hetatms ) throws StructureException{ - List atoms = new ArrayList(); + List atoms = new ArrayList<>(); Collections.addAll(atoms, ca); logger.debug("got {} hetatoms", hetatms.size()); @@ -436,7 +436,7 @@ public static final Atom[] getAtomArray(Atom[] ca,List hetatms ) throws S public static final StructureAlignmentJmol display(AFPChain afpChain,Group[] twistedGroups, Atom[] ca1, Atom[] ca2,List hetatms1, List hetatms2 ) throws StructureException { - List twistedAs = new ArrayList(); + List twistedAs = new ArrayList<>(); for ( Group g: twistedGroups){ if ( g == null ) @@ -560,7 +560,7 @@ public static Structure createArtificalStructure(AFPChain afpChain, Atom[] ca1, Group[] twistedGroups = AlignmentTools.prepareGroupsForDisplay(afpChain,ca1, ca2); - List twistedAs = new ArrayList(); + List twistedAs = new ArrayList<>(); for ( Group g: twistedGroups){ if ( g == null ) diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DotPlotPanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DotPlotPanel.java index 22f4ad1822..b96b10a066 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DotPlotPanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DotPlotPanel.java @@ -56,7 +56,6 @@ public class DotPlotPanel extends ScaleableMatrixPanel { /** * * @param alignment The alignment to plot - * @param background [Optional]A matrix of 'background colors' over which to draw the alignment. * * Originally designed as a matrix of RMSD values between AFPs, so it is colorized * accordingly from red (0) to black (>10). @@ -76,7 +75,7 @@ public DotPlotPanel(AFPChain alignment ){ int[][][] optAln = alignment.getOptAln(); // [block #][{0,1} chain index][pos] for(;alignNumber < optAln.length;alignNumber++) { - List alignPairs = new ArrayList(); + List alignPairs = new ArrayList<>(); for(int pos = 0; pos
  • File: open, save, export, import, exit. *
  • Align: new pairwise alignment, new multiple alignment. - *
  • View: aligment panel, aligned pairs, text format, + *
  • View: alignment panel, aligned pairs, text format, * FatCat format, distance matrices, dot plot. *
  • Help * @@ -548,7 +548,7 @@ public static JMenuItem getExitMenuItem(){ public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("Quit")){ + if ( "Quit".equals(cmd)){ System.exit(0); } } @@ -606,7 +606,7 @@ class MyCloseListener implements ActionListener{ public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("Close Frame")){ + if ( "Close Frame".equals(cmd)){ f.dispose(); } } @@ -885,7 +885,7 @@ private static JMenuItem getConfigMenuItem() { public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("Settings")){ + if ( "Settings".equals(cmd)){ ConfigPDBInstallPanel.showDialog(); } } diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentCalc.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentCalc.java index e764a5e654..d3b2af0c6d 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentCalc.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentCalc.java @@ -78,7 +78,7 @@ public void run() { parent.getMultipleStructureAligner(); try { - List atomArrays = new ArrayList(); + List atomArrays = new ArrayList<>(); for (Structure s:structures){ Atom[] ca = StructureTools.getRepresentativeAtomArray(s); atomArrays.add(ca); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentJmolDisplay.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentJmolDisplay.java index fac312875f..0e7f333e1e 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentJmolDisplay.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MultipleAlignmentJmolDisplay.java @@ -76,7 +76,7 @@ public class MultipleAlignmentJmolDisplay { public static List getPDBresnum(int structNum, MultipleAlignment multAln, Atom[] ca){ - List lst = new ArrayList(); + List lst = new ArrayList<>(); for(Block block : multAln.getBlocks() ) { @@ -92,6 +92,15 @@ else if (pos < ca.length) { return lst; } + /** + * @deprecated Replace with {@see showMultipleAlignmentPanel} + */ + @Deprecated + public static void showMultipleAligmentPanel(MultipleAlignment multAln, + AbstractAlignmentJmol jmol) throws StructureException { + showMultipleAlignmentPanel(multAln, jmol); + } + /** * Creates a new Frame with the MultipleAlignment Sequence Panel. * The panel can communicate with the Jmol 3D visualization by @@ -102,7 +111,7 @@ else if (pos < ca.length) { * @throws StructureException */ - public static void showMultipleAligmentPanel(MultipleAlignment multAln, + public static void showMultipleAlignmentPanel(MultipleAlignment multAln, AbstractAlignmentJmol jmol) throws StructureException { MultipleAligPanel me = new MultipleAligPanel(multAln, jmol); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MyOpenPdbFileListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MyOpenPdbFileListener.java index 23de201682..25fb83ee82 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MyOpenPdbFileListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MyOpenPdbFileListener.java @@ -34,7 +34,7 @@ public class MyOpenPdbFileListener @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("Open PDB file")){ + if ( "Open PDB file".equals(cmd)){ final JFileChooser fc = new JFileChooser(); // In response to a button click: diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MySaveFileListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MySaveFileListener.java index f93fba29df..c5c7566eda 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MySaveFileListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/MySaveFileListener.java @@ -47,7 +47,7 @@ * and from a Jmol view an XML format is saved. * * @author Aleix Lafita - * @version 2.0 - adapted for MultipleAligments + * @version 2.0 - adapted for MultipleAlignments * */ public class MySaveFileListener implements ActionListener { diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/ParameterGUI.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/ParameterGUI.java index 836e386ab4..ca983d3452 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/ParameterGUI.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/ParameterGUI.java @@ -82,7 +82,7 @@ public ParameterGUI(ConfigStrucAligParams params, String algorithm) { assert(names.size() == types.size()); assert(names.size() == helps.size()); - textFields = new ArrayList(); + textFields = new ArrayList<>(); Box vBox = Box.createVerticalBox(); for (int i = 0 ; i < keys.size(); i++){ @@ -108,7 +108,7 @@ public ParameterGUI(ConfigStrucAligParams params, String algorithm) { String[] values = new String[]{"true","false"}; JComboBox jcbox = new JComboBox(values); - if ( data.equalsIgnoreCase("false")) + if ( "false".equalsIgnoreCase(data)) jcbox.setSelectedIndex(1); else jcbox.setSelectedIndex(0); @@ -203,7 +203,7 @@ protected void setDefault() { field.updateUI(); } else if ( type == Boolean.class){ JComboBox field = (JComboBox) textFields.get(i); - if ( data.toString().equalsIgnoreCase("false")) + if ( "false".equalsIgnoreCase(data.toString())) field.setSelectedIndex(1); else field.setSelectedIndex(0); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/SelectPDBPanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/SelectPDBPanel.java index 240246bb88..41eaf80b1e 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/SelectPDBPanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/SelectPDBPanel.java @@ -43,7 +43,8 @@ import org.biojava.nbio.structure.gui.util.StructurePairSelector; -/** A Panel that allows user to specify PDB & chain ID, as well as sub-ranges +/** + * A Panel that allows user to specify PDB and chain ID, as well as sub-ranges * * @author Andreas * diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/ShowPDBIDListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/ShowPDBIDListener.java index fdc16c217f..2c992d1965 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/ShowPDBIDListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/ShowPDBIDListener.java @@ -37,7 +37,7 @@ public class ShowPDBIDListener @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("Show By ID")){ + if ( "Show By ID".equals(cmd)){ JCheckBox useBioAssembly = new JCheckBox("Show Biological Assembly"); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AligPanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AligPanel.java index 6eadd48dcd..509dafefaf 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AligPanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AligPanel.java @@ -450,7 +450,7 @@ private void updateJmolDisplay() { select2 = JmolTools.getPdbInfo(a2); // nothing to display - if ( select1.equals("") && select2.equals("")) + if ( "".equals(select1) && "".equals(select2)) continue; if ( nrSelected > 0) diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AligPanelMouseMotionListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AligPanelMouseMotionListener.java index 9914f07d2a..83f1dda632 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AligPanelMouseMotionListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AligPanelMouseMotionListener.java @@ -44,7 +44,7 @@ public class AligPanelMouseMotionListener implements MouseMotionListener, MouseL public AligPanelMouseMotionListener(AligPanel parent){ this.parent = parent; - aligPosListeners = new ArrayList(); + aligPosListeners = new ArrayList<>(); prevPos = -1; isDragging = false; selectionStart = null; diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAligPanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAligPanel.java index 1387bbd417..3614907b5b 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAligPanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAligPanel.java @@ -139,7 +139,7 @@ public MultipleAligPanel(AFPChain afpChain, Atom[] ca1, Atom[] ca2, this.multAln = ensemble.getMultipleAlignment(0); //Create the sequence alignment and the structure-sequence mapping. - this.mapSeqToStruct = new ArrayList(); + this.mapSeqToStruct = new ArrayList<>(); this.alnSeq = MultipleAlignmentTools.getSequenceAlignment( this.multAln, this.mapSeqToStruct); @@ -154,15 +154,15 @@ public MultipleAligPanel(AFPChain afpChain, Atom[] ca1, Atom[] ca2, /** * Constructor using a MultipleAlignment. * - * @param multAln - * @param colors + * @param msa + * @param jm */ public MultipleAligPanel(MultipleAlignment msa, AbstractAlignmentJmol jm) { this(); this.multAln = msa; //Create the sequence alignment and the structure-sequence mapping. - this.mapSeqToStruct = new ArrayList(); + this.mapSeqToStruct = new ArrayList<>(); this.alnSeq = MultipleAlignmentTools.getSequenceAlignment( this.multAln, this.mapSeqToStruct); @@ -225,7 +225,7 @@ public void paintComponent(Graphics g){ else isGapped = true; //Loop through every structure to get all the points - List points = new ArrayList(); + List points = new ArrayList<>(); for (int str=0; str(); + aligPosListeners = new ArrayList<>(); prevPos = -1; isDragging = false; selectionStart = null; diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/DefaultAutoSuggestProvider.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/DefaultAutoSuggestProvider.java index 045ff5ce8d..1a87aa786a 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/DefaultAutoSuggestProvider.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/DefaultAutoSuggestProvider.java @@ -30,7 +30,7 @@ public class DefaultAutoSuggestProvider implements AutoSuggestProvider { @Override public Vector getSuggestion(String userInput) { - Vector data = new Vector(); + Vector data = new Vector<>(); data.add(userInput + " no AutoSuggestProvider registered yet!"); return data; diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java index 128ee39149..9e3c825910 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java @@ -135,11 +135,11 @@ public void focusLost(FocusEvent e) { System.out.println("Lost Focus"); dialog.setVisible(false); - if (getText().trim().equals("") && e.getOppositeComponent() != null && e.getOppositeComponent().getName() != null) { - if (!e.getOppositeComponent().getName().equals("suggestFieldDropdownButton")) { + if ("".equals(getText().trim()) && e.getOppositeComponent() != null && e.getOppositeComponent().getName() != null) { + if (!"suggestFieldDropdownButton".equals(e.getOppositeComponent().getName())) { setText(defaultText); } - } else if (getText().trim().equals("")) { + } else if ("".equals(getText().trim())) { setText(defaultText); } } @@ -247,7 +247,7 @@ private void init(){ lastWord = ""; regular = getFont(); busy = new Font(getFont().getName(), Font.ITALIC, getFont().getSize()); - suggestions = new Vector(); + suggestions = new Vector<>(); defaultText = DEFAULT_TEXT; @@ -352,7 +352,7 @@ public String doInBackground() { try { setFont(busy); String userInput = getText().trim(); - if ( userInput == null || userInput.equals("")) + if ( userInput == null || "".equals(userInput)) return ""; if ( previousWord != null){ diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/SCOPAutoSuggestProvider.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/SCOPAutoSuggestProvider.java index d90fd0380f..136f184584 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/SCOPAutoSuggestProvider.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/SCOPAutoSuggestProvider.java @@ -47,7 +47,7 @@ public Vector getSuggestion(String userInput) { long timeS = System.currentTimeMillis(); - List domains = new ArrayList(); + List domains = new ArrayList<>(); domains = getPossibleScopDomains(userInput); @@ -55,7 +55,7 @@ public Vector getSuggestion(String userInput) { // convert domains to Strings - Vector v=new Vector(); + Vector v=new Vector<>(); int counter = 0; for ( ScopDomain d : domains){ @@ -82,7 +82,7 @@ public Vector getSuggestion(String userInput) { private List getPossibleScopDomains(String userInput) { - List domains = new ArrayList(); + List domains = new ArrayList<>(); ScopDatabase scop = ScopFactory.getSCOP(); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java index 4663505797..535ad182fe 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java @@ -196,7 +196,7 @@ public Structure getStructure(){ /** * Set the title of the AlignmentJmol window. - * @param label + * @param title */ public void setTitle(String title){ frame.setTitle(title); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AtomInfo.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AtomInfo.java index e90fafcf43..61379a9a52 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AtomInfo.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AtomInfo.java @@ -118,13 +118,13 @@ public String toString() { StringBuffer buf = new StringBuffer(); if ( printResName) { - if ( !aa3.equals("")){ + if ( !"".equals(aa3)){ buf.append("["); buf.append(aa3); buf.append("]"); } } - if ( ! res1.equals("")) { + if ( ! "".equals(res1)) { // let's check if there is an insertion code... Matcher matcher = inscodePatter.matcher(res1); @@ -137,7 +137,7 @@ public String toString() { String residueNumber = matcher.group(1); String insCode = matcher.group(2); buf.append(residueNumber); - if ( insCode != null && ! ( insCode.equals(""))) { + if ( insCode != null && ! "".equals(insCode)) { buf.append("^"); buf.append(insCode); } @@ -145,7 +145,7 @@ public String toString() { } - if ( ! chain1.equals("")){ + if ( ! "".equals(chain1)){ buf.append(":"); buf.append(chain1); } diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolPanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolPanel.java index b8b37c6251..23361e62ed 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolPanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolPanel.java @@ -229,7 +229,7 @@ public void actionPerformed(ActionEvent event) { String selectLigand = "select ligand;wireframe 0.16;spacefill 0.5; color cpk ;"; - if ( value.equals("Cartoon")){ + if ( "Cartoon".equals(value)){ String script = "hide null; select all; spacefill off; wireframe off; backbone off;" + " cartoon on; " + " select ligand; wireframe 0.16;spacefill 0.5; color cpk; " + @@ -238,7 +238,7 @@ public void actionPerformed(ActionEvent event) { " select *.ZN; spacefill 0.7; color cpk ; " + " select all; "; this.executeCmd(script); - } else if (value.equals("Backbone")){ + } else if ("Backbone".equals(value)){ String script = "hide null; select all; spacefill off; wireframe off; backbone 0.4;" + " cartoon off; " + " select ligand; wireframe 0.16;spacefill 0.5; color cpk; " + @@ -247,7 +247,7 @@ public void actionPerformed(ActionEvent event) { " select *.ZN; spacefill 0.7; color cpk ; " + " select all; "; this.executeCmd(script); - } else if (value.equals("CPK")){ + } else if ("CPK".equals(value)){ String script = "hide null; select all; spacefill off; wireframe off; backbone off;" + " cartoon off; cpk on;" + " select ligand; wireframe 0.16;spacefill 0.5; color cpk; " + @@ -257,11 +257,11 @@ public void actionPerformed(ActionEvent event) { " select all; "; this.executeCmd(script); - } else if (value.equals("Ligands")){ + } else if ("Ligands".equals(value)){ this.executeCmd("restrict ligand; cartoon off; wireframe on; display selected;"); - } else if (value.equals("Ligands and Pocket")){ + } else if ("Ligands and Pocket".equals(value)){ this.executeCmd(" select within (6.0,ligand); cartoon off; wireframe on; backbone off; display selected; "); - } else if ( value.equals("Ball and Stick")){ + } else if ( "Ball and Stick".equals(value)){ String script = "hide null; restrict not water; wireframe 0.2; spacefill 25%;" + " cartoon off; backbone off; " + " select ligand; wireframe 0.16; spacefill 0.5; color cpk; " + @@ -270,24 +270,24 @@ public void actionPerformed(ActionEvent event) { " select *.ZN; spacefill 0.7; color cpk ; " + " select all; "; this.executeCmd(script); - } else if ( value.equals("By Chain")){ + } else if ( "By Chain".equals(value)){ jmolColorByChain(); String script = "hide null; select all;set defaultColors Jmol; color_by_chain(\"cartoon\"); color_by_chain(\"\"); " + selectLigand + "; select all; "; this.executeCmd(script); - } else if ( value.equals("Rainbow")) { + } else if ( "Rainbow".equals(value)) { this.executeCmd("hide null; select all; set defaultColors Jmol; color group; color cartoon group; " + selectLigand + "; select all; " ); - } else if ( value.equals("Secondary Structure")){ + } else if ( "Secondary Structure".equals(value)){ this.executeCmd("hide null; select all; set defaultColors Jmol; color structure; color cartoon structure;" + selectLigand + "; select all; " ); - } else if ( value.equals("By Element")){ + } else if ( "By Element".equals(value)){ this.executeCmd("hide null; select all; set defaultColors Jmol; color cpk; color cartoon cpk; " + selectLigand + "; select all; "); - } else if ( value.equals("By Amino Acid")){ + } else if ( "By Amino Acid".equals(value)){ this.executeCmd("hide null; select all; set defaultColors Jmol; color amino; color cartoon amino; " + selectLigand + "; select all; " ); - } else if ( value.equals("Hydrophobicity") ){ + } else if ( "Hydrophobicity".equals(value) ){ this.executeCmd("hide null; set defaultColors Jmol; select hydrophobic; color red; color cartoon red; select not hydrophobic ; color blue ; color cartoon blue; "+ selectLigand+"; select all; "); - } else if ( value.equals("Suggest Domains")){ + } else if ( "Suggest Domains".equals(value)){ colorByPDP(); - } else if ( value.equals("Show SCOP Domains")){ + } else if ( "Show SCOP Domains".equals(value)){ colorBySCOP(); } evalString("restore selection; "); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolTools.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolTools.java index 5a42f37cad..5a3b4ed463 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolTools.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolTools.java @@ -82,13 +82,13 @@ public static final String getPdbInfo(Atom a, boolean printResName){ StringBuffer buf = new StringBuffer(); if ( printResName) { - if ( !aa3.equals("")){ + if ( !"".equals(aa3)){ buf.append("["); buf.append(aa3); buf.append("]"); } } - if ( ! res1.equals("")) { + if ( ! "".equals(res1)) { // let's check if there is an insertion code... Matcher matcher = inscodePatter.matcher(res1); @@ -101,7 +101,7 @@ public static final String getPdbInfo(Atom a, boolean printResName){ String residueNumber = matcher.group(1); String insCode = matcher.group(2); buf.append(residueNumber); - if ( insCode != null && ! ( insCode.equals(""))) { + if ( insCode != null && ! "".equals(insCode)) { buf.append("^"); buf.append(insCode); } @@ -112,7 +112,7 @@ public static final String getPdbInfo(Atom a, boolean printResName){ - if ( ! chain1.equals("")){ + if ( ! "".equals(chain1)){ buf.append(":"); buf.append(chain1); } diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/MultipleAlignmentJmol.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/MultipleAlignmentJmol.java index fc7d209312..fe1f69346a 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/MultipleAlignmentJmol.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/MultipleAlignmentJmol.java @@ -113,7 +113,7 @@ public MultipleAlignmentJmol(MultipleAlignment msa, frame.setJMenuBar(menu); this.multAln = msa; this.transformedAtoms = rotatedAtoms; - this.selectedStructures = new ArrayList(); + this.selectedStructures = new ArrayList<>(); frame.addWindowListener(new WindowAdapter() { @@ -385,7 +385,7 @@ public void actionPerformed(ActionEvent ae) { .showAlignmentImage(multAln, result); } else if (cmd.equals(MenuCreator.ALIGNMENT_PANEL)) { - MultipleAlignmentJmolDisplay.showMultipleAligmentPanel(multAln, + MultipleAlignmentJmolDisplay.showMultipleAlignmentPanel(multAln, this); } else if (cmd.equals(MenuCreator.FATCAT_TEXT)) { @@ -432,7 +432,7 @@ public static String getJmolString(MultipleAlignment multAln, // Color the equivalent residues of every structure StringBuffer sel = new StringBuffer(); sel.append("select *; color lightgrey; backbone 0.1; "); - List> allPDB = new ArrayList>(); + List> allPDB = new ArrayList<>(); // Get the aligned residues of every structure for (int i = 0; i < multAln.size(); i++) { @@ -508,7 +508,7 @@ private static void printJmolScript4Block(Atom[] atoms, int str, int colorPos, int blockNum) { // Obtain the residues aligned in this block of the structure - List pdb = new ArrayList(); + List pdb = new ArrayList<>(); for (int i = 0; i < alignRes.get(str).size(); i++) { // Handle gaps - only color if it is not null diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/RasmolCommandListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/RasmolCommandListener.java index 6c47f80276..d1ce5c0e30 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/RasmolCommandListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/RasmolCommandListener.java @@ -50,7 +50,7 @@ public class RasmolCommandListener public RasmolCommandListener(JmolPanel panel, JTextField field){ textfield = field; jmolPanel = panel; - history = new ArrayList(); + history = new ArrayList<>(); historyPosition = -2; // -2 = history = empty; } @@ -69,7 +69,7 @@ public void actionPerformed(ActionEvent event) { // now comes history part: // no need for history: - if ( cmd.equals("")) return; + if ( "".equals(cmd)) return; // check last command in history // if equivalent, don't add, diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/StructureAlignmentJmol.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/StructureAlignmentJmol.java index 1b0ee9a6f8..7a87f6cbb9 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/StructureAlignmentJmol.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/StructureAlignmentJmol.java @@ -256,13 +256,13 @@ public void itemStateChanged(ItemEvent e) { zoomSlider.setMajorTickSpacing(100); zoomSlider.setPaintTicks(true); - Hashtable labelTable = new Hashtable(); - labelTable.put(new Integer(0),new JLabel("0%")); - labelTable.put(new Integer(100),new JLabel("100%")); - labelTable.put(new Integer(200),new JLabel("200%")); - labelTable.put(new Integer(300),new JLabel("300%")); - labelTable.put(new Integer(400),new JLabel("400%")); - labelTable.put(new Integer(500),new JLabel("500%")); + Hashtable labelTable = new Hashtable<>(); + labelTable.put(0,new JLabel("0%")); + labelTable.put(100,new JLabel("100%")); + labelTable.put(200,new JLabel("200%")); + labelTable.put(300,new JLabel("300%")); + labelTable.put(400,new JLabel("400%")); + labelTable.put(500,new JLabel("500%")); zoomSlider.setLabelTable(labelTable); zoomSlider.setPaintLabels(true); @@ -559,8 +559,8 @@ private static void printJmolScript4Block(Atom[] ca1, Atom[] ca2, int blockNum, c1 = ColorUtils.getIntermediate(ColorUtils.orange, end1, blockNum, bk); c2 = ColorUtils.getIntermediate(ColorUtils.cyan, end2, blockNum, bk); - List pdb1 = new ArrayList(); - List pdb2 = new ArrayList(); + List pdb1 = new ArrayList<>(); + List pdb2 = new ArrayList<>(); for (int i = 0; i < optLen[bk]; i++) { /// int pos1 = optAln[bk][0][i]; diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/webstart/ConfigXMLHandler.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/webstart/ConfigXMLHandler.java index 78d43fe862..f25ea0171d 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/webstart/ConfigXMLHandler.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/webstart/ConfigXMLHandler.java @@ -49,7 +49,7 @@ public ConfigXMLHandler() { @Override public void startElement (String uri, String name, String qName, Attributes atts){ //System.out.println("new element >" + name + "< >" + qName+"<" + uri); - if ( qName.equals("PDBFILEPATH")){ + if ( "PDBFILEPATH".equals(qName)){ String path = atts.getValue("path"); // default path is system tmp... @@ -58,7 +58,7 @@ public void startElement (String uri, String name, String qName, Attributes atts //Deprecated property; supported for backwards compatibility String autoFetch = atts.getValue("autoFetch"); - if(autoFetch == null || !autoFetch.equals("false")) { + if(autoFetch == null || !"false".equals(autoFetch)) { config.setFetchBehavior(FetchBehavior.DEFAULT); } else { config.setFetchBehavior(FetchBehavior.LOCAL_ONLY); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/webstart/WebStartMain.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/webstart/WebStartMain.java index e589f56140..dbb65c5eee 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/webstart/WebStartMain.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/webstart/WebStartMain.java @@ -99,12 +99,12 @@ public void run() { String arg0 = args[0]; - if (! (arg0.equals("fatcat") || - arg0.equals("biojava") || - arg0.equals("fatcat_flexible") || - arg0.equals("ce") || - arg0.equals("ce_cp") || - arg0.equals("sw") + if (! ("fatcat".equals(arg0) || + "biojava".equals(arg0) || + "fatcat_flexible".equals(arg0) || + "ce".equals(arg0) || + "ce_cp".equals(arg0) || + "sw".equals(arg0) )){ JOptionPane.showMessageDialog(null, "Wrong arguments. First argument has to be \"fatcat\", \"ce\", \"ce_cp\", \"sw\", \"fatcat_flexible\", or \"biojava\", but got " + arg0); @@ -139,21 +139,21 @@ public void run() { System.out.println("done reading structures"); - if (arg0.equalsIgnoreCase("ce") || - arg0.equalsIgnoreCase("ce_cp") || - arg0.equalsIgnoreCase("sw") || - arg0.equalsIgnoreCase("fatcat") || - arg0.equalsIgnoreCase("fatcat_flexible")){ + if ("ce".equalsIgnoreCase(arg0) || + "ce_cp".equalsIgnoreCase(arg0) || + "sw".equalsIgnoreCase(arg0) || + "fatcat".equalsIgnoreCase(arg0) || + "fatcat_flexible".equalsIgnoreCase(arg0)){ try { StructureAlignment algorithm ; - if ( arg0.equalsIgnoreCase("ce")) + if ( "ce".equalsIgnoreCase(arg0)) algorithm = StructureAlignmentFactory.getAlgorithm(CeMain.algorithmName); - else if ( arg0.equalsIgnoreCase("ce_cp")) + else if ( "ce_cp".equalsIgnoreCase(arg0)) algorithm = StructureAlignmentFactory.getAlgorithm(CeCPMain.algorithmName); - else if ( arg0.equalsIgnoreCase("fatcat")) + else if ( "fatcat".equalsIgnoreCase(arg0)) algorithm = StructureAlignmentFactory.getAlgorithm(FatCatRigid.algorithmName); - else if ( arg0.equalsIgnoreCase("fatcat_flexible")) + else if ( "fatcat_flexible".equalsIgnoreCase(arg0)) algorithm = StructureAlignmentFactory.getAlgorithm(FatCatFlexible.algorithmName); else algorithm = new SmithWaterman3Daligner(); @@ -167,7 +167,7 @@ else if ( arg0.equalsIgnoreCase("fatcat_flexible")) } - } else if ( arg0.equalsIgnoreCase("biojava")){ + } else if ( "biojava".equalsIgnoreCase(arg0)){ try { //showBiojava(ca1,ca2); } catch (Exception e){ diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/ScaleableMatrixPanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/ScaleableMatrixPanel.java index b2c6917559..37a0133e78 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/ScaleableMatrixPanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/ScaleableMatrixPanel.java @@ -198,7 +198,7 @@ public ScaleableMatrixPanel(){ protected static Map createGradients() { - SortedMap gradients = new TreeMap(); + SortedMap gradients = new TreeMap<>(); int i = 0; //prepend number, since sorted alphabetically ColorSpace hsv = HSVColorSpace.getHSVColorSpace(); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/SequenceDisplay.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/SequenceDisplay.java index 0aada492fb..93c7757201 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/SequenceDisplay.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/SequenceDisplay.java @@ -232,7 +232,7 @@ public SequenceDisplay(StructurePairAligner structurePairAligner){ this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS)); - apos = new ArrayList(); + apos = new ArrayList<>(); } public void clearListeners(){ diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/events/JmolAlignedPositionListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/events/JmolAlignedPositionListener.java index 7fe43819de..18e8d3afc3 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/events/JmolAlignedPositionListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/events/JmolAlignedPositionListener.java @@ -80,7 +80,7 @@ public void mouseOverPosition(AlignedPosition p) { Chain c = parent.getChain(); pdbpos1 = parent.getResidueNumber().toString(); //System.out.printlng"chainid 1 is >"+c.getName()+"<"); - if (! c.getId().equals( " ")) { + if (! " ".equals(c.getId())) { pdbpos1 += ":" + c.getId(); } @@ -96,7 +96,7 @@ public void mouseOverPosition(AlignedPosition p) { pdbpos2 = parent.getResidueNumber().toString(); //System.out.println("2:" + parent); //System.out.println("chainid 2 is >"+c.getName()+"<"); - if (! c.getId().equals( " ")) { + if (! " ".equals(c.getId())) { pdbpos2 += ":" + c.getId(); } if ( p1 > -1) diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/events/package-info.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/events/package-info.java index 138365c88a..001686e4f6 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/events/package-info.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/events/package-info.java @@ -19,12 +19,10 @@ * */ /** - * *

    * Some event classes for the protein structure GUIs. * Possible start classes are one level higher at * org.biojava.nbio.structure.gui.BiojavaJmol, and org.biojava.nbio.structure.gui.AlignmentGui. *

    - * */ package org.biojava.nbio.structure.gui.events; \ No newline at end of file diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/package-info.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/package-info.java index 1a4bc6d6af..ed9ae12804 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/package-info.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/package-info.java @@ -19,13 +19,11 @@ * */ /** - * *

    * A few convenience classes to view protein structures with Jmol (if it is on the classpath), * to calculate a protein structure alignment and to investigate the internals of the protein structure alignment algorithm. * Possible start classes are BiojavaJmol, AlignmentGui. * Also MVC interface for structure-gui *

    - * */ package org.biojava.nbio.structure.gui; \ No newline at end of file diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/AlternativeAlignmentFrame.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/AlternativeAlignmentFrame.java index 8dc672ed36..f80f087baf 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/AlternativeAlignmentFrame.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/AlternativeAlignmentFrame.java @@ -126,12 +126,12 @@ private Object[][] getDataFromAligs(AlternativeAlignment[] aligs){ for ( int i=0;i< aligs.length;i++){ AlternativeAlignment alig = aligs[i]; - data[i][0] = new Integer(i+1); - data[i][1] = new Integer(alig.getEqr()); - data[i][2] = new Double(alig.getScore()); - data[i][3] = new Double(alig.getRmsd()); - data[i][4] = new Integer(alig.getGaps()); - data[i][5] = new Integer(alig.getCluster()); + data[i][0] = Integer.valueOf(i+1); + data[i][1] = Integer.valueOf(alig.getEqr()); + data[i][2] = Double.valueOf(alig.getScore()); + data[i][3] = Double.valueOf(alig.getRmsd()); + data[i][4] = Integer.valueOf(alig.getGaps()); + data[i][5] = Integer.valueOf(alig.getCluster()); JButton maxb = new JButton("Distance Matrix"); maxb.addMouseListener(new MatrixMouseListener(this,i)); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/MenuCreator.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/MenuCreator.java index ef945c5263..97570e7d2a 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/MenuCreator.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/MenuCreator.java @@ -60,7 +60,7 @@ public static JMenuBar initMenu(){ @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("Open")){ + if ( "Open".equals(cmd)){ final JFileChooser fc = new JFileChooser(); // In response to a button click: @@ -95,7 +95,7 @@ public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("Exit")){ + if ( "Exit".equals(cmd)){ System.exit(0); } } @@ -111,7 +111,7 @@ public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("2 protein structures")){ + if ( "2 protein structures".equals(cmd)){ MenuCreator.showPairDialog(); } } @@ -129,7 +129,7 @@ public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); - if ( cmd.equals("PDBview")){ + if ( "PDBview".equals(cmd)){ MenuCreator.showAboutDialog(); } } diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/PDBUploadPanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/PDBUploadPanel.java index 785727cbcd..70d69d03c5 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/PDBUploadPanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/PDBUploadPanel.java @@ -79,7 +79,7 @@ public class PDBUploadPanel public static JComboBox getFileFormatSelect(){ JComboBox fileType = new JComboBox<>(); - fileType = new JComboBox(new String[] {UserConfiguration.PDB_FORMAT,UserConfiguration.MMCIF_FORMAT}); + fileType = new JComboBox<>(new String[] {UserConfiguration.PDB_FORMAT,UserConfiguration.MMCIF_FORMAT}); fileType.setSelectedIndex(0); fileType.setMaximumSize(new Dimension(10,50)); @@ -171,7 +171,7 @@ private Structure getStructure(JTextField filePath,JTextField chainId) throws St URL u ; - if ( chainId.getText() == null || chainId.getText().equals("")){ + if ( chainId.getText() == null || "".equals(chainId.getText())){ u = f.toURI().toURL(); } else { diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/ScopSelectPanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/ScopSelectPanel.java index a6571483a6..db63e2d206 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/ScopSelectPanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/ScopSelectPanel.java @@ -128,7 +128,7 @@ public Structure getStructure2() throws StructureException private Structure getStructure(String domainID) throws StructureException{ //PDBFileReader reader = new PDBFileReader(); - if ( domainID == null || domainID.equals("")) + if ( domainID == null || "".equals(domainID)) return null; diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SelectMultiplePanel.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SelectMultiplePanel.java index ae8d859951..c651b0deca 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SelectMultiplePanel.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SelectMultiplePanel.java @@ -90,7 +90,7 @@ private Box getDomainPanel(JTextField f){ public List getStructures() throws StructureException { - List structures = new ArrayList(); + List structures = new ArrayList<>(); for (StructureIdentifier name:getNames()){ structures.add(getStructure(name)); @@ -100,7 +100,7 @@ public List getStructures() throws StructureException { public List getNames() { - List names = new ArrayList(); + List names = new ArrayList<>(); String raw = input.getText().trim(); String[] split = raw.split(" "); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceMouseListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceMouseListener.java index e10331b9d5..11d7f2fd31 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceMouseListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceMouseListener.java @@ -86,7 +86,7 @@ public SequenceMouseListener(SequenceDisplay parent) { coordManager = new CoordManager(); - alignmentPositionListeners = new ArrayList(); + alignmentPositionListeners = new ArrayList<>(); //renderer.getLayeredPane().addMouseListener(popupFrame); } 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 bc29425c07..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 @@ -105,7 +105,7 @@ public SequenceScalePanel(int position) { setPrefSize(); coordManager = new CoordManager(); - apos = new ArrayList(); + apos = new ArrayList<>(); } @@ -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-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/ContinuousColorMapperTransform.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/ContinuousColorMapperTransform.java index 5cd010b356..d691a5237d 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/ContinuousColorMapperTransform.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/ContinuousColorMapperTransform.java @@ -60,7 +60,7 @@ public Color getColor(double value) { /** * An arbitrary transform over reals - * @param the input value + * @param value the input value * @return the transformed value */ public abstract double transform(double value); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/GradientMapper.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/GradientMapper.java index 4678d68707..55ab77d2ad 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/GradientMapper.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/GradientMapper.java @@ -61,7 +61,7 @@ public GradientMapper(Color negInf, Color posInf) { this(negInf,posInf,ColorSpace.getInstance(ColorSpace.CS_sRGB)); } public GradientMapper(Color negInf, Color posInf, ColorSpace cspace) { - mapping = new TreeMap(); + mapping = new TreeMap<>(); mapping.put(Double.NEGATIVE_INFINITY, negInf); mapping.put(Double.POSITIVE_INFINITY, posInf); interpolator = new LinearColorInterpolator(cspace); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/HSVColorSpace.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/HSVColorSpace.java index 4aafce9f1e..31e3919ae5 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/HSVColorSpace.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/HSVColorSpace.java @@ -79,9 +79,8 @@ public static void main(String[] args) { } + /** - * @param type - * @param numcomponents */ public HSVColorSpace() { super(ColorSpace.TYPE_HSV, 3); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/LinearColorInterpolator.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/LinearColorInterpolator.java index 9522ec7a15..2e6d1fc4e4 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/LinearColorInterpolator.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/LinearColorInterpolator.java @@ -142,7 +142,7 @@ public Color interpolate(Color a, Color b, float mixing) { * InterpolationDirections. * * @param colorSpace The color space for interpolation - * @param interpDirection An array of size colorSpace.getNumComponents() + * @param dir An array of size colorSpace.getNumComponents() * giving the interpolation direction for each component. */ public void setColorSpace(ColorSpace colorSpace, InterpolationDirection[] dir) { diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/package-info.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/package-info.java index 2c59281a2c..c820470c62 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/package-info.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/package-info.java @@ -19,12 +19,10 @@ * */ /** - * *

    * Some utility classes for the protein structure GUIs. * Possible start classes are one level higher at * org.biojava.nbio.structure.ngui.BiojavaJmol, and org.biojava.nbio.structure.gui.AlignmentGui. *

    - * */ package org.biojava.nbio.structure.gui.util; \ No newline at end of file diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryDisplay.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryDisplay.java index f5fc7da991..ea558927a3 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryDisplay.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryDisplay.java @@ -104,7 +104,7 @@ public static MultipleAlignmentJmol displayFull(CeSymmResult symm) * Displays a single structure in a cartoon representation with each * symmetric repeat colored differently. * - * @param msa + * @param symmResult * the symmetry multiple alignment obtained from CeSymm * @throws StructureException */ @@ -239,7 +239,7 @@ public static String printSymmetryAxes(CeSymmResult symm,boolean allAxes) for (Axis a : symmAxes) { RotationAxis rot = a.getRotationAxis(); List> cyclicForm = axes.getRepeatsCyclicForm(a); - List repAtoms = new ArrayList(); + List repAtoms = new ArrayList<>(); for(List cycle : cyclicForm) { for(Integer repeat : cycle) { repAtoms.addAll(Arrays.asList(repeats.get(repeat))); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryListener.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryListener.java index 1fdb882f7c..0b4198b3e6 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryListener.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryListener.java @@ -57,27 +57,27 @@ public SymmetryListener(MultipleAlignmentJmol jmol, CeSymmResult symm) { @Override public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand(); - if (cmd.equals("New Symmetry Analysis")) + if ("New Symmetry Analysis".equals(cmd)) SymmetryGui.getInstance(); if (symm == null) logger.error("Currently not displaying a symmetry!"); try { - if (cmd.equals("Repeats Superposition")) { + if ("Repeats Superposition".equals(cmd)) { MultipleAlignmentJmol j = SymmetryDisplay.displayRepeats(symm); String s = SymmetryDisplay.printSymmetryAxes(symm, false); j.evalString(s); j.evalString("save STATE state_1"); - } else if (cmd.equals("Multiple Structure Alignment")) { + } else if ("Multiple Structure Alignment".equals(cmd)) { MultipleAlignmentJmol j = SymmetryDisplay.displayFull(symm); String s = SymmetryDisplay.printSymmetryAxes(symm); j.evalString(s); j.evalString("save STATE state_1"); - } else if (cmd.equals("Optimal Self Alignment")) { + } else if ("Optimal Self Alignment".equals(cmd)) { Atom[] cloned = StructureTools.cloneAtomArray(symm.getAtoms()); AbstractAlignmentJmol jmol = StructureAlignmentDisplay.display( symm.getSelfAlignment(), symm.getAtoms(), cloned); @@ -85,11 +85,11 @@ public void actionPerformed(ActionEvent ae) { jmol.evalString(axis.getJmolScript(symm.getAtoms())); jmol.setTitle(SymmetryDisplay.getSymmTitle(symm)); - } else if (cmd.equals("Show Symmetry Group")) { + } else if ("Show Symmetry Group".equals(cmd)) { String script = SymmetryDisplay.printSymmetryGroup(symm); jmol.evalString(script); - } else if (cmd.equals("Show Symmetry Axes")) { + } else if ("Show Symmetry Axes".equals(cmd)) { String s = SymmetryDisplay.printSymmetryAxes(symm); jmol.evalString(s); } diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGenerator.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGenerator.java index 8d3e89b4bf..507d4c727e 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGenerator.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGenerator.java @@ -38,25 +38,25 @@ public abstract class JmolSymmetryScriptGenerator { /** * Returns an instance of a JmolSymmetryScriptGenerator, based on the symmetry of a structure (factory method) * @param axisAligner - * @param rotationGroup + * @param name * @return instance of JmolSymmetryScriptGenerator */ public static JmolSymmetryScriptGenerator getInstance(AxisAligner axisAligner, String name) { String symmetry = axisAligner.getSymmetry(); - if (symmetry.equals("C1")) { + if ("C1".equals(symmetry)) { return new JmolSymmetryScriptGeneratorC1((RotationAxisAligner)axisAligner, name); } else if (symmetry.startsWith("C")) { return new JmolSymmetryScriptGeneratorCn((RotationAxisAligner)axisAligner, name); } else if (symmetry.startsWith("D")) { return new JmolSymmetryScriptGeneratorDn((RotationAxisAligner)axisAligner, name); - } else if (symmetry.equals("T")) { + } else if ("T".equals(symmetry)) { return new JmolSymmetryScriptGeneratorT((RotationAxisAligner)axisAligner, name); - } else if (symmetry.equals("O")) { + } else if ("O".equals(symmetry)) { return new JmolSymmetryScriptGeneratorO((RotationAxisAligner)axisAligner, name); - } else if (symmetry.equals("I")) { + } else if ("I".equals(symmetry)) { return new JmolSymmetryScriptGeneratorI((RotationAxisAligner)axisAligner, name); - } else if (symmetry.equals("H")) { + } else if ("H".equals(symmetry)) { return new JmolSymmetryScriptGeneratorH((HelixAxisAligner)axisAligner, name); } diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorCn.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorCn.java index a4e8024ef7..34cc7292e3 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorCn.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorCn.java @@ -36,7 +36,7 @@ public class JmolSymmetryScriptGeneratorCn extends JmolSymmetryScriptGeneratorPo public JmolSymmetryScriptGeneratorCn(RotationAxisAligner axisTransformation, String name) { super(axisTransformation, name); - if (axisTransformation.getRotationGroup().getPointGroup().equals("C2")) { + if ("C2".equals(axisTransformation.getRotationGroup().getPointGroup())) { setPolyhedron(new RectangularPrism(axisTransformation.getDimension().z*2, axisTransformation.getDimension().x*2, axisTransformation.getDimension().y*2)); } else { Prism p = new Prism(axisTransformation.getRotationGroup().getRotation(0).getFold()); @@ -64,7 +64,7 @@ public int getZoom() { @Override public int getOrientationCount() { // the last two views (top, bottom) are not that interesting. - if (getAxisTransformation().getRotationGroup().getPointGroup().equals("C2")) { + if ("C2".equals(getAxisTransformation().getRotationGroup().getPointGroup())) { return getPolyhedron().getViewCount()-2; } return getPolyhedron().getViewCount(); @@ -77,7 +77,7 @@ public int getOrientationCount() { */ @Override public String getOrientationName(int index) { - if (getAxisTransformation().getRotationGroup().getPointGroup().equals("C2")) { + if ("C2".equals(getAxisTransformation().getRotationGroup().getPointGroup())) { if (index == 0) { return "Front C2 axis"; } else if (index == 2) { diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorDn.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorDn.java index 2ad5f0c91a..8b0d76a0e3 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorDn.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorDn.java @@ -39,7 +39,7 @@ public JmolSymmetryScriptGeneratorDn(RotationAxisAligner axisTransformation, Str // special case for D2. Since there is no 2-fold prism, draw a 4-fold // prism that encases the D2 structure - if (axisTransformation.getRotationGroup().getPointGroup().equals("D2")) { + if ("D2".equals(axisTransformation.getRotationGroup().getPointGroup())) { fold = 4; } @@ -76,7 +76,7 @@ public int getOrientationCount() { */ @Override public String getOrientationName(int index) { - if (index == 0 && getAxisTransformation().getRotationGroup().getPointGroup().equals("D2")) { + if (index == 0 && "D2".equals(getAxisTransformation().getRotationGroup().getPointGroup())) { return "Front C2 axis"; } else { return getPolyhedron().getViewName(index); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java index 428635c78b..7686b98ac0 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java @@ -423,7 +423,7 @@ public String colorBySubunit() { Color4f c = colors[i]; List ids = colorMap.get(c); if (ids == null) { - ids = new ArrayList(); + ids = new ArrayList<>(); colorMap.put(c, ids); } String id = getChainSpecification(modelNumbers, chainIds, j); @@ -454,7 +454,7 @@ public String colorBySequenceCluster() { Color4f c = colors[seqClusterIds.get(i)]; List ids = colorMap.get(c); if (ids == null) { - ids = new ArrayList(); + ids = new ArrayList<>(); colorMap.put(c, ids); } String id = getChainSpecification(modelNumbers, chainIds, i); @@ -504,7 +504,7 @@ public String colorBySymmetry() { c.scale(scale); List ids = colorMap.get(c); if (ids == null) { - ids = new ArrayList(); + ids = new ArrayList<>(); colorMap.put(c, ids); } String id = getChainSpecification(modelNumbers, chainIds, subunit); diff --git a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorPointGroup.java b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorPointGroup.java index 1a4f8a7301..d895450dc6 100644 --- a/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorPointGroup.java +++ b/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorPointGroup.java @@ -225,7 +225,7 @@ public String showPolyhedron() { */ @Override public String drawAxes() { - if (rotationGroup.getPointGroup().equals("C1")) { + if ("C1".equals(rotationGroup.getPointGroup())) { return drawInertiaAxes(); } else { return drawSymmetryAxes(); @@ -257,7 +257,7 @@ public String playOrientations() { // draw point group - if ( rotationGroup.getPointGroup().equals("C1")) { + if ( "C1".equals(rotationGroup.getPointGroup())) { s.append(drawFooter("Asymmetric", "white")); } else { s.append(drawFooter("Point group " + rotationGroup.getPointGroup(), "white")); @@ -332,7 +332,7 @@ public String colorBySubunit() { Color4f c = colors[colorIndex]; List ids = colorMap.get(c); if (ids == null) { - ids = new ArrayList(); + ids = new ArrayList<>(); colorMap.put(c, ids); } String id = getChainSpecification(modelNumbers, chainIds, subunit); @@ -362,7 +362,7 @@ public String colorBySequenceCluster() { Color4f c = colors[seqClusterIds.get(i)]; List ids = colorMap.get(c); if (ids == null) { - ids = new ArrayList(); + ids = new ArrayList<>(); colorMap.put(c, ids); } String id = getChainSpecification(modelNumbers, chainIds, i); @@ -395,7 +395,7 @@ public String colorBySymmetry() { colorMap = getCnColorMap(); // complex cases } else if ((pointGroup.startsWith("D") && orbits.size() > 2) || - pointGroup.equals("T")|| pointGroup.equals("O") || pointGroup.equals("I")) { + "T".equals(pointGroup)|| "O".equals(pointGroup) || "I".equals(pointGroup)) { int nColor = 0; if (orbits.size() % 2 == 0) { nColor = orbits.size()/2; @@ -414,7 +414,7 @@ public String colorBySymmetry() { Color4f c = colors[colorIndex]; List ids = colorMap.get(c); if (ids == null) { - ids = new ArrayList(); + ids = new ArrayList<>(); colorMap.put(c, ids); } for (int subunit: orbits.get(i)) { @@ -431,7 +431,7 @@ public String colorBySymmetry() { Color4f c = new Color4f(colors[i]); List ids = colorMap.get(c); if (ids == null) { - ids = new ArrayList(); + ids = new ArrayList<>(); colorMap.put(c, ids); } List orbit = orbits.get(i); @@ -542,7 +542,7 @@ private Map> getCnColorMap() { Color4f c = colors[i]; List ids = colorMap.get(c); if (ids == null) { - ids = new ArrayList(); + ids = new ArrayList<>(); colorMap.put(c, ids); } ids.add(id); @@ -582,7 +582,7 @@ private Color4f[] getSymmetryColors(int nColors) { String pointGroup = rotationGroup.getPointGroup(); Color[] col = null; Color4f[] colors = null; - if (pointGroup.equals("C1")) { + if ("C1".equals(pointGroup)) { col = ColorBrewer.Greys.getColorPalette(nColors); colors = ColorConverter.convertColor4f(col); } else if (pointGroup.startsWith("C")) { @@ -591,13 +591,13 @@ private Color4f[] getSymmetryColors(int nColors) { } else if (pointGroup.startsWith("D")) { col = ColorBrewer.YlOrRd.getColorPalette(nColors); colors = ColorConverter.convertColor4f(col); - } else if (pointGroup.equals("T")) { + } else if ("T".equals(pointGroup)) { col = ColorBrewer.Greens.getColorPalette(nColors); colors = ColorConverter.convertColor4f(col); - } else if (pointGroup.equals("O")) { + } else if ("O".equals(pointGroup)) { col = ColorBrewer.Blues.getColorPalette(nColors); colors = ColorConverter.convertColor4f(col); - } else if (pointGroup.equals("I")) { + } else if ("I".equals(pointGroup)) { col = ColorBrewer.BuPu.getColorPalette(nColors); colors = ColorConverter.convertColor4f(col); } else { @@ -684,7 +684,8 @@ private String drawSymmetryAxes() { return s.toString(); } - private Vector3d getAligmentVector(Point3d point, Vector3d axis) { + + private Vector3d getAlignmentVector(Point3d point, Vector3d axis) { // for system with a single Cn axis if (rotationGroup.getPointGroup().startsWith("C") || rotationGroup.getPointGroup().startsWith("D")) { // if axis is orthogonal to principal axis, use principal axis as reference axis @@ -760,14 +761,14 @@ private String getSymmetryAxis(int i, int j, String pointGroup, int n, Vector3d if (drawPolygon) { double polygonRadius = getMeanExtension() * 0.06; if (n == 2) { - referenceAxis = getAligmentVector(p1, axis); + referenceAxis = getAlignmentVector(p1, axis); s.append(getC2PolygonJmol(i, p1, referenceAxis, axis, color, polygonRadius, name)); - referenceAxis = getAligmentVector(p2, axis); + referenceAxis = getAlignmentVector(p2, axis); s.append(getC2PolygonJmol(j, p2, referenceAxis, axis, color, polygonRadius, name)); } else if (n > 2) { - referenceAxis = getAligmentVector(p1, axis); + referenceAxis = getAlignmentVector(p1, axis); s.append(getPolygonJmol(i, p1, referenceAxis, axis, n, color, polygonRadius, name)); - referenceAxis = getAligmentVector(p2, axis); + referenceAxis = getAlignmentVector(p2, axis); s.append(getPolygonJmol(j, p2, referenceAxis, axis, n, color, polygonRadius, name)); } } @@ -947,7 +948,7 @@ private static Vector3d[] getC2PolygonVertices(Vector3d axis, Vector3d reference private List getUniqueAxes() { - List uniqueRotations = new ArrayList(); + List uniqueRotations = new ArrayList<>(); for (int i = 0, n = rotationGroup.getOrder(); i < n; i++) { Rotation rotationI = rotationGroup.getRotation(i); diff --git a/biojava-structure/pom.xml b/biojava-structure/pom.xml index ecb43920a0..7fbc64a3c1 100644 --- a/biojava-structure/pom.xml +++ b/biojava-structure/pom.xml @@ -4,7 +4,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-structure biojava-structure @@ -40,17 +40,24 @@ mmtf-codec ${mmtf.version} compile + + + + org.apache.logging.log4j + log4j-slf4j-impl + + org.biojava biojava-alignment - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT compile org.biojava biojava-core - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT compile @@ -67,11 +74,9 @@ 1.4.0 - - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api org.glassfish.jaxb @@ -93,7 +98,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-structure/src/main/java/demo/DemoChangeChemCompProvider.java b/biojava-structure/src/main/java/demo/DemoChangeChemCompProvider.java index b8e4eb5430..b3c292c92d 100644 --- a/biojava-structure/src/main/java/demo/DemoChangeChemCompProvider.java +++ b/biojava-structure/src/main/java/demo/DemoChangeChemCompProvider.java @@ -34,20 +34,20 @@ /** * This demo shows how to use an alternative ChemCompProvider. The default mechanism in BioJava is to access chemical - * componentsby using the {@link DownloadChemCompProvider}. It fetches and locally caches chemical component - * definitions as they are encountered during file parsing. It can be enabled by using the - * {@link FileParsingParameters#setLoadChemCompInfo(boolean)} method. - * + * components by using the {@link DownloadChemCompProvider}. It fetches and locally caches chemical component + * definitions as they are encountered during file parsing. + *

    * The {@link AllChemCompProvider} downloads and unpacks all chemcomps. It is slower and requires more memory than the * default {@link DownloadChemCompProvider}, but it avoids network access to the FTP site, if a new chemcomp is * detected, that has not been downloaded yet. - * + *

    * Since all chemcomps will be kept in memory, the standard memory that is available to a JVM will not be sufficient * in order to run this demo. Please start with -Xmx200M * * @author Andreas Prlic */ public class DemoChangeChemCompProvider { + public static void main(String[] args){ String pdbId = "1O1G"; boolean loadChemComp = true; @@ -104,7 +104,7 @@ private void printStructure(Structure struc) { for (int i = 0; i < struc.nrModels(); i++) { // loop chain for (Chain ch : struc.getModel(i)) { - if (!ch.getName().equals("A")) { + if (!"A".equals(ch.getName())) { continue; } System.out.println(pdbid + ">>>" + ch.getName() + ">>>" + ch.getAtomSequence()); diff --git a/biojava-structure/src/main/java/demo/DemoMmtfReader.java b/biojava-structure/src/main/java/demo/DemoMmtfReader.java deleted file mode 100644 index 0dc4b76ab1..0000000000 --- a/biojava-structure/src/main/java/demo/DemoMmtfReader.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * BioJava development code - * - * This code may be freely distributed and modified under the - * terms of the GNU Lesser General Public Licence. This should - * be distributed with the code. If you do not have a copy, - * see: - * - * http://www.gnu.org/copyleft/lesser.html - * - * Copyright for this code is held jointly by the individual - * authors. These should be listed in @author doc comments. - * - * For more information on the BioJava project and its aims, - * or to join the biojava-l mailing list, visit the home page - * at: - * - * http://www.biojava.org/ - * - */ -package demo; - -import java.io.IOException; - -import org.biojava.nbio.structure.Structure; -import org.biojava.nbio.structure.StructureException; -import org.biojava.nbio.structure.io.mmtf.MmtfActions; - -/** - * Class to show how to read a Biojava structure using MMTF - * @author Anthony Bradley - * - */ -public class DemoMmtfReader { - - /** - * Main function to run the demo - * @param args no args to specify - * @throws IOException - * @throws StructureException - */ - public static void main(String[] args) throws IOException, StructureException { - Structure structure = MmtfActions.readFromWeb("4cup"); - System.out.println(structure.getChains().size()); - } - -} diff --git a/biojava-structure/src/main/java/demo/DemoMultipleMC.java b/biojava-structure/src/main/java/demo/DemoMultipleMC.java index 4ca84f0174..6a60c454e6 100644 --- a/biojava-structure/src/main/java/demo/DemoMultipleMC.java +++ b/biojava-structure/src/main/java/demo/DemoMultipleMC.java @@ -92,9 +92,9 @@ public static void main(String[] args) throws IOException, StructureException, I //Load the CA atoms of the structures AtomCache cache = new AtomCache(); - List atomArrays = new ArrayList(); + List atomArrays = new ArrayList<>(); - List ids = new ArrayList(); + List ids = new ArrayList<>(); for (String name:names) { StructureIdentifier id = new StructureName(name); ids.add(id); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Atom.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Atom.java index 2e19acb29a..df38b06205 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Atom.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Atom.java @@ -48,7 +48,7 @@ public interface Atom extends Cloneable, PDBRecord { * @param s a trimmed String specifying the name value * @see #getName */ - public void setName(String s); + void setName(String s); /** * Get atom name, e.g. "CA". @@ -57,42 +57,42 @@ public interface Atom extends Cloneable, PDBRecord { * @return a trimmed String representing the name value * @see #setName */ - public String getName(); + String getName(); /** * Set element of the atom name, e.g. {@link Element#Fe} * @param e an Element enumeration * @see #getElement */ - public void setElement(Element e); + void setElement(Element e); /** * Get element of the atom, e.g. {@link Element#Ca} * @return an Element enumeration * @see #setElement */ - public Element getElement(); + Element getElement(); /** * Set PDB atom number. * @param i an int specifying the PDBserial value * @see #getPDBserial */ - public void setPDBserial(int i) ; + void setPDBserial(int i) ; /** * Get PDB atom number. * @return an int representing the PDBserial value * @see #setPDBserial */ - public int getPDBserial() ; + int getPDBserial() ; /** * Set the coordinates. * @param c an array of doubles specifying the coords value * @see #getCoords */ - public void setCoords(double[] c); + void setCoords(double[] c); /** * Get the coordinates. @@ -100,7 +100,7 @@ public interface Atom extends Cloneable, PDBRecord { * @see #setCoords * @see #getCoordsAsPoint3d() */ - public double[] getCoords() ; + double[] getCoords() ; /** * Get the coordinates. @@ -110,56 +110,56 @@ public interface Atom extends Cloneable, PDBRecord { * @return a reference to the Point3d coordinates * @see #getCoords() */ - public Point3d getCoordsAsPoint3d(); + Point3d getCoordsAsPoint3d(); /** * Set the X coordinate. * @param x a double * @see #getX() */ - public void setX(double x); + void setX(double x); /** * Set the Y coordinate. * @param y a double * @see #getY() */ - public void setY(double y); + void setY(double y); /** * Set the Z coordinate. * @param z a double * @see #getZ() */ - public void setZ(double z); + void setZ(double z); /** * Get coordinate X. * @return a double * @see #setX(double) */ - public double getX() ; + double getX() ; /** * Get coordinate Y. * @return a double * @see #setY(double) */ - public double getY() ; + double getY() ; /** * Get coordinate Z. * @return a double * @see #setZ(double) */ - public double getZ() ; + double getZ() ; /** * Set alternate Location. * @param c a Character object specifying the alt loc value * @see #getAltLoc */ - public void setAltLoc(Character c); + void setAltLoc(Character c); /** * Get alternate Location. @@ -167,41 +167,41 @@ public interface Atom extends Cloneable, PDBRecord { * is represented by ' ' (space character, ascii 32). * @see #setAltLoc */ - public Character getAltLoc(); + Character getAltLoc(); /** * Set occupancy. * @param occupancy a float specifying the occupancy value * @see #getOccupancy */ - public void setOccupancy(float occupancy) ; + void setOccupancy(float occupancy) ; /** * Get occupancy. * @return a float representing the occupancy value * @see #setOccupancy */ - public float getOccupancy(); + float getOccupancy(); /** * Set temp factor . * @param temp a float specifying the temp factor value * @see #getTempFactor */ - public void setTempFactor(float temp) ; + void setTempFactor(float temp) ; /** * Get temp factor. * @return a float representing the temp factor value * @see #setTempFactor */ - public float getTempFactor() ; + float getTempFactor() ; /** * Return an identical copy of this object . * @return an identical copy of this object */ - public Object clone(); + Object clone(); /** * Set the back-reference to its parent Group. @@ -209,7 +209,7 @@ public interface Atom extends Cloneable, PDBRecord { * @see #getGroup() */ - public void setGroup(Group parent); + void setGroup(Group parent); /** * Return the parent Group of the Atom. @@ -217,28 +217,27 @@ public interface Atom extends Cloneable, PDBRecord { * @return Group the parent Group of the Atom, or null * @see #setGroup(Group) */ - public Group getGroup(); + Group getGroup(); /** * Add a bond * @param bond to be added * @see #getBonds() */ - public void addBond(Bond bond); + void addBond(Bond bond); /** * Get all {@link Bond}s this atom is part of. * * @return a list of {@link Bond}s or null if no bonds exist for this Atom */ - public List getBonds(); + List getBonds(); /** * Sets the bonds * @param bonds */ - public void setBonds(List bonds); - + void setBonds(List bonds); /** * Test if another atom has a bond to this atom @@ -246,19 +245,18 @@ public interface Atom extends Cloneable, PDBRecord { * @param other * @return */ - public boolean hasBond(Atom other); + boolean hasBond(Atom other); /** * Get the charge of this atom * * @return a the integer charge. */ - public short getCharge(); + short getCharge(); /** * Set the charge of this atom * - * @return void. */ - public void setCharge(short charge); + void setCharge(short charge); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java index efe8822397..41021e0045 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java @@ -153,7 +153,7 @@ public AtomPositionMap(Atom[] atoms) { * @param atoms */ public AtomPositionMap(Atom[] atoms, GroupMatcher matcher) { - hashMap = new HashMap(); + hashMap = new HashMap<>(); for (int i = 0; i < atoms.length; i++) { Group group = atoms[i].getGroup(); ResidueNumber rn = group.getResidueNumber(); @@ -164,7 +164,7 @@ public AtomPositionMap(Atom[] atoms, GroupMatcher matcher) { } } Comparator vc = new ValueComparator(hashMap); - treeMap = new TreeMap(vc); + treeMap = new TreeMap<>(vc); treeMap.putAll(hashMap); } @@ -341,7 +341,7 @@ public List getRanges() { String currentChain = ""; ResidueNumber first = null; ResidueNumber prev = null; - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); for (ResidueNumber rn : treeMap.keySet()) { if (!rn.getChainName().equals(currentChain)) { if (first != null) { 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/BioAssemblyIdentifier.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/BioAssemblyIdentifier.java index 194368d763..eef6de2457 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/BioAssemblyIdentifier.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/BioAssemblyIdentifier.java @@ -58,7 +58,7 @@ public BioAssemblyIdentifier(String pdbCode, int biolNr) { } /** - * @param pdbCode + * @param pdbId * @param biolNr */ public BioAssemblyIdentifier(PdbId pdbId, int biolNr) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Bond.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Bond.java index 7af10c23e0..ae4c97f74e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Bond.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Bond.java @@ -26,7 +26,7 @@ * A simple bond -- it stores information about two atoms as well as information * about its bond order. * - * @author Jules Jacobsen + * @author Jules Jacobsen jacobsen@ebi.ac.uk * @author Ulysse Carion */ public interface Bond extends Serializable { @@ -39,7 +39,7 @@ public interface Bond extends Serializable { * @see #getAtomB() * @return one of the two atoms in this bond */ - public Atom getAtomA(); + Atom getAtomA(); /** * Gets atom 'B' of this bond. There is no meaning to which atom is 'A' and @@ -49,7 +49,7 @@ public interface Bond extends Serializable { * @see #getAtomA() * @return one of the two atoms in this bond */ - public Atom getAtomB(); + Atom getAtomB(); /** * A utility method to get the other atom in a bond, given one of its atoms. @@ -66,7 +66,7 @@ public interface Bond extends Serializable { * if the passed atom is not in this bond * @return the atom in this bond that was not passed as an argument */ - public Atom getOther(Atom exclude); + Atom getOther(Atom exclude); /** * Gets the bond order of this bond. A return value of '1' corresponds to a @@ -74,7 +74,7 @@ public interface Bond extends Serializable { * * @return this bond's bond order */ - public int getBondOrder(); + int getBondOrder(); /** * Gets the distance between the two atoms of this bond. @@ -85,5 +85,5 @@ public interface Bond extends Serializable { * * @return the distance between the two atoms of this bond. */ - public double getLength(); + double getLength(); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/BondImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/BondImpl.java index e6a243d7cf..4deac44faa 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/BondImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/BondImpl.java @@ -27,7 +27,7 @@ * A simple bond -- it stores information about two atoms as well as information * about its bond order. * - * @author Jules Jacobsen + * @author Jules Jacobsen jacobsen@ebi.ac.uk * @author Ulysse Carion */ public class BondImpl implements Bond { @@ -44,7 +44,7 @@ public class BondImpl implements Bond { * Note that by forming a bond between atoms 'A' and 'B' with this * constructor, atoms 'A' and 'B' will be updated to have this bond in their * list of bonds. If you do not want this automatic updating, instead use - * {@link #Bond(Atom, Atom, int, boolean)} with the + * {@link #BondImpl(Atom, Atom, int, boolean)} with the * addSelfToAtoms flag set to false. * * @param atomA one of the atoms in this bond @@ -83,14 +83,14 @@ public BondImpl(Atom atomA, Atom atomB, int bondOrder, boolean addSelfToAtoms) { * include this bond. *

    * If you created your Bond with the constructor - * {@link #Bond(Atom, Atom, int)}, this method has already been called for + * {@link #BondImpl(Atom, Atom, int)}, this method has already been called for * you and should not be called again. */ // TODO first check if those bonds haven't been made already private void addSelfToAtoms() { List bonds = atomA.getBonds(); if (bonds==null) { - bonds = new ArrayList(AtomImpl.BONDS_INITIAL_CAPACITY); + bonds = new ArrayList<>(AtomImpl.BONDS_INITIAL_CAPACITY); atomA.setBonds(bonds); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/BondType.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/BondType.java index 9b3f752092..5a8569f396 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/BondType.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/BondType.java @@ -23,7 +23,7 @@ /** * Work in progress - NOT final! - * @author Jules Jacobsen + * @author Jules Jacobsen jacobsen@ebi.ac.uk */ public enum BondType { UNDEFINED, COVALENT, IONIC, HBOND, VANDERWAALS, HYDROPHOBIC, METAL, PLANAR, ATOM_PLANE; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java index b6fde44843..8c92f876f0 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java @@ -327,9 +327,9 @@ public static final double getPsi(AminoAcid a, AminoAcid b) } /** - * Test if two amino acids are connected, i.e. if the distance from C to N < + * Test if two amino acids are connected, i.e. if the distance from C to N < * 2.5 Angstrom. - * + *

    * If one of the AminoAcids has an atom missing, returns false. * * @param a diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Chain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Chain.java index 6ceba9fd61..0d067373ca 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Chain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Chain.java @@ -199,7 +199,7 @@ public interface Chain extends Serializable { * @return the length * @see #getAtomGroup(int) * @see #getAtomGroups() - * @see #getSeqResLength()) + * @see #getSeqResLength() */ int getAtomLength(); @@ -346,18 +346,20 @@ public interface Chain extends Serializable { /** * Get the predominant {@link GroupType} for a given Chain, following these - * rules:

  • if the ratio of number of residues of a certain + * rules: + *
      + *
    • if the ratio of number of residues of a certain * {@link GroupType} to total non-water residues is above the threshold * {@value org.biojava.nbio.structure.StructureTools#RATIO_RESIDUES_TO_TOTAL}, then that {@link GroupType} is * returned
    • if there is no {@link GroupType} that is above the * threshold then the {@link GroupType} with most members is chosen, logging * it
    • + *
    *

    * See also {@link ChemComp#getPolymerType()} and * {@link ChemComp#getResidueType()} which follow the PDB chemical component * dictionary and provide a much more accurate description of groups and * their linking. - *

    * * @return the predominant group type */ diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/ChainImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/ChainImpl.java index 4808ef0afb..7c30badc02 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/ChainImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/ChainImpl.java @@ -421,7 +421,7 @@ public String getSeqResSequence(){ // an amino acid residue.. use for alignment String oneLetter= ChemCompGroupFactory.getOneLetterCode(cc); // AB oneLetter.length() should be one. e.g. in 1EMA it is 3 and this makes mapping residue to sequence impossible. - if ( oneLetter == null || oneLetter.isEmpty() || oneLetter.equals("?")) { + if ( oneLetter == null || oneLetter.isEmpty() || "?".equals(oneLetter)) { oneLetter = Character.toString(StructureTools.UNKNOWN_GROUP_LABEL); } str.append(oneLetter); @@ -452,7 +452,7 @@ public String getSeqResOneLetterSeq(){ // an amino acid residue.. use for alignment String oneLetter= ChemCompGroupFactory.getOneLetterCode(cc); // AB oneLetter.length() should be one. e.g. in 1EMA it is 3 and this makes mapping residue to sequence impossible. - if ( oneLetter == null || oneLetter.isEmpty() || oneLetter.equals("?") || oneLetter.length()!=1) { + if ( oneLetter == null || oneLetter.isEmpty() || "?".equals(oneLetter) || oneLetter.length()!=1) { oneLetter = Character.toString(StructureTools.UNKNOWN_GROUP_LABEL); } str.append(oneLetter); @@ -597,14 +597,7 @@ public GroupType getPredominantGroupType(){ max = GroupType.HETATM; } } - logger.debug( - "Ratio of residues to total for chain with asym_id {} is below {}. Assuming it is a {} chain. " - + "Counts: # aa residues: {}, # nuc residues: {}, # non-water het residues: {}, # waters: {}, " - + "ratio aa/total: {}, ratio nuc/total: {}", - getId(), ratioResiduesToTotal, max, sizeAminos, - sizeNucleotides, sizeHetatomsWithoutWater, sizeWaters, - (double) sizeAminos / (double) fullSize, - (double) sizeNucleotides / (double) fullSize); + logger.debug("Ratio of residues to total for chain with asym_id {} is below {}. Assuming it is a {} chain. Counts: # aa residues: {}, # nuc residues: {}, # non-water het residues: {}, # waters: {}, ratio aa/total: {}, ratio nuc/total: {}{}{}{}{}", getId(), ratioResiduesToTotal, max, sizeAminos, sizeNucleotides, sizeHetatomsWithoutWater, sizeWaters, (double) sizeAminos, (double) fullSize, (double) sizeNucleotides, (double) fullSize); return max; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/DBRef.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/DBRef.java index b4c397c544..99ede802bf 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/DBRef.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/DBRef.java @@ -156,8 +156,8 @@ public String toString(){ for (Method m : methods) { String name = m.getName(); - if (name.substring(0, 3).equals("get")) { - if (name.equals("getClass")) { + if ("get".equals(name.substring(0, 3))) { + if ("getClass".equals(name)) { continue; } Object o = m.invoke(this); 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 510230ccf6..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 @@ -191,7 +191,7 @@ public enum Element { private static final Map allElements ; static { - allElements = new HashMap(); + allElements = new HashMap<>(); for (Element e : Element.values()){ allElements.put(e.toString().toLowerCase(), e); } @@ -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/EntityInfo.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/EntityInfo.java index 829e8abfc7..61300fe451 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/EntityInfo.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/EntityInfo.java @@ -159,11 +159,11 @@ public EntityInfo (EntityInfo c) { this.title = c.title; if (c.synonyms!=null) { - this.synonyms = new ArrayList(); + this.synonyms = new ArrayList<>(); synonyms.addAll(c.synonyms); } if (c.ecNums!=null) { - this.ecNums = new ArrayList(); + this.ecNums = new ArrayList<>(); ecNums.addAll(c.ecNums); } @@ -380,7 +380,7 @@ private void initResSerialsMap(Chain c) { return; } - Map resNums2ResSerials = new HashMap(); + Map resNums2ResSerials = new HashMap<>(); chains2pdbResNums2ResSerials.put(c.getId(), resNums2ResSerials); for (int i=0;i *

    * Entities are of four types: polymer, non-polymer, macrolide and water. @@ -76,10 +75,8 @@ public enum EntityType { /** * @param entType the type of the Entity */ - private EntityType(String entType) { - + EntityType(String entType) { this.setEntityType(entType); - } /** @@ -101,19 +98,15 @@ private void setEntityType(String entityType) { * Returns null if entityType is null or not one of the supported * standard types. * - * @param entityType String value , should be one of "polymer","non-polymer","water","macrolide" - * @return an EntityType object + * @param entityType should be one of "polymer", "non-polymer", "water", "macrolide", "branched" (case insensitive) + * @return an EntityType object or null if the input string doesn't correspond to a known entity */ - public static EntityType entityTypeFromString(String entityType) - { - - if ( entityType == null) + public static EntityType entityTypeFromString(String entityType) { + if (entityType == null) return null; - for(EntityType et : EntityType.values()) - { - if(entityType.equals(et.entityType)) - { + for(EntityType et : EntityType.values()) { + if (entityType.equalsIgnoreCase(et.entityType)) { return et; } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/ExperimentalTechnique.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/ExperimentalTechnique.java index 65fc455d26..d64c4e08fd 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/ExperimentalTechnique.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/ExperimentalTechnique.java @@ -71,7 +71,7 @@ private ExperimentalTechnique(String name, boolean isXtallographic, boolean isNm private static HashMap initExpTechStr2Value() { - HashMap expTechStr2Value = new HashMap(); + HashMap expTechStr2Value = new HashMap<>(); for(ExperimentalTechnique exp:ExperimentalTechnique.values()) { expTechStr2Value.put(exp.getName(), exp); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Group.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Group.java index 8b7b5cb809..1ea0d1633e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Group.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Group.java @@ -346,7 +346,7 @@ public interface Group extends Serializable { * The main group (this group) will contain the first altloc (be it the default '.' or 'A' or a mix of '.' and 'A'). *

    * This method will return the altloc groups that are not the main group, e.g.: - * + *

      *
    • if '.' (default), 'A' and 'B' altlocs are present in file, the main group will contain * the default '.' and this method will return 2 altloc groups *
    • @@ -354,7 +354,7 @@ public interface Group extends Serializable { *
    • if 'A' and 'B' are present in file without a default '.' group, then the main group will contain the 'A' * location whilst this method will return only 1 altloc group with the 'B' location *
    • - * + *
    *

    * Note that atoms with the default altloc (.) are included in all groups. Atoms with other altlocs (typically A, B, etc) * will be sorted into groups by altloc. diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/GroupType.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/GroupType.java index 7fa92f7363..e6c3373b9d 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/GroupType.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/GroupType.java @@ -95,7 +95,7 @@ public Set getResidueTypes() { * @return */ private static Set matchPolymerTypes(Set allowedTypes) { - Set matched = new HashSet(); + Set matched = new HashSet<>(); for(ResidueType restype : ResidueType.values()) { if(allowedTypes.contains(restype.polymerType)) { matched.add(restype); @@ -109,7 +109,7 @@ private static Set matchPolymerTypes(Set allowedTypes) * @return */ private static Set getHetatmTypes() { - Set unmatched = new HashSet(); + Set unmatched = new HashSet<>(); for(ResidueType restype : ResidueType.values()) { if(!AMINOACID.getResidueTypes().contains(restype) && !NUCLEOTIDE.getResidueTypes().contains(restype) ) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java index cf9dfcbeb9..face75517e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java @@ -137,7 +137,7 @@ public void setPDBName(String s) { //if (s.length() != 3) { //throw new PDBParseException("amino acid name is not of length 3!"); //} - if (s != null && s.equals("?")) logger.info("invalid pdbname: ?"); + if ("?".equals(s)) logger.info("invalid pdbname: ?"); pdb_name =s ; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/JournalArticle.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/JournalArticle.java index ff92f608f6..5e4052a1dc 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/JournalArticle.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/JournalArticle.java @@ -32,8 +32,8 @@ public class JournalArticle implements Serializable { private static final long serialVersionUID = 5062668226159515468L; - private List authorList = new ArrayList(); - private List editorList = new ArrayList(); + private List authorList = new ArrayList<>(); + private List editorList = new ArrayList<>(); private String title = ""; private String ref = ""; private String journalName = ""; @@ -258,19 +258,19 @@ public String toString() { } refString.append(ref); jrnlString.append(refString).append(eol); - if (!publisher.equals("")) { + if (!"".equals(publisher)) { publString.append(publisher); jrnlString.append(publString).append(eol); } - if (!refn.equals("")) { + if (!"".equals(refn)) { refnString.append(refn); jrnlString.append(refnString).append(eol); } - if (!pmid.equals("")) { + if (!"".equals(pmid)) { pmidString.append(pmid); jrnlString.append(pmidString).append(eol); } - if (!doi.equals("")) { + if (!"".equals(doi)) { doiString.append(doi); jrnlString.append(doiString).append(eol); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Mutator.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Mutator.java index 42e4662689..a26745f9a5 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Mutator.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Mutator.java @@ -59,7 +59,7 @@ public class Mutator{ List supportedAtoms; public Mutator(){ - supportedAtoms = new ArrayList(); + supportedAtoms = new ArrayList<>(); supportedAtoms.add("N"); supportedAtoms.add("CA"); supportedAtoms.add("C"); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBHeader.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBHeader.java index a948e3281a..f3cc2d8d16 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBHeader.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBHeader.java @@ -104,7 +104,7 @@ public PDBHeader(){ rFree = DEFAULT_RFREE; rWork = DEFAULT_RFREE; - bioAssemblies = new LinkedHashMap(); + bioAssemblies = new LinkedHashMap<>(); crystallographicInfo = new PDBCrystallographicInfo(); keywords = new ArrayList<>(); @@ -127,8 +127,8 @@ public String toString(){ for (Method m : methods) { String name = m.getName(); - if (name.substring(0, 3).equals("get")) { - if (name.equals("getClass")) { + if ("get".equals(name.substring(0, 3))) { + if ("getClass".equals(name)) { continue; } Object o = m.invoke(this); @@ -232,7 +232,7 @@ private void printAuthors(StringBuffer buf){ String authors = getAuthors(); if ( authors == null) return; - if ( authors.equals("")){ + if ( "".equals(authors)){ return; } @@ -424,8 +424,8 @@ public boolean equals(PDBHeader other){ for (Method m : methods) { String name = m.getName(); - if (name.substring(0, 3).equals("get")) { - if (name.equals("getClass")) { + if ("get".equals(name.substring(0, 3))) { + if ("getClass".equals(name)) { continue; } Object a = m.invoke(this); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBStatus.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBStatus.java index b09b65020c..2211b5b4d2 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBStatus.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBStatus.java @@ -71,11 +71,11 @@ public enum Status { */ public static Status fromString(String statusStr) { if (statusStr == null) throw new IllegalArgumentException("Status string can't be null"); - if(statusStr.equalsIgnoreCase("REMOVED")) + if("REMOVED".equalsIgnoreCase(statusStr)) return Status.REMOVED; - else if(statusStr.equalsIgnoreCase("CURRENT")) + else if("CURRENT".equalsIgnoreCase(statusStr)) return Status.CURRENT; - else if(statusStr.equalsIgnoreCase("UNRELEASED")) + else if("UNRELEASED".equalsIgnoreCase(statusStr)) return Status.UNRELEASED; else { throw new IllegalArgumentException("Unable to parse status '"+statusStr+"'."); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRange.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRange.java index 79dbedbdfc..05fb941fc8 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRange.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRange.java @@ -137,7 +137,7 @@ public static List parseMultiple(String s) { } String[] parts = s.split(","); - List list = new ArrayList(parts.length); + List list = new ArrayList<>(parts.length); for (String part : parts) { list.add(parse(part)); } @@ -352,7 +352,7 @@ public static Iterator multiIterator(AtomPositionMap map, List parseMultiple(List ranges) { - List rrs = new ArrayList(ranges.size()); + List rrs = new ArrayList<>(ranges.size()); for (String range : ranges) { ResidueRange rr = ResidueRange.parse(range); if (rr != null) rrs.add(rr); @@ -361,7 +361,7 @@ public static List parseMultiple(List ranges) { } public static List toStrings(List ranges) { - List list = new ArrayList(ranges.size()); + List list = new ArrayList<>(ranges.size()); for (ResidueRange range : ranges) { list.add(range.toString()); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRangeAndLength.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRangeAndLength.java index a8988aada4..d9769d0134 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRangeAndLength.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/ResidueRangeAndLength.java @@ -100,7 +100,7 @@ public static ResidueRangeAndLength parse(String s, AtomPositionMap map) { String chain = rr.getChainName(); // handle special "_" chain - if(chain == null || chain.equals("_")) { + if(chain == null || "_".equals(chain)) { ResidueNumber first = map.getNavMap().firstKey(); chain = first.getChainName(); // Quick check for additional chains. Not guaranteed if the atoms are out of order. @@ -129,7 +129,7 @@ public static ResidueRangeAndLength parse(String s, AtomPositionMap map) { public static List parseMultiple(List ranges, AtomPositionMap map) { - List rrs = new ArrayList(ranges.size()); + List rrs = new ArrayList<>(ranges.size()); for (String range : ranges) { ResidueRangeAndLength rr = ResidueRangeAndLength.parse(range, map); if (rr != null) rrs.add(rr); @@ -145,7 +145,7 @@ public static List parseMultiple(List ranges, Ato */ public static List parseMultiple(String s, AtomPositionMap map) { String[] parts = s.split(","); - List list = new ArrayList(parts.length); + List list = new ArrayList<>(parts.length); for (String part : parts) { list.add(parse(part, map)); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Site.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Site.java index 306b3a2cee..9158906d23 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Site.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Site.java @@ -42,7 +42,7 @@ public class Site implements PDBRecord, Comparable { private static final String lineEnd = System.getProperty("line.separator"); private String siteID = ""; - private List groups = new ArrayList(); + private List groups = new ArrayList<>(); //variables for REMARK 800 private String evCode = ""; private String description = ""; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/StandardAminoAcid.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/StandardAminoAcid.java index d52d358385..731267aafa 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/StandardAminoAcid.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/StandardAminoAcid.java @@ -64,7 +64,7 @@ private StandardAminoAcid() { * @author Tamas Horvath provided the standard amino acids */ static { - aminoAcids = new HashMap(); + aminoAcids = new HashMap<>(); InputStream fileStream = StandardAminoAcid.class.getClassLoader().getResourceAsStream(STANDARD_AMINOS_FILE); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/Structure.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/Structure.java index 5a31f407e2..05bd0ba859 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/Structure.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/Structure.java @@ -31,9 +31,8 @@ /** - * * Interface for a structure object. Provides access to the data of a PDB file. - * + *

    * A structure object allows to access the PDB header information as well * as to the data from the ATOM records. The header information is * currently available through the following objects: @@ -61,50 +60,33 @@ * *

    * The tutorial for the BioJava structure modules can be found at github. - *

    - * - * *
    - * *

    * Q: How can I get a Structure object from a PDB file? - *

    *

    * A: - *

    *
    - *  {@link Structure} loadStructure(String pathToPDBFile){
    - * 		{@link PDBFileReader} pdbreader = new {@link PDBFileReader}();
    - *
    - * 		{@link Structure} structure = null;
    - * 		try{
    - * 			structure = pdbreader.getStructure(pathToPDBFile);
    - * 			System.out.println(structure);
    - * 		} catch (IOException e) {
    - * 			e.printStackTrace();
    - * 		}
    + *  Structure loadStructure(String pathToPDBFile) {
    + * 		PDBFileReader pdbreader = new PDBFileReader();
    + * 		Structure structure = pdbreader.getStructure(pathToPDBFile);
    + * 		System.out.println(structure);
      * 		return structure;
      * 	}
      *  
    * *
    - * *

    * Q: How can I calculate Phi and Psi angles of AminoAcids? - *

    *

    * A: - *

    - *
    - *  void calcPhiPsi({@link Structure} structure){
    - *
    + * 
    {@code
    + *  void calcPhiPsi(Structure structure) {
      *
      * 		// get the first chain from the structure
    - *
    - * 		{@link Chain} chain  = structure.getChain(0);
    + * 		Chain chain  = structure.getChain(0);
      *
      * 		// A protein chain consists of a number of groups. These can be either
    - * 		// {@link AminoAcid}, {@link HetatomImpl Hetatom} or {@link NucleotideImpl Nucleotide} groups.
    + * 		// AminoAcid, HetatomImpl or NucleotideImpl groups.
      * 		//
      * 		// Note: BioJava provides access to both the ATOM and SEQRES data in a PDB file.
      * 		// since we are interested in doing calculations here, we only request the groups
    @@ -113,58 +95,35 @@
      * 		//  get the Groups of the chain that are AminoAcids.
      * 		List groups = chain.getAtomGroups(GroupType.AMINOACID);
      *
    - * 		{@link AminoAcid} a;
    - * 		{@link AminoAcid} b;
    - * 		{@link AminoAcid} c ;
    - *
    - * 		for ( int i=0; i < groups.size(); i++){
    - *
    + * 		AminoAcid a;
    + * 		AminoAcid b;
    + * 		AminoAcid c;
    + * 		for (int i=0; i < groups.size(); i++) {
      * 			// since we requested only groups of type AMINOACID they will always be amino acids
      * 			// Nucleotide and Hetatom groups will not be present in the groups list.
    - *
    - * 			b = ({@link AminoAcid})groups.get(i);
    - *
    - * 			double phi =360.0;
    - * 			double psi =360.0;
    - *
    - * 			if ( i > 0) {
    - * 				a = ({@link AminoAcid})groups.get(i-1) ;
    - * 				try {
    - *
    - * 					// the Calc class provides utility methods for various calculations on
    - * 					// structures, groups and atoms
    - *
    - * 					phi = {@link Calc}.getPhi(a,b);
    - * 				} catch ({@link StructureException} e){
    - * 					e.printStackTrace();
    - * 					phi = 360.0 ;
    - * 				}
    + * 			b = (AminoAcid)groups.get(i);
    + * 			double phi = 360.0;
    + * 			double psi = 360.0;
    + *
    + * 			if (i > 0) {
    + * 				a = (AminoAcid)groups.get(i-1) ;
    + * 				// the Calc class provides utility methods for various calculations on
    + * 				// structures, groups and atoms
    + * 				phi = Calc.getPhi(a,b);
      * 			}
    - * 			if ( i < groups.size()-1) {
    - * 				c = ({@link AminoAcid})groups.get(i+1) ;
    - * 				try {
    - * 					psi = {@link Calc}.getPsi(b,c);
    - * 				}catch ({@link StructureException} e){
    - * 					e.printStackTrace();
    - * 					psi = 360.0 ;
    - * 				}
    + * 			if (i < groups.size()-1) {
    + * 				c = (AminoAcid)groups.get(i+1) ;
    + * 				psi = Calc.getPsi(b, c);
      * 			}
    - *
      * 			System.out.print(b.getPDBCode() + " " + b.getPDBName() + ":"  );
    - *
      * 			System.out.println(String.format("\tphi: %+7.2f psi: %+7.2f", phi, psi));
    - *
      * 		}
    - * 
    + * } + * }
    *
    - * - * - * - * * * @author Andreas Prlic * @since 1.4 - * @version %I% %G% */ public interface Structure extends Cloneable, Serializable { @@ -219,10 +178,10 @@ public interface Structure extends Cloneable, Serializable { /** * Return number of chains of model. * - * @param modelnr an int specifying the number of the Model that should be used + * @param modelIdx an int specifying the index of the Model that should be used * @return an int representing the number of Chains in this Model */ - int size(int modelnr); + int size(int modelIdx); /** * Return the number of models . @@ -273,10 +232,10 @@ public interface Structure extends Cloneable, Serializable { * Retrieve all Chains belonging to a model . * @see #getChains(int modelnr) * - * @param modelnr an int + * @param modelIdx the model index * @return a List object containing the Chains of Model nr. modelnr */ - List getModel(int modelnr); + List getModel(int modelIdx); /** * Retrieve all chains for the first model. @@ -302,17 +261,17 @@ public interface Structure extends Cloneable, Serializable { * Retrieve all chains of a model. * @see #getModel * - * @param modelnr an int + * @param modelIdx the model index * @return a List object containing the Chains of Model nr. modelnr */ - List getChains(int modelnr); + List getChains(int modelIdx); /** * Set the chains for a model * @param chains the chains for a model - * @param modelnr the number of the model + * @param modelIdx the model index */ - void setChains( int modelnr, List chains); + void setChains(int modelIdx, List chains); /** * Return all polymeric chains for the first model @@ -356,7 +315,7 @@ public interface Structure extends Cloneable, Serializable { /** * Return all water chains for the given model index - * @param modelIdx + * @param modelIdx the model index * @return * @since 5.0 */ @@ -373,9 +332,9 @@ public interface Structure extends Cloneable, Serializable { * Add a new chain to the model specified by the given index * * @param chain a Chain object - * @param modelnr an int specifying to which model the Chain should be added + * @param modelIdx an int specifying to which model the Chain should be added */ - void addChain(Chain chain, int modelnr); + void addChain(Chain chain, int modelIdx); /** * Retrieve a chain by its index within the Structure . @@ -389,10 +348,10 @@ public interface Structure extends Cloneable, Serializable { * Retrieve a chain by its indices within the Structure and model. * * @param chainIndex the index of the desired chain in the structure - * @param modelnr the model the desired chain is in + * @param modelIdx the model index * @return a Chain object */ - Chain getChainByIndex(int modelnr, int chainIndex); + Chain getChainByIndex(int modelIdx, int chainIndex); /** * Check if a chain with the chainId aymId is contained in this structure. @@ -435,11 +394,11 @@ public interface Structure extends Cloneable, Serializable { * considers only model nr X. count starts with 0. * @param authId the chain name of the chain to use * @param pdbResnum the PDB residue number of the requested group - * @param modelnr the number of the model to use + * @param modelIdx the model index * @return Group the requested Group * @throws StructureException */ - Group findGroup(String authId, String pdbResnum, int modelnr) throws StructureException; + Group findGroup(String authId, String pdbResnum, int modelIdx) throws StructureException; /** * Retrieve a Chain (polymeric, non-polymeric or water) based on @@ -782,13 +741,11 @@ public interface Structure extends Cloneable, Serializable { * * @param pdb_id a String specifying the PDBCode * @see #getPDBCode - * @deprecated use {@link #setPDBCode(PdbId)} + * @deprecated use {@link #setPdbId(PdbId)} */ @Deprecated void setPDBCode (String pdb_id); - - /** * Returns the PDB identifier associated with this StructureIdentifier. * @return the {@link PdbId} object @@ -796,7 +753,6 @@ public interface Structure extends Cloneable, Serializable { */ PdbId getPdbId(); - /**Sets the {@link PdbId} identifier associated with this structure. * @param pdbId the {@link PdbId} identifier object to set * @since 6.0.0 diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java index 9b96705c91..0b802787dd 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java @@ -81,7 +81,7 @@ public class StructureIO { *
      *
    • If only a PDB code is provided, the whole structure will be return including ligands, but the first model only (for NMR). *
    • Chain IDs are case sensitive, PDB ids are not. To specify a particular chain write as: 4hhb.A or 4HHB.A
    • - *
    • To specify a SCOP domain write a scopId e.g. d2bq6a1. Some flexibility can be allowed in SCOP domain names, see {@link #setStrictSCOP(boolean)}
    • + *
    • To specify a SCOP domain write a scopId e.g. d2bq6a1
    • *
    • URLs are accepted as well
    • *
    * @@ -116,6 +116,7 @@ public static AtomCache getAtomCache() { * Returns the first biological assembly that is available for the given PDB id. *

    * The output Structure will be different depending on the multiModel parameter: + *

      *
    • * the symmetry-expanded chains are added as new models, one per transformId. All original models but * the first one are discarded. @@ -124,9 +125,10 @@ public static AtomCache getAtomCache() { * as original with symmetry-expanded chains added with renamed chain ids and names (in the form * originalAsymId_transformId and originalAuthId_transformId) *
    • + *
    *

    * For more documentation on quaternary structures see: - * {@link http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/biological-assemblies} + * http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/biological-assemblies * * * @param pdbId @@ -147,7 +149,7 @@ public static Structure getBiologicalAssembly(String pdbId, boolean multiModel) * using multiModel={@value AtomCache#DEFAULT_BIOASSEMBLY_STYLE} *

    * For more documentation on quaternary structures see: - * {@link http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/biological-assemblies} + * http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/biological-assemblies * * * @param pdbId @@ -163,6 +165,7 @@ public static Structure getBiologicalAssembly(String pdbId) throws IOException, * Returns the biological assembly for the given PDB id and bioassembly identifier. *

    * The output Structure will be different depending on the multiModel parameter: + *

      *
    • * the symmetry-expanded chains are added as new models, one per transformId. All original models but * the first one are discarded. @@ -171,6 +174,7 @@ public static Structure getBiologicalAssembly(String pdbId) throws IOException, * as original with symmetry-expanded chains added with renamed chain ids and names (in the form * originalAsymId_transformId and originalAuthId_transformId) *
    • + *
    * @param pdbId * @param biolAssemblyNr - the ith biological assembly that is available for a PDB ID (we start counting at 1, 0 represents the asym unit). * @param multiModel if true the output Structure will be a multi-model one with one transformId per model, @@ -202,6 +206,7 @@ public static Structure getBiologicalAssembly(String pdbId, int biolAssemblyNr) * Returns all biological assemblies for the given PDB id. *

    * The output Structure will be different depending on the multiModel parameter: + *

      *
    • * the symmetry-expanded chains are added as new models, one per transformId. All original models but * the first one are discarded. @@ -210,6 +215,7 @@ public static Structure getBiologicalAssembly(String pdbId, int biolAssemblyNr) * as original with symmetry-expanded chains added with renamed chain ids and names (in the form * originalAsymId_transformId and originalAuthId_transformId) *
    • + *
    * If only one biological assembly is required use {@link #getBiologicalAssembly(String)} or {@link #getBiologicalAssembly(String, int)} instead. * @param pdbId * @param multiModel if true the output Structure will be a multi-model one with one transformId per model, diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIdentifier.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIdentifier.java index cc7d8109b2..ba8de5d870 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIdentifier.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIdentifier.java @@ -33,12 +33,12 @@ * An identifier that uniquely identifies a whole {@link Structure} or * arbitrary substructure. Common examples would be reducing a structure to a * single chain, domain, or residue range. - * + *

    * StructureIdentifiers are represented by unique strings. The getId() and fromId() * methods convert to and from the string representation. - * + *

    * Implementations should provide a constructor which takes a String. A static - * fromId(String) method is also recommended. + * fromId(String) method is also recommended. * * @author dmyersturnbull * @author Spencer Bliven @@ -48,7 +48,7 @@ public interface StructureIdentifier extends Serializable { /** * Get the String form of this identifier. * - * It is recommended that the {@link #toString()} method also return the + * It is recommended that the toString() method also return the * identifier, for consistency during serialization. * @return The String form of this identifier */ @@ -59,11 +59,11 @@ public interface StructureIdentifier extends Serializable { * Loads a structure encompassing the structure identified. * The Structure returned should be suitable for passing as * the input to {@link #reduce(Structure)}. - * + *

    * It is recommended that the most complete structure available be returned * (e.g. the full PDB) to allow processing of unselected portions where * appropriate. - * @param AtomCache A potential sources of structures + * @param cache A potential sources of structures * @return A Structure containing at least the atoms identified by this, * or null if Structures are not applicable. * @throws StructureException For errors loading and parsing the structure @@ -92,7 +92,6 @@ public interface StructureIdentifier extends Serializable { * ID should match that returned by getPdbId(), if applicable. * @return * @throws StructureException - * @see StructureTools#getReducedStructure(Structure, String) */ Structure reduce(Structure input) throws StructureException; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java index 08b7ebceb0..0a697e2d7b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java @@ -123,20 +123,15 @@ public Structure clone() { n.setDBRefs(this.getDBRefs()); n.setSites(getSites()); - // go through each chain and clone chain for (int i=0;i cloned_model = new ArrayList(); + List cloned_model = new ArrayList<>(); for (int j=0;j models.size()) - throw new StructureException(" no model nr " + modelnr + + if ( modelIdx > models.size()) + throw new StructureException(" no model nr " + modelIdx + " in this structure. (contains "+models.size()+")"); - // first we need to gather all groups with the author id chainName: polymers, non-polymers and waters - Chain polyChain = getPolyChainByPDB(chainName, modelnr); + Chain polyChain = getPolyChainByPDB(chainName, modelIdx); if(polyChain != null) { - List groups = new ArrayList<>(); - - groups.addAll(polyChain.getAtomGroups()); + List groups = new ArrayList<>(polyChain.getAtomGroups()); // there can be more than one non-poly chain for a given author id - for (Chain chain: getNonPolyChainsByPDB(chainName, modelnr)) { + for (Chain chain: getNonPolyChainsByPDB(chainName, modelIdx)) { groups.addAll(chain.getAtomGroups()); } - Chain water = getWaterChainByPDB(chainName, modelnr); + Chain water = getWaterChainByPDB(chainName, modelIdx); if (water!=null) groups.addAll(water.getAtomGroups()); - - // now iterate over all groups // in order to find the amino acid that has this pdbRenum. @@ -254,13 +243,12 @@ public void setStructureIdentifier(StructureIdentifier structureIdentifier) { /** {@inheritDoc} */ @Override public void addChain(Chain chain) { - int modelnr = 0 ; - addChain(chain,modelnr); + addChain(chain, 0); } /** {@inheritDoc} */ @Override - public void addChain(Chain chain, int modelnr) { + public void addChain(Chain chain, int modelIdx) { // if model has not been initialized, init it! chain.setStructure(this); if (models.isEmpty()) { @@ -271,37 +259,25 @@ public void addChain(Chain chain, int modelnr) { models.add(model); } else { - Model model = models.get(modelnr); + Model model = models.get(modelIdx); model.addChain(chain); } - - - } - - /** {@inheritDoc} */ @Override public Chain getChainByIndex(int number) { - - int modelnr = 0 ; - - return getChainByIndex(modelnr,number); + return getChainByIndex(0, number); } /** {@inheritDoc} */ @Override - public Chain getChainByIndex(int modelnr,int number) { - - Model model = models.get(modelnr); - + public Chain getChainByIndex(int modelIdx, int number) { + Model model = models.get(modelIdx); return model.getChains().get(number); } - - /** {@inheritDoc} */ @Override public void addModel(List modelChains){ @@ -313,16 +289,12 @@ public void addModel(List modelChains){ models.add(model); } - /** {@inheritDoc} */ @Override public void setChains(List chains){ - - setModel(0,chains); + setModel(0, chains); } - - /** {@inheritDoc} */ @Override public void setModel(int position, List modelChains){ @@ -333,8 +305,6 @@ public void setModel(int position, List modelChains){ c.setStructure(this); //System.out.println("model size:" + models.size()); - - Model model = new Model(); model.setChains(modelChains); @@ -345,12 +315,9 @@ public void setModel(int position, List modelChains){ } } - /** String representation. - * - */ @Override public String toString(){ - String newline = System.getProperty("line.separator"); + String newline = System.lineSeparator(); StringBuilder str = new StringBuilder(); str.append("structure "); str.append(name); @@ -384,17 +351,13 @@ public String toString(){ List hgr = cha.getAtomGroups(GroupType.HETATM); List ngr = cha.getAtomGroups(GroupType.NUCLEOTIDE); - - - str.append("chain ") .append(j).append(": asymId:") .append(cha.getId()) .append(" authId:") .append(cha.getName()).append(" "); - - if ( cha.getEntityInfo() != null){ + if (cha.getEntityInfo() != null){ EntityInfo comp = cha.getEntityInfo(); String molName = comp.getDescription(); if ( molName != null){ @@ -406,7 +369,6 @@ public String toString(){ .append(")"); } - str.append(newline); str.append(" length SEQRES: ").append(cha.getSeqResLength()); str.append(" length ATOM: ").append(cha.getAtomLength()); @@ -425,32 +387,21 @@ public String toString(){ str.append(mol).append(newline); } - return str.toString() ; } @Override public int size() { - int modelnr = 0 ; - if (!models.isEmpty()) { - return models.get(modelnr).getPolyChains().size(); - } - else { + return models.get(0).getPolyChains().size(); + } else { return 0 ; } - } - /** return number of chains of model. - * - */ @Override - public int size(int modelnr) { return models.get(modelnr).size(); } + public int size(int modelIdx) { return models.get(modelIdx).size(); } - // some NMR stuff : - - /** return number of models. */ @Override public int nrModels() { return models.size() ; @@ -520,16 +471,15 @@ public List getChains(int modelIdx){ /** {@inheritDoc} */ @Override public List getChains(){ - if (models.size()==0) { + if (models.isEmpty()) { return new ArrayList<>(0); } return getChains(0); - } @Override public List getPolyChains() { - if (models.size()==0) { + if (models.isEmpty()) { return new ArrayList<>(0); } return getPolyChains(0); @@ -542,7 +492,7 @@ public List getPolyChains(int modelIdx) { @Override public List getNonPolyChains() { - if (models.size()==0) { + if (models.isEmpty()) { return new ArrayList<>(0); } return getNonPolyChains(0); @@ -555,7 +505,7 @@ public List getNonPolyChains(int modelIdx) { @Override public List getWaterChains() { - if (models.size()==0) { + if (models.isEmpty()) { return new ArrayList<>(0); } return getWaterChains(0); @@ -566,55 +516,46 @@ public List getWaterChains(int modelIdx) { return models.get(modelIdx).getWaterChains(); } - - /** {@inheritDoc} */ @Override - public void setChains(int modelnr, List chains){ + public void setChains(int modelIdx, List chains){ for (Chain c: chains){ c.setStructure(this); } - if (models.size()>modelnr) { - models.remove(modelnr); + if (models.size()> modelIdx) { + models.remove(modelIdx); } Model model = new Model(); model.setChains(chains); - models.add(modelnr, model); - + models.add(modelIdx, model); } - /** Retrieve all Chains belonging to a model . - * - * @param modelnr an int - * @return a List object + /** + * {@inheritDoc} */ @Override - public List getModel(int modelnr) { - - return models.get(modelnr).getChains(); + public List getModel(int modelIdx) { + if (models.isEmpty()) return new ArrayList<>(); + return models.get(modelIdx).getChains(); } /** {@inheritDoc} */ @Override - public Chain getChain(String asymId, int modelnr) { - - List chains = getChains(modelnr); + public Chain getChain(String asymId, int modelIdx) { + List chains = getChains(modelIdx); for (Chain c : chains) { if (c.getId().equals(asymId)) { return c; } } return null; - } /** {@inheritDoc} */ @Override public Chain getChain(String asymId) { - return getChain(asymId,0); - } @Override @@ -625,6 +566,8 @@ public Chain getPolyChain(String asymId) { @Override public Chain getPolyChain(String asymId, int modelIdx) { + if (models.isEmpty()) return null; + Model model = models.get(modelIdx); if (model==null) { return null; @@ -637,7 +580,6 @@ public Chain getPolyChain(String asymId, int modelIdx) { return null; } - @Override public Chain getNonPolyChain(String asymId) { return getNonPolyChain(asymId, 0); @@ -655,7 +597,6 @@ public Chain getNonPolyChain(String asymId, int modelIdx) { if (c.getId().equals(asymId)) return c; } - return null; } @@ -693,7 +634,6 @@ public List getNonPolyChainsByPDB(String authId, int modelIdx) { return chains; } - List nonpolyChains = model.getNonPolyChains(); for (Chain c : nonpolyChains){ if (c.getName().equals(authId)) @@ -708,7 +648,6 @@ public Chain getWaterChain(String asymId) { return getWaterChain(asymId, 0); } - @Override public Chain getWaterChain(String asymId, int modelIdx) { Model model = models.get(modelIdx); @@ -729,7 +668,6 @@ public Chain getWaterChainByPDB(String authId) { return getWaterChainByPDB(authId, 0); } - @Override public Chain getWaterChainByPDB(String authId, int modelIdx) { Model model = models.get(modelIdx); @@ -745,8 +683,6 @@ public Chain getWaterChainByPDB(String authId, int modelIdx) { return null; } - - /** {@inheritDoc} */ @Override public String toPDB() { @@ -835,7 +771,6 @@ public EntityInfo getEntityById(int entityId) { return null; } - /** {@inheritDoc} */ @Override public List getDBRefs() { @@ -855,7 +790,6 @@ public void setDBRefs(List dbrefs) { this.dbrefs = dbrefs; } - /** {@inheritDoc} */ @Override public PDBHeader getPDBHeader() { @@ -872,7 +806,6 @@ public void setPDBHeader(PDBHeader pdbHeader){ @Override public List getSSBonds(){ return ssbonds; - } /** {@inheritDoc} */ @@ -882,9 +815,7 @@ public void setSSBonds(List ssbonds){ } /** - * Adds a single disulfide Bond to this structure - * - * @param ssbond the SSBond. + * {@inheritDoc} */ @Override public void addSSBond(Bond ssbond){ @@ -892,10 +823,7 @@ public void addSSBond(Bond ssbond){ } /** - * Return whether or not the entry has an associated journal article - * or publication. The JRNL section is not mandatory and thus may not be - * present. - * @return flag if a JournalArticle could be found. + * R{@inheritDoc} */ @Override public boolean hasJournalArticle() { @@ -903,9 +831,7 @@ public boolean hasJournalArticle() { } /** - * get the associated publication as defined by the JRNL records in a PDB - * file. - * @return a JournalArticle + * {@inheritDoc} */ @Override public JournalArticle getJournalArticle() { @@ -913,9 +839,7 @@ public JournalArticle getJournalArticle() { } /** - * set the associated publication as defined by the JRNL records in a PDB - * file. - * @param journalArticle the article + * {@inheritDoc} */ @Override public void setJournalArticle(JournalArticle journalArticle) { @@ -923,29 +847,21 @@ public void setJournalArticle(JournalArticle journalArticle) { } /** - * @return the sites contained in this structure + * {@inheritDoc} */ - @Override public List getSites() { return sites; } /** - * @param sites the sites to set in the structure + * {@inheritDoc} */ - @Override public void setSites(List sites) { this.sites = sites; } - /** Caution: we should probably remove this to avoid confusion. Currently this is always an empty list! - * - * @return a list of Groups listed in the HET records - this will not - * include any waters. - */ - /** * Sets a flag to indicate if this structure is a biological assembly * @param biologicalAssembly true if biological assembly, otherwise false @@ -1015,7 +931,7 @@ public String getPDBCode () { } /** {@inheritDoc} - * @deprecated use {@link #setPDBCode(PdbId)} + * @deprecated use {@link #setPdbId(PdbId)} * */ @Deprecated @Override @@ -1026,19 +942,17 @@ public void setPDBCode(String pdb_id){ pdbId = new PdbId(pdb_id); } } - - - /** {@inheritDoc} - * @since 6.0.0 - * */ + /** + * {@inheritDoc} + **/ public PdbId getPdbId() { return this.pdbId; } - /** {@inheritDoc} - * @since 6.0.0 - * */ + /** + * {@inheritDoc} + **/ public void setPdbId(PdbId pdbId) { this.pdbId = pdbId; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java index af5f7ab80f..3921299613 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java @@ -171,7 +171,7 @@ public class StructureTools { private static final Set AMINOACID_BACKBONE_ATOMS; static { - nucleotides30 = new HashMap(); + nucleotides30 = new HashMap<>(); nucleotides30.put("DA", 'A'); nucleotides30.put("DC", 'C'); nucleotides30.put("DG", 'G'); @@ -215,14 +215,14 @@ public class StructureTools { // store nucleic acids (C, G, A, T, U, and I), and // the modified versions of nucleic acids (+C, +G, +A, +T, +U, and +I), // and - nucleotides23 = new HashMap(); + nucleotides23 = new HashMap<>(); String[] names = { "C", "G", "A", "T", "U", "I", "+C", "+G", "+A", "+T", "+U", "+I" }; for (String n : names) { nucleotides23.put(n, n.charAt(n.length() - 1)); } - aminoAcids = new HashMap(); + aminoAcids = new HashMap<>(); aminoAcids.put("GLY", 'G'); aminoAcids.put("ALA", 'A'); aminoAcids.put("VAL", 'V'); @@ -254,7 +254,7 @@ public class StructureTools { aminoAcids.put("PYH", 'O'); aminoAcids.put("PYL", 'O'); - hBondDonorAcceptors = new HashSet(); + hBondDonorAcceptors = new HashSet<>(); hBondDonorAcceptors.add(Element.N); hBondDonorAcceptors.add(Element.O); hBondDonorAcceptors.add(Element.S); @@ -320,7 +320,7 @@ public static int getNrGroups(Structure s) { public static Atom[] getAtomArray(Structure s, String[] atomNames) { List chains = s.getModel(0); - List atoms = new ArrayList(); + List atoms = new ArrayList<>(); extractAtoms(atomNames, chains, atoms); return atoms.toArray(new Atom[0]); @@ -787,7 +787,7 @@ private static void extractAtoms(String[] atomNames, List chains, List thisGroupAtoms = new ArrayList(); + List thisGroupAtoms = new ArrayList<>(); // flag to check if this group contains all the requested atoms. boolean thisGroupAllAtoms = true; for (String atomName : atomNames) { @@ -834,10 +834,7 @@ public static Atom[] getAtomArray(Chain c, String[] atomNames) { for (String atomName : atomNames) { Atom a = g.getAtom(atomName); if (a == null) { - logger.debug("Group " + g.getResidueNumber() + " (" - + g.getPDBName() - + ") does not have the required atom '" + atomName - + "'"); + logger.debug("Group {} ({}) does not have the required atom '{}'", g.getResidueNumber(), g.getPDBName(), atomName); // this group does not have a required atom, skip it... thisGroupAllAtoms = false; break; @@ -930,7 +927,7 @@ public static Atom[] getRepresentativeAtomArray(Chain c) { public static Atom[] cloneAtomArray(Atom[] ca) { Atom[] newCA = new Atom[ca.length]; - List model = new ArrayList(); + List model = new ArrayList<>(); int apos = -1; for (Atom a : ca) { apos++; @@ -976,7 +973,7 @@ public static Atom[] cloneAtomArray(Atom[] ca) { public static Group[] cloneGroups(Atom[] ca) { Group[] newGroup = new Group[ca.length]; - List model = new ArrayList(); + List model = new ArrayList<>(); int apos = -1; for (Atom a : ca) { apos++; @@ -1084,7 +1081,7 @@ public static Atom[] duplicateCA2(Atom[] ca2) { */ public static Atom[] getAtomCAArray(Structure s) { - List atoms = new ArrayList(); + List atoms = new ArrayList<>(); for (Chain c : s.getChains()) { for (Group g : c.getAtomGroups()) { @@ -1463,12 +1460,12 @@ public static Map getGroupDistancesWithinShell( // for speed, we avoid calculating square roots radius = radius * radius; - Map distances = new HashMap(); + Map distances = new HashMap<>(); // we only need this if we're averaging distances // note that we can't use group.getAtoms().size() because some the // group's atoms be outside the shell - Map atomCounts = new HashMap(); + Map atomCounts = new HashMap<>(); for (Chain chain : structure.getChains()) { groupLoop: for (Group chainGroup : chain.getAtomGroups()) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java index 44f799cac0..6419603c64 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java @@ -109,7 +109,7 @@ public SubstructureIdentifier(String id) { this.ranges = ResidueRange.parseMultiple(rangeStr); } else { - this.ranges = new LinkedList(); + this.ranges = new LinkedList<>(); } } @@ -245,7 +245,7 @@ public Structure reduce(Structure s) throws StructureException { // StructureTools.addGroupsToStructure(newS, groups, modelNr, false); Chain polyChain; //polymer - if(chainName.equals("_") ) { + if("_".equals(chainName) ) { // Handle special case of "_" chain for single-chain proteins polyChain = s.getPolyChains(modelNr).get(0); chainName = polyChain.getName(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/URLIdentifier.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/URLIdentifier.java index 796362809f..3505deaf02 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/URLIdentifier.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/URLIdentifier.java @@ -42,15 +42,15 @@ /** * Represents a structure loaded from a URL (including a file URL) - * + *

    * A few custom query parameters are supported: * *

      - *
    • format=[pdb|cif] Specify the file format (will otherwise be + *
    • format=[pdb|cif] Specify the file format (will otherwise be * guessed from the extension) - *
    • pdbId=[String] Specify the PDB ID (also guessed from the filename) - *
    • chainID=[String] A single chain from the structure - *
    • residues=[String] Residue ranges, in a form understood by + *
    • pdbId=[String] Specify the PDB ID (also guessed from the filename) + *
    • chainID=[String] A single chain from the structure + *
    • residues=[String] Residue ranges, in a form understood by * {@link SubstructureIdentifier} *
    * @author Spencer Bliven @@ -75,7 +75,7 @@ public class URLIdentifier implements StructureIdentifier { //TODO: should this get renamed to chainname or asymid? public static final String CHAINID_PARAM = "chainid"; /** - * URL parameter specifying residue ranges to include, e.g. residues=A:1-70 + * URL parameter specifying residue ranges to include, e.g. residues=A:1-70 * @see SubstructureIdentifier */ public static final String RESIDUES_PARAM = "residues"; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AFPTwister.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AFPTwister.java index 3718259c56..0b2d21ae82 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AFPTwister.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/AFPTwister.java @@ -295,7 +295,7 @@ private static void transformOrigPDB(int n, int[] res1, int[] res2, private static Atom[] getAtoms(Atom[] ca, int[] positions, int length, boolean clone) { - List atoms = new ArrayList(); + List atoms = new ArrayList<>(); for (int i = 0; i < length; i++) { int p = positions[i]; Atom a; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/CallableStructureAlignment.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/CallableStructureAlignment.java index f22e2a31f5..3429a3c950 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/CallableStructureAlignment.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/CallableStructureAlignment.java @@ -177,12 +177,9 @@ private void writeXML(File outFileF, String name1, String name2, String xml) // Create file File newF = new File(outFileF, "dbsearch_" +name1+"_" + name2+".xml.gz"); - FileOutputStream fstream = new FileOutputStream(newF); - - GZIPOutputStream gz = new GZIPOutputStream(fstream); - OutputStreamWriter writer = new OutputStreamWriter(gz); - writer.write(xml); - writer.close(); + try (OutputStreamWriter writer = new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(newF)))) { + writer.write(xml); + } } catch (Exception e){//Catch exception if any logger.error("Exception: ", e); } 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/StrucAligParameters.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StrucAligParameters.java index c871e46a0f..791233d465 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StrucAligParameters.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StrucAligParameters.java @@ -125,16 +125,16 @@ public String toString() { StringBuffer buf = new StringBuffer(); String t = " "; - Object[] params = new Object[]{new Integer(initialK) ,new Integer(seedFragmentLength), - new Float(seedRmsdCutoff), - new Integer(fragmentLength), - new Integer(diagonalDistance), new Integer(diagonalDistance2), new Float(fragmentMiniDistance), - new Integer(angleDiff), - new Float(fragCompat), new Integer(maxrefine), - new Boolean(reduceInitialFragments), new Double(joinRMSCutoff), new Boolean(joinPlo), - new Boolean(doAngleCheck), new Boolean(doDistanceCheck), new Boolean(doRMSCheck), - new Boolean(doDensityCheck), new Float(densityCutoff), new Float(create_co), new Integer(maxIter), - new Float(gapOpen), new Float(gapExtension), new Integer(permutationSize), new Float(evalCutoff)}; + Object[] params = new Object[]{Integer.valueOf(initialK) ,Integer.valueOf(seedFragmentLength), + Float.valueOf(seedRmsdCutoff), + Integer.valueOf(fragmentLength), + Integer.valueOf(diagonalDistance), Integer.valueOf(diagonalDistance2), Float.valueOf(fragmentMiniDistance), + Integer.valueOf(angleDiff), + Float.valueOf(fragCompat), Integer.valueOf(maxrefine), + Boolean.valueOf(reduceInitialFragments), Double.valueOf(joinRMSCutoff), Boolean.valueOf(joinPlo), + Boolean.valueOf(doAngleCheck), Boolean.valueOf(doDistanceCheck), Boolean.valueOf(doRMSCheck), + Boolean.valueOf(doDensityCheck), Float.valueOf(densityCutoff), Float.valueOf(create_co), Integer.valueOf(maxIter), + Float.valueOf(gapOpen), Float.valueOf(gapExtension), Integer.valueOf(permutationSize), Float.valueOf(evalCutoff)}; for (int i=0 ; i< params.length ; i++){ buf.append(params[i]); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java index 8b1c2629ef..956529262c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java @@ -135,7 +135,7 @@ public static StructureAlignment[] getAllAlgorithms(){ public static String[] getAllAlgorithmNames(){ StructureAlignment[] algos = getAllAlgorithms(); - List names = new ArrayList(); + List names = new ArrayList<>(); for (StructureAlignment alg : algos){ names.add(alg.getAlgorithmName()); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java index d47dc52502..906e79e70a 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java @@ -407,8 +407,8 @@ public void align(Atom[] ca1, Atom[] ca2, StrucAligParameters params) // step 1 get all Diagonals of length X that are similar between both // structures - logger.debug(" length atoms1:" + ca1.length); - logger.debug(" length atoms2:" + ca2.length); + logger.debug(" length atoms1:{}", ca1.length); + logger.debug(" length atoms2:{}", ca2.length); logger.debug("step 1 - get fragments with similar intramolecular distances "); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java index 85e2c100ab..dc61972ecb 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java @@ -74,15 +74,14 @@ * * @author Andreas * @author Spencer - * */ public abstract class AbstractUserArgumentProcessor implements UserArgumentProcessor { - public static String newline = System.getProperty("line.separator"); + public static String newline = System.lineSeparator(); protected StartupParameters params ; - public static final List mandatoryArgs= new ArrayList(); + public static final List mandatoryArgs= new ArrayList<>(); protected AbstractUserArgumentProcessor(){ params = getStartupParametersInstance(); @@ -109,23 +108,18 @@ public void process(String[] argv){ printAboutMe(); -// if(argv.length == 0 ) { -// System.out.println(printHelp()); -// return; -// } - for (int i = 0 ; i < argv.length; i++){ String arg = argv[i]; // help string - if(arg.equalsIgnoreCase("-h") || arg.equalsIgnoreCase("-help") - || arg.equalsIgnoreCase("--help") ) + if("-h".equalsIgnoreCase(arg) || "-help".equalsIgnoreCase(arg) + || "--help".equalsIgnoreCase(arg) ) { System.out.println(printHelp()); return; } // version - if(arg.equalsIgnoreCase("-version") || arg.equalsIgnoreCase("--version")) { + if("-version".equalsIgnoreCase(arg) || "--version".equalsIgnoreCase(arg)) { StructureAlignment alg = getAlgorithm(); System.out.println(alg.getAlgorithmName() + " v." + alg.getVersion() ); return; @@ -144,8 +138,6 @@ public void process(String[] argv){ String[] tmp = {arg,value}; - //System.out.println(arg + " " + value); - try { CliTools.configureBean(params, tmp); @@ -177,15 +169,17 @@ public void process(String[] argv){ String pdb1 = params.getPdb1(); String file1 = params.getFile1(); - try { if (pdb1 != null || file1 != null){ runPairwise(); return; } - - } catch (ConfigurationException e) { + if ( params.getAlignPairs() != null){ + runAlignPairs(); + return; + } + } catch (Exception e) { System.err.println(e.getLocalizedMessage()); System.exit(1); return; } @@ -195,90 +189,103 @@ public void process(String[] argv){ System.exit(1); return; } + public static void printAboutMe() { + ResourceManager about = ResourceManager.getResourceManager("about"); + String version = about.getString("project_version"); + String build = about.getString("build"); + System.out.println("Protein Comparison Tool " + version + " " + build); + } + private void runAlignPairs() throws ConfigurationException, StructureException, IOException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, IllegalAccessException { - public static void printAboutMe() { - try { - ResourceManager about = ResourceManager.getResourceManager("about"); + String pdbFilePath = params.getPdbFilePath(); - String version = about.getString("project_version"); - String build = about.getString("build"); + if ( pdbFilePath == null || pdbFilePath.equals("")){ + UserConfiguration c = new UserConfiguration(); + pdbFilePath = c.getPdbFilePath(); + System.err.println("You did not specify the -pdbFilePath parameter. Defaulting to "+pdbFilePath+"."); + } - System.out.println("Protein Comparison Tool " + version + " " + build); - } catch (Exception e){ - e.printStackTrace(); + AtomCache cache = new AtomCache(pdbFilePath, pdbFilePath); + + String alignPairs = params.getAlignPairs(); + + if ( alignPairs == null || alignPairs.equals("")) { + throw new ConfigurationException("Please specify -alignPairs!"); } + String outputFile = params.getOutFile(); + if ( outputFile == null || outputFile.equals("")){ + throw new ConfigurationException("Please specify the mandatory argument -outFile!"); + } + + runAlignPairs(cache, alignPairs, outputFile); } - private void runAlignPairs(AtomCache cache, String alignPairs, - String outputFile) { - try { - File f = new File(alignPairs); + private void runAlignPairs(AtomCache cache, String alignPairs, String outputFile) throws IOException, StructureException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, IllegalAccessException { - BufferedReader is = new BufferedReader (new InputStreamReader(new FileInputStream(f))); + File f = new File(alignPairs); - BufferedWriter out = new BufferedWriter(new FileWriter(outputFile, true)); + BufferedReader is = new BufferedReader (new InputStreamReader(new FileInputStream(f))); - StructureAlignment algorithm = getAlgorithm(); + BufferedWriter out = new BufferedWriter(new FileWriter(outputFile, true)); - String header = "# algorithm:" + algorithm.getAlgorithmName(); - out.write(header); - out.write(newline); + StructureAlignment algorithm = getAlgorithm(); - out.write("#Legend: " + newline ); - String legend = getDbSearchLegend(); - out.write(legend + newline ); - System.out.println(legend); - String line = null; - while ( (line = is.readLine()) != null){ - if ( line.startsWith("#")) - continue; + String header = "# algorithm:" + algorithm.getAlgorithmName(); + out.write(header); + out.write(newline); - String[] spl = line.split(" "); + out.write("#Legend: " + newline ); + String legend = getDbSearchLegend(); + out.write(legend + newline ); + System.out.println(legend); + String line = null; + while ( (line = is.readLine()) != null){ + if ( line.startsWith("#")) + continue; - if ( spl.length != 2) { - System.err.println("wrongly formattted line. Expected format: 4hhb.A 4hhb.B but found " + line); - continue; - } + String[] spl = line.split(" "); - String pdb1 = spl[0]; - String pdb2 = spl[1]; + if ( spl.length != 2) { + System.err.println("wrongly formattted line. Expected format: 4hhb.A 4hhb.B but found " + line); + continue; + } + String pdb1 = spl[0]; + String pdb2 = spl[1]; - Structure structure1 = cache.getStructure(pdb1); - Structure structure2 = cache.getStructure(pdb2); - Atom[] ca1; - Atom[] ca2; + Structure structure1 = cache.getStructure(pdb1); + Structure structure2 = cache.getStructure(pdb2); + Atom[] ca1; + Atom[] ca2; - ca1 = StructureTools.getRepresentativeAtomArray(structure1); - ca2 = StructureTools.getRepresentativeAtomArray(structure2); - Object jparams = getParameters(); + ca1 = StructureTools.getRepresentativeAtomArray(structure1); + ca2 = StructureTools.getRepresentativeAtomArray(structure2); - AFPChain afpChain; + Object jparams = getParameters(); - afpChain = algorithm.align(ca1, ca2, jparams); - afpChain.setName1(pdb1); - afpChain.setName2(pdb2); + AFPChain afpChain; - String result = getDbSearchResult(afpChain); - out.write(result); - System.out.print(result); + afpChain = algorithm.align(ca1, ca2, jparams); + afpChain.setName1(pdb1); + afpChain.setName2(pdb2); - checkWriteFile(afpChain,ca1,ca2,true); - } + String result = getDbSearchResult(afpChain); + out.write(result); + System.out.print(result); - out.close(); - is.close(); - } catch(Exception e){ - e.printStackTrace(); + checkWriteFile(afpChain,ca1,ca2,true); } + + out.close(); + is.close(); } @@ -411,9 +418,6 @@ private void runPairwise() throws ConfigurationException{ checkWriteFile(afpChain,ca1, ca2, false); - - - if ( params.isPrintXML()){ String fatcatXML = AFPChainXMLConverter.toXML(afpChain,ca1,ca2); System.out.println(fatcatXML); @@ -426,26 +430,12 @@ private void runPairwise() throws ConfigurationException{ System.out.println(afpChain.toCE(ca1, ca2)); } - } catch (IOException e) { - e.printStackTrace(); - System.exit(1); return; - } catch (ClassNotFoundException e) { - e.printStackTrace(); - System.exit(1); return; - } catch (NoSuchMethodException e) { - e.printStackTrace(); - System.exit(1); return; - } catch (InvocationTargetException e) { - e.printStackTrace(); - System.exit(1); return; - } catch (IllegalAccessException e) { - e.printStackTrace(); - System.exit(1); return; - } catch (StructureException e) { + } catch (IOException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException | + IllegalAccessException | StructureException e) { e.printStackTrace(); System.exit(1); return; } - } + } /** * check if the result should be written to the local file system @@ -591,12 +581,12 @@ private Structure getStructure(AtomCache cache, String name1, String file) */ private Structure fixStructureName(Structure s, String file) { - if ( s.getName() != null && (! s.getName().equals(""))) + if ( s.getName() != null && (! "".equals(s.getName()))) return s; s.setName(s.getPDBCode()); - if ( s.getName() == null || s.getName().equals("")){ + if ( s.getName() == null || "".equals(s.getName())){ File f = new File(file); s.setName(f.getName()); } 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 7e88bcb0b2..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 @@ -118,7 +118,7 @@ public CECalculator(CeParameters params){ dist1= new double[0][0]; dist2= new double[0][0]; this.params = params; - matrixListeners = new ArrayList(); + matrixListeners = new ArrayList<>(); } @@ -1143,7 +1143,7 @@ private void checkBestTraces( AFPChain afpChain, } // start to convert CE internal datastructure to generic AFPChain one... - List afpSet = new ArrayList(); + List afpSet = new ArrayList<>(); for (int afp=0;afp= strLen * 0.95 && !isRmsdLenAssigned) { rmsdLen=rmsd; isRmsdLenAssigned=true; } @@ -1923,7 +1923,7 @@ public double calc_rmsd(Atom[] pro1, Atom[] pro2, int strLen, */ private Atom[] getAtoms(Atom[] ca, int length, boolean clone) throws StructureException{ - List atoms = new ArrayList(); + List atoms = new ArrayList<>(); for ( int i = 0 ; i < length ; i++){ Atom a; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java index 2d7e76cf77..e40bdce47c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java @@ -61,7 +61,7 @@ public class CeCPMain extends CeMain { /** * version history: * 1.5 - Added more parameters to the command line, including -maxOptRMSD - * 1.4 - Added DuplicationHint parameter & default to duplicating the shorter chain + * 1.4 - Added DuplicationHint parameter and default to duplicating the shorter chain * 1.3 - Short CPs are now discarded * 1.2 - now supports check AlignmentTools.isSequentialAlignment. XML protocol * 1.1 - skipped, (trying to avoid confusion with jfatcat in all vs. all comparisons) @@ -415,8 +415,8 @@ public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCal // Fix numbering: // First, split up the atoms into left and right blocks - List< ResiduePair > left = new ArrayList(); // residues from left of duplication - List< ResiduePair > right = new ArrayList(); // residues from right of duplication + List< ResiduePair > left = new ArrayList<>(); // residues from left of duplication + List< ResiduePair > right = new ArrayList<>(); // residues from right of duplication for(int i=0;i= firstRes && optAln[0][1][i] <= lastRes ) { // not trimmed @@ -432,7 +432,7 @@ public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCal alignLen = 0; // Now we don't care about left/right, so just call them "blocks" - List> blocks = new ArrayList>(2); + List> blocks = new ArrayList<>(2); if( !left.isEmpty() ) { blocks.add(left); alignLen += left.size(); 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 05db803cf0..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 @@ -116,7 +116,7 @@ public CeCalculatorEnhanced(CeParameters params){ dist1= new double[0][0]; dist2= new double[0][0]; this.params = params; - matrixListeners = new ArrayList(); + matrixListeners = new ArrayList<>(); } @@ -1134,7 +1134,7 @@ private void checkBestTraces( AFPChain afpChain, } // start to convert CE internal datastructure to generic AFPChain one... - List afpSet = new ArrayList(); + List afpSet = new ArrayList<>(); for (int afp=0;afp= strLen * 0.95 && !isRmsdLenAssigned) { rmsdLen=rmsd; isRmsdLenAssigned=true; } @@ -2013,7 +2013,7 @@ public double calc_rmsd(Atom[] pro1, Atom[] pro2, int strLen, boolean storeTrans */ private Atom[] getAtoms(Atom[] ca, int length, boolean clone) throws StructureException{ - List atoms = new ArrayList(); + List atoms = new ArrayList<>(); for ( int i = 0 ; i < length ; i++){ Atom a; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeMain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeMain.java index 70f4acb64f..e35e88fce8 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeMain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeMain.java @@ -39,7 +39,7 @@ * The original CE paper is available from here: http://peds.oxfordjournals.org/cgi/content/short/11/9/739 * * For a demo of how to use this algorithm, visit the BioJava web site: - * CE usage example. + * CE usage example. * * The BioJava CE version is based on CE version 2.3 (2003 or 2004). * diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeParameters.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeParameters.java index 8383acf585..b2e7177244 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeParameters.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeParameters.java @@ -205,7 +205,7 @@ public Integer getMaxGapSize() { @Override public List getUserConfigHelp() { - List params =new ArrayList(); + List params =new ArrayList<>(); String helpMaxGap = "This parameter configures the maximum gap size G, that is applied during the AFP extension. The larger the value, the longer the calculation time can become, Default value is 30. Set to 0 for no limit. " ; //String helpRmsdThr = "This configures the RMSD threshold applied during the trace of the fragment matrix."; String helpWinSize = "This configures the fragment size m of Aligned Fragment Pairs (AFPs)."; @@ -222,7 +222,7 @@ public List getUserConfigHelp() { @Override public List getUserConfigParameters() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("MaxGapSize"); //params.add("RmsdThr"); params.add("WinSize"); @@ -236,7 +236,7 @@ public List getUserConfigParameters() { @Override public List getUserConfigParameterNames(){ - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("max. gap size G (during AFP extension)."); //params.add("RMSD threshold during trace of the fragment matrix."); params.add("fragment size m"); @@ -250,7 +250,7 @@ public List getUserConfigParameterNames(){ @Override @SuppressWarnings("rawtypes") public List getUserConfigTypes() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add(Integer.class); //params.add(Double.class); params.add(Integer.class); @@ -342,7 +342,8 @@ public void setDistanceIncrement(Double distanceIncrement) - /** Get the Original RMSD threshold from which the alignment optimization is started + /** + * Get the Original RMSD threshold from which the alignment optimization is started * * @return oRMSDThreshold */ @@ -353,7 +354,8 @@ public Double getORmsdThr() - /** Set the Original RMSD threshold from which the alignment optimization is started + /** + * Set the Original RMSD threshold from which the alignment optimization is started * * @param oRmsdThr the threshold */ @@ -363,16 +365,17 @@ public void setORmsdThr(Double oRmsdThr) } - /** Get the maximum nr of times the (slow) optimiziation of alignment should iterate. Default: unlimited + /** + * Get the maximum nr of times the (slow) optimiziation of alignment should iterate. Default: unlimited * - * @param maxNrIterationsForOptimization */ public int getMaxNrIterationsForOptimization() { return maxNrIterationsForOptimization; } - /** Set the maximum nr of times the (slow) optimiziation of alignment should iterate. Default: unlimited + /** + * Set the maximum nr of times the (slow) optimiziation of alignment should iterate. Default: unlimited * * @param maxNrIterationsForOptimization */ @@ -381,7 +384,8 @@ public void setMaxNrIterationsForOptimization(int maxNrIterationsForOptimization } - /** Should sequence conservation be considered as part of the alignment? If yes, this weight factor allows to determine how much. + /** + * Should sequence conservation be considered as part of the alignment? If yes, this weight factor allows to determine how much. * By default this is set to 0, meaning no contribution of the sequence alignment score. * * @return seqWeight the weight factor (default 0) @@ -392,7 +396,8 @@ public double getSeqWeight() { } - /** Should sequence conservation be considered as part of the alignment? If yes, this weight factor allows to determine how much. + /** + * Should sequence conservation be considered as part of the alignment? If yes, this weight factor allows to determine how much. * By default this is set to 0, meaning no contribution of the sequence alignment score. * * @param seqWeight the weight factor (default 0) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeUserArgumentProcessor.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeUserArgumentProcessor.java index 6f04aa7342..9274ed41eb 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeUserArgumentProcessor.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeUserArgumentProcessor.java @@ -28,7 +28,8 @@ import org.biojava.nbio.structure.align.StructureAlignment; import org.biojava.nbio.structure.align.ce.CeParameters.ScoringStrategy; -/** process the arguments from command line +/** + * Process the arguments from command line * * @author Andreas Prlic * @@ -154,7 +155,6 @@ public String toString() { .append(showMenu).append(", printPDB=").append(printPDB) .append(", isDomainSplit=").append(isDomainSplit) .append(", alignPairs=").append(alignPairs) - .append(", searchFile=").append(searchFile) .append(", saveOutputDir=").append(saveOutputDir) .append(", nrCPU=").append(nrCPU).append("]"); return builder.toString(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java index b10e09fbfd..0f3e4d1283 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java @@ -126,7 +126,7 @@ private static void permuteArray(T[] arr, int cp) { "Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" ); } - List temp = new ArrayList(cp); + List temp = new ArrayList<>(cp); // shift residues left for(int i=0;i * Sets residue numbers in the second protein to (i-cp)%len * * @param afpChain @@ -333,7 +333,7 @@ private static void permuteOptAln(AFPChain afpChain, int cp) int[] optLen = afpChain.getOptLen(); // the processed alignment - List>> blocks = new ArrayList>>(afpChain.getBlockNum()*2); + List>> blocks = new ArrayList<>(afpChain.getBlockNum()*2); //Update residue indices // newi = (oldi-cp) % N @@ -342,7 +342,7 @@ private static void permuteOptAln(AFPChain afpChain, int cp) continue; // set up storage for the current block - List> currBlock = new ArrayList>(2); + List> currBlock = new ArrayList<>(2); currBlock.add( new ArrayList()); currBlock.add( new ArrayList()); blocks.add(currBlock); @@ -356,7 +356,7 @@ private static void permuteOptAln(AFPChain afpChain, int cp) //this happens when the new alignment crosses the protein terminus if( optAln[block][1][pos-1]+cp= ca2len) { - currBlock = new ArrayList>(2); + currBlock = new ArrayList<>(2); currBlock.add( new ArrayList()); currBlock.add( new ArrayList()); blocks.add(currBlock); @@ -425,7 +425,7 @@ private static void assignOptAln(AFPChain afpChain, List>> bl /** * Finds the optimal alignment between two proteins allowing for a circular * permutation (CP). - * + *

    * The precise algorithm is controlled by the * {@link OptimalCECPParameters parameters}. If the parameter * {@link OptimalCECPParameters#isTryAllCPs() tryAllCPs} is true, all possible @@ -456,10 +456,9 @@ public AFPChain align(Atom[] ca1, Atom[] ca2, Object param) /** * Finds the optimal alignment between two proteins allowing for a circular * permutation (CP). - * + *

    * This algorithm performs a CE alignment for each possible CP site. This is - * quite slow. Use {@link #alignHeuristic(Atom[], Atom[], Object)} for a - * faster algorithm. + * quite slow. * * @param ca1 CA atoms of the first protein * @param ca2 CA atoms of the second protein diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/StartupParameters.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/StartupParameters.java index b6ee5e8ec5..bc6201d238 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/StartupParameters.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/StartupParameters.java @@ -25,7 +25,6 @@ * A simple bean that contains the parameters that can get set at startup * * @author Andreas Prlic - * */ public class StartupParameters { @@ -49,7 +48,6 @@ public class StartupParameters { // for DB searches String alignPairs; - String searchFile; String saveOutputDir; int nrCPU; @@ -69,19 +67,8 @@ public StartupParameters(){ nrCPU = 1; } - /** An input file to be used for the DB search - * - * @return - */ - public String getSearchFile() { - return searchFile; - } - public void setSearchFile(String searchFile) { - this.searchFile = searchFile; - } - - - /** The file that contains a list of PDB pairs to be aligned + /** + * The file that contains a list of PDB pairs to be aligned * * @return */ @@ -109,7 +96,8 @@ public void setShowMenu(boolean showMenu) { this.showMenu = showMenu; } - /** Display the output string in CE style + /** + * Display the output string in CE style * * @return flag */ @@ -117,7 +105,8 @@ public boolean isPrintCE() { return printCE; } - /** Display the output string in CE style + /** + * Display the output string in CE style * * @param printCE a flag */ @@ -129,7 +118,8 @@ public void setPrintCE(boolean printCE) { public String getPdb1() { return pdb1; } - /** mandatory argument to set the first PDB (and optionally chain ID) to be aligned. + /** + * mandatory argument to set the first PDB (and optionally chain ID) to be aligned. * * @param pdb1 */ @@ -140,7 +130,8 @@ public String getPdb2() { return pdb2; } - /** mandatory argument to set the second PDB (and optionally chain ID) to be aligned. + /** + * mandatory argument to set the second PDB (and optionally chain ID) to be aligned. * @param pdb2 */ public void setPdb2(String pdb2) { @@ -164,7 +155,8 @@ public String getPdbFilePath() { return pdbFilePath; } - /** mandatory argument to set the location of PDB files. + /** + * mandatory argument to set the location of PDB files. * * @param pdbFilePath */ @@ -232,9 +224,8 @@ public void setFile2(String file2) this.file2 = file2; } - - - /** When writing the results to a file, don;t write as XML but write aligned PDB file + /** + * When writing the results to a file, don;t write as XML but write aligned PDB file * * @return flag */ @@ -249,10 +240,6 @@ public void setOutputPDB(boolean printPDB) { this.printPDB = printPDB; } - - - - public boolean isDomainSplit() { return isDomainSplit; } @@ -273,14 +260,8 @@ public String toString() { + ", " + newline + " printPDB=" + printPDB + ", " + newline + " isDomainSplit=" + isDomainSplit + ", " + newline + " alignPairs=" + alignPairs - + ", " + newline + " searchFile=" + searchFile + ", " + newline + " saveOutputDir=" + + ", " + newline + " saveOutputDir=" + saveOutputDir + ", " + newline + " nrCPU=" + nrCPU + "]"; } - - - - - - } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/client/StructureName.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/client/StructureName.java index 123987531b..c7d68f2d04 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/client/StructureName.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/client/StructureName.java @@ -329,7 +329,7 @@ private boolean initFromFile() { } private static Set getChainNames(SubstructureIdentifier si) { - Set chains = new TreeSet(); + Set chains = new TreeSet<>(); List ranges = si.getResidueRanges(); for(ResidueRange range : ranges) { String chainName = range.getChainName(); @@ -457,7 +457,7 @@ public StructureIdentifier getBaseIdentifier() throws StructureException { if(base == null) { // Guessing didn't work, so just use the PDBID and Chain from name // Guess that '_' means 'whole structure' - if (chainName.equals("_")) { + if ("_".equals(chainName)) { base = new SubstructureIdentifier(pdbId.getId()); } else { base = new SubstructureIdentifier(pdbId, ResidueRange.parseMultiple(chainName)); @@ -604,7 +604,7 @@ public int compareTo(StructureName o) { * @return The best match for name among the domains of scopDB, or null if none match. */ public static ScopDomain guessScopDomain(String name, ScopDatabase scopDB) { - List matches = new LinkedList(); + List matches = new LinkedList<>(); // Try exact match first ScopDomain domain = scopDB.getDomainByScopID(name); @@ -624,9 +624,9 @@ public static ScopDomain guessScopDomain(String name, ScopDatabase scopDB) { for (ScopDomain potentialSCOP : scopDB.getDomainsForPDB(pdbID)) { Matcher potMatch = scopPattern.matcher(potentialSCOP.getScopId()); if (potMatch.matches()) { - if (chainName.equals(potMatch.group(2)) || chainName.equals("_") || chainName.equals(".") - || potMatch.group(2).equals("_") || potMatch.group(2).equals(".")) { - if (domainID.equals(potMatch.group(3)) || domainID.equals("_") || potMatch.group(3).equals("_")) { + if (chainName.equals(potMatch.group(2)) || "_".equals(chainName) || ".".equals(chainName) + || "_".equals(potMatch.group(2)) || ".".equals(potMatch.group(2))) { + if (domainID.equals(potMatch.group(3)) || "_".equals(domainID) || "_".equals(potMatch.group(3))) { // Match, or near match matches.add(potentialSCOP); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPCalculator.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPCalculator.java index a672cc9831..52b903189d 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPCalculator.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPCalculator.java @@ -48,7 +48,7 @@ public class AFPCalculator public static void extractAFPChains(FatCatParameters params, AFPChain afpChain,Atom[] ca1,Atom[] ca2) throws StructureException { - List afpSet = new ArrayList(); + List afpSet = new ArrayList<>(); afpChain.setAfpSet(afpSet); if ( debug ) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java index 1d1628b51e..1e9e1cf7d7 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java @@ -39,17 +39,17 @@ import javax.vecmath.Matrix4d; -/** a class to chain AFPs to an alignment +/** + * A class to chain AFPs to an alignment * * @author Andreas Prlic - * */ public class AFPChainer { public static final boolean debug = FatCatAligner.debug; // private static final boolean showAlig = false; - /** + /* // Key function: chain (assembly) the AFPs // a AFP (k) is defined as (i, j, k), with i and j are staring points // AFP extension (eg. AFP(k-1) -> AFP(k) ) requiring diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/FatCatParameters.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/FatCatParameters.java index 760b196bd5..bee2eb4df5 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/FatCatParameters.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/FatCatParameters.java @@ -366,7 +366,7 @@ public void setSparse(int sparse) @Override public List getUserConfigHelp() { - List params = new ArrayList(); + List params = new ArrayList<>(); String fragLen = "The length of the fragments."; String rmsdCutHelp = "The RMSD cutoff to be used during AFP detection."; String disCutHelp = "The distance cutoff used when calculate the connectivity of AFP pairs"; @@ -382,7 +382,7 @@ public List getUserConfigHelp() { @Override public List getUserConfigParameterNames() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("Fragment Length"); params.add("RMSD Cutoff"); params.add("AFP Distance Cutoff"); @@ -393,7 +393,7 @@ public List getUserConfigParameterNames() { @Override public List getUserConfigParameters() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("FragLen"); params.add("RmsdCut"); params.add("DisCut"); @@ -406,7 +406,7 @@ public List getUserConfigParameters() { @SuppressWarnings({ "rawtypes" }) public List getUserConfigTypes() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add(Integer.class); params.add(Double.class); params.add(Double.class); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/helper/JointFragments.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/helper/JointFragments.java index 862e7d8d50..05cc643aa8 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/helper/JointFragments.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/helper/JointFragments.java @@ -40,7 +40,7 @@ public class JointFragments { List idxlist; public JointFragments(){ - idxlist = new ArrayList(); + idxlist = new ArrayList<>(); rms = 999; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/AFPChain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/AFPChain.java index bd4013ada3..0c4ee5ec95 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/AFPChain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/AFPChain.java @@ -180,7 +180,7 @@ public AFPChain(AFPChain o) { this.alignScoreUpdate = o.alignScoreUpdate; this.afpChainTwiNum = o.afpChainTwiNum; this.minLen = o.minLen; - this.afpSet = new ArrayList(o.afpSet); + this.afpSet = new ArrayList<>(o.afpSet); this.afpIndex = o.afpIndex == null? null: o.afpIndex.clone(); this.afpAftIndex = o.afpAftIndex == null? null: o.afpAftIndex.clone(); this.afpBefIndex = o.afpBefIndex == null? null: o.afpBefIndex.clone(); @@ -440,15 +440,15 @@ private void init(){ blockResSize = new int[maxTra+1]; - afpSet = new ArrayList(); + afpSet = new ArrayList<>(); totalLenIni = totalLenOpt = 0; totalRmsdIni = totalRmsdOpt = 0.0; afpChainTwiNum = 0; alignScore = 0; alignScoreUpdate = 0; - conn = new Double(0); - dvar = new Double(0); + conn = Double.valueOf(0); + dvar = Double.valueOf(0); calculationTime = 0; similarity = -1; @@ -973,6 +973,10 @@ public void setOptRmsd(double[] optRmsd) this.optRmsd = optRmsd; } + /** + * The number of aligned residues in the final alignment. + * @return + */ public int getOptLength() { return optLength; @@ -1023,7 +1027,7 @@ public void setAlnseq2(char[] alnseq2) /** * @return The total length of the alignment, including gaps - * @see #getOptLength(), the number of aligned residues in the final alignment. + * @see #getOptLength() */ public int getAlnLength() { @@ -1308,7 +1312,7 @@ public void setSequentialAlignment(boolean sequentialAlignment) { * up to the alignment algorithm. * *

    Note: - * A {@link org.biojava.nbio.structure.gui.JMatrixPanel}, which is used in + * The org.biojava.nbio.structure.gui.JMatrixPanel, used in * the structure-gui package to display distance matrices, will display the * transpose of this matrix. Be sure to take that into account when debugging * visually. diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/AfpChainWriter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/AfpChainWriter.java index 76fa8748ac..472741cb90 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/AfpChainWriter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/AfpChainWriter.java @@ -263,9 +263,9 @@ public static String toFatCatCore( //System.err.println("t,len:"+t+":"+len); - String lseq1 = new String(alnseq1).substring(t,t+len); - String lseq2 = new String(alnseq2).substring(t,t+len); - String lsymb = new String(alnsymb).substring(t,t+len); + String lseq1 = String.valueOf(alnseq1).substring(t,t+len); + String lseq2 = String.valueOf(alnseq2).substring(t,t+len); + String lsymb = String.valueOf(alnsymb).substring(t,t+len); //System.err.println("B:" + b); @@ -1197,8 +1197,8 @@ public static String toCE(AFPChain afpChain, Atom[] ca1, Atom[] ca2) //System.err.println("t,len:"+t+":"+len); - a = new String(alnseq1).substring(t,t+len); - b = new String(alnseq2).substring(t,t+len); + a = String.valueOf(alnseq1).substring(t,t+len); + b = String.valueOf(alnseq2).substring(t,t+len); //System.err.println("B:" + b); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/AbstractScoresCache.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/AbstractScoresCache.java index b1ae2bf543..796da8382b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/AbstractScoresCache.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/AbstractScoresCache.java @@ -48,7 +48,7 @@ protected AbstractScoresCache(AbstractScoresCache cache) { @Override public void putScore(String property, Double score) { if(scores == null) { - scores = new TreeMap(); + scores = new TreeMap<>(); } scores.put(property, score); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/Block.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/Block.java index 8e79653de6..802d016c68 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/Block.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/Block.java @@ -72,7 +72,7 @@ public interface Block extends ScoresCache { * alignRes.get(structure).get(residue) = alignRes.get(size).get(length). * * @return List a double List of aligned residues for each structure. - * @see #setAlignRes() + * @see #setAlignRes(List) */ public List> getAlignRes(); @@ -89,7 +89,7 @@ public interface Block extends ScoresCache { * Returns the total number of aligned positions (columns) in the Block. * * @return int number of aligned residues. - * @see #getCoreLength(); + * @see #getCoreLength() * @see #size() */ public int length(); @@ -108,7 +108,6 @@ public interface Block extends ScoresCache { * Block. * * @return int number of aligned residues. - * @see #updateCoreLength() * @see #length() * @see #size() */ @@ -124,8 +123,8 @@ public interface Block extends ScoresCache { /** * Calculates and returns the first position of the specified structure in - * the alignment that is not null. This will return the aligment index, not - * the reisude aligned in that position. + * the alignment that is not null. This will return the alignment index, not + * the residue aligned in that position. * * @param str * structure index @@ -148,8 +147,8 @@ public interface Block extends ScoresCache { /** * Calculates and returns the last position of the specified structure in - * the alignment that is not null. This will return the aligment index, not - * the reisude aligned in that position. + * the alignment that is not null. This will return the alignment index, not + * the residue aligned in that position. * * @param str * structure index 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 402aa5984e..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 @@ -52,7 +52,6 @@ public class BlockImpl extends AbstractScoresCache implements Serializable, * * @param blockSet * the parent BlockSet of the BlockImpl instance. - * @return BlockImpl a BlockImpl instance linked to its parent BlockSet. */ public BlockImpl(BlockSet blockSet) { @@ -69,7 +68,6 @@ public BlockImpl(BlockSet blockSet) { * * @param b * BlockImpl object to be copied. - * @return BlockImpl an identical copy of the input BlockImpl object. */ public BlockImpl(BlockImpl b) { @@ -80,7 +78,7 @@ public BlockImpl(BlockImpl b) { this.alignRes = null; if (b.alignRes != null) { // Make a deep copy of everything - alignRes = new ArrayList>(); + alignRes = new ArrayList<>(); for (int k = 0; k < b.size(); k++) { alignRes.add(new ArrayList(b.alignRes.get(k))); } @@ -129,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(); } @@ -188,7 +186,7 @@ public List getAlignResCounts() { if (alignResCounts != null) return alignResCounts; - alignResCounts = new ArrayList(size()); + alignResCounts = new ArrayList<>(size()); for (int s = 0; s < size(); s++) { int count = 0; for (int r = 0; r < length(); r++) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSet.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSet.java index 4fdf318c61..ed46d6bbe7 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSet.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockSet.java @@ -111,7 +111,7 @@ public interface BlockSet extends ScoresCache { * This may trigger other properties to update which depend on the * superposition. * - * @param matrices + * @param transformations */ public void setTransformations(List transformations); 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 c817853634..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 @@ -55,7 +55,6 @@ public class BlockSetImpl extends AbstractScoresCache implements Serializable, * * @param alignment * MultipleAlignment parent of the BlockSet. - * @return BlockSet an instance linked to the parent alignment. */ public BlockSetImpl(MultipleAlignment alignment) { @@ -76,7 +75,6 @@ public BlockSetImpl(MultipleAlignment alignment) { * * @param bs * BlockSet object to be copied. - * @return BlockSet an identical copy of the input object. */ public BlockSetImpl(BlockSetImpl bs) { @@ -98,7 +96,7 @@ public BlockSetImpl(BlockSetImpl bs) { blocks = null; if (bs.blocks != null) { // Make a deep copy of everything - this.blocks = new ArrayList(); + this.blocks = new ArrayList<>(); for (Block b : bs.blocks) { Block newB = b.clone(); newB.setBlockSet(this); @@ -143,7 +141,7 @@ public void setMultipleAlignment(MultipleAlignment parent) { @Override public List getBlocks() { if (blocks == null) - blocks = new ArrayList(); + blocks = new ArrayList<>(); return blocks; } @@ -181,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 @@ -196,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."); } @@ -209,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."); } @@ -232,7 +230,7 @@ public List getAlignResCounts() { if (alignResCounts != null) return alignResCounts; - alignResCounts = new ArrayList(size()); + alignResCounts = new ArrayList<>(size()); for (int s = 0; s < size(); s++) alignResCounts.add(0); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsemble.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsemble.java index d6358a825d..be1c46631c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsemble.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsemble.java @@ -147,7 +147,6 @@ public interface MultipleAlignmentEnsemble extends ScoresCache { * structure. * * @return List of Matrix interatomic distance matrices. - * @see #updateDistanceMatrix() */ public List getDistanceMatrix(); @@ -155,7 +154,6 @@ public interface MultipleAlignmentEnsemble extends ScoresCache { * Returns the List of MultipleAlignments in the ensemble. * * @return List of MultipleAlignment in the ensemble. - * @see #setMultipleAlignments() */ public List getMultipleAlignments(); @@ -165,7 +163,6 @@ public interface MultipleAlignmentEnsemble extends ScoresCache { * accessing an index of a List * * @return MultipleAlignment at the index in the ensemble. - * @see #setMultipleAlignments() */ public MultipleAlignment getMultipleAlignment(int index); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsembleImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsembleImpl.java index 04b31447b0..0f0b442a63 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsembleImpl.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsembleImpl.java @@ -67,7 +67,6 @@ public class MultipleAlignmentEnsembleImpl extends AbstractScoresCache /** * Default Constructor. Empty ensemble, no structures assigned. * - * @return MultipleAlignmentEnsemble an empty ensemble instance. */ public MultipleAlignmentEnsembleImpl() { @@ -88,7 +87,6 @@ public MultipleAlignmentEnsembleImpl() { * @param structureIdentifiers * List of Structure names, that can be parsed by * {@link AtomCache}. - * @return MultipleAlignmentEnsemble an ensemble with the structures. */ public MultipleAlignmentEnsembleImpl( List structureIdentifiers) { @@ -102,7 +100,6 @@ public MultipleAlignmentEnsembleImpl( * * @param e * MultipleAlignmentEnsemble to copy. - * @return MultipleAlignmentEnsemble identical copy of the input ensemble. */ public MultipleAlignmentEnsembleImpl(MultipleAlignmentEnsembleImpl e) { @@ -115,7 +112,7 @@ public MultipleAlignmentEnsembleImpl(MultipleAlignmentEnsembleImpl e) { distanceMatrix = null; if (e.distanceMatrix != null) { // Make a deep copy of everything - distanceMatrix = new ArrayList(); + distanceMatrix = new ArrayList<>(); for (Matrix mat : e.distanceMatrix) { distanceMatrix.add((Matrix) mat.clone()); } @@ -124,7 +121,7 @@ public MultipleAlignmentEnsembleImpl(MultipleAlignmentEnsembleImpl e) { multipleAlignments = null; if (e.multipleAlignments != null) { // Make a deep copy of everything - multipleAlignments = new ArrayList(); + multipleAlignments = new ArrayList<>(); for (MultipleAlignment msa : e.multipleAlignments) { MultipleAlignment newMSA = msa.clone(); newMSA.setEnsemble(this); @@ -133,10 +130,10 @@ public MultipleAlignmentEnsembleImpl(MultipleAlignmentEnsembleImpl e) { } if (e.atomArrays != null) { - atomArrays = new ArrayList(e.atomArrays); + atomArrays = new ArrayList<>(e.atomArrays); } if (e.structureIdentifiers != null) { - structureIdentifiers = new ArrayList( + structureIdentifiers = new ArrayList<>( e.structureIdentifiers); } } @@ -153,7 +150,6 @@ public MultipleAlignmentEnsembleImpl(MultipleAlignmentEnsembleImpl e) { * Atoms of the second structure * @param flexible * true if the alignment is flexible (use BlockSets) - * @return MultipleAlignmentEnsemble an ensemble */ public MultipleAlignmentEnsembleImpl(AFPChain afp, Atom[] ca1, Atom[] ca2, boolean flexible) { @@ -326,7 +322,7 @@ public void setAtomArrays(List atomArrays) { */ public void updateAtomArrays() throws IOException, StructureException { AtomCache cache = new AtomCache(); - atomArrays = new ArrayList(); + atomArrays = new ArrayList<>(); for (StructureIdentifier name : getStructureIdentifiers()) { Atom[] array = cache.getRepresentativeAtoms(name); atomArrays.add(array); @@ -346,7 +342,7 @@ public List getDistanceMatrix() { public void updateDistanceMatrix() { // Reset the distance Matrix variable - distanceMatrix = new ArrayList(); + distanceMatrix = new ArrayList<>(); for (int s = 0; s < size(); s++) { Atom[] ca = atomArrays.get(s); @@ -359,7 +355,7 @@ public void updateDistanceMatrix() { public List getMultipleAlignments() { if (multipleAlignments == null) { - multipleAlignments = new ArrayList(); + multipleAlignments = new ArrayList<>(); } return multipleAlignments; } @@ -377,7 +373,7 @@ public void setMultipleAlignments(List alignments) { @Override public void addMultipleAlignment(MultipleAlignment alignment) { if (multipleAlignments == null) { - multipleAlignments = new ArrayList(); + multipleAlignments = new ArrayList<>(); } multipleAlignments.add(alignment); alignment.setEnsemble(this); 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 91d087b8b8..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 @@ -53,7 +53,6 @@ public class MultipleAlignmentImpl extends AbstractScoresCache implements /** * Default Constructor. Empty alignment. No structures assigned. * - * @return MultipleAlignment an empty MultipleAlignment instance. */ public MultipleAlignmentImpl() { this(new MultipleAlignmentEnsembleImpl()); // assign an empty ensemble. @@ -65,7 +64,6 @@ public MultipleAlignmentImpl() { * * @param ensemble * parent MultipleAlignmentEnsemble. - * @return MultipleAlignment an alignment instance part of an ensemble. */ public MultipleAlignmentImpl(MultipleAlignmentEnsemble ensemble) { @@ -87,7 +85,6 @@ public MultipleAlignmentImpl(MultipleAlignmentEnsemble ensemble) { * * @param ma * MultipleAlignmentImpl to copy. - * @return MultipleAlignmentImpl identical copy of the alignment. */ public MultipleAlignmentImpl(MultipleAlignmentImpl ma) { @@ -100,7 +97,7 @@ public MultipleAlignmentImpl(MultipleAlignmentImpl ma) { blockSets = null; if (ma.blockSets != null) { // Make a deep copy of everything - this.blockSets = new ArrayList(); + this.blockSets = new ArrayList<>(); for (BlockSet bs : ma.blockSets) { BlockSet newBS = bs.clone(); newBS.setMultipleAlignment(this); @@ -127,7 +124,7 @@ public MultipleAlignmentImpl clone() { @Override public String toString() { - List ids = new ArrayList(parent + List ids = new ArrayList<>(parent .getStructureIdentifiers().size()); for (StructureIdentifier i : parent.getStructureIdentifiers()) { ids.add(i.getIdentifier()); @@ -147,13 +144,13 @@ public String toString() { @Override public List getBlockSets() { if (blockSets == null) - blockSets = new ArrayList(); + blockSets = new ArrayList<>(); return blockSets; } @Override public List getBlocks() { - List blocks = new ArrayList(); + List blocks = new ArrayList<>(); for (BlockSet bs : getBlockSets()) { blocks.addAll(bs.getBlocks()); } @@ -210,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 @@ -226,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 @@ -240,7 +237,6 @@ protected void updateCoreLength() { /** * Updates all cached properties * - * @throws StructureException */ protected void updateCache() { updateCoreLength(); @@ -263,7 +259,7 @@ public List getAlignResCounts() { if (alignResCounts != null) return alignResCounts; - alignResCounts = new ArrayList(size()); + alignResCounts = new ArrayList<>(size()); for (int s = 0; s < size(); s++) alignResCounts.add(0); @@ -282,7 +278,7 @@ public List getCoverages() { return coverages; List counts = getAlignResCounts(); - coverages = new ArrayList(size()); + coverages = new ArrayList<>(size()); for (int s = 0; s < size(); s++) coverages.add(counts.get(s) / (double) getAtomArrays().get(s).length); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcMain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcMain.java index dcc843d791..e68cbe384e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcMain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcMain.java @@ -91,7 +91,7 @@ public class MultipleMcMain implements MultipleStructureAligner { /** * Default constructor. * Default parameters are used. - * @param pairwise the pairwise structure alignment used to generate the + * @param pairwiseAlgo the pairwise structure alignment used to generate the * multiple alignment seed. */ public MultipleMcMain(StructureAlignment pairwiseAlgo){ @@ -124,7 +124,7 @@ private MultipleAlignment generateSeed(List atomArrays) int size = atomArrays.size(); //List to store the all-to-all alignments - List> afpAlignments = new ArrayList>(); + List> afpAlignments = new ArrayList<>(); for (int i=0; i()); for (int j=0; j atomArrays) int threads = params.getNrThreads(); ExecutorService executor = Executors.newFixedThreadPool(threads); - List> afpFuture = new ArrayList>(); + List> afpFuture = new ArrayList<>(); //Create all the possible protein pairwise combinations //(N*(N-1)/2) and call the pairwise alignment algorithm @@ -177,14 +177,14 @@ private MultipleAlignment generateSeed(List atomArrays) * lowest average RMSD against all others. * The index of this structure is returned. * - * @param alignments List double containing all-to-all pairwise alignments + * @param afpAlignments List double containing all-to-all pairwise alignments * @return int reference index */ private static int chooseReferenceRMSD(List> afpAlignments){ int size = afpAlignments.size(); - List RMSDs = new ArrayList(); + List RMSDs = new ArrayList<>(); for (int i=0; i> afpAlignments){ * It uses the blocks in AFPChain as {@link Block}s in the * MultipleAlignment, so considers non-topological * alignments, if the alignment is rigid. If the alignment is flexible, - * it considers the blocks as {@link BlockSets}. + * it considers the blocks as {@link BlockSet}s. * * @param afpList the list of pairwise alignments to the reference * @param atomArrays List of Atoms of the structures @@ -226,10 +226,10 @@ private static MultipleAlignment combineReferenceAlignments( int length = 0; //the number of residues of the reference structure if (ref==0) length = afpList.get(1).getCa1Length(); else length = afpList.get(0).getCa2Length(); - SortedSet flexibleBoundaries = new TreeSet(); + SortedSet flexibleBoundaries = new TreeSet<>(); //Stores the equivalencies of all the structures as a double List - List> equivalencies = new ArrayList>(); + List> equivalencies = new ArrayList<>(); for (int str=0; str()); for (int res=0; res> alnRes = - new ArrayList>(size); + new ArrayList<>(size); for (int k=0; k()); 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 0845c61300..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 @@ -108,7 +108,6 @@ public class MultipleMcOptimizer implements Callable { * the parameter beam * @param reference * the index of the most similar structure to all others - * @throws StructureException */ public MultipleMcOptimizer(MultipleAlignment seedAln, MultipleMcParameters params, int reference) { @@ -125,7 +124,7 @@ public MultipleMcOptimizer(MultipleAlignment seedAln, imposer = new CoreSuperimposer(reference); if (params.getConvergenceSteps() == 0) { - List lens = new ArrayList(); + List lens = new ArrayList<>(); for (int i = 0; i < size; i++) lens.add(atomArrays.get(i).length); convergenceSteps = Collections.min(lens) * size; @@ -142,8 +141,8 @@ public MultipleMcOptimizer(MultipleAlignment seedAln, Lmin = params.getMinBlockLen(); // Delete all shorter than Lmin blocks, and empty blocksets - List toDelete = new ArrayList(); - List emptyBs = new ArrayList(); + List toDelete = new ArrayList<>(); + List emptyBs = new ArrayList<>(); for (Block b : msa.getBlocks()) { if (b.getCoreLength() < Lmin) { @@ -154,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); } } @@ -183,12 +182,12 @@ public MultipleAlignment call() throws Exception { private void initialize() throws StructureException { // Initialize alignment variables - freePool = new ArrayList>(); - List> aligned = new ArrayList>(); + freePool = new ArrayList<>(); + List> aligned = new ArrayList<>(); // Generate freePool residues from the ones not aligned for (int i = 0; i < size; i++) { - List residues = new ArrayList(); + List residues = new ArrayList<>(); for (BlockSet bs : msa.getBlockSets()) { for (Block b : bs.getBlocks()) { for (int l = 0; l < b.length(); l++) { @@ -210,7 +209,7 @@ private void initialize() throws StructureException { } } - // Set the superposition and score for the seed aligment + // Set the superposition and score for the seed alignment checkGaps(); msa.clear(); imposer.superimpose(msa); @@ -219,9 +218,9 @@ private void initialize() throws StructureException { // Initialize the history variables if (history) { - lengthHistory = new ArrayList(); - rmsdHistory = new ArrayList(); - scoreHistory = new ArrayList(); + lengthHistory = new ArrayList<>(); + rmsdHistory = new ArrayList<>(); + scoreHistory = new ArrayList<>(); } } @@ -235,7 +234,7 @@ private void initialize() throws StructureException { *

  • Shrink Block: move a block column to the freePool. *
  • Insert gap: insert a gap in a random position of the alignment. * - *
  • + * */ public MultipleAlignment optimize() throws StructureException { @@ -249,9 +248,9 @@ public MultipleAlignment optimize() throws StructureException { // Save the state of the system MultipleAlignment lastMSA = msa.clone(); - List> lastFreePool = new ArrayList>(); + List> lastFreePool = new ArrayList<>(); for (int k = 0; k < size; k++) { - SortedSet p = new TreeSet(); + SortedSet p = new TreeSet<>(); for (Integer l : freePool.get(k)) p.add(l); lastFreePool.add(p); @@ -349,10 +348,10 @@ private boolean checkGaps() { boolean shrinkedAny = false; - List> shrinkColumns = new ArrayList>(); + List> shrinkColumns = new ArrayList<>(); // Loop for each Block for (Block b : msa.getBlocks()) { - List shrinkCol = new ArrayList(); + List shrinkCol = new ArrayList<>(); // Loop for each column in the Block for (int res = 0; res < b.length(); res++) { int gapCount = 0; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcParameters.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcParameters.java index a49d9febc3..cc42754463 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcParameters.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcParameters.java @@ -54,7 +54,7 @@ public MultipleMcParameters(){ @Override public List getUserConfigParameters() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("RandomSeed"); params.add("MinBlockLen"); params.add("MinAlignedStructures"); @@ -69,7 +69,7 @@ public List getUserConfigParameters() { @Override public List getUserConfigParameterNames() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("Random Seed"); params.add("Minimum Block Length"); params.add("Minimum Structures per Column"); @@ -85,7 +85,7 @@ public List getUserConfigParameterNames() { @SuppressWarnings("rawtypes") public List getUserConfigTypes() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add(Integer.class); params.add(Integer.class); params.add(Integer.class); @@ -100,7 +100,7 @@ public List getUserConfigTypes() { @Override public List getUserConfigHelp() { - List params =new ArrayList(); + List params =new ArrayList<>(); String randomSeed = "Random seed for the optimizer random number generator."; String minBlockLen = diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/CoreSuperimposer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/CoreSuperimposer.java index 097615a554..56a8be3687 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/CoreSuperimposer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/CoreSuperimposer.java @@ -127,8 +127,8 @@ public void superimpose(MultipleAlignment alignment) Atom[] ref = atomArrays.get(reference); Atom[] curr = atomArrays.get(i); - List atomSet1 = new ArrayList(); - List atomSet2 = new ArrayList(); + List atomSet1 = new ArrayList<>(); + List atomSet2 = new ArrayList<>(); for( Block blk : bs.getBlocks() ) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentDisplay.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentDisplay.java index ad5b1dd83f..d3fe14ba20 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentDisplay.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentDisplay.java @@ -69,7 +69,7 @@ public static List getRotatedAtoms(MultipleAlignment multAln) + atomArrays.get(i).length); } - List rotatedAtoms = new ArrayList(); + List rotatedAtoms = new ArrayList<>(); // TODO implement independent BlockSet superposition of the structure List transf = multAln.getBlockSet(0).getTransformations(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentScorer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentScorer.java index 1422348e6d..b17c5ae8f3 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentScorer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentScorer.java @@ -66,7 +66,7 @@ public static void calculateScores(MultipleAlignment alignment) alignment.putScore(RMSD, getRMSD(trans)); // Put AvgTM-Score - List lengths = new ArrayList(alignment.size()); + List lengths = new ArrayList<>(alignment.size()); for (Atom[] atoms : alignment.getAtomArrays()) { lengths.add(atoms.length); } @@ -237,7 +237,7 @@ public static double getAvgTMScore(MultipleAlignment alignment) List trans = MultipleAlignmentTools.transformAtoms(alignment); - List lengths = new ArrayList(alignment.size()); + List lengths = new ArrayList<>(alignment.size()); for (Atom[] atoms : alignment.getAtomArrays()) { lengths.add(atoms.length); } @@ -304,7 +304,7 @@ public static double getAvgTMScore(List transformed, * length. * * @param alignment - * @param reference + * @param ref * Index of the reference structure * @return * @throws StructureException @@ -314,7 +314,7 @@ public static double getRefTMScore(MultipleAlignment alignment, int ref) List trans = MultipleAlignmentTools.transformAtoms(alignment); - List lengths = new ArrayList(alignment.size()); + List lengths = new ArrayList<>(alignment.size()); for (Atom[] atoms : alignment.getAtomArrays()) { lengths.add(atoms.length); } @@ -427,7 +427,7 @@ public static double getMCScore(MultipleAlignment alignment, * Complexity: T(n,l) = O(l*n^2), if n=number of structures and l=alignment * length. * - * @param transformed + * @param trans * List of transformed Atom arrays * @param d0 * parameter for the half-score distance diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentTools.java index d790eec19c..543aaa8405 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentTools.java @@ -57,6 +57,7 @@ import org.biojava.nbio.structure.align.multiple.BlockSet; import org.biojava.nbio.structure.align.multiple.MultipleAlignment; import org.biojava.nbio.structure.align.util.AlignmentTools; +import org.biojava.nbio.structure.cluster.SubunitCluster; import org.biojava.nbio.structure.jama.Matrix; import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix; import org.forester.phylogeny.Phylogeny; @@ -108,7 +109,7 @@ public static List getSequenceAlignment( MultipleAlignment alignment, final List mapSeqToStruct) { // Initialize sequence variables - List alnSequences = new ArrayList(); + List alnSequences = new ArrayList<>(); for (int str = 0; str < alignment.size(); str++) alnSequences.add(""); mapSeqToStruct.clear(); @@ -116,13 +117,13 @@ public static List getSequenceAlignment( int globalPos = -1; // Initialize helper variables in constucting the sequence alignment - List> freePool = new ArrayList>(); - List> blockStarts = new ArrayList>(); - List> aligned = new ArrayList>(); + List> freePool = new ArrayList<>(); + List> blockStarts = new ArrayList<>(); + List> aligned = new ArrayList<>(); // Generate freePool residues from the ones not aligned for (int i = 0; i < alignment.size(); i++) { - List residues = new ArrayList(); + List residues = new ArrayList<>(); freePool.add(new TreeSet()); blockStarts.add(new TreeSet()); for (BlockSet bs : alignment.getBlockSets()) { @@ -308,7 +309,7 @@ public static List getSequenceAlignment( * Blocks is indicated by a gap in all positions, meaning that there is a * possible discontinuity. * - * @param alignment + * @param msa * input MultipleAlignment * @return String for each row in the alignment, giving the 1-letter code * for each aligned residue. @@ -346,7 +347,7 @@ public static List getBlockSequenceAlignment( MultipleAlignment alignment, List mapSeqToStruct) { // Initialize sequence variables - List alnSequences = new ArrayList(); + List alnSequences = new ArrayList<>(); for (int str = 0; str < alignment.size(); str++) alnSequences.add(""); mapSeqToStruct.clear(); @@ -465,7 +466,7 @@ else if (previousPos[str] + 1 == residue) { * gap in all positions, meaning that there is something unaligned * inbetween. * - * @param alignment + * @param ma * input MultipleAlignment * @return String for each row in the alignment, giving the 1-letter code * for each aligned residue. @@ -478,7 +479,7 @@ public static List getBlockSequenceAlignment(MultipleAlignment ma) { * Returns the Atom of the specified structure that is aligned in the * sequence alignment position specified. * - * @param multAln + * @param msa * the MultipleAlignment object from where the sequence alignment * has been generated * @param mapSeqToStruct @@ -567,7 +568,7 @@ public static int getBlockForSequencePosition(MultipleAlignment multAln, * Complexity: T(n,l) = O(l*n^2), if n=number of structures and l=alignment * length. * - * @param alignment + * @param msa * MultipleAlignment * @return Matrix containing all average residue distances */ @@ -643,7 +644,7 @@ public static Matrix getAverageResidueDistances(List transformed) { *

    * For each structure in the alignment, returns an atom for each * representative atom in the aligned columns, omitting unaligned residues - * (i.e. an array of length alignment.length() ). + * (i.e. an array of length alignment.length() ). *

    * All blocks are concatenated together, so Atoms may not appear in the same * order as in their parent structure. If the alignment blocks contain null @@ -661,7 +662,7 @@ public static List transformAtoms(MultipleAlignment alignment) { } List atomArrays = alignment.getAtomArrays(); - List transformed = new ArrayList(atomArrays.size()); + List transformed = new ArrayList<>(atomArrays.size()); // Loop through structures for (int i = 0; i < atomArrays.size(); i++) { @@ -721,7 +722,7 @@ public static List transformAtoms(MultipleAlignment alignment) { /** * Calculate a List of alignment indicies that correspond to the core of a - * Block, which means that all structures have a residue in that positon. + * Block, which means that all structures have a residue in that position. * * @param block * alignment Block @@ -729,7 +730,7 @@ public static List transformAtoms(MultipleAlignment alignment) { */ public static List getCorePositions(Block block) { - List corePositions = new ArrayList(); + List corePositions = new ArrayList<>(); for (int col = 0; col < block.length(); col++) { boolean core = true; @@ -800,9 +801,9 @@ public static MultipleSequenceAlignment toPr + "the structures aligned are not proteins"); } - MultipleSequenceAlignment msa = new MultipleSequenceAlignment(); + MultipleSequenceAlignment msa = new MultipleSequenceAlignment<>(); - Map uniqueID = new HashMap(); + Map uniqueID = new HashMap<>(); List seqs = getSequenceAlignment(msta); for (int i = 0; i < msta.size(); i++) { // Make sure the identifiers are unique (required by AccessionID) @@ -875,7 +876,7 @@ public static Matrix getRMSDMatrix(MultipleAlignment msa) { for (int j = i; j < msa.size(); j++) { if (i == j) rmsdMat.set(i, j, 0.0); - List compared = new ArrayList(); + List compared = new ArrayList<>(); compared.add(superposed.get(i)); compared.add(superposed.get(j)); double rmsd = MultipleAlignmentScorer.getRMSD(compared); @@ -939,7 +940,6 @@ public static Phylogeny getHSDMTree(MultipleAlignment msta) * @param msta * MultipleAlignment of protein structures * @return Phylogeny phylogenetic tree - * @throws CompoundNotFoundException */ public static Phylogeny getStructuralTree(MultipleAlignment msta) { double[][] rmsdMat = MultipleAlignmentTools.getRMSDMatrix(msta) @@ -947,7 +947,7 @@ public static Phylogeny getStructuralTree(MultipleAlignment msta) { BasicSymmetricalDistanceMatrix rmsdDist = (BasicSymmetricalDistanceMatrix) DistanceMatrixCalculator .structuralDistance(rmsdMat, 1, 5, 0.4); // Set the identifiers of the matrix - Map alreadySeen = new HashMap(); + Map alreadySeen = new HashMap<>(); for (int i = 0; i < msta.size(); i++) { // Make sure the identifiers are unique String id = msta.getStructureIdentifier(i).toString(); @@ -964,4 +964,46 @@ public static Phylogeny getStructuralTree(MultipleAlignment msta) { return tree; } + /** + * Convert an MSA into a matrix of equivalent residues. + * + * This concatenates all blocks, meaning that the indices might not be + * sequential. + * + * Indices should be consistent with `msa.getAtomArrays()`. + * @param msa Multiple alignment + * @param coreOnly Include only core (ungapped) columns. Otherwise gaps are + * represented with null. + * @return + */ + public static List> getEquivalentResidues(MultipleAlignment msa, boolean coreOnly) { + List> eqr = new ArrayList<>(); + for (int str = 0; str < msa.size(); str++) { + eqr.add(new ArrayList<>()); + } + + for(Block block: msa.getBlocks()) { + List> aln = block.getAlignRes(); + for (int col = 0; col < block.length(); col++) { + // skip non-core columns + if(coreOnly) { + boolean core = true; + for (int str = 0; str < block.size(); str++) { + if (aln.get(str).get(col) == null) { + core = false; + break; + } + } + if(!core) { + continue; + } + } + // add column to eqr + for (int str = 0; str < block.size(); str++) { + eqr.get(str).add(aln.get(str).get(col)); + } + } + } + return eqr; + } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java index 70482a8c78..771b8b5f68 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java @@ -95,7 +95,7 @@ public static String toFatCat(MultipleAlignment alignment) { fatcat.append(alignment.toString() + "\n\n"); // Get the alignment sequences and the mapping - List mapSeqToStruct = new ArrayList(); + List mapSeqToStruct = new ArrayList<>(); List alnSequences = MultipleAlignmentTools .getSequenceAlignment(alignment, mapSeqToStruct); @@ -194,7 +194,7 @@ public static String toAlignedResidues(MultipleAlignment multAln) { * Converts the transformation Matrices of the alignment into a String * output. * - * @param afpChain + * @param alignment * @return String transformation Matrices */ public static String toTransformMatrices(MultipleAlignment alignment) { @@ -289,7 +289,7 @@ public static String toXML(MultipleAlignmentEnsemble ensemble) * ATOM 2004 CA ARG 4 32.662 -25.111 7.172 132 ARG * ATOM 2005 CA GLY 5 29.121 -25.194 8.602 133 ARG * - * Column 1 -30: Atom & Residue records of query sequence. + * Column 1 -30: Atom and Residue records of query sequence. * Column 31-54: Coordinates of atoms in query copied from corresponding atoms in template. * Column 55-59: Corresponding residue number in template based on alignment * Column 60-64: Corresponding residue name in template diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/ReferenceSuperimposer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/ReferenceSuperimposer.java index 0285f8a90d..24fe3abe9c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/ReferenceSuperimposer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/ReferenceSuperimposer.java @@ -125,8 +125,8 @@ public void superimpose(MultipleAlignment alignment) Atom[] ref = atomArrays.get(reference); Atom[] curr = atomArrays.get(i); - List atomSet1 = new ArrayList(); - List atomSet2 = new ArrayList(); + List atomSet1 = new ArrayList<>(); + List atomSet2 = new ArrayList<>(); for( Block blk : bs.getBlocks() ) { if( blk.size() != atomArrays.size()) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java index 2af3894f5e..731ed2cfe4 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java @@ -677,11 +677,11 @@ private void getPdbRegions(Atom[] ca1, Atom[] ca2){ String pdb2 = p2.getResidueNumber().toString(); - if ( ! cid1.equals(" ")) + if ( ! " ".equals(cid1)) pdb1 += ":" + cid1; - if ( ! cid2.equals(" ")) + if ( ! " ".equals(cid2)) pdb2 += ":" + cid2; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java index ac8fdaa563..87f51844ec 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java @@ -118,7 +118,7 @@ public JointFragments[] approach_ap3(Atom[] ca1, Atom[] ca2, FragmentPair[] frag StrucAligParameters params) throws StructureException { //the final list of joined fragments stores as apairs - List fll = new ArrayList(); + List fll = new ArrayList<>(); FragmentPair[] tmpfidx = new FragmentPair[fraglst.length]; for ( int i=0 ; i < fraglst.length; i++){ @@ -203,7 +203,7 @@ public JointFragments[] approach_ap3(Atom[] ca1, Atom[] ca2, FragmentPair[] frag Collections.sort(fll,comp); Collections.reverse(fll); int m = Math.min(params.getMaxrefine(),fll.size()); - List retlst = new ArrayList(); + List retlst = new ArrayList<>(); for ( int i = 0 ; i < m ; i++){ JointFragments jf = fll.get(i); retlst.add(jf); @@ -372,13 +372,13 @@ public JointFragments[] frag_pairwise_compat(FragmentPair[] fraglst, int angleDi int[] used = new int[n]; //the final list of joined fragments stores as apairs - List fll = new ArrayList(); + List fll = new ArrayList<>(); double adiff = angleDiff * Math.PI / 180d; - logger.debug("addiff" + adiff); + logger.debug("addiff{}", adiff); //distance between two unit vectors with angle adiff double ddiff = Math.sqrt(2.0-2.0*Math.cos(adiff)); - logger.debug("ddiff" + ddiff); + logger.debug("ddiff{}", ddiff); // the fpairs in the flist have to be sorted with respect to their positions @@ -443,7 +443,7 @@ public JointFragments[] frag_pairwise_compat(FragmentPair[] fraglst, int angleDi Collections.sort(fll,comp); Collections.reverse(fll); int m = Math.min(maxRefine,fll.size()); - List retlst = new ArrayList(); + List retlst = new ArrayList<>(); for ( int i = 0 ; i < m ; i++){ JointFragments jf = fll.get(i); retlst.add(jf); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/Gotoh.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/Gotoh.java index d0b9752519..83ed3ffaae 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/Gotoh.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/Gotoh.java @@ -209,7 +209,7 @@ private void setPath(){ int n; IndexPair[] backId = new IndexPair[a.getRows()+1+a.getCols()+1]; - List path = new ArrayList(); + List path = new ArrayList<>(); backId[0] = new IndexPair((short)(a.getRows()),(short)(a.getCols())); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlign.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlign.java index d7dcade047..2b92f3330d 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlign.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlign.java @@ -94,7 +94,7 @@ public static QsAlignResult align(List s1, List s2, List c2 = SubunitClusterer.cluster(s2, cParams).getClusters(); // STEP 2: match each subunit cluster between groups O(N^2*L^2) - inter - Map clusterMap = new HashMap(); + Map clusterMap = new HashMap<>(); for (int i = 0; i < c1.size(); i++) { for (int j = 0; j < c2.size(); j++) { @@ -123,15 +123,15 @@ public static QsAlignResult align(List s1, List s2, // Take a cluster match as reference int index1 = 0; int index2 = clust1.size() - clust2.size(); - Map subunitMap = new HashMap(); + Map subunitMap = new HashMap<>(); subunitMap.put(index1, index2); // Map cluster id to their subunit matching - Map> clustSubunitMap = new HashMap>(); + Map> clustSubunitMap = new HashMap<>(); clustSubunitMap.put(globalKey, subunitMap); // Change order of key set so that globalKey is first - List keySet = new ArrayList(clusterMap.keySet()); + List keySet = new ArrayList<>(clusterMap.keySet()); keySet.remove((Integer) globalKey); keySet.add(0, globalKey); @@ -141,7 +141,7 @@ public static QsAlignResult align(List s1, List s2, if (key == globalKey) subunitMap = clustSubunitMap.get(key); else - subunitMap = new HashMap(); + subunitMap = new HashMap<>(); // Obtain the clusters of each subunit group clust1 = c1.get(key); @@ -224,11 +224,11 @@ public static QsAlignResult align(List s1, List s2, logger.info("Cluster Subunit Map: " + clustSubunitMap.toString()); // Unfold the nested map into subunit map and alignment - subunitMap = new HashMap(); - List alignRes1 = new ArrayList(); - List alignRes2 = new ArrayList(); - List atomArray1 = new ArrayList(); - List atomArray2 = new ArrayList(); + subunitMap = new HashMap<>(); + List alignRes1 = new ArrayList<>(); + List alignRes2 = new ArrayList<>(); + List atomArray1 = new ArrayList<>(); + List atomArray2 = new ArrayList<>(); for (int key : clustSubunitMap.keySet()) { @@ -274,7 +274,7 @@ public static QsAlignResult align(List s1, List s2, // Fill in the alignment information BlockSet bs = new BlockSetImpl(msa); Block b = new BlockImpl(bs); - List> alignRes = new ArrayList>(2); + List> alignRes = new ArrayList<>(2); alignRes.add(alignRes1); alignRes.add(alignRes2); b.setAlignRes(alignRes); 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/seq/SmithWaterman3DParameters.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/seq/SmithWaterman3DParameters.java index 986bf3a8d3..74b8b891d5 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/seq/SmithWaterman3DParameters.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/seq/SmithWaterman3DParameters.java @@ -42,7 +42,7 @@ public SmithWaterman3DParameters() { @Override public List getUserConfigHelp() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("The Gap open penalty"); params.add("The Gap extension penalty"); params.add("The maximum RMSD of superposition allowed"); @@ -54,7 +54,7 @@ public List getUserConfigHelp() { @Override public List getUserConfigParameterNames() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("Gap Open"); params.add("Gap Extension"); params.add("Maximum RMSD"); @@ -65,7 +65,7 @@ public List getUserConfigParameterNames() { @Override public List getUserConfigParameters() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add("GapOpen"); params.add("GapExtend"); params.add("MaxRmsd"); @@ -77,7 +77,7 @@ public List getUserConfigParameters() { @Override @SuppressWarnings("rawtypes") public List getUserConfigTypes() { - List params = new ArrayList(); + List params = new ArrayList<>(); params.add(Short.class); params.add(Short.class); params.add(Double.class); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/seq/SmithWaterman3Daligner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/seq/SmithWaterman3Daligner.java index 1a0597fd07..a9d9569cc1 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/seq/SmithWaterman3Daligner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/seq/SmithWaterman3Daligner.java @@ -140,7 +140,7 @@ public AFPChain align(Atom[] ca1, Atom[] ca2, Object parameters) throw new StructureException("Empty alignment for sequences "+s1+" and "+s2); } - logger.debug("Smith-Waterman alignment is: "+pair.toString(100)); + logger.debug("Smith-Waterman alignment is: {}", pair.toString(100)); // convert to a 3D alignment... afpChain = convert(ca1,ca2,pair, smithWaterman); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AFPAlignmentDisplay.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AFPAlignmentDisplay.java index cdde7480a3..8d053a2520 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AFPAlignmentDisplay.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AFPAlignmentDisplay.java @@ -90,7 +90,7 @@ public static Atom getTranslation(AFPChain afpChain,Atom[] ca1,Atom[] ca2) throw } public static Atom[] getAlignedAtoms1(AFPChain afpChain,Atom[] ca1){ - List atoms = new ArrayList(); + List atoms = new ArrayList<>(); int blockNum = afpChain.getBlockNum(); @@ -111,7 +111,7 @@ public static Atom[] getAlignedAtoms1(AFPChain afpChain,Atom[] ca1){ } public static Atom[] getAlignedAtoms2(AFPChain afpChain,Atom[] ca2){ - List atoms = new ArrayList(); + List atoms = new ArrayList<>(); int blockNum = afpChain.getBlockNum(); @@ -168,8 +168,9 @@ public static void getAlign(AFPChain afpChain,Atom[] ca1,Atom[] ca2) { *

      *
    • {@link AFPChain#getOptAln()} and lengths *
    - * - *
    Known Bugs
    + *

    + * Known Bugs: + *

    * Expects the alignment to have linear topology. May give odd results * for circular permutations and other complicated topologies. * @@ -329,7 +330,7 @@ public static Map calcIdSimilarity(char[] seq1, char[] seq2, int if ( seq1 == null || seq2 == null){ logger.warn("Can't calc %ID for an empty alignment! "); - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("similarity", similarity); m.put("identity", identity); return m; @@ -369,7 +370,7 @@ public static Map calcIdSimilarity(char[] seq1, char[] seq2, int similarity = (similarity) / eqr; identity = identity/eqr; } - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("similarity", similarity); m.put("identity", identity); @@ -400,7 +401,7 @@ public static Structure createArtificalStructure(AFPChain afpChain, Atom[] ca1, Group[] twistedGroups = AlignmentTools.prepareGroupsForDisplay(afpChain,ca1, ca2); - List twistedAs = new ArrayList(); + List twistedAs = new ArrayList<>(); for ( Group g: twistedGroups){ if ( g == null ) @@ -412,8 +413,8 @@ public static Structure createArtificalStructure(AFPChain afpChain, Atom[] ca1, } Atom[] twistedAtoms = twistedAs.toArray(new Atom[twistedAs.size()]); - List hetatms = new ArrayList(); - List nucs1 = new ArrayList(); + List hetatms = new ArrayList<>(); + List nucs1 = new ArrayList<>(); Group g1 = ca1[0].getGroup(); Chain c1 = null; if ( g1 != null) { @@ -423,8 +424,8 @@ public static Structure createArtificalStructure(AFPChain afpChain, Atom[] ca1, nucs1 = c1.getAtomGroups(GroupType.NUCLEOTIDE); } } - List hetatms2 = new ArrayList(); - List nucs2 = new ArrayList(); + List hetatms2 = new ArrayList<>(); + List nucs2 = new ArrayList<>(); Group g2 = ca2[0].getGroup(); Chain c2 = null; if ( g2 != null){ diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java index f7660e2097..c6791f4ed2 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java @@ -72,7 +72,7 @@ public class AlignmentTools { * Since algorithms which create non-sequential alignments split the * alignment into multiple blocks, some computational time can be saved * by only checking block boundaries for sequentiality. Setting - * checkWithinBlocks to true makes this function slower, + * checkWithinBlocks to true makes this function slower, * but detects AFPChains with non-sequential blocks. * * Note that this method should give the same results as @@ -157,7 +157,7 @@ public static boolean isSequentialAlignment(AFPChain afpChain, boolean checkWith * @throws StructureException If afpChain is not one-to-one */ public static Map alignmentAsMap(AFPChain afpChain) throws StructureException { - Map map = new HashMap(); + Map map = new HashMap<>(); if( afpChain.getAlnLength() < 1 ) { return map; @@ -209,7 +209,7 @@ public static Map applyAlignment(Map alignmentMap, int k) { * @param * @param alignmentMap The input function, as a map (see {@link AlignmentTools#alignmentAsMap(AFPChain)}) * @param identity An identity-like function providing the isomorphism between - * the codomain of alignmentMap (of type ) and the domain (type ). + * the codomain of alignmentMap (of type T) and the domain (type S). * @param k The number of times to apply the alignment * @return A new alignment. If the input function is not automorphic * (one-to-one), then some inputs may map to null, indicating that the @@ -223,11 +223,11 @@ public static Map applyAlignment(Map alignmentMap, Map ide if(k<0) throw new IllegalArgumentException("k must be positive"); if(k==1) { - return new HashMap(alignmentMap); + return new HashMap<>(alignmentMap); } // Convert to lists to establish a fixed order - List preimage = new ArrayList(alignmentMap.keySet()); // currently unmodified - List image = new ArrayList(preimage); + List preimage = new ArrayList<>(alignmentMap.keySet()); // currently unmodified + List image = new ArrayList<>(preimage); for(int n=1;n Map applyAlignment(Map alignmentMap, Map ide } } - - - Map imageMap = new HashMap(alignmentMap.size()); + Map imageMap = new HashMap<>(alignmentMap.size()); //TODO handle nulls consistently. // assure that all the residues in the domain are valid keys @@ -282,7 +280,7 @@ public static Map applyAlignment(Map alignmentMap, Map ide */ public static int getSymmetryOrder(Map alignment, final int maxSymmetry, final float minimumMetricChange) { - return getSymmetryOrder(alignment, new IdentityMap(), maxSymmetry, minimumMetricChange); + return getSymmetryOrder(alignment, new IdentityMap<>(), maxSymmetry, minimumMetricChange); } /** * Tries to detect symmetry in an alignment. @@ -303,7 +301,7 @@ public static int getSymmetryOrder(Map alignment, * identity. If n corresponds to the intrinsic order of the alignment, * this will be small. This algorithm tries increasing values of n * and looks for abrupt decreases in the root mean squared offset. - * If none are found at n<=maxSymmetry, the alignment is reported as + * If none are found at n<=maxSymmetry, the alignment is reported as * non-symmetric. * * @param alignment The alignment to test for symmetry @@ -314,15 +312,15 @@ public static int getSymmetryOrder(Map alignment, * the calculation time and can lead to overfitting. * @param minimumMetricChange Percent decrease in root mean squared offsets * in order to declare symmetry. 0.4f seems to work well for CeSymm. - * @return The order of symmetry of alignment, or 1 if no order <= + * @return The order of symmetry of alignment, or 1 if no order <= * maxSymmetry is found. * * @see IdentityMap For a simple identity function */ public static int getSymmetryOrder(Map alignment, Map identity, final int maxSymmetry, final float minimumMetricChange) { - List preimage = new ArrayList(alignment.keySet()); // currently unmodified - List image = new ArrayList(preimage); + List preimage = new ArrayList<>(alignment.keySet()); // currently unmodified + List image = new ArrayList<>(preimage); int bestSymmetry = 1; double bestMetric = Double.POSITIVE_INFINITY; //lower is better @@ -443,10 +441,10 @@ public static int getSymmetryOrder(AFPChain afpChain, int maxSymmetry, float min */ public static Map guessSequentialAlignment( Map alignment, boolean inverseAlignment) { - Map identity = new HashMap(); + Map identity = new HashMap<>(); - SortedSet aligned1 = new TreeSet(); - SortedSet aligned2 = new TreeSet(); + SortedSet aligned1 = new TreeSet<>(); + SortedSet aligned2 = new TreeSet<>(); for(Entry pair : alignment.entrySet()) { aligned1.add(pair.getKey()); @@ -470,9 +468,10 @@ public static Map guessSequentialAlignment( * Retrieves the optimum alignment from an AFPChain and returns it as a * java collection. The result is indexed in the same way as * {@link AFPChain#getOptAln()}, but has the correct size(). - *

    +	 * 
    {@code
     	 * List>> aln = getOptAlnAsList(AFPChain afpChain);
    -	 * aln.get(blockNum).get(structureNum={0,1}).get(pos)
    + * aln.get(blockNum).get(structureNum={0,1}).get(pos) + * }
    * * @param afpChain * @return @@ -480,18 +479,18 @@ public static Map guessSequentialAlignment( public static List>> getOptAlnAsList(AFPChain afpChain) { int[][][] optAln = afpChain.getOptAln(); int[] optLen = afpChain.getOptLen(); - List>> blocks = new ArrayList>>(afpChain.getBlockNum()); + List>> blocks = new ArrayList<>(afpChain.getBlockNum()); for(int blockNum=0;blockNum align1 = new ArrayList(optLen[blockNum]); - List align2 = new ArrayList(optLen[blockNum]); + List align1 = new ArrayList<>(optLen[blockNum]); + List align2 = new ArrayList<>(optLen[blockNum]); for(int pos=0;pos> block = new ArrayList>(2); + List> block = new ArrayList<>(2); block.add(align1); block.add(align2); blocks.add(block); @@ -503,7 +502,7 @@ public static List>> getOptAlnAsList(AFPChain afpChain) { /** - * A Map can be viewed as a function from K to V. This class represents + * A {@code Map} can be viewed as a function from K to V. This class represents * the identity function. Getting a value results in the value itself. * *

    The class is a bit inconsistent when representing its contents. On @@ -627,7 +626,7 @@ public static AFPChain splitBlocksByTopology(AFPChain a, Atom[] ca1, Atom[] ca2) // Determine block lengths // Split blocks if residue indices don't increase monotonically - List newBlkLen = new ArrayList(); + List newBlkLen = new ArrayList<>(); boolean blockChanged = false; for(int blk=0;blk blocks = new ArrayList( newBlkLen.size() ); + List blocks = new ArrayList<>( newBlkLen.size() ); int oldBlk = 0; int pos = 0; @@ -758,7 +757,7 @@ public static AFPChain replaceOptAln(AFPChain afpChain, Atom[] ca1, Atom[] ca2, // increasing monotonically. Integer[] res1 = alignment.keySet().toArray(new Integer[0]); Arrays.sort(res1); - List blockLens = new ArrayList(2); + List blockLens = new ArrayList<>(2); int optLength = 0; Integer lastRes = alignment.get(res1[0]); int blkLen = lastRes==null?0:1; @@ -850,7 +849,7 @@ public static AFPChain replaceOptAln(AFPChain afpChain, Atom[] ca1, Atom[] ca2, * @param ca1 * @param ca2 Second set of ca atoms. Will be modified based on the superposition * @throws StructureException - * @see {@link CECalculator#calc_rmsd(Atom[], Atom[], int, boolean)} + * @see CECalculator#calc_rmsd(Atom[], Atom[], int, boolean) * contains much of the same code, but stores results in a CECalculator * instance rather than an AFPChain */ @@ -979,27 +978,28 @@ public static Object resizeArray (Object oldArray, int newSize) { *

    Note that more concise representations may be possible.

    * * Examples: + *
      *
    • 1>2>3>1
    • *
    • 1>2>3>2 4>3
    • - * + *
    * @param alignment The input function, as a map (see {@link AlignmentTools#alignmentAsMap(AFPChain)}) * @param identity An identity-like function providing the isomorphism between - * the codomain of alignment (of type ) and the domain (type ). + * the codomain of alignment (of type T) and the domain (type S). * @return */ public static String toConciseAlignmentString(Map alignment, Map identity) { // Clone input to prevent changes - Map alig = new HashMap(alignment); + Map alig = new HashMap<>(alignment); // Generate inverse alignment - Map> inverse = new HashMap>(); + Map> inverse = new HashMap<>(); for(Entry e: alig.entrySet()) { S val = identity.get(e.getValue()); if( inverse.containsKey(val) ) { List l = inverse.get(val); l.add(e.getKey()); } else { - List l = new ArrayList(); + List l = new ArrayList<>(); l.add(e.getKey()); inverse.put(val,l); } @@ -1058,7 +1058,7 @@ public static String toConciseAlignmentString(Map alignment) { * @see #toConciseAlignmentString(Map, Map) */ public static Map fromConciseAlignmentString(String string) { - Map map = new HashMap(); + Map map = new HashMap<>(); boolean matches = true; while (matches) { Pattern pattern = Pattern.compile("(\\d+)>(\\d+)"); @@ -1076,9 +1076,9 @@ public static Map fromConciseAlignmentString(String string) { /** * Method that calculates the number of gaps in each subunit block of an optimal AFP alignment. - * - * INPUT: an optimal alignment in the format int[][][]. - * OUTPUT: an int[] array of length containing the gaps in each block as int[block]. + * @param optAln + * an optimal alignment in the format int[][][] + * @return an int[] array of order length containing the gaps in each block as int[block] */ public static int[] calculateBlockGap(int[][][] optAln){ @@ -1197,11 +1197,10 @@ public static void alignmentToSIF(Writer out,AFPChain afpChain, * Does NOT rotate anything. * @param ca * @return a list of Chains that is built up from the Atoms in the ca array - * @throws StructureException */ public static final List getAlignedModel(Atom[] ca){ - List model = new ArrayList(); + List model = new ArrayList<>(); for ( Atom a: ca){ Group g = a.getGroup(); 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 258fdbf7f3..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 @@ -38,7 +38,6 @@ import org.biojava.nbio.structure.io.FileParsingParameters; import org.biojava.nbio.structure.io.LocalPDBDirectory.FetchBehavior; import org.biojava.nbio.structure.io.LocalPDBDirectory.ObsoleteBehavior; -import org.biojava.nbio.structure.io.MMTFFileReader; import org.biojava.nbio.structure.io.PDBFileReader; import org.biojava.nbio.core.util.FileDownloadUtils; import org.biojava.nbio.structure.io.StructureFiletype; @@ -163,7 +162,6 @@ public AtomCache(UserConfiguration config) { * @return an array of Atoms. * @throws IOException * @throws StructureException - * @see */ public Atom[] getAtoms(String name) throws IOException, StructureException { return getAtoms(new StructureName(name)); @@ -190,7 +188,6 @@ public Atom[] getAtoms(StructureIdentifier name) throws IOException, StructureEx * @return an array of Atoms. * @throws IOException * @throws StructureException - * @see */ public Atom[] getRepresentativeAtoms(String name) throws IOException, StructureException { return getRepresentativeAtoms(new StructureName(name)); @@ -224,14 +221,14 @@ public Atom[] getRepresentativeAtoms(StructureIdentifier name) throws IOExceptio * if false the outputStructure will be as the original with added chains with renamed asymIds (in the form originalAsymId_transformId and originalAuthId_transformId). * @return a structure object * @throws IOException - * @throws StructureException if biassemblyId < 0 or other problems while loading structure + * @throws StructureException if biassemblyId < 0 or other problems while loading structure * @since 3.2 */ public Structure getBiologicalAssembly(String pdbId, int bioAssemblyId, boolean multiModel) 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()} @@ -248,7 +245,7 @@ public Structure getBiologicalAssembly(String pdbId, int bioAssemblyId, boolean * if false the outputStructure will be as the original with added chains with renamed asymIds (in the form originalAsymId_transformId and originalAuthId_transformId). * @return a structure object * @throws IOException - * @throws StructureException if biassemblyId < 0 or other problems while loading structure + * @throws StructureException if biassemblyId < 0 or other problems while loading structure * @since 6.0.0 */ public Structure getBiologicalAssembly(PdbId pdbId, int bioAssemblyId, boolean multiModel) @@ -287,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); } @@ -306,7 +303,7 @@ public Structure getBiologicalAssembly(PdbId pdbId, int bioAssemblyId, boolean m * the asymmetric unit will be returned, e.g. for NMR structures. * *

    Biological assemblies can also be accessed using - * getStructure("BIO:[pdbId]") + * getStructure("BIO:[pdbId]") * @param pdbId the PDB id * @param multiModel if true the output Structure will be a multi-model one with one transformId per model, * if false the outputStructure will be as the original with added chains with renamed asymIds (in the form originalAsymId_transformId and originalAuthId_transformId). @@ -342,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); } @@ -388,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; @@ -467,8 +464,7 @@ public String getPath() { *

  • If only a PDB code is provided, the whole structure will be return including ligands, but the first model * only (for NMR). *
  • Chain IDs are case sensitive, PDB ids are not. To specify a particular chain write as: 4hhb.A or 4HHB.A
  • - *
  • To specify a SCOP domain write a scopId e.g. d2bq6a1. Some flexibility can be allowed in SCOP domain names, - * see {@link #setStrictSCOP(boolean)}
  • + *
  • To specify a SCOP domain write a scopId e.g. d2bq6a1.
  • *
  • URLs are accepted as well
  • * * @@ -671,14 +667,14 @@ public void setFileParsingParams(FileParsingParameters params) { * Load the requested ID from the PDB's obsolete repository *
  • {@link ObsoleteBehavior#FETCH_CURRENT FETCH_CURRENT} * Load the most recent version of the requested structure + * * *

    This setting may be silently ignored by implementations which do not have * access to the server to determine whether an entry is obsolete, such as - * if {@link #isAutoFetch()} is false. Note that an obsolete entry may still be + * certain {@link FetchBehavior}s. Note that an obsolete entry may still be * returned even this is FETCH_CURRENT if the entry is found locally. * - * @param fetchFileEvenIfObsolete Whether to fetch obsolete records - * @see #setFetchCurrent(boolean) + * @param behavior Whether to fetch obsolete records * @since 4.0.0 */ public void setObsoleteBehavior(ObsoleteBehavior behavior) { @@ -688,7 +684,7 @@ public void setObsoleteBehavior(ObsoleteBehavior behavior) { /** * Returns how this instance deals with obsolete entries. Note that this * setting may be ignored by some implementations or in some situations, - * such as when {@link #isAutoFetch()} is false. + * such as certain {@link FetchBehavior}s. * *

    For most implementations, the default value is * {@link ObsoleteBehavior#THROW_EXCEPTION THROW_EXCEPTION}. @@ -792,7 +788,7 @@ protected void flagLoadingFinished(PdbId pdbId) { /** * Loads a structure directly by PDB ID - * @param pdbId + * @param id * @return * @throws IOException * @throws StructureException @@ -807,12 +803,11 @@ public Structure getStructureForPdbId(String id) throws IOException, StructureEx * @param pdbId * @return * @throws IOException - * @throws StructureException */ public Structure getStructureForPdbId(PdbId pdbId) throws IOException { if (pdbId == null) return null; - + while (checkLoading(pdbId)) { // waiting for loading to be finished... try { @@ -829,38 +824,16 @@ public Structure getStructureForPdbId(PdbId pdbId) throws IOException { case BCIF: logger.debug("loading from bcif"); return loadStructureFromBcifByPdbId(pdbId); - case MMTF: - logger.debug("loading from mmtf"); - return loadStructureFromMmtfByPdbId(pdbId); case PDB: default: logger.debug("loading from pdb"); return loadStructureFromPdbByPdbId(pdbId); } } - - protected Structure loadStructureFromMmtfByPdbId(String pdbId) throws IOException { - return loadStructureFromMmtfByPdbId(new PdbId(pdbId)); - } - - /** - * Load a {@link Structure} from MMTF either from the local file system. - * @param pdbId the input PDB id - * @return the {@link Structure} object of the parsed structure - * @throws IOException error reading from Web or file system - */ - protected Structure loadStructureFromMmtfByPdbId(PdbId pdbId) throws IOException { - logger.debug("Loading structure {} from mmtf file.", pdbId); - MMTFFileReader reader = new MMTFFileReader(); - reader.setFetchBehavior(fetchBehavior); - reader.setObsoleteBehavior(obsoleteBehavior); - return reader.getStructureById(pdbId); - } - 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/align/util/CliTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/CliTools.java index 97566c86b3..8b8af2539a 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/CliTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/CliTools.java @@ -100,14 +100,14 @@ public static String[] configureBean(Object bean, String[] args) throw new ConfigurationException("Couldn't get information for target bean " + ex.getMessage()); } - Map propertiesByName = new HashMap(); + Map propertiesByName = new HashMap<>(); for (PropertyDescriptor pd : bi.getPropertyDescriptors() ) { propertiesByName.put(pd.getName(), pd); } - List anonArgs = new ArrayList(); - Map> arrayProps = new HashMap>(); - Set usedProps = new HashSet(); + List anonArgs = new ArrayList<>(); + Map> arrayProps = new HashMap<>(); + Set usedProps = new HashSet<>(); boolean stdInUsed = false; boolean stdOutUsed = false; @@ -153,13 +153,13 @@ public static String[] configureBean(Object bean, String[] args) if (propType == Integer.TYPE) { try { - propVal = new Integer(args[++i]); + propVal = Integer.valueOf(args[++i]); } catch (Exception ex) { throw new ConfigurationException("Option " + arg + " requires an integer parameter"); } } else if (propType == Double.TYPE || propType == Double.class ) { try { - propVal = new Double(args[++i]); + propVal = Double.valueOf(args[++i]); } catch (Exception ex) { throw new ConfigurationException("Option " + arg + " requires a numerical parameter"); } @@ -171,9 +171,9 @@ public static String[] configureBean(Object bean, String[] args) if ( val == null ) propVal = Boolean.TRUE; else { - if ( val.equalsIgnoreCase("true") || val.equalsIgnoreCase("t")) + if ( "true".equalsIgnoreCase(val) || "t".equalsIgnoreCase(val)) propVal = Boolean.TRUE; - else if( val.equalsIgnoreCase("false") || val.equalsIgnoreCase("f")) + else if( "false".equalsIgnoreCase(val) || "f".equalsIgnoreCase(val)) propVal = Boolean.FALSE; else throw new ConfigurationException("Option "+arg+" requires a boolean parameter"); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java index 6e00e1d434..859f944645 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java @@ -374,8 +374,7 @@ private void calculateTranslationalAxis(Matrix rotation, Atom translation) { * @param atoms Some atoms from the protein, used for determining the bounds * of the axis. * - * @return The Jmol script, suitable for calls to - * {@link org.biojava.nbio.structure.align.gui.jmol.StructureAlignmentJmol#evalString() jmol.evalString()} + * @return The Jmol script */ public String getJmolScript(Atom[] atoms){ return getJmolScript(atoms, 0); @@ -442,8 +441,7 @@ public Pair getAxisEnds(Atom[] atoms) { * @param axisID in case of representing more than one axis in the same jmol * panel, indicate the ID number. * - * @return The Jmol script, suitable for calls to - * {@link org.biojava.nbio.structure.align.gui.jmol.StructureAlignmentJmol#evalString() jmol.evalString()} + * @return The Jmol script */ public String getJmolScript(Atom[] atoms, int axisID){ final double width=.5;// width of JMol object diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/SynchronizedOutFile.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/SynchronizedOutFile.java index 9d05773c25..2442807d11 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/SynchronizedOutFile.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/SynchronizedOutFile.java @@ -43,7 +43,7 @@ public class SynchronizedOutFile { * @throws FileNotFoundException * @throws IOException */ - public SynchronizedOutFile(File f, boolean gzipCompress) throws FileNotFoundException, IOException{ + public SynchronizedOutFile(File f, boolean gzipCompress) throws IOException{ if ( f.isDirectory()) throw new FileNotFoundException("please provide a file and not a directory"); @@ -62,7 +62,7 @@ public SynchronizedOutFile(File f, boolean gzipCompress) throws FileNotFoundExce * * @param f */ - public SynchronizedOutFile(File f) throws FileNotFoundException, IOException{ + public SynchronizedOutFile(File f) throws IOException{ this(f,false); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/UserConfiguration.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/UserConfiguration.java index 70e85acec3..67eba4c966 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/UserConfiguration.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/UserConfiguration.java @@ -306,7 +306,6 @@ public XMLWriter toXML(PrintWriter pw) * @param xw the XML writer to use * @return the writer again * @throws IOException - * @see org.biojava.nbio.structure.align.webstart.ConfigXMLHandler */ public XMLWriter toXML(XMLWriter xw) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java index 0827134bbe..282e971c84 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java @@ -223,7 +223,7 @@ public static void rebuildAFPChain(AFPChain afpChain, Atom[] ca1, Atom[] ca2){ } public static AFPChain[] parseMultiXML(String xml) throws IOException { - List afpChains = new ArrayList(); + List afpChains = new ArrayList<>(); try { @@ -316,7 +316,7 @@ public static AFPChain[] parseMultiXML(String xml) throws IOException { a.setBlockShiftVector(blockShiftVector); int afpNum = Integer.parseInt(getAttribute(rootElement,"afpNum")); - List afpSet = new ArrayList(); + List afpSet = new ArrayList<>(); for (int afp=0;afp parseXMLfile(String xml) throws ParserConfigurationException, SAXException, IOException { List ensembles = - new ArrayList(); + new ArrayList<>(); //Convert string to XML document DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); @@ -113,13 +113,13 @@ private static MultipleAlignmentEnsemble parseEnsemble(Node root){ for (int i=0; i> alignRes = new ArrayList>(); + List> alignRes = new ArrayList<>(); b.setAlignRes(alignRes); NodeList children = root.getChildNodes(); @@ -199,17 +199,17 @@ private static Block parseBlock(Node root, BlockSet blockSet) { } String residue = node.getTextContent(); - if (residue.equals("null")){ + if ("null".equals(residue)){ alignRes.get(str-1).add(null); } else { - alignRes.get(str-1).add(new Integer(residue)); + alignRes.get(str-1).add(Integer.valueOf(residue)); } str++; node = atts.getNamedItem("str"+str); } } - else if (child.getNodeName().equals("ScoresCache")){ + else if ("ScoresCache".equals(child.getNodeName())){ parseScoresCache(child, b); } } @@ -225,7 +225,7 @@ private static Matrix4d parseMatrix4d(Node node) { for (int y=0; y<4; y++){ String key = "mat"+(x+1)+(y+1); String value = atts.getNamedItem(key).getTextContent(); - m.setElement(x, y, new Double(value)); + m.setElement(x, y, Double.valueOf(value)); } } return m; @@ -241,7 +241,7 @@ private static void parseScoresCache(Node root, ScoresCache cache) { NamedNodeMap atts = child.getAttributes(); if (atts != null) { Node score = atts.getNamedItem("value"); - Double value = new Double(score.getTextContent()); + Double value = Double.valueOf(score.getTextContent()); cache.putScore(child.getNodeName(), value); } } @@ -253,30 +253,30 @@ private static void parseHeader(Node node, NamedNodeMap atts = node.getAttributes(); String algo = atts.getNamedItem("Algorithm").getTextContent(); - if (!algo.equals("null")){ + if (!"null".equals(algo)){ ensemble.setAlgorithmName(algo); } String version = atts.getNamedItem("Version").getTextContent(); - if (!version.equals("null")){ + if (!"null".equals(version)){ ensemble.setVersion(version); } String ioTime = atts.getNamedItem("IOTime").getTextContent(); - if (!ioTime.equals("null")){ - ensemble.setIoTime(new Long(ioTime)); + if (!"null".equals(ioTime)){ + ensemble.setIoTime(Long.valueOf(ioTime)); } String time = atts.getNamedItem("CalculationTime").getTextContent(); - if (!time.equals("null")){ - ensemble.setCalculationTime(new Long(time)); + if (!"null".equals(time)){ + ensemble.setCalculationTime(Long.valueOf(time)); } } private static void parseStructures(Node root, MultipleAlignmentEnsemble ensemble) { - List names = new ArrayList(); + List names = new ArrayList<>(); ensemble.setStructureIdentifiers(names); NamedNodeMap atts = root.getAttributes(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/PdbPairXMLConverter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/PdbPairXMLConverter.java index 433e053a3c..afcc4f95ac 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/PdbPairXMLConverter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/PdbPairXMLConverter.java @@ -44,7 +44,7 @@ public class PdbPairXMLConverter { public static final String DEFAULT_METHOD_NAME = FatCatRigid.algorithmName; public static PdbPairsMessage convertXMLtoPairs(String xml) { - SortedSet pairs = new TreeSet(); + SortedSet pairs = new TreeSet<>(); PdbPairsMessage message = new PdbPairsMessage(); try { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/PdbPairsMessage.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/PdbPairsMessage.java index 170ee5ff47..6aa415a8d9 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/PdbPairsMessage.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/PdbPairsMessage.java @@ -40,7 +40,7 @@ public PdbPairsMessage(){ method = PdbPairXMLConverter.DEFAULT_METHOD_NAME; - pairs = new TreeSet(); + pairs = new TreeSet<>(); } 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 144bcd1209..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 @@ -126,16 +126,17 @@ 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) { - this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms); + 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; @@ -151,6 +152,22 @@ public AsaCalculator(Structure structure, double probe, int nSpherePoints, int n initSpherePoints(nSpherePoints); } + /** + * 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 of model 1 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 + * NACCESS' -h option + */ + public AsaCalculator(Structure structure, double probe, int nSpherePoints, int nThreads, boolean hetAtoms) { + this(structure, probe, nSpherePoints, nThreads, hetAtoms, 0); + } + /** * Constructs a new AsaCalculator. Subsequently call {@link #calculateAsas()} * or {@link #getGroupAsas()} to calculate the ASAs. @@ -531,19 +548,19 @@ else if (atom.getElement()==Element.S) { return SULFUR_VDW; } else if (atom.getElement()==Element.N) { - if (atomCode.equals("NZ")) return TETRAHEDRAL_NITROGEN_VDW; // tetrahedral Nitrogen + if ("NZ".equals(atomCode)) return TETRAHEDRAL_NITROGEN_VDW; // tetrahedral Nitrogen return TRIGONAL_NITROGEN_VDW; // trigonal Nitrogen } else if (atom.getElement()==Element.C) { // it must be a carbon - if (atomCode.equals("C") || - atomCode.equals("CE1") || atomCode.equals("CE2") || atomCode.equals("CE3") || - atomCode.equals("CH2") || - atomCode.equals("CZ") || atomCode.equals("CZ2") || atomCode.equals("CZ3")) { + if ("C".equals(atomCode) || + "CE1".equals(atomCode) || "CE2".equals(atomCode) || "CE3".equals(atomCode) || + "CH2".equals(atomCode) || + "CZ".equals(atomCode) || "CZ2".equals(atomCode) || "CZ3".equals(atomCode)) { return TRIGONAL_CARBON_VDW; // trigonal Carbon } - else if (atomCode.equals("CA") || atomCode.equals("CB") || - atomCode.equals("CE") || - atomCode.equals("CG1") || atomCode.equals("CG2")) { + else if ("CA".equals(atomCode) || "CB".equals(atomCode) || + "CE".equals(atomCode) || + "CG1".equals(atomCode) || "CG2".equals(atomCode)) { return TETRAHEDRAL_CARBON_VDW; // tetrahedral Carbon } // the rest of the cases (CD, CD1, CD2, CG) depend on amino acid @@ -567,8 +584,8 @@ else if (atomCode.equals("CA") || atomCode.equals("CB") || case 'Q': case 'E': - if (atomCode.equals("CD")) return TRIGONAL_CARBON_VDW; - else if (atomCode.equals("CG")) return TETRAHEDRAL_CARBON_VDW; + if ("CD".equals(atomCode)) return TRIGONAL_CARBON_VDW; + else if ("CG".equals(atomCode)) return TETRAHEDRAL_CARBON_VDW; default: logger.info("Unexpected carbon atom {} for aminoacid {}, assigning its standard vdw radius", atomCode, aa); @@ -618,7 +635,7 @@ private static double getRadiusForNucl(NucleotideImpl nuc, Atom atom) { * * If atom is neither part of a nucleotide nor of a standard aminoacid, * the default vdw radius for the element is returned. If atom is of - * unknown type (element) the vdw radius of {@link Element().N} is returned + * unknown type (element) the vdw radius of {@link Element#N} is returned * * @param atom * @return diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/GroupAsa.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/GroupAsa.java index 05d34b8d21..6c8be18ed9 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/GroupAsa.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/asa/GroupAsa.java @@ -44,7 +44,7 @@ public class GroupAsa implements Serializable { private static HashMap initTriPeptAsas() { // ASA in extended tripeptide conformation (GLY-X-GLY) from Miller et al JMB 1987 (for calculation of relative ASAs) - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); map.put('A', 113.0); map.put('R', 241.0); map.put('N', 158.0); @@ -223,8 +223,8 @@ public Object clone() { GroupAsa n = new GroupAsa(this.g); n.setAsaC(this.getAsaC()); n.setAsaU(this.getAsaU()); - n.atomAsaUs = new ArrayList(this.atomAsaUs.size()); - n.atomAsaCs = new ArrayList(this.atomAsaCs.size()); + n.atomAsaUs = new ArrayList<>(this.atomAsaUs.size()); + n.atomAsaCs = new ArrayList<>(this.atomAsaCs.size()); for (int i=0;i getChains() throws StructureException { - Set chains = new HashSet(); + Set chains = new HashSet<>(); List rrs = toCanonical().getResidueRanges(); for (ResidueRange rr : rrs) chains.add(rr.getChainName()); return chains; @@ -436,7 +436,7 @@ public String getIdentifier() { @Override public SubstructureIdentifier toCanonical() throws StructureException{ - List ranges = new ArrayList(); + List ranges = new ArrayList<>(); String chain = String.valueOf(getDomainName().charAt(getDomainName().length() - 3)); for (CathSegment segment : this.getSegments()) { ranges.add(new ResidueRange(chain, segment.getStart(), segment.getStop())); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathFactory.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathFactory.java index 77fe36fd8e..4a7796e6af 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathFactory.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathFactory.java @@ -45,7 +45,7 @@ public class CathFactory { private static CathDatabase cath; - private static Map versions = new HashMap(); + private static Map versions = new HashMap<>(); /** * Sets the default (singleton) CathDatabase. diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathInstallation.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathInstallation.java index 3b7f94981a..3f0f44158b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathInstallation.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathInstallation.java @@ -32,6 +32,7 @@ import java.io.*; import java.net.URL; import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.ParseException; @@ -96,11 +97,11 @@ public CathInstallation(String cacheLocation, boolean usingCDDF, boolean parseCF cathVersion = DEFAULT_VERSION; cathDownloadUrl = CATH_DOWNLOAD_URL; - pdbMap = new HashMap>(); - domainMap = new HashMap(); - cathTree = new HashMap(); + pdbMap = new HashMap<>(); + domainMap = new HashMap< >(); + cathTree = new HashMap<>(); - if (parseCathFragments) fragmentMap = new HashMap>(); + if (parseCathFragments) fragmentMap = new HashMap<>(); } @@ -206,7 +207,7 @@ public List getByCategory(CathCategory category) { ensureDomallInstalled(); } ensureNodeListInstalled(); - List matches = new ArrayList(); + List matches = new ArrayList<>(); CathNode node; for ( String nodeId : cathTree.keySet() ) { if ( (node = cathTree.get(nodeId)).getCategory() == category ) { @@ -223,7 +224,7 @@ public List filterByCathCode(String query) { } else { ensureDomallInstalled(); } - List matches = new ArrayList(); + List matches = new ArrayList<>(); for ( String k : domainMap.keySet() ) { if ( domainMap.get(k).getCATH().startsWith(query) ) { matches.add( domainMap.get(k) ); @@ -235,7 +236,7 @@ public List filterByCathCode(String query) { @Override public List getTree(CathDomain domain) { CathNode node = getCathNode( domain.getCATH() ); - List tree = new ArrayList(); + List tree = new ArrayList<>(); while (node != null) { node = getCathNode( node.getParentId() ); if (node != null) tree.add(node); @@ -247,14 +248,14 @@ public List getTree(CathDomain domain) { @Override public List filterByNodeName(String query) { ensureNodeListInstalled(); - List matchingNodes = new ArrayList(); + List matchingNodes = new ArrayList<>(); CathNode node; for ( String nodeId : cathTree.keySet() ) { if ( (node = cathTree.get(nodeId) ).getDescription().startsWith(query) ) { matchingNodes.add(node); } } - List matches = new ArrayList(); + List matches = new ArrayList<>(); for (CathNode n : matchingNodes) { matches.addAll(getDomainsByNodeId(n.getNodeId())); } @@ -268,7 +269,7 @@ public List filterByDescription(String query) { } else { ensureDomallInstalled(); } - List matches = new ArrayList(); + List matches = new ArrayList<>(); for ( String k : domainMap.keySet() ) { if ( domainMap.get(k).getName().startsWith(query) ) { matches.add( domainMap.get(k) ); @@ -327,7 +328,7 @@ public List getDomainsByNodeId(String nodeId) { } else { ensureDomallInstalled(); } - List domains = new ArrayList(); + List domains = new ArrayList<>(); for (String domainName : domainMap.keySet()) { CathDomain description = domainMap.get(domainName); if ( description.getCATH().startsWith(nodeId) ) { @@ -365,7 +366,7 @@ private void parseCathDomainList(BufferedReader bufferedReader) throws IOExcepti if ( pdbMap.containsKey(pdbId)){ domainList = pdbMap.get(pdbId); } else { - domainList = new ArrayList(); + domainList = new ArrayList<>(); pdbMap.put(pdbId,domainList); } @@ -446,7 +447,7 @@ private void parseCathDomainDescriptionFile(BufferedReader bufferedReader) throw } else if ( line.startsWith("DSEQS") ) { seqs = seqs.append( line.substring(10) ); } else if ( line.startsWith("NSEGMENTS") ) { - segments = new ArrayList(); + segments = new ArrayList<>(); } else if ( line.startsWith("SEGMENT") ) { segment = new CathSegment(); sseqh = new StringBuilder(); @@ -483,7 +484,7 @@ private void parseCathDomainDescriptionFile(BufferedReader bufferedReader) throw if ( pdbMap.containsKey(pdbId)){ domainList = pdbMap.get(pdbId); } else { - domainList = new ArrayList(); + domainList = new ArrayList<>(); pdbMap.put(pdbId,domainList); } @@ -583,7 +584,7 @@ private void parseCathDomall(BufferedReader bufferedReader) throws IOException{ continue; } - List segments = new ArrayList(numberOfSegments); + List segments = new ArrayList<>(numberOfSegments); segIdx = 1; // Offset from domIdx. for (int j=1; j<=numberOfSegments; j++) { CathSegment segment = new CathSegment(); @@ -591,13 +592,13 @@ private void parseCathDomall(BufferedReader bufferedReader) throws IOException{ // String chainLetter = token[domIdx+segIdx]; // Redundant unless some domains cross chain boundaries. sstart = Integer.parseInt( token[domIdx + segIdx + 1] ); String sstartInsertion = token[domIdx + segIdx + 2]; - sstartInsertion = sstartInsertion.equals("-") ? "" : sstartInsertion; + sstartInsertion = "-".equals(sstartInsertion) ? "" : sstartInsertion; // String chainLetter = token[domIdx+segIdx+4]; // Redundant unless some segments cross chain boundaries. segment.setStart(sstart + sstartInsertion); sstop = Integer.parseInt( token[domIdx + segIdx + 4] ); String sstopInsertion = token[domIdx + segIdx + 5]; - sstopInsertion = sstopInsertion.equals("-") ? "" : sstopInsertion; + sstopInsertion = "-".equals(sstopInsertion) ? "" : sstopInsertion; segment.setStart(sstart + sstartInsertion); segment.setStop(sstop + sstopInsertion); @@ -610,19 +611,19 @@ private void parseCathDomall(BufferedReader bufferedReader) throws IOException{ domIdx += 6*numberOfSegments + 1; } if (parseCathFragments) { - List fragments = new ArrayList(numberOfFragments); + List fragments = new ArrayList<>(numberOfFragments); for (int i=1; i<=numberOfFragments; i++) { CathFragment fragment = new CathFragment(); fragment.setFragmentId(i); // String chainLetter = token[domIdx]; // Redundant unless some fragments cross chain boundaries. fstart = Integer.parseInt( token[domIdx+1] ); String fstartInsertion = token[domIdx + 2]; - fstartInsertion = fstartInsertion.equals("-") ? "" : fstartInsertion; + fstartInsertion = "-".equals(fstartInsertion) ? "" : fstartInsertion; fragment.setStart(fstart + fstartInsertion); // String chainLetter = token[domIdx+3]; // Redundant unless some fragments cross chain boundaries. fstop = Integer.parseInt( token[domIdx+4] ); String fstopInsertion = token[domIdx + 5]; - fstopInsertion = fstopInsertion.equals("-") ? "" : fstopInsertion; + fstopInsertion = "-".equals(fstopInsertion) ? "" : fstopInsertion; fragment.setStop(fstop + fstopInsertion); flength = Integer.parseInt( token[domIdx + 6].replaceAll("[^0-9]","") ); fragment.setLength(flength); @@ -653,7 +654,7 @@ protected void downloadFileFromRemote(URL remoteURL, File localFile) throws IOEx in.close(); out.close(); - FileDownloadUtils.copy(tempFile,localFile); + Files.copy(tempFile.toPath(), localFile.toPath(), StandardCopyOption.REPLACE_EXISTING); // delete the tmp file tempFile.delete(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemComp.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemComp.java index cb33e369b3..794fe2cb82 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemComp.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemComp.java @@ -73,7 +73,7 @@ public String toString(){ public boolean hasParent(){ String pid = monNstdParentCompId; - return (pid != null) && (!pid.equals("?")); + return (pid != null) && (!"?".equals(pid)); } public boolean isStandard(){ @@ -401,6 +401,6 @@ public static ChemComp getEmptyChemComp() { */ public boolean isEmpty() { // Is this the best flag for it being empty? - return id == null || getThreeLetterCode() == null || getThreeLetterCode().equals("???"); + return id == null || getThreeLetterCode() == null || "???".equals(getThreeLetterCode()); } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemCompGroupFactory.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemCompGroupFactory.java index a7aa84a138..d69247e8c7 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemCompGroupFactory.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemCompGroupFactory.java @@ -78,7 +78,7 @@ public static Group getGroupFromChemCompDictionary(String recordName) { AminoAcid aa = new AminoAcidImpl(); String one_letter = cc.getOneLetterCode(); - if (one_letter == null || one_letter.equals("X") || one_letter.equals("?") || one_letter.length() == 0) { + if (one_letter == null || "X".equals(one_letter) || "?".equals(one_letter) || one_letter.length() == 0) { String parent = cc.getMonNstdParentCompId(); if (parent != null && parent.length() == 3) { String parentid = cc.getMonNstdParentCompId(); @@ -87,7 +87,7 @@ public static Group getGroupFromChemCompDictionary(String recordName) { } } - if (one_letter == null || one_letter.length() == 0 || one_letter.equals("?")) { + if (one_letter == null || one_letter.length() == 0 || "?".equals(one_letter)) { // e.g. problem with PRR, which probably should have a parent of ALA, but as of 20110127 does not. logger.warn("Problem with chemical component: {} Did not find one letter code! Setting it to 'X'", recordName); @@ -109,7 +109,7 @@ public static Group getGroupFromChemCompDictionary(String recordName) { public static String getOneLetterCode(ChemComp cc) { String oneLetter = cc.getOneLetterCode(); - if (oneLetter == null || oneLetter.equals("X") || oneLetter.equals("?")) { + if (oneLetter == null || "X".equals(oneLetter) || "?".equals(oneLetter)) { String parentId = cc.getMonNstdParentCompId(); if (parentId == null) { return oneLetter; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemCompTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemCompTools.java index 929223040a..f34da29373 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemCompTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemCompTools.java @@ -127,9 +127,9 @@ public static boolean isStandardChemComp(ChemComp cc) { PolymerType polymerType = getPolymerType(residueType); // standard residues have no parent - if (pid == null || pid.equals("?")) { + if (pid == null || "?".equals(pid)) { // and they have a one letter code - if (one != null && !one.equals("?")) { + if (one != null && !"?".equals(one)) { // peptides and dpeptides must not have X if (polymerType == PolymerType.peptide || polymerType == PolymerType.dpeptide) { return performPeptideCheck(cc, one); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemicalComponentDictionary.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemicalComponentDictionary.java index c191e67118..371e00669e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemicalComponentDictionary.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/ChemicalComponentDictionary.java @@ -88,12 +88,12 @@ public ChemComp getParent(ChemComp c) { public void addChemComp(ChemComp comp) { dictionary.put(comp.getId(),comp); String rep = comp.getPdbxReplaces(); - if (rep != null && !rep.equals("?")) { + if (rep != null && !"?".equals(rep)) { replaces.put(comp.getId(),rep); } String isrep = comp.getPdbxReplacedBy(); - if (isrep != null && !isrep.equals("?")) { + if (isrep != null && !"?".equals(isrep)) { isReplacedBy.put(comp.getId(), isrep); } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/DownloadChemCompProvider.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/DownloadChemCompProvider.java index f2180dba03..9eb9c7c6cf 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/DownloadChemCompProvider.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/DownloadChemCompProvider.java @@ -109,11 +109,13 @@ public static void setServerBaseUrl(String serverBaseUrl) { /** * Set the path to append to the serverBaseUrl (settable in {@link #setServerBaseUrl(String)}). * The string can contain placeholders that will be expanded at runtime: + *

      *
    • "{ccd_id}" to be replaced by the chemical component identifier, in capitals
    • *
    • "{ccd_id:beginIndex-endIndex}" to be replaced by a substring of the chemical component identifier in capitals, * with indices following the same convention as {@link String#substring(int, int)}
    • *
    • "{ccd_id:index}" to be replaced by a substring of the chemical component identifier in capitals, * with index either a positive or negative integer to substring from left or right of the string respectively.
    • + *
    * If any of the indices are off-bounds, then the full chemical component identifier is replaced */ public static void setChemCompPathUrlTemplate(String chemCompPathUrlTemplate) { @@ -233,7 +235,7 @@ public ChemComp getChemComp(String recordName) { recordName = recordName.toUpperCase().trim(); boolean haveFile = true; - if (recordName.equals("?")) { + if ("?".equals(recordName)) { return null; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/PolymerType.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/PolymerType.java index 78bae77f86..8066044a43 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/PolymerType.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/chem/PolymerType.java @@ -106,22 +106,22 @@ public static PolymerType polymerTypeFromString(String polymerTypeString) { } /** - * Convenience Set of polymer types classified as protein. This only contains {@link #peptide} + * Convenience Set of polymer types classified as protein. This only contains {@link #peptide} */ public static final Set PROTEIN_ONLY; /** - * Convenience Set of polymer types classified as DNA. This only contains {@link #dna} + * Convenience Set of polymer types classified as DNA. This only contains {@link #dna} */ public static final Set DNA_ONLY; /** - * Convenience Set of polymer types classified as RNA. This only contains {@link #rna} + * Convenience Set of polymer types classified as RNA. This only contains {@link #rna} */ public static final Set RNA_ONLY; /** - * Convenience Set of polymer types classified as DNA. This contains: + * Convenience Set of polymer types classified as DNA. This contains: *
      *
    • {@link #dna}
    • *
    • {@link #rna}
    • @@ -131,7 +131,7 @@ public static PolymerType polymerTypeFromString(String polymerTypeString) { public static final Set POLYNUCLEOTIDE_ONLY; /** - * Convenience Set of all polymer types. + * Convenience Set of all polymer types. */ public static final Set ALL_POLYMER_TYPES; 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 5888213c5b..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 @@ -58,7 +58,7 @@ public ZipChemCompProvider(String chemicalComponentDictionaryFile, String tempDi this.m_zipFile = Paths.get(chemicalComponentDictionaryFile); // Use a default temporary directory if not passed a value. - if (tempDir == null || tempDir.equals("")) { + if (tempDir == null || "".equals(tempDir)) { this.m_tempDir = Paths.get(System.getProperty("java.io.tmpdir")); } else { this.m_tempDir = Paths.get(tempDir); @@ -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 d73d747cb6..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 @@ -158,6 +158,22 @@ public SubunitCluster(SubunitCluster other, List subunitsToRetain) { setAlpha(other.getAlpha()); } + /** + * Create the cluster manually by specifying subunits and the equivalent residues + * @param subunits List of aligned subunits + * @param subunitEQR Double list giving the aligned residue indices in each subunit + */ + public SubunitCluster(List subunits, List> subunitEQR) { + if(subunits.size() != subunitEQR.size()) { + throw new IllegalArgumentException("Mismatched subunit length"); + } + this.subunits = subunits; + this.subunitEQR = subunitEQR; + this.representative = 0; + this.method = SubunitClustererMethod.MANUAL; + this.pseudoStoichiometric = false; + } + /** * Subunits contained in the SubunitCluster. * @@ -315,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); } @@ -491,21 +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 %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; @@ -521,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(); @@ -543,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; @@ -580,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 @@ -679,9 +696,9 @@ public boolean divideInternally(SubunitClustererParameters clusterParams) } // Divide the Subunits in their repeats - List newSubunits = new ArrayList(subunits.size() + List newSubunits = new ArrayList<>(subunits.size() * columns.size()); - List> newSubunitEQR = new ArrayList>( + List> newSubunitEQR = new ArrayList<>( subunits.size() * columns.size()); for (int s = 0; s < subunits.size(); s++) { @@ -700,7 +717,7 @@ public boolean divideInternally(SubunitClustererParameters clusterParams) .get(s).getStructure())); // Recalculate equivalent residues - List eqr = new ArrayList(); + List eqr = new ArrayList<>(); for (int p = 0; p < columns.get(r).size(); p++) { eqr.add(subunitEQR.get(s).get(columns.get(r).get(p)) - start); 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/cluster/SubunitClustererMethod.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClustererMethod.java index 40cd9fba6a..cd36611259 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClustererMethod.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClustererMethod.java @@ -59,6 +59,10 @@ public enum SubunitClustererMethod { * sequence and structure clustering differ, the cluster contains * pseudosymmetry (by definition). */ - SEQUENCE_STRUCTURE -} + SEQUENCE_STRUCTURE, + /** + * Some other method was used when clustering. + */ + MANUAL, +} diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java index 7060037bfc..45641d1e58 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java @@ -66,7 +66,7 @@ public static List extractSubunits(Structure structure, int absMinLen, double fraction, int minLen) { // The extracted subunit container - List subunits = new ArrayList(); + List subunits = new ArrayList<>(); for (Chain c : structure.getPolyChains()) { // Only take protein chains @@ -82,7 +82,7 @@ public static List extractSubunits(Structure structure, // Calculate the minimum length of a Subunit int adjustedMinLen = calcAdjustedMinimumSequenceLength(subunits, absMinLen, fraction, minLen); - logger.debug("Adjusted minimum sequence length: " + adjustedMinLen); + logger.debug("Adjusted minimum sequence length: {}", adjustedMinLen); // Filter out short Subunits for (int s = subunits.size() - 1; s >= 0; s--) { @@ -107,7 +107,7 @@ private static int calcAdjustedMinimumSequenceLength( int minLength = Integer.MAX_VALUE; // Extract the length List, the min and the max - List lengths = new ArrayList(); + List lengths = new ArrayList<>(); for (int i = 0; i < subunits.size(); i++) { if (subunits.get(i).size() >= absMinLen) { maxLength = Math.max(subunits.get(i).size(), maxLength); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java index e1297faec9..34de552786 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java @@ -42,7 +42,7 @@ public class AtomContactSet implements Serializable, Iterable { public AtomContactSet(double cutoff) { this.cutoff = cutoff; - this.contacts = new HashMap,AtomContact>(); + this.contacts = new HashMap<>(); } public void add(AtomContact contact) { @@ -87,7 +87,7 @@ public Iterator iterator() { } private Pair getAtomIdPairFromContact(AtomContact contact) { - Pair pair = new Pair( + Pair pair = new Pair<>( new AtomIdentifier(contact.getPair().getFirst().getPDBserial(),contact.getPair().getFirst().getGroup().getChainId()), new AtomIdentifier(contact.getPair().getSecond().getPDBserial(),contact.getPair().getSecond().getGroup().getChainId())); @@ -132,7 +132,7 @@ public List getContactsWithinDistance(double distance) { String.format("%.2f", distance)+" is larger than contacts' distance cutoff "+ String.format("%.2f", cutoff)); - List list = new ArrayList(); + List list = new ArrayList<>(); for (AtomContact contact:this.contacts.values()) { if (contact.getDistance() getIndexPair() { - return new Pair(i,j); + return new Pair<>(i,j); } public int getI() { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GridCell.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GridCell.java index 5123831ec6..6028110eb6 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GridCell.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GridCell.java @@ -40,8 +40,8 @@ public class GridCell { private ArrayList jIndices; public GridCell(Grid parent){ - iIndices = new ArrayList(); - jIndices = new ArrayList(); + iIndices = new ArrayList<>(); + jIndices = new ArrayList<>(); this.grid = parent; } @@ -70,7 +70,7 @@ public int getNumJindices() { */ public List getContactsWithinCell(){ - List contacts = new ArrayList(); + List contacts = new ArrayList<>(); Point3d[] iAtoms = grid.getIAtoms(); Point3d[] jAtoms = grid.getJAtoms(); @@ -103,14 +103,11 @@ public List getContactsWithinCell(){ * within the given cutoff as a list of Contacts containing the indices of the pair and the calculated distance. * * @param otherCell - * @param iAtoms the first set of atom coordinates to which the iIndices correspond - * @param jAtoms the second set of atom coordinates to which the jIndices correspond, if null distances are within the iAtoms only - * @param cutoff * @return */ public List getContactsToOtherCell(GridCell otherCell){ - List contacts = new ArrayList(); + List contacts = new ArrayList<>(); Point3d[] iAtoms = grid.getIAtoms(); Point3d[] jAtoms = grid.getJAtoms(); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContact.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContact.java index 16c0eb08c5..07b163730d 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContact.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContact.java @@ -41,7 +41,7 @@ public class GroupContact implements Serializable { private List atomContacts; public GroupContact() { - atomContacts = new ArrayList(); + atomContacts = new ArrayList<>(); } public void addAtomContact(AtomContact atomContact) { @@ -82,7 +82,7 @@ public List getAtomContacts() { */ public List getContactsWithinDistance(double distance) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (AtomContact contact:this.atomContacts) { if (contact.getDistance(){ private HashMap, GroupContact> contacts; public GroupContactSet() { - contacts = new HashMap, GroupContact>(); + contacts = new HashMap<>(); } /** @@ -52,7 +52,7 @@ public GroupContactSet() { * @param atomContacts */ public GroupContactSet(AtomContactSet atomContacts) { - contacts = new HashMap, GroupContact>(); + contacts = new HashMap<>(); atoms2groups(atomContacts); } @@ -69,8 +69,8 @@ private void atoms2groups(AtomContactSet atomContacts) { // we skip the self-residue contacts if (iResidue.equals(jResidue)) continue; - Pair residuePair = new Pair (iResidue, jResidue); - Pair pair = new Pair(new ResidueIdentifier(iResidue), new ResidueIdentifier(jResidue)); + Pair residuePair = new Pair<> (iResidue, jResidue); + Pair pair = new Pair<>(new ResidueIdentifier(iResidue), new ResidueIdentifier(jResidue)); if (!contacts.containsKey(pair)) { @@ -152,7 +152,7 @@ public Iterator iterator() { } private Pair getResIdPairFromContact(GroupContact groupContact) { - return new Pair( + return new Pair<>( new ResidueIdentifier(groupContact.getPair().getFirst()), new ResidueIdentifier(groupContact.getPair().getSecond()) ); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterface.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterface.java index b26275cde8..351e00f25b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterface.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterface.java @@ -522,7 +522,7 @@ public Pair> getRimResidues(double bsaToAsaCutoff, double minAsaForS } } - return new Pair>(rim1, rim2); + return new Pair<>(rim1, rim2); } /** @@ -613,8 +613,8 @@ public double getContactOverlapScore(StructureInterface other, boolean invert) { return 0; } - Pair thisCompounds = new Pair(thisChains.getFirst().getEntityInfo(), thisChains.getSecond().getEntityInfo()); - Pair otherCompounds = new Pair(otherChains.getFirst().getEntityInfo(), otherChains.getSecond().getEntityInfo()); + Pair thisCompounds = new Pair<>(thisChains.getFirst().getEntityInfo(), thisChains.getSecond().getEntityInfo()); + Pair otherCompounds = new Pair<>(otherChains.getFirst().getEntityInfo(), otherChains.getSecond().getEntityInfo()); if (checkMolIdMatch(thisCompounds,otherCompounds)) { @@ -706,7 +706,7 @@ public Pair getParentCompounds() { logger.warn("Could not find parents chains, compounds will be null"); return null; } - return new Pair(chains.getFirst().getEntityInfo(), chains.getSecond().getEntityInfo()); + return new Pair<>(chains.getFirst().getEntityInfo(), chains.getSecond().getEntityInfo()); } private Structure getParentStructure() { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceCluster.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceCluster.java index 5b1699bf8a..8743cdff9a 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceCluster.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceCluster.java @@ -40,7 +40,7 @@ public class StructureInterfaceCluster implements Serializable { public StructureInterfaceCluster() { - this.members = new ArrayList(); + this.members = new ArrayList<>(); } public List getMembers() { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceList.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceList.java index eb9901bd38..60f7c3a91b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceList.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceList.java @@ -52,7 +52,7 @@ public class StructureInterfaceList implements Serializable, Iterable reloadFromFile() { File f = getCacheFile(); - serializedCache = new HashMap(); + serializedCache = new HashMap<>(); // has never been cached here before if( ! f.exists()) { @@ -127,7 +127,7 @@ public Map reloadFromFile() { try{ - logger.debug("Reloading from cache " + f.getAbsolutePath()); + logger.debug("Reloading from cache {}", f.getAbsolutePath()); FileInputStream fis = new FileInputStream(f); ObjectInputStream ois = new ObjectInputStream(fis); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/pdp/ClusterDomains.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/pdp/ClusterDomains.java index 29fd0b6d21..6cdc379da4 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/pdp/ClusterDomains.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/pdp/ClusterDomains.java @@ -77,8 +77,8 @@ public static List cluster(List domains, PDPDistanceMatrix pdpDi if(minDomSize>150&&maxDomSize>1.5*minDomSize) maxDomSize=1.5*minDomSize; else if(maxDomSize>2*minDomSize) maxDomSize=2*minDomSize; - long size1= new Double(Math.min(PDPParameters.MAXSIZE,minDomSize)).longValue(); - long size2= new Double(Math.min(PDPParameters.MAXSIZE,maxDomSize)).longValue(); + long size1= Double.valueOf(Math.min(PDPParameters.MAXSIZE,minDomSize)).longValue(); + long size2= Double.valueOf(Math.min(PDPParameters.MAXSIZE,maxDomSize)).longValue(); minDomSize=Math.min(Math.pow(minDomSize,1.6/3)+PDPParameters.RG1,Math.pow(minDomSize,1.4/3)+Math.pow(PDPParameters.TD1,1.6/3)+PDPParameters.RG1); maxDomSize=Math.min(Math.pow(maxDomSize,1.6/3)+PDPParameters.RG1,Math.pow(maxDomSize,1.4/3)+Math.pow(PDPParameters.TD1,1.6/3)+PDPParameters.RG1); @@ -90,8 +90,8 @@ public static List cluster(List domains, PDPDistanceMatrix pdpDi /* total_max_contacts = min(x*y,MAXCONT); */ - total_max_contacts=new Double(minDomSize*maxDomSize*10).longValue(); - if(size1>130) total_max_contacts=new Double(minDomSize*maxDomSize*9).longValue(); + total_max_contacts=Double.valueOf(minDomSize*maxDomSize*10).longValue(); + if(size1>130) total_max_contacts=Double.valueOf(minDomSize*maxDomSize*9).longValue(); /* avd=(domains.get(i).avd+domains.get(j).avd)/2; @@ -228,7 +228,7 @@ private static List combine(List domains,int Si, int Sj, double if ( verbose) System.out.println(" +++ combining domains " + Si + " " + Sj); - List newdoms = new ArrayList(); + List newdoms = new ArrayList<>(); //int ndom = domains.size(); for(int i=0;i(); + domains = new ArrayList<>(); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/pdp/Domain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/pdp/Domain.java index 878ec29686..6586c9f941 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/pdp/Domain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/pdp/Domain.java @@ -23,9 +23,9 @@ */ package org.biojava.nbio.structure.domain.pdp; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -48,7 +48,7 @@ public class Domain implements Comparable, Serializable{ int nseg; double score; - Listsegments = new ArrayList(); + Listsegments = new ArrayList<>(); public Domain(){ diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodDomain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodDomain.java index 66d6ae615c..7e0ab2c16a 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodDomain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodDomain.java @@ -150,7 +150,7 @@ public EcodDomain(EcodDomain o) { this.tGroupName = o.tGroupName; this.fGroupName = o.fGroupName; this.assemblyId = o.assemblyId; - this.ligands = new HashSet(o.ligands); + this.ligands = new HashSet<>(o.ligands); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java index 9dc3ec7f11..f4be5cd4f5 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java @@ -97,7 +97,7 @@ public class EcodInstallation implements EcodDatabase { * installations at the same path can lead to race conditions when downloading * files. * @param cacheLocation Location to save files, typically from the PDB_CACHE_DIR parameter - * @param requestedVersion ECOD requestedVersion to fetch + * @param version ECOD requestedVersion to fetch */ public EcodInstallation(String cacheLocation, String version) { domainsFileLock = new ReentrantReadWriteLock(); @@ -153,7 +153,7 @@ public List getDomainsForPdb(String id) throws IOException { return null; } // Deep clone - List clonedDoms = new ArrayList(doms.size()); + List clonedDoms = new ArrayList<>(doms.size()); for(EcodDomain d : doms) { clonedDoms.add( new EcodDomain(d) ); } @@ -178,7 +178,7 @@ public List filterByHierarchy(String hierarchy) throws IOException { Integer hGroup = xhtGroup.length>1 ? Integer.parseInt(xhtGroup[1]) : null; Integer tGroup = xhtGroup.length>2 ? Integer.parseInt(xhtGroup[2]) : null; - List filtered = new ArrayList(); + List filtered = new ArrayList<>(); for(EcodDomain d: getAllDomains()) { boolean match = true; if(xhtGroup.length>0) { @@ -295,7 +295,7 @@ public String getUrl() { /** * Specify a different mirror for the ECOD server. - * @param urlFormat the urlFormat to set + * @param url the urlFormat to set */ public void setUrl(String url) { this.url = url; @@ -485,7 +485,7 @@ private void indexDomains() throws IOException { } // Leave enough space for all PDBs as of 2015 - domainMap = new HashMap>((int) (150000/.85),.85f); + domainMap = new HashMap<>((int) (150000/.85),.85f); // Index with domainMap for(EcodDomain d : allDomains) { @@ -504,7 +504,7 @@ private void indexDomains() throws IOException { if( domainMap.containsKey(pdbId) ) { currDomains = domainMap.get(pdbId); } else { - currDomains = new LinkedList(); + currDomains = new LinkedList<>(); domainMap.put(pdbId,currDomains); } currDomains.add(d); @@ -582,7 +582,7 @@ public EcodParser(BufferedReader reader) throws IOException { private void parse(BufferedReader in) throws IOException { try { // Allocate plenty of space for ECOD as of 2015 - ArrayList domainsList = new ArrayList(500000); + ArrayList domainsList = new ArrayList<>(500000); Pattern versionRE = Pattern.compile("^\\s*#.*ECOD\\s*version\\s+(\\S+).*"); Pattern commentRE = Pattern.compile("^\\s*#.*"); @@ -686,7 +686,7 @@ private void parse(BufferedReader in) throws IOException { String assemblyStr = fields[i++]; if(assemblyStr.equals(NOT_DOMAIN_ASSEMBLY)) { assemblyId = uid; - } else if(assemblyStr.equals("IS_DOMAIN_ASSEMBLY") ) { + } else if("IS_DOMAIN_ASSEMBLY".equals(assemblyStr) ) { if(warnIsDomainAssembly > 1) { logger.info("Deprecated 'IS_DOMAIN_ASSEMBLY' value ignored in line {}.",lineNum); warnIsDomainAssembly--; @@ -701,11 +701,11 @@ private void parse(BufferedReader in) throws IOException { String ligandStr = fields[i++]; Set ligands = null; - if( ligandStr.equals("NO_LIGANDS_4A") || ligandStr.isEmpty() ) { + if( "NO_LIGANDS_4A".equals(ligandStr) || ligandStr.isEmpty() ) { ligands = Collections.emptySet(); } else { String[] ligSplit = ligandStr.split(","); - ligands = new LinkedHashSet(ligSplit.length); + ligands = new LinkedHashSet<>(ligSplit.length); for(String s : ligSplit) { ligands.add(s.intern()); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java index c1cfeb73e1..b0e440af31 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java @@ -40,7 +40,7 @@ private CalcPoint() { } /** - * Center a cloud of points. This means subtracting the {@lin + * Center a cloud of points. This means subtracting the {@link * #centroid(Point3d[])} of the cloud to each point. * * @param x 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 7d638bce65..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 @@ -47,7 +47,7 @@ public class MomentsOfInertia { private List points = new ArrayList(); - private List masses = new ArrayList(); + private List masses = new ArrayList<>(); private boolean modified = true; @@ -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/geometry/SuperPositionQCP.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositionQCP.java index a3d5728f19..c96f2f7125 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositionQCP.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositionQCP.java @@ -74,12 +74,12 @@ *

      * Citations: *

      - * Liu P, Agrafiotis DK, & Theobald DL (2011) Reply to comment on: "Fast + * Liu P, Agrafiotis DK, & Theobald DL (2011) Reply to comment on: "Fast * determination of the optimal rotation matrix for macromolecular * superpositions." Journal of Computational Chemistry 32(1):185-186. * [http://dx.doi.org/10.1002/jcc.21606] *

      - * Liu P, Agrafiotis DK, & Theobald DL (2010) "Fast determination of the optimal + * Liu P, Agrafiotis DK, & Theobald DL (2010) "Fast determination of the optimal * rotation matrix for macromolecular superpositions." Journal of Computational * Chemistry 31(7):1561-1563. [http://dx.doi.org/10.1002/jcc.21439] *

      @@ -96,7 +96,7 @@ *

      * dtheobald@brandeis.edu *

      - * Pu Liu Johnson & Johnson Pharmaceutical Research and Development, L.L.C. 665 + * Pu Liu Johnson & Johnson Pharmaceutical Research and Development, L.L.C. 665 * Stockton Drive Exton, PA 19341 USA *

      * pliu24@its.jnj.com @@ -261,13 +261,13 @@ private void calcRmsd(Point3d[] x, Point3d[] y) { // translate to origin xref = CalcPoint.clonePoint3dArray(x); xtrans = CalcPoint.centroid(xref); - logger.debug("x centroid: " + xtrans); + logger.debug("x centroid: {}", xtrans); xtrans.negate(); CalcPoint.translate(new Vector3d(xtrans), xref); yref = CalcPoint.clonePoint3dArray(y); ytrans = CalcPoint.centroid(yref); - logger.debug("y centroid: " + ytrans); + logger.debug("y centroid: {}", ytrans); ytrans.negate(); CalcPoint.translate(new Vector3d(ytrans), yref); innerProduct(yref, xref); @@ -587,7 +587,7 @@ public Matrix4d superpose(Point3d[] fixed, Point3d[] moved) { * @param fixed * @param moved * @param weight - * array of weigths for each equivalent point position + * array of weights for each equivalent point position * @return weighted RMSD. */ public double getWeightedRmsd(Point3d[] fixed, Point3d[] moved, double[] weight) { @@ -598,13 +598,11 @@ public double getWeightedRmsd(Point3d[] fixed, Point3d[] moved, double[] weight) /** * The QCP method can be used as a two-step calculation: first compute the * RMSD (fast) and then compute the superposition. - * + *

      * This method assumes that the RMSD of two arrays of points has been * already calculated using {@link #getRmsd(Point3d[], Point3d[])} method * and calculates the transformation of the same two point arrays. * - * @param fixed - * @param moved * @return transformation matrix as a Matrix4d to superpose moved onto fixed * point arrays */ diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java index e7568de2fb..e6b8548025 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java @@ -89,6 +89,7 @@ public BondMaker(Structure structure, FileParsingParameters params) { /** * Creates bond objects and corresponding references in Atom objects: + *

        *
      • * peptide bonds: inferred from sequence and distances *
      • @@ -98,6 +99,7 @@ public BondMaker(Structure structure, FileParsingParameters params) { *
      • * intra-group (residue) bonds: read from the chemical component dictionary, via {@link org.biojava.nbio.structure.chem.ChemCompProvider} *
      • + *
      */ public void makeBonds() { logger.debug("Going to start making bonds"); @@ -340,8 +342,8 @@ private void formDisulfideBond(SSBondImpl disulfideBond) { */ public void formLinkRecordBond(LinkRecord linkRecord) { // only work with atoms that aren't alternate locations - if (linkRecord.getAltLoc1().equals(" ") - || linkRecord.getAltLoc2().equals(" ")) + if (" ".equals(linkRecord.getAltLoc1()) + || " ".equals(linkRecord.getAltLoc2())) return; try { @@ -361,8 +363,8 @@ public void formLinkRecordBond(LinkRecord linkRecord) { if (polyChain2!=null) allChainIds2.add(polyChain2.getId()); if (nonpolyChains1!=null) nonpolyChains1.forEach(npc -> allChainIds1.add(npc.getId())); if (nonpolyChains2!=null) nonpolyChains2.forEach(npc -> allChainIds2.add(npc.getId())); - if (waterChain1!=null && linkRecord.getResName1().equals("HOH")) allChainIds1.add(waterChain1.getId()); - if (waterChain2!=null && linkRecord.getResName2().equals("HOH")) allChainIds2.add(waterChain2.getId()); + if (waterChain1!=null && "HOH".equals(linkRecord.getResName1())) allChainIds1.add(waterChain1.getId()); + if (waterChain2!=null && "HOH".equals(linkRecord.getResName2())) allChainIds2.add(waterChain2.getId()); Map a = getAtomFromRecordTryMultipleChainIds(linkRecord.getName1(), linkRecord.getAltLoc1(), linkRecord.getResSeq1(), linkRecord.getiCode1(), allChainIds1); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/CAConverter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/CAConverter.java index 6f57eb3a46..1634988665 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/CAConverter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/CAConverter.java @@ -42,7 +42,7 @@ public class CAConverter { * @since Biojava 4.1.0 */ public static List getRepresentativeAtomsOnly(List chains){ - List newChains = new ArrayList(); + List newChains = new ArrayList<>(); for (Chain chain : chains){ Chain newChain = getRepresentativeAtomsOnly(chain); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java index 96d52edee1..d5c47fdf92 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java @@ -297,7 +297,7 @@ private static TreeMap findEntitiesFromAlignment(List IDENTITY_THRESHOLD && gapCov1 pair) { private static int getNumGapsQuery(SequencePair pair) { int numGaps = 0; for (int alignmentIndex=1;alignmentIndex<=pair.getLength();alignmentIndex++) { - if (pair.getCompoundInQueryAt(alignmentIndex).getShortName().equals("-")) { + if ("-".equals(pair.getCompoundInQueryAt(alignmentIndex).getShortName())) { numGaps++; } } @@ -432,7 +432,7 @@ private static int getNumGapsQuery(SequencePair pair) { private static int getNumGapsTarget(SequencePair pair) { int numGaps = 0; for (int alignmentIndex=1;alignmentIndex<=pair.getLength();alignmentIndex++) { - if (pair.getCompoundInTargetAt(alignmentIndex).getShortName().equals("-")) { + if ("-".equals(pair.getCompoundInTargetAt(alignmentIndex).getShortName())) { numGaps++; } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java index 6c6506504c..1b8278125e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java @@ -51,7 +51,7 @@ import java.util.*; /** - * A collection of static utilities to convert between {@link AFPChain AFPChains} and {@link FastaSequence FastaSequences}. + * A collection of static utilities to convert between {@link AFPChain AFPChains} and FastaSequences. * * @author dmyersturnbull * @see StructureSequenceMatcher @@ -73,7 +73,7 @@ public static AFPChain cpFastaToAfpChain(String first, String second, Structure /** * Takes a structure and sequence corresponding to an alignment between a structure or sequence and itself (or even a structure with a sequence), where the result has a circular permutation site - * {@link cpSite} residues to the right. + * cpSite residues to the right. * * @param fastaFile A FASTA file containing exactly 2 sequences, the first unpermuted and the second permuted * @param cpSite @@ -85,9 +85,9 @@ public static AFPChain cpFastaToAfpChain(String first, String second, Structure public static AFPChain cpFastaToAfpChain(File fastaFile, Structure structure, int cpSite) throws IOException, StructureException { InputStream inStream = new FileInputStream(fastaFile); SequenceCreatorInterface creator = new CasePreservingProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()); - SequenceHeaderParserInterface headerParser = new GenericFastaHeaderParser(); - FastaReader fastaReader = new FastaReader(inStream, headerParser, creator); - LinkedHashMap sequences = fastaReader.process(); + SequenceHeaderParserInterface headerParser = new GenericFastaHeaderParser<>(); + FastaReader fastaReader = new FastaReader<>(inStream, headerParser, creator); + Map sequences = fastaReader.process(); inStream.close(); Iterator iter = sequences.values().iterator(); ProteinSequence first = iter.next(); @@ -97,7 +97,7 @@ public static AFPChain cpFastaToAfpChain(File fastaFile, Structure structure, in /** * Takes a structure and sequence corresponding to an alignment between a structure or sequence and itself (or even a structure with a sequence), where the result has a circular permutation site - * {@link cpSite} residues to the right. + * cpSite residues to the right. * * @param first The unpermuted sequence * @param second The sequence permuted by cpSite @@ -196,10 +196,10 @@ public static AFPChain fastaFileToAfpChain(File fastaFile, Structure structure1, InputStream inStream = new FileInputStream(fastaFile); SequenceCreatorInterface creator = new CasePreservingProteinSequenceCreator( AminoAcidCompoundSet.getAminoAcidCompoundSet()); - SequenceHeaderParserInterface headerParser = new GenericFastaHeaderParser(); - FastaReader fastaReader = new FastaReader( + SequenceHeaderParserInterface headerParser = new GenericFastaHeaderParser<>(); + FastaReader fastaReader = new FastaReader<>( inStream, headerParser, creator); - LinkedHashMap sequences = fastaReader.process(); + Map sequences = fastaReader.process(); inStream.close(); return fastaToAfpChain(sequences, structure1, structure2); } @@ -236,8 +236,8 @@ public static AFPChain fastaToAfpChain(Map sequences, S throw new IllegalArgumentException("A structure is null"); } - List seqs = new ArrayList(); - List names = new ArrayList(2); + List seqs = new ArrayList<>(); + List names = new ArrayList<>(2); for (Map.Entry entry : sequences.entrySet()) { seqs.add(entry.getValue()); names.add(entry.getKey()); @@ -321,7 +321,7 @@ public static AFPChain fastaToAfpChain(SequencePair, sb1.append(a.getBase()); } ProteinSequence seq2 = new ProteinSequence(sb2.toString()); - LinkedHashMap map = new LinkedHashMap(); + LinkedHashMap map = new LinkedHashMap<>(); map.put(structure1.getName(), seq1); map.put(structure2.getName(), seq2); return fastaToAfpChain(map, structure1, structure2); @@ -349,8 +349,8 @@ private static AFPChain buildAlignment(Atom[] ca1, Atom[] ca2, ResidueNumber[] r // remove any gap // this includes the ones introduced by the nullifying above - List alignedResiduesList1 = new ArrayList(); - List alignedResiduesList2 = new ArrayList(); + List alignedResiduesList1 = new ArrayList<>(); + List alignedResiduesList2 = new ArrayList<>(); for (int i = 0; i < residues1.length; i++) { if (residues1[i] != null && residues2[i] != null) { alignedResiduesList1.add(residues1[i]); @@ -379,7 +379,7 @@ private static AFPChain buildAlignment(Atom[] ca1, Atom[] ca2, ResidueNumber[] r * @param sequence Make sure not to use {@link ProteinSequence#getSequenceAsString()} for this, as it won't preserve upper- and lower-case */ public static List getAlignedUserCollection(String sequence) { - List aligned = new ArrayList(sequence.length()); + List aligned = new ArrayList<>(sequence.length()); for (char c : sequence.toCharArray()) { aligned.add(Character.isUpperCase(c)); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaStructureParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaStructureParser.java index 29baf9d825..0586df8ced 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaStructureParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaStructureParser.java @@ -35,6 +35,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.LinkedHashMap; +import java.util.Map; /** @@ -109,7 +110,7 @@ public FastaStructureParser(FastaReader read */ public void process() throws IOException, StructureException { if(sequences == null) { // only process once, then return cached values - LinkedHashMap sequenceMap = reader.process(); + Map sequenceMap = reader.process(); sequences = sequenceMap.values().toArray(new ProteinSequence[0]); accessions = new String[sequences.length]; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/GroupToSDF.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/GroupToSDF.java index bbc277b89f..108a65f4a3 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/GroupToSDF.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/GroupToSDF.java @@ -130,7 +130,7 @@ private Object getCharges(Group thisGroup) { private static List getAtomCharges(Group group) { // The list to store the answer - List outArr = new ArrayList(); + List outArr = new ArrayList<>(); // Get the atom charge Information for(Atom a: group.getAtoms()){ outArr.add(a.getCharge()); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/LocalPDBDirectory.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/LocalPDBDirectory.java index 127a1ad019..4ec4577f59 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/LocalPDBDirectory.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/LocalPDBDirectory.java @@ -133,13 +133,11 @@ public static enum FetchBehavior { Date d = formatter.parse(LAST_REMEDIATION_DATE_STRING); t = d.getTime(); } catch (ParseException e){ - logger.error("Unexpected error! could not parse LAST_REMEDIATION_DATE: "+e.getMessage()); + logger.error("Unexpected error! could not parse LAST_REMEDIATION_DATE: {}", e.getMessage()); } LAST_REMEDIATION_DATE = t; } - protected static final String lineSplit = System.getProperty("file.separator"); - /** Minimum size for a valid structure file (CIF or PDB), in bytes */ public static final long MIN_PDB_FILE_SIZE = 40; // Empty gzip files are 20bytes. Add a few more for buffer. @@ -174,7 +172,7 @@ public static enum FetchBehavior { * @param path Path to the PDB file directory */ public LocalPDBDirectory(String path) { - extensions = new ArrayList(); + extensions = new ArrayList<>(); params = new FileParsingParameters(); @@ -261,14 +259,14 @@ public FileParsingParameters getFileParsingParameters(){ * Load the requested ID from the PDB's obsolete repository *
    • {@link ObsoleteBehavior#FETCH_CURRENT FETCH_CURRENT} * Load the most recent version of the requested structure - * + * *

      This setting may be silently ignored by implementations which do not have * access to the server to determine whether an entry is obsolete, such as - * if {@link #isAutoFetch()} is false. Note that an obsolete entry may still be + * certain {@link FetchBehavior}s. Note that an obsolete entry may still be * returned even this is FETCH_CURRENT if the entry is found locally. * - * @param fetchFileEvenIfObsolete Whether to fetch obsolete records - * @see #setFetchCurrent(boolean) + * @param behavior Whether to fetch obsolete records + * @see #setFetchBehavior(FetchBehavior) * @since 4.0.0 */ public void setObsoleteBehavior(ObsoleteBehavior behavior) { @@ -278,7 +276,7 @@ public void setObsoleteBehavior(ObsoleteBehavior behavior) { /** * Returns how this instance deals with obsolete entries. Note that this * setting may be ignored by some implementations or in some situations, - * such as when {@link #isAutoFetch()} is false. + * such as certain {@link FetchBehavior}s. * *

      For most implementations, the default value is * {@link ObsoleteBehavior#THROW_EXCEPTION THROW_EXCEPTION}. @@ -297,10 +295,9 @@ public ObsoleteBehavior getObsoleteBehavior() { public FetchBehavior getFetchBehavior() { return fetchBehavior; } + /** * Set the behavior for fetching files from the server. - * This replaces the {@link #setAutoFetch(boolean)} method with a more - * extensive set of options. * @param fetchBehavior */ public void setFetchBehavior(FetchBehavior fetchBehavior) { @@ -436,7 +433,7 @@ public boolean deleteStructure(PdbId pdbId) throws IOException{ // delete file boolean success = existing.delete(); if(success) { - logger.debug("Deleting "+existing.getAbsolutePath()); + logger.debug("Deleting {}", existing.getAbsolutePath()); } deleted = deleted || success; @@ -445,7 +442,7 @@ public boolean deleteStructure(PdbId pdbId) throws IOException{ if(parent != null) { success = parent.delete(); if(success) { - logger.debug("Deleting "+parent.getAbsolutePath()); + logger.debug("Deleting {}", parent.getAbsolutePath()); } } @@ -530,9 +527,9 @@ protected File downloadStructure(PdbId pdbId) throws IOException { } /** - * Download a file from the ftp server +/- its validation metadata, replacing any existing files if needed + * Download a file from the http server +/- its validation metadata, replacing any existing files if needed * @param pdbId PDB ID - * @param pathOnServer Path on the FTP server, e.g. data/structures/divided/pdb + * @param pathOnServer Path on the http server, e.g. data/structures/divided/pdb * @param obsolete Whether or not file should be saved to the obsolete location locally * @param existingFile if not null and checkServerFileDate is true, the last modified date of the * server file and this file will be compared to decide whether to download or not @@ -548,9 +545,7 @@ private File downloadStructure(PdbId pdbId, String pathOnServer, boolean obsolet String ftp; String filename = getFilename(id); - if (filename.endsWith(".mmtf.gz")){ - ftp = CodecUtils.getMmtfEntryUrl(id, true, false); - } else if (filename.endsWith(".bcif") || filename.endsWith(".bcif.gz")) { + if (filename.endsWith(".bcif") || filename.endsWith(".bcif.gz")) { // TODO this should be configurable ftp = DEFAULT_BCIF_FILE_SERVER + filename; } else { @@ -578,8 +573,8 @@ private File downloadStructure(PdbId pdbId, String pathOnServer, boolean obsolet } } - logger.info("Fetching " + ftp); - logger.info("Writing to "+ realFile); + logger.info("Fetching {}", ftp); + logger.info("Writing to {}", realFile); FileDownloadUtils.createValidationFiles(url, realFile, null, FileDownloadUtils.Hash.UNKNOWN); FileDownloadUtils.downloadFile(url, realFile); @@ -677,7 +672,7 @@ public File getLocalFile(PdbId pdbId) throws IOException { // Search directories: // 1) LOCAL_MMCIF_SPLIT_DIR//(pdb)?. // 2) LOCAL_MMCIF_ALL_DIR//(pdb)?. - LinkedList searchdirs = new LinkedList(); + LinkedList searchdirs = new LinkedList<>(); String middle = id.substring(offset, offset+2).toLowerCase(); File splitdir = new File(splitDirPath, middle); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBBioAssemblyParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBBioAssemblyParser.java index 22462bafe1..d40bef1ec3 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBBioAssemblyParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBBioAssemblyParser.java @@ -41,10 +41,10 @@ public class PDBBioAssemblyParser { //private static final Logger logger = LoggerFactory.getLogger(PDBBioAssemblyParser.class); private Integer currentBioMolecule = null; - private List currentChainIDs = new ArrayList(); + private List currentChainIDs = new ArrayList<>(); private Matrix currentMatrix = null; private double[] shift = null; - private Map transformationMap = new HashMap(); + private Map transformationMap = new HashMap<>(); private int modelNumber = 1; private List transformations; @@ -159,7 +159,7 @@ private void addToCurrentChainList(String line) { } private void initialize() { - transformations = new ArrayList(); + transformations = new ArrayList<>(); currentMatrix = Matrix.identity(3,3); currentBioMolecule = null; shift = new double[3]; 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 92bd9f2456..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 @@ -177,15 +177,15 @@ public class PDBFileParser { private boolean isLastCompndLine = false; private boolean isLastSourceLine = false; private EntityInfo current_compound; - private List entities = new ArrayList(); - private HashMap> compoundMolIds2chainIds = new HashMap>(); - private List compndLines = new ArrayList(); - private List sourceLines = new ArrayList(); - private List journalLines = new ArrayList(); - private List keywordsLines = new ArrayList(); + private List entities = new ArrayList<>(); + private HashMap> compoundMolIds2chainIds = new HashMap<>(); + private List compndLines = new ArrayList<>(); + private List sourceLines = new ArrayList<>(); + private List journalLines = new ArrayList<>(); + private List keywordsLines = new ArrayList<>(); private List dbrefs; - private Map siteMap = new LinkedHashMap(); - private Map> siteToResidueMap = new LinkedHashMap>(); + private Map siteMap = new LinkedHashMap<>(); + private Map> siteToResidueMap = new LinkedHashMap<>(); private List ssbonds = new ArrayList<>(); @@ -207,7 +207,7 @@ public class PDBFileParser { private float rfreeStandardLine = -1; private float rfreeNoCutoffLine = -1; - private static final List compndFieldValues = new ArrayList( + private static final List compndFieldValues = new ArrayList<>( Arrays.asList( "MOL_ID:", "MOLECULE:", "CHAIN:", "SYNONYM:", "EC:", "FRAGMENT:", "ENGINEERED:", "MUTATION:", @@ -215,14 +215,14 @@ public class PDBFileParser { )); - private static final List ignoreCompndFieldValues = new ArrayList( + private static final List ignoreCompndFieldValues = new ArrayList<>( Arrays.asList( "HETEROGEN:","ENGINEEREED:","FRAGMENT,", "MUTANT:","SYNTHETIC:" )); // ENGINEEREED in pdb219d - private static final List sourceFieldValues = new ArrayList( + private static final List sourceFieldValues = new ArrayList<>( Arrays.asList("ENGINEERED:", "MOL_ID:", "SYNTHETIC:", "FRAGMENT:", "ORGANISM_SCIENTIFIC:", "ORGANISM_COMMON:", "ORGANISM_TAXID:","STRAIN:", @@ -274,14 +274,14 @@ public PDBFileParser() { pdbHeader = new PDBHeader(); crystallographicInfo = new PDBCrystallographicInfo(); - connects = new ArrayList>() ; + connects = new ArrayList<>() ; - helixList = new ArrayList>(); - strandList = new ArrayList>(); - turnList = new ArrayList>(); + helixList = new ArrayList<>(); + strandList = new ArrayList<>(); + turnList = new ArrayList<>(); current_compound = null; - dbrefs = new ArrayList(); + dbrefs = new ArrayList<>(); siteMap = null; dateFormat = new SimpleDateFormat("dd-MMM-yy", Locale.US); atomCount = 0; @@ -294,7 +294,7 @@ public PDBFileParser() { loadMaxAtoms = params.getMaxAtoms(); atomCAThreshold = params.getAtomCaThreshold(); - linkRecords = new ArrayList(); + linkRecords = new ArrayList<>(); blankChainIdsPresent = false; @@ -369,7 +369,7 @@ private void pdb_HEADER_Handler(String line) { pdbCode = line.substring (62, min(len,66)).trim() ; pdbId = pdbCode; - logger.debug("Parsing entry " + pdbId); + logger.debug("Parsing entry {}", pdbId); PdbId pdbIdToSet; if(pdbCode.isBlank()) { @@ -486,7 +486,7 @@ private void pdb_HELIX_Handler(String line){ //System.out.println(initResName + " " + initChainId + " " + initSeqNum + " " + initICode + " " + // endResName + " " + endChainId + " " + endSeqNum + " " + endICode); - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("initResName",initResName); m.put("initChainId", initChainId); @@ -573,7 +573,7 @@ private void pdb_SHEET_Handler( String line){ //System.out.println(initResName + " " + initChainId + " " + initSeqNum + " " + initICode + " " + // endResName + " " + endChainId + " " + endSeqNum + " " + endICode); - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("initResName",initResName); m.put("initChainId", initChainId); @@ -638,7 +638,7 @@ private void pdb_TURN_Handler( String line){ //System.out.println(initResName + " " + initChainId + " " + initSeqNum + " " + initICode + " " + // endResName + " " + endChainId + " " + endSeqNum + " " + endICode); - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("initResName",initResName); m.put("initChainId", initChainId); @@ -862,7 +862,7 @@ private void pdb_TITLE_Handler(String line) { title = line.substring(10,line.length()).trim(); String t = pdbHeader.getTitle(); - if ( (t != null) && (! t.equals("")) ){ + if ( (t != null) && (! "".equals(t)) ){ if (t.endsWith("-")) t += ""; // if last line ends with a hyphen then we don't add space else @@ -917,14 +917,10 @@ private void pdb_JRNL_Handler(String line) { */ private void pdb_COMPND_Handler(String line) { - logger.debug("previousContinuationField is " - + previousContinuationField); - logger.debug("current continuationField is " - + continuationField); - logger.debug("current continuationString is " - + continuationString); - logger.debug("current compound is " - + current_compound); + logger.debug("previousContinuationField is {}", previousContinuationField); + logger.debug("current continuationField is {}", continuationField); + logger.debug("current continuationString is {}", continuationString); + logger.debug("current compound is {}", current_compound); // In legacy PDB files the line ends with the PDB code and a serial number, chop those off! @@ -947,7 +943,7 @@ private void pdb_COMPND_Handler(String line) { String field0 = fieldList[0]; if (compndFieldValues.contains(field0)) { continuationField = field0; - if (previousContinuationField.equals("")) { + if ("".equals(previousContinuationField)) { previousContinuationField = continuationField; } } else if (field0.endsWith(";") && compndFieldValues.contains(field0.substring(0, field0.length()-1)) ) { @@ -972,25 +968,24 @@ private void pdb_COMPND_Handler(String line) { while (compndTokens.hasMoreTokens()) { String token = compndTokens.nextToken(); - if (previousContinuationField.equals("")) { + if ("".equals(previousContinuationField)) { previousContinuationField = continuationField; } if (previousContinuationField.equals(continuationField) && compndFieldValues.contains(continuationField)) { - logger.debug("Still in field " + continuationField); - logger.debug("token = " + token); + logger.debug("Still in field {}", continuationField); + logger.debug("token = {}", token); continuationString = continuationString.concat(token + " "); - logger.debug("continuationString = " - + continuationString); + logger.debug("continuationString = {}", continuationString); } if (!continuationField.equals(previousContinuationField)) { - if (continuationString.equals("")) { + if ("".equals(continuationString)) { continuationString = token; } else { @@ -1022,7 +1017,7 @@ private void pdb_COMPND_Handler(String line) { private void compndValueSetter(String field, String value) { value = value.trim().replace(";", ""); - if (field.equals("MOL_ID:")) { + if ("MOL_ID:".equals(field)) { int i = -1; try { @@ -1053,29 +1048,29 @@ private void compndValueSetter(String field, String value) { return; } - if (field.equals("MOLECULE:")) { + if ("MOLECULE:".equals(field)) { current_compound.setDescription(value); } - if (field.equals("CHAIN:")) { + if ("CHAIN:".equals(field)) { //System.out.println(value); StringTokenizer chainTokens = new StringTokenizer(value, ","); - List chains = new ArrayList(); + List chains = new ArrayList<>(); while (chainTokens.hasMoreTokens()) { String chainID = chainTokens.nextToken().trim(); // NULL is used in old PDB files to represent empty chain DI - if (chainID.equals("NULL")) + if ("NULL".equals(chainID)) chainID = " "; chains.add(chainID); } compoundMolIds2chainIds.put(current_compound.getMolId(),chains); } - if (field.equals("SYNONYM:")) { + if ("SYNONYM:".equals(field)) { StringTokenizer synonyms = new StringTokenizer(value, ","); - List names = new ArrayList(); + List names = new ArrayList<>(); while (synonyms.hasMoreTokens()) { names.add(synonyms.nextToken()); @@ -1085,10 +1080,10 @@ private void compndValueSetter(String field, String value) { } - if (field.equals("EC:")) { + if ("EC:".equals(field)) { StringTokenizer ecNumTokens = new StringTokenizer(value, ","); - List ecNums = new ArrayList(); + List ecNums = new ArrayList<>(); while (ecNumTokens.hasMoreTokens()) { ecNums.add(ecNumTokens.nextToken()); @@ -1097,27 +1092,27 @@ private void compndValueSetter(String field, String value) { } } - if (field.equals("FRAGMENT:")) { + if ("FRAGMENT:".equals(field)) { current_compound.setFragment(value); } - if (field.equals("ENGINEERED:")) { + if ("ENGINEERED:".equals(field)) { current_compound.setEngineered(value); } - if (field.equals("MUTATION:")) { + if ("MUTATION:".equals(field)) { current_compound.setMutation(value); } - if (field.equals("BIOLOGICAL_UNIT:")) { + if ("BIOLOGICAL_UNIT:".equals(field)) { current_compound.setBiologicalUnit(value); } - if (field.equals("OTHER_DETAILS:")) { + if ("OTHER_DETAILS:".equals(field)) { current_compound.setDetails(value); @@ -1148,16 +1143,11 @@ private void pdb_SOURCE_Handler(String line) { - logger.debug("current continuationNo is " - + continuationNr); - logger.debug("previousContinuationField is " - + previousContinuationField); - logger.debug("current continuationField is " - + continuationField); - logger.debug("current continuationString is " - + continuationString); - logger.debug("current compound is " - + current_compound); + logger.debug("current continuationNo is {}", continuationNr); + logger.debug("previousContinuationField is {}", previousContinuationField); + logger.debug("current continuationField is {}", continuationField); + logger.debug("current continuationString is {}", continuationString); + logger.debug("current compound is {}", current_compound); // following the docs, the last valid character should be 79, chop off the rest @@ -1167,32 +1157,32 @@ private void pdb_SOURCE_Handler(String line) { line = line.substring(10, line.length()); - logger.debug("LINE: >" + line + "<"); + logger.debug("LINE: >{}<", line); String[] fieldList = line.split("\\s+"); - if (!fieldList[0].equals("") + if (!"".equals(fieldList[0]) && sourceFieldValues.contains(fieldList[0])) { // System.out.println("[PDBFileParser.pdb_COMPND_Handler] Setting continuationField to '" + fieldList[0] + "'"); continuationField = fieldList[0]; - if (previousContinuationField.equals("")) { + if ("".equals(previousContinuationField)) { previousContinuationField = continuationField; } } else if ((fieldList.length > 1) && ( sourceFieldValues.contains(fieldList[1]))) { // System.out.println("[PDBFileParser.pdb_COMPND_Handler] Setting continuationField to '" + fieldList[1] + "'"); continuationField = fieldList[1]; - if (previousContinuationField.equals("")) { + if ("".equals(previousContinuationField)) { previousContinuationField = continuationField; } } else { - if (continuationNr.equals("")) { + if ("".equals(continuationNr)) { logger.debug("looks like an old PDB file"); continuationField = "MOLECULE:"; - if (previousContinuationField.equals("")) { + if ("".equals(previousContinuationField)) { previousContinuationField = continuationField; } } @@ -1208,7 +1198,7 @@ private void pdb_SOURCE_Handler(String line) { while (compndTokens.hasMoreTokens()) { String token = compndTokens.nextToken(); - if (previousContinuationField.equals("")) { + if ("".equals(previousContinuationField)) { // System.out.println("previousContinuationField is empty. Setting to : " + continuationField); previousContinuationField = continuationField; } @@ -1216,16 +1206,15 @@ private void pdb_SOURCE_Handler(String line) { if (previousContinuationField.equals(continuationField) && sourceFieldValues.contains(continuationField)) { - logger.debug("Still in field " + continuationField); + logger.debug("Still in field {}", continuationField); continuationString = continuationString.concat(token + " "); - logger.debug("continuationString = " - + continuationString); + logger.debug("continuationString = {}", continuationString); } if (!continuationField.equals(previousContinuationField)) { - if (continuationString.equals("")) { + if ("".equals(continuationString)) { continuationString = token; } else { @@ -1261,7 +1250,7 @@ private void sourceValueSetter(String field, String value) { value = value.trim().replace(";", ""); // System.out.println("[sourceValueSetter] " + field); - if (field.equals("MOL_ID:")) { + if ("MOL_ID:".equals(field)) { try { current_compound = entities.get(Integer.valueOf(value) - 1); @@ -1274,69 +1263,69 @@ private void sourceValueSetter(String field, String value) { // System.out.println("[sourceValueSetter] Fetching compound " + value + " " + current_compound.getMolId()); } - if (field.equals("SYNTHETIC:")) { + if ("SYNTHETIC:".equals(field)) { current_compound.setSynthetic(value); - } else if (field.equals("FRAGMENT:")) { + } else if ("FRAGMENT:".equals(field)) { current_compound.setFragment(value); - } else if (field.equals("ORGANISM_SCIENTIFIC:")) { + } else if ("ORGANISM_SCIENTIFIC:".equals(field)) { current_compound.setOrganismScientific(value); - } else if (field.equals("ORGANISM_TAXID:")) { + } else if ("ORGANISM_TAXID:".equals(field)) { current_compound.setOrganismTaxId(value); - } else if (field.equals("ORGANISM_COMMON:")) { + } else if ("ORGANISM_COMMON:".equals(field)) { current_compound.setOrganismCommon(value); - } else if (field.equals("STRAIN:")) { + } else if ("STRAIN:".equals(field)) { current_compound.setStrain(value); - } else if (field.equals("VARIANT:")) { + } else if ("VARIANT:".equals(field)) { current_compound.setVariant(value); - } else if (field.equals("CELL_LINE:")) { + } else if ("CELL_LINE:".equals(field)) { current_compound.setCellLine(value); - } else if (field.equals("ATCC:")) { + } else if ("ATCC:".equals(field)) { current_compound.setAtcc(value); - } else if (field.equals("ORGAN:")) { + } else if ("ORGAN:".equals(field)) { current_compound.setOrgan(value); - } else if (field.equals("TISSUE:")) { + } else if ("TISSUE:".equals(field)) { current_compound.setTissue(value); - } else if (field.equals("CELL:")) { + } else if ("CELL:".equals(field)) { current_compound.setCell(value); - } else if (field.equals("ORGANELLE:")) { + } else if ("ORGANELLE:".equals(field)) { current_compound.setOrganelle(value); - } else if (field.equals("SECRETION:")) { + } else if ("SECRETION:".equals(field)) { current_compound.setSecretion(value); - } else if (field.equals("GENE:")) { + } else if ("GENE:".equals(field)) { current_compound.setGene(value); - } else if (field.equals("CELLULAR_LOCATION:")) { + } else if ("CELLULAR_LOCATION:".equals(field)) { current_compound.setCellularLocation(value); - } else if (field.equals("EXPRESSION_SYSTEM:")) { + } else if ("EXPRESSION_SYSTEM:".equals(field)) { current_compound.setExpressionSystem(value); - } else if (field.equals("EXPRESSION_SYSTEM_TAXID:")) { + } else if ("EXPRESSION_SYSTEM_TAXID:".equals(field)) { current_compound.setExpressionSystemTaxId(value); - } else if (field.equals("EXPRESSION_SYSTEM_STRAIN:")) { + } else if ("EXPRESSION_SYSTEM_STRAIN:".equals(field)) { current_compound.setExpressionSystemStrain(value); - } else if (field.equals("EXPRESSION_SYSTEM_VARIANT:")) { + } else if ("EXPRESSION_SYSTEM_VARIANT:".equals(field)) { current_compound.setExpressionSystemVariant(value); - } else if (field.equals("EXPRESSION_SYSTEM_CELL_LINE:")) { + } else if ("EXPRESSION_SYSTEM_CELL_LINE:".equals(field)) { current_compound.setExpressionSystemCellLine(value); - } else if (field.equals("EXPRESSION_SYSTEM_ATCC_NUMBER:")) { + } else if ("EXPRESSION_SYSTEM_ATCC_NUMBER:".equals(field)) { current_compound.setExpressionSystemAtccNumber(value); - } else if (field.equals("EXPRESSION_SYSTEM_ORGAN:")) { + } else if ("EXPRESSION_SYSTEM_ORGAN:".equals(field)) { current_compound.setExpressionSystemOrgan(value); - } else if (field.equals("EXPRESSION_SYSTEM_TISSUE:")) { + } else if ("EXPRESSION_SYSTEM_TISSUE:".equals(field)) { current_compound.setExpressionSystemTissue(value); - } else if (field.equals("EXPRESSION_SYSTEM_CELL:")) { + } else if ("EXPRESSION_SYSTEM_CELL:".equals(field)) { current_compound.setExpressionSystemCell(value); - } else if (field.equals("EXPRESSION_SYSTEM_ORGANELLE:")) { + } else if ("EXPRESSION_SYSTEM_ORGANELLE:".equals(field)) { current_compound.setExpressionSystemOrganelle(value); - } else if (field.equals("EXPRESSION_SYSTEM_CELLULAR_LOCATION:")) { + } else if ("EXPRESSION_SYSTEM_CELLULAR_LOCATION:".equals(field)) { current_compound.setExpressionSystemCellularLocation(value); - } else if (field.equals("EXPRESSION_SYSTEM_VECTOR_TYPE:")) { + } else if ("EXPRESSION_SYSTEM_VECTOR_TYPE:".equals(field)) { current_compound.setExpressionSystemVectorType(value); - } else if (field.equals("EXPRESSION_SYSTEM_VECTOR:")) { + } else if ("EXPRESSION_SYSTEM_VECTOR:".equals(field)) { current_compound.setExpressionSystemVector(value); - } else if (field.equals("EXPRESSION_SYSTEM_PLASMID:")) { + } else if ("EXPRESSION_SYSTEM_PLASMID:".equals(field)) { current_compound.setExpressionSystemPlasmid(value); - } else if (field.equals("EXPRESSION_SYSTEM_GENE:")) { + } else if ("EXPRESSION_SYSTEM_GENE:".equals(field)) { current_compound.setExpressionSystemGene(value); - } else if (field.equals("OTHER_DETAILS:")) { + } else if ("OTHER_DETAILS:".equals(field)) { current_compound.setExpressionSystemOtherDetails(value); } @@ -1658,7 +1647,7 @@ private void pdb_ATOM_Handler(String line) { // let's first get the chain name which will serve to identify if we are starting a new molecule String chainName = line.substring(21,22); - if (chainName.equals(" ")) { + if (" ".equals(chainName)) { blankChainIdsPresent = true; } @@ -1716,7 +1705,7 @@ private void pdb_ATOM_Handler(String line) { boolean isHetAtomInFile = false; - if (recordName.equals("HETATM") ){ + if ("HETATM".equals(recordName) ){ // HETATOM RECORDS are treated slightly differently // some modified amino acids that we want to treat as amino acids // can be found as HETATOM records @@ -1808,7 +1797,7 @@ private void pdb_ATOM_Handler(String line) { if ( parseCAonly ){ // yes , user wants to get CA only // only parse CA atoms... - if (! fullname.equals(" CA ")){ + if (! " CA ".equals(fullname)){ //System.out.println("ignoring " + line); atomCount--; return; @@ -1981,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; } @@ -2032,9 +2021,9 @@ private Integer conect_helper (String line,int start,int end) { int bond = -1 ; Integer b = null ; - if ( ! sbond.equals("")) { + if ( ! "".equals(sbond)) { bond = Integer.parseInt(sbond); - b = new Integer(bond); + b = bond; } return b ; @@ -2090,8 +2079,8 @@ private void pdb_CONECT_Handler(String line) { //System.out.println(atomserial+ " "+ bond1 +" "+bond2+ " " +bond3+" "+bond4+" "+ // hyd1+" "+hyd2 +" "+salt1+" "+hyd3+" "+hyd4+" "+salt2); - HashMap cons = new HashMap(); - cons.put("atomserial",new Integer(atomserial)); + HashMap cons = new HashMap<>(); + cons.put("atomserial",atomserial); if ( bond1 != null) cons.put("bond1",bond1); if ( bond2 != null) cons.put("bond2",bond2); @@ -2174,7 +2163,7 @@ private void pdb_TER_Handler() { */ private void pdb_DBREF_Handler(String line){ - logger.debug("Parsing DBREF " + line); + logger.debug("Parsing DBREF {}", line); DBRef dbref = new DBRef(); String idCode = line.substring(7,11); @@ -2256,16 +2245,16 @@ private void pdb_SSBOND_Handler(String line){ String symop2 = line.substring(66, 72).trim(); // until we implement proper treatment of symmetry in biojava #220, we can't deal with sym-related parteners properly, skipping them - if (!symop1.equals("") && !symop2.equals("") && // in case the field is missing - (!symop1.equals("1555") || !symop2.equals("1555")) ) { + if (!"".equals(symop1) && !"".equals(symop2) && // in case the field is missing + (!"1555".equals(symop1) || !"1555".equals(symop2)) ) { logger.info("Skipping ss bond between groups {} and {} belonging to different symmetry partners, because it is not supported yet", seqNum1+icode1, seqNum2+icode2); return; } } - if (icode1.equals(" ")) + if (" ".equals(icode1)) icode1 = ""; - if (icode2.equals(" ")) + if (" ".equals(icode2)) icode2 = ""; SSBondImpl ssbond = new SSBondImpl(); @@ -2385,7 +2374,7 @@ private void pdb_SITE_Handler(String line){ // make a map of: SiteId to List - logger.debug("Site Line:"+line); + logger.debug("Site Line:{}", line); String siteID = line.substring(11, 14); @@ -2394,11 +2383,11 @@ private void pdb_SITE_Handler(String line){ //if the siteResidues doesn't yet exist, make a new one. if (siteResidues == null || ! siteToResidueMap.containsKey(siteID.trim())){ - siteResidues = new ArrayList(); + siteResidues = new ArrayList<>(); siteToResidueMap.put(siteID.trim(), siteResidues); logger.debug(String.format("New Site made: %s %s", siteID, siteResidues)); - logger.debug("Now made " + siteMap.size() + " sites"); + logger.debug("Now made {} sites", siteMap.size()); } @@ -2411,10 +2400,10 @@ private void pdb_SITE_Handler(String line){ String groupString = null; //groupString = 'ARG H 221A' //keep iterating through chunks of 10 characters - these are the groups in the siteResidues - while (!(groupString = line.substring(0, 10)).equals(" ")) { + while (!" ".equals((groupString = line.substring(0, 10)))) { //groupstring: 'ARG H 221A' - logger.debug("groupString: '" + groupString + "'"); + logger.debug("groupString: '{}'", groupString); //set the residue name //residueName = 'ARG' @@ -2444,7 +2433,7 @@ private void pdb_SITE_Handler(String line){ ResidueNumber residueNumber = new ResidueNumber(); - logger.debug("pdbCode: '" + resNum + insCode + "'"); + logger.debug("pdbCode: '{}{}'", resNum, insCode); residueNumber.setChainName(chainId); residueNumber.setSeqNum(resNum); @@ -2457,7 +2446,7 @@ private void pdb_SITE_Handler(String line){ line = line.substring(11); } - logger.debug("Current SiteMap (contains "+ siteToResidueMap.keySet().size() + " sites):"); + logger.debug("Current SiteMap (contains {} sites):", siteToResidueMap.keySet().size()); for (String key : siteToResidueMap.keySet()) { logger.debug(key + " : " + siteToResidueMap.get(key)); } @@ -2477,11 +2466,11 @@ private void pdb_REMARK_800_Handler(String line){ String[] fields = line.split(": "); if (fields.length == 2) { - if (fields[0].equals("SITE_IDENTIFIER")) { + if ("SITE_IDENTIFIER".equals(fields[0])) { // remark800Counter++; String siteID = fields[1].trim(); - logger.debug("siteID: '" + siteID +"'"); + logger.debug("siteID: '{}'", siteID); //fetch the siteResidues from the map site = siteMap.get(siteID); @@ -2491,30 +2480,30 @@ private void pdb_REMARK_800_Handler(String line){ site = new Site(siteID, new ArrayList()); siteMap.put(site.getSiteID(), site); - logger.debug("New Site made: " + site); - logger.debug("Now made " + siteMap.size() + " sites"); + logger.debug("New Site made: {}", site); + logger.debug("Now made {} sites", siteMap.size()); } } - if (fields[0].equals("EVIDENCE_CODE")) { + if ("EVIDENCE_CODE".equals(fields[0])) { // remark800Counter++; String evCode = fields[1].trim(); - logger.debug("evCode: '" + evCode +"'"); + logger.debug("evCode: '{}'", evCode); //fetch the siteResidues from the map site.setEvCode(evCode); } - if (fields[0].equals("SITE_DESCRIPTION")) { + if ("SITE_DESCRIPTION".equals(fields[0])) { // remark800Counter++; String desc = fields[1].trim(); - logger.debug("desc: '" + desc +"'"); + logger.debug("desc: '{}'", desc); //fetch the siteResidues from the map site.setDescription(desc); - logger.debug("Finished making REMARK 800 for site " + site.getSiteID()); + logger.debug("Finished making REMARK 800 for site {}", site.getSiteID()); logger.debug(site.remark800toPDB()); } @@ -2611,10 +2600,10 @@ public Structure parsePDBFile(BufferedReader buf) startOfMolecule = true; startOfModel = true; - seqResChains = new ArrayList(); - siteMap = new LinkedHashMap(); + seqResChains = new ArrayList<>(); + siteMap = new LinkedHashMap<>(); pdbHeader = new PDBHeader(); - connects = new ArrayList>(); + connects = new ArrayList<>(); previousContinuationField = ""; continuationField = ""; continuationString = ""; @@ -2632,7 +2621,7 @@ public Structure parsePDBFile(BufferedReader buf) lengthCheck = -1; atomCount = 0; atomOverflow = false; - linkRecords = new ArrayList(); + linkRecords = new ArrayList<>(); siteToResidueMap.clear(); blankChainIdsPresent = false; @@ -2644,7 +2633,7 @@ public Structure parsePDBFile(BufferedReader buf) while ((line = buf.readLine()) != null) { // ignore empty lines - if ( line.equals("") || + if ( "".equals(line) || (line.equals(NEWLINE))){ continue; } @@ -2667,54 +2656,54 @@ public Structure parsePDBFile(BufferedReader buf) recordName = line.substring (0, 6).trim (); try { - if (recordName.equals("ATOM")) + if ("ATOM".equals(recordName)) pdb_ATOM_Handler(line); - else if (recordName.equals("SEQRES")) + else if ("SEQRES".equals(recordName)) pdb_SEQRES_Handler(line); - else if (recordName.equals("HETATM")) + else if ("HETATM".equals(recordName)) pdb_ATOM_Handler(line); - else if (recordName.equals("MODEL")) + else if ("MODEL".equals(recordName)) pdb_MODEL_Handler(line); - else if (recordName.equals("TER")) + else if ("TER".equals(recordName)) pdb_TER_Handler(); - else if (recordName.equals("HEADER")) + else if ("HEADER".equals(recordName)) pdb_HEADER_Handler(line); - else if (recordName.equals("AUTHOR")) + else if ("AUTHOR".equals(recordName)) pdb_AUTHOR_Handler(line); - else if (recordName.equals("TITLE")) + else if ("TITLE".equals(recordName)) pdb_TITLE_Handler(line); - else if (recordName.equals("SOURCE")) + else if ("SOURCE".equals(recordName)) sourceLines.add(line); //pdb_SOURCE_Handler - else if (recordName.equals("COMPND")) + else if ("COMPND".equals(recordName)) compndLines.add(line); //pdb_COMPND_Handler - else if (recordName.equals("KEYWDS")) + else if ("KEYWDS".equals(recordName)) keywordsLines.add(line); - else if (recordName.equals("JRNL")) + else if ("JRNL".equals(recordName)) pdb_JRNL_Handler(line); - else if (recordName.equals("EXPDTA")) + else if ("EXPDTA".equals(recordName)) pdb_EXPDTA_Handler(line); - else if (recordName.equals("CRYST1")) + else if ("CRYST1".equals(recordName)) pdb_CRYST1_Handler(line); else if (recordName.startsWith("MTRIX")) pdb_MTRIXn_Handler(line); - else if (recordName.equals("REMARK")) + else if ("REMARK".equals(recordName)) pdb_REMARK_Handler(line); - else if (recordName.equals("CONECT")) + else if ("CONECT".equals(recordName)) pdb_CONECT_Handler(line); - else if (recordName.equals("REVDAT")) + else if ("REVDAT".equals(recordName)) pdb_REVDAT_Handler(line); - else if (recordName.equals("DBREF")) + else if ("DBREF".equals(recordName)) pdb_DBREF_Handler(line); - else if (recordName.equals("SITE")) + else if ("SITE".equals(recordName)) pdb_SITE_Handler(line); - else if (recordName.equals("SSBOND")) + else if ("SSBOND".equals(recordName)) pdb_SSBOND_Handler(line); - else if (recordName.equals("LINK")) + else if ("LINK".equals(recordName)) pdb_LINK_Handler(line); else if ( params.isParseSecStruc()) { - if ( recordName.equals("HELIX") ) pdb_HELIX_Handler ( line ) ; - else if (recordName.equals("SHEET")) pdb_SHEET_Handler(line ) ; - else if (recordName.equals("TURN")) pdb_TURN_Handler( line ) ; + if ( "HELIX".equals(recordName) ) pdb_HELIX_Handler ( line ) ; + else if ("SHEET".equals(recordName)) pdb_SHEET_Handler(line ) ; + else if ("TURN".equals(recordName)) pdb_TURN_Handler( line ) ; } } catch (StringIndexOutOfBoundsException | NullPointerException ex) { logger.info("Unable to parse [" + line + "]"); @@ -2773,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); @@ -2823,7 +2812,7 @@ private void handlePDBKeywords(List lines) { } String fulllengthList = fullList.toString(); keywords = fulllengthList.split("( )*,( )*"); - ArrayList lst = new ArrayList(keywords.length); + ArrayList lst = new ArrayList<>(keywords.length); for (String keyword : keywords) { if(keyword.length() == 0) { logger.debug("Keyword empty in structure {}", structure.getIdentifier().toString()); @@ -2999,9 +2988,9 @@ private void setSecElement(List> secList, String assignment, String endSeqNum = m.get("endSeqNum"); String endICode = m.get("endICode"); - if (initICode.equals(" ")) + if (" ".equals(initICode)) initICode = ""; - if (endICode.equals(" ")) + if (" ".equals(endICode)) endICode = ""; GroupIterator gi = new GroupIterator(structure); @@ -3149,13 +3138,13 @@ private void assignAsymIds(List> polys, List> nonPolys, */ private String getNextAsymId(String asymId) { if (asymId.length()==1) { - if (!asymId.equals("Z")) { + if (!"Z".equals(asymId)) { return Character.toString(getNextChar(asymId.charAt(0))); } else { return "AA"; } } else if (asymId.length()==2) { - if (asymId.equals("ZZ")) { + if ("ZZ".equals(asymId)) { return "AAA"; } char[] c = new char[2]; @@ -3164,7 +3153,7 @@ private String getNextAsymId(String asymId) { if (c[0]=='A') { c[1] = getNextChar(c[1]); } - return new String(c); + return String.valueOf(c); } else if (asymId.length()==3) { char[] c = new char[3]; asymId.getChars(0, 3, c, 0); @@ -3175,7 +3164,7 @@ private String getNextAsymId(String asymId) { c[2] = getNextChar(c[2]); } } - return new String(c); + return String.valueOf(c); } return null; } @@ -3328,7 +3317,7 @@ private void linkSitesToGroups() { List sites = null; //check that there are chains with which to associate the groups if (structure.getChains().isEmpty()) { - sites = new ArrayList(siteMap.values()); + sites = new ArrayList<>(siteMap.values()); logger.info("No chains to link Site Groups with - Sites will not be present in the Structure"); return; } @@ -3371,7 +3360,7 @@ private void linkSitesToGroups() { //System.out.println("SITEMAP: " + siteMap); - sites = new ArrayList(siteMap.values()); + sites = new ArrayList<>(siteMap.values()); structure.setSites(sites); //System.out.println("STRUCTURE SITES: " + structure.getSites().size()); // for (Site site : structure.getSites()) { @@ -3414,62 +3403,62 @@ private void buildjournalArticle() { // System.out.println("'" + line + "'"); String subField = line.substring(12, 16); // System.out.println("'" + subField + "'"); - if (subField.equals("AUTH")) { + if ("AUTH".equals(subField)) { auth.append(line.substring(19, line.length()).trim()); - logger.debug("AUTH '" + auth.toString() + "'"); + logger.debug("AUTH '{}'", auth.toString()); } - if (subField.equals("TITL")) { + if ("TITL".equals(subField)) { //add a space to the end of a line so that when wrapped the //words on the join won't be concatenated titl.append(line.substring(19, line.length()).trim()).append(" "); - logger.debug("TITL '" + titl.toString() + "'"); + logger.debug("TITL '{}'", titl.toString()); } - if (subField.equals("EDIT")) { + if ("EDIT".equals(subField)) { edit.append(line.substring(19, line.length()).trim()); - logger.debug("EDIT '" + edit.toString() + "'"); + logger.debug("EDIT '{}'", edit.toString()); } // JRNL REF NAT.IMMUNOL. V. 8 430 2007 - if (subField.equals("REF ")) { + if ("REF ".equals(subField)) { ref.append(line.substring(19, line.length()).trim()).append(" "); - logger.debug("REF '" + ref.toString() + "'"); + logger.debug("REF '{}'", ref.toString()); } - if (subField.equals("PUBL")) { + if ("PUBL".equals(subField)) { publ.append(line.substring(19, line.length()).trim()).append(" "); - logger.debug("PUBL '" + publ.toString() + "'"); + logger.debug("PUBL '{}'", publ.toString()); } // JRNL REFN ISSN 1529-2908 - if (subField.equals("REFN")) { + if ("REFN".equals(subField)) { if ( line.length() < 35 ) { logger.info("can not process Journal REFN line: " + line); continue; } refn.append(line.substring(35, line.length()).trim()); - logger.debug("REFN '" + refn.toString() + "'"); + logger.debug("REFN '{}'", refn.toString()); } // JRNL PMID 17351618 - if (subField.equals("PMID")) { + if ("PMID".equals(subField)) { pmid.append(line.substring(19, line.length()).trim()); - logger.debug("PMID '" + pmid.toString() + "'"); + logger.debug("PMID '{}'", pmid.toString()); } // JRNL DOI 10.1038/NI1450 - if (subField.equals("DOI ")) { + if ("DOI ".equals(subField)) { doi.append(line.substring(19, line.length()).trim()); - logger.debug("DOI '" + doi.toString() + "'"); + logger.debug("DOI '{}'", doi.toString()); } } @@ -3480,7 +3469,7 @@ private void buildjournalArticle() { journalArticle.setRef(ref.toString()); JournalParser journalParser = new JournalParser(ref.toString()); journalArticle.setJournalName(journalParser.getJournalName()); - if (!journalArticle.getJournalName().equals("TO BE PUBLISHED")) { + if (!"TO BE PUBLISHED".equals(journalArticle.getJournalName())) { journalArticle.setIsPublished(true); } journalArticle.setVolume(journalParser.getVolume()); @@ -3509,10 +3498,10 @@ private class JournalParser { public JournalParser(String ref) { - logger.debug("JournalParser init '" + ref + "'"); + logger.debug("JournalParser init '{}'", ref); - if (ref.equals("TO BE PUBLISHED ")) { + if ("TO BE PUBLISHED ".equals(ref)) { journalName = ref.trim(); logger.debug(String.format("JournalParser found journalString '%s'", journalName)); @@ -3571,7 +3560,7 @@ public JournalParser(String ref) { logger.debug(String.format("JournalParser found journalString '%s'", journalString)); - if (!dateString.equals(" ")) { + if (!" ".equals(dateString)) { try { publicationDate = Integer.valueOf(dateString); } catch (NumberFormatException nfe) { @@ -3582,24 +3571,24 @@ public JournalParser(String ref) { // } } - if (!startPageString.equals(" ")) { + if (!" ".equals(startPageString)) { startPage = startPageString; // if (DEBUG) { // System.out.println("JournalParser set startPage " + startPage); // } } - if (!volumeString.equals(" ")) { + if (!" ".equals(volumeString)) { volume = volumeString; // if (DEBUG) { // System.out.println("JournalParser set volume " + volume); // } } - if (!journalString.equals(" ")) { + if (!" ".equals(journalString)) { journalName = journalString; - logger.debug("JournalParser set journalName " + journalName); + logger.debug("JournalParser set journalName {}", journalName); } } @@ -3622,9 +3611,9 @@ private String getVolume() { } private List authorBuilder(String authorString) { - ArrayList authorList = new ArrayList(); + ArrayList authorList = new ArrayList<>(); - if (authorString.equals("")) { + if ("".equals(authorString)) { return authorList; } @@ -3649,14 +3638,14 @@ private List authorBuilder(String authorString) { Author author = new Author(); author.setSurname(authors[0]); - logger.debug("Set consortium author name " + author.getSurname()); + logger.debug("Set consortium author name {}", author.getSurname()); authorList.add(author); } else { for (int i = 0; i < authors.length; i++) { String authorFullName = authors[i]; - logger.debug("Building author " + authorFullName); + logger.debug("Building author {}", authorFullName); Author author = new Author(); String regex = "\\."; @@ -3679,7 +3668,7 @@ private List authorBuilder(String authorString) { else if (authorNames.length == 1) { author.setSurname(authorNames[0]); - logger.debug("Set consortium author name in multiple author block " + author.getSurname + logger.debug("Set consortium author name in multiple author block {}", author.getSurname ()); } else { @@ -3693,14 +3682,14 @@ else if (authorNames.length == 1) { initials += initial + "."; } - logger.debug("built initials '" + initials + "'"); + logger.debug("built initials '{}'", initials); author.setInitials(initials); //surname is always last int lastName = authorNames.length - 1; String surname = authorNames[lastName]; - logger.debug("built author surname " + surname); + logger.debug("built author surname {}", surname); author.setSurname(surname); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileReader.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileReader.java index 5591fbdd84..dec97b4f61 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileReader.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileReader.java @@ -30,27 +30,17 @@ import java.io.InputStream; /** - *

      * The wrapper class for parsing a PDB file. - *

      - * * - *

      + *

      * Several flags can be set for this class - *

        - * - *
      • {@link #setAutoFetch(boolean)} - if the PDB file can not be found locally, should it be fetched - * from the PDB ftp servers? (default:false)
      • - *
      • Other parameters can be set using the {@link #setFileParsingParameters(FileParsingParameters)}
      • - *
      - *

      - * - * + *
        + *
      • Parameters can be set using the {@link #setFileParsingParameters(FileParsingParameters)}
      • + *
      * *

      Example

      *

      * Q: How can I get a Structure object from a PDB file? - *

      *

      * A: *

      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SSBondImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SSBondImpl.java
      index ae3aaab9ae..bdf132b31a 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SSBondImpl.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SSBondImpl.java
      @@ -261,8 +261,8 @@ public static List getSsBondListFromBondList(List bonds) {
       	 */
       	public static SSBondImpl toSsBond(Bond bond) {
       
      -		if (!bond.getAtomA().getGroup().getPDBName().equals("CYS") ||
      -			!bond.getAtomB().getGroup().getPDBName().equals("CYS")    ) {
      +		if (!"CYS".equals(bond.getAtomA().getGroup().getPDBName()) ||
      +			!"CYS".equals(bond.getAtomB().getGroup().getPDBName())    ) {
       
       			throw new IllegalArgumentException("Trying to create a SSBond from a Bond between 2 groups that are not CYS");
       		}
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java
      index 53e38c3463..7ee21de4b4 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java
      @@ -312,7 +312,7 @@ private List trySimpleMatch(List seqResGroups,List atmResGr
       			//			}
       
       			if ( seqResPos >= seqResGroups.size()){
      -				logger.debug("seqres groups don't match atom indices " + seqResPos);
      +				logger.debug("seqres groups don't match atom indices {}", seqResPos);
       				if ( atomResGroup instanceof AminoAcid )
       					return null;
       				else
      @@ -411,7 +411,7 @@ public static String getFullAtomSequence(List groups, Map groups, Map seqRes, List atomRes) {
       
      -		Map seqresIndexPosition = new HashMap();
      -		Map atomIndexPosition   = new HashMap();
      +		Map seqresIndexPosition = new HashMap<>();
      +		Map atomIndexPosition   = new HashMap<>();
       
       		String seq1 = getFullAtomSequence(seqRes, seqresIndexPosition, true);
       		//
      @@ -521,7 +521,7 @@ private boolean alignNucleotideGroups(List seqRes, List atomRes) {
       
       
       
      -		logger.debug("Alignment:\n"+pair.toString(100));
      +		logger.debug("Alignment:\n{}", pair.toString(100));
       
       
       		boolean noMatchFound = mapDNAChains(seqRes,atomRes,pair,seqresIndexPosition, atomIndexPosition );
      @@ -573,8 +573,8 @@ private Sequence getNucleotideSequence(String seq) {
       	 */
       	private boolean alignProteinChains(List seqRes, List atomRes) {
       
      -		Map seqresIndexPosition = new HashMap();
      -		Map atomIndexPosition   = new HashMap();
      +		Map seqresIndexPosition = new HashMap<>();
      +		Map atomIndexPosition   = new HashMap<>();
       
       		String seq1 = getFullAtomSequence(seqRes, seqresIndexPosition, false);
       		//
      @@ -617,7 +617,7 @@ private boolean alignProteinChains(List seqRes, List atomRes) {
       		}
       
       
      -		logger.debug("Alignment:\n"+pair.toString(100));
      +		logger.debug("Alignment:\n{}", pair.toString(100));
       
       
       		boolean noMatchFound = mapChains(seqRes,atomRes,pair,seqresIndexPosition, atomIndexPosition );
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java
      index 252c9422dc..529526e2e0 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java
      @@ -59,8 +59,7 @@ public class StructureSequenceMatcher {
       	 * @param sequence The input protein sequence
       	 * @param wholeStructure The structure from which to take a substructure
       	 * @return The resulting structure
      -	 * @throws StructureException
      -	 * @see {@link #matchSequenceToStructure(ProteinSequence, Structure)}
      +	 * @see #matchSequenceToStructure(ProteinSequence, Structure)
       	 */
       	public static Structure getSubstructureMatchingProteinSequence(ProteinSequence sequence, Structure wholeStructure) {
       		ResidueNumber[] rns = matchSequenceToStructure(sequence, wholeStructure);
      @@ -104,8 +103,7 @@ public static Structure getSubstructureMatchingProteinSequence(ProteinSequence s
       	 * @return A ProteinSequence with the full sequence of struct. Chains are
       	 *  concatenated in the same order as the input structures
       	 *
      -	 * @see {@link SeqRes2AtomAligner#getFullAtomSequence(List, Map)}, which
      -	 * 	does the heavy lifting.
      +	 * @see SeqRes2AtomAligner#getFullAtomSequence(List, Map, boolean)
       	 *
       	 */
       	public static ProteinSequence getProteinSequenceForStructure(Structure struct, Map groupIndexPosition ) {
      @@ -118,7 +116,7 @@ public static ProteinSequence getProteinSequenceForStructure(Structure struct, M
       
       		for(Chain chain : struct.getChains()) {
       			List groups = chain.getAtomGroups();
      -			Map chainIndexPosition = new HashMap();
      +			Map chainIndexPosition = new HashMap<>();
       			int prevLen = seqStr.length();
       
       			// get the sequence for this chain
      @@ -162,7 +160,7 @@ public static ProteinSequence getProteinSequenceForStructure(Structure struct, M
       	public static ResidueNumber[] matchSequenceToStructure(ProteinSequence seq, Structure struct) {
       
       		//1. Create ProteinSequence for struct while remembering to which group each residue corresponds
      -		Map atomIndexPosition   = new HashMap();
      +		Map atomIndexPosition   = new HashMap<>();
       
       		ProteinSequence structSeq = getProteinSequenceForStructure(struct,atomIndexPosition);
       
      @@ -171,10 +169,10 @@ public static ResidueNumber[] matchSequenceToStructure(ProteinSequence seq, Stru
       		// Identity substitution matrix with +1 for match, -1 for mismatch
       		// TODO
       		SubstitutionMatrix matrix =
      -			new SimpleSubstitutionMatrix(
      +			new SimpleSubstitutionMatrix<>(
       					AminoAcidCompoundSet.getAminoAcidCompoundSet(),
       					(short)1, (short)-1 );
      -		matrix = new SimpleSubstitutionMatrix(
      +		matrix = new SimpleSubstitutionMatrix<>(
       				AminoAcidCompoundSet.getAminoAcidCompoundSet(),
       				new InputStreamReader(
       						SimpleSubstitutionMatrix.class.getResourceAsStream("/matrices/blosum100.txt")),
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/AbstractCifFileSupplier.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/AbstractCifFileSupplier.java
      index 826d9588ef..7e9d8ad7ac 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/AbstractCifFileSupplier.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/AbstractCifFileSupplier.java
      @@ -308,7 +308,12 @@ public void accept(WrappedAtom wrappedAtom) {
                       }
                   }
                   labelEntityId.add(entityId);
      -            labelSeqId.add(seqId);
      +            // see https://github.com/biojava/biojava/issues/1116
      +            if (chain.getEntityInfo().getType() == EntityType.POLYMER) {
      +                labelSeqId.add(seqId);
      +            } else {
      +                labelSeqId.markNextNotPresent();
      +            }
                   String insCode = "";
                   if (group.getResidueNumber().getInsCode() != null) {
                       insCode = Character.toString(group.getResidueNumber().getInsCode());
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java
      index fb3214be96..67514edd84 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/cif/CifStructureConsumerImpl.java
      @@ -217,7 +217,8 @@ public void consumeAtomSite(AtomSite atomSite) {
                       isHetAtmInFile = true;
                   }
       
      -            String insCodeString = pdbxPDBInsCode.get(atomIndex);
      +            String insCodeString = pdbxPDBInsCode.isDefined()? pdbxPDBInsCode.get(atomIndex) : null;
      +
                   Character insCode = null;
                   if (insCodeString != null && !insCodeString.isEmpty() && !"?".equals(insCodeString)) {
                       insCode = insCodeString.charAt(0);
      @@ -246,7 +247,8 @@ public void consumeAtomSite(AtomSite atomSite) {
                   }
       
                   String asymId = labelAsymId.get(atomIndex);
      -            String authId = authAsymId.get(atomIndex);
      +            String authId = authAsymId.isDefined()? authAsymId.get(atomIndex) : asymId;
      +
                   if (currentChain == null) {
                       currentChain = new ChainImpl();
                       currentChain.setName(authId);
      @@ -277,7 +279,9 @@ public void consumeAtomSite(AtomSite atomSite) {
                       }
                   }
       
      -            ResidueNumber residueNumber = new ResidueNumber(authId, authSeqId.get(atomIndex), insCode);
      +            int authSeqIdInt = authSeqId.isDefined()? authSeqId.get(atomIndex) : (int)seqId;
      +
      +            ResidueNumber residueNumber = new ResidueNumber(authId, authSeqIdInt, insCode);
       
                   String recordName = groupPDB.get(atomIndex);
                   String compId = labelCompId.get(atomIndex);
      @@ -289,7 +293,7 @@ public void consumeAtomSite(AtomSite atomSite) {
                   }
       
                   Group altGroup = null;
      -            String altLocation = labelAltId.get(atomIndex);
      +            String altLocation = labelAltId.isDefined()? labelAltId.get(atomIndex) : null;
       
                   if (startOfNewChain) {
                       currentGroup = createGroup(recordName, oneLetterCode, compId, seqId);
      @@ -305,7 +309,7 @@ public void consumeAtomSite(AtomSite atomSite) {
                           currentGroup.setResidueNumber(residueNumber);
                           currentGroup.setHetAtomInFile(isHetAtmInFile);
                       } else {
      -                    if (altLocation != null && !altLocation.isEmpty() && !altLocation.equals(".")) {
      +                    if (altLocation != null && !altLocation.isEmpty() && !".".equals(altLocation)) {
                               altGroup = getAltLocGroup(recordName, altLocation.charAt(0), oneLetterCode, compId, seqId);
                               if (altGroup.getChain() == null) {
                                   altGroup.setChain(currentChain);
      @@ -329,10 +333,10 @@ public void consumeAtomSite(AtomSite atomSite) {
                   atom.setY(cartnY.get(atomIndex));
                   atom.setZ(cartnZ.get(atomIndex));
       
      -            atom.setOccupancy((float) occupancy.get(atomIndex));
      +            atom.setOccupancy((float) (occupancy.isDefined()? occupancy.get(atomIndex) : 1.0));
                   atom.setTempFactor((float) bIsoOrEquiv.get(atomIndex));
       
      -            if (altLocation == null || altLocation.isEmpty() || altLocation.equals(".")) {
      +            if (altLocation == null || altLocation.isEmpty() || ".".equals(altLocation)) {
                       atom.setAltLoc(' ');
                   } else {
                       atom.setAltLoc(altLocation.charAt(0));
      @@ -556,8 +560,7 @@ public void consumeCell(Cell cell) {
                       // If the entry describes a structure determined by a technique other than X-ray crystallography,
                       // cell is (sometimes!) a = b = c = 1.0, alpha = beta = gamma = 90 degrees
                       // if so we don't add and CrystalCell will be null
      -                logger.debug("The crystal cell read from file does not have reasonable dimensions (at least one " +
      -                        "dimension is below {}), discarding it.", CrystalCell.MIN_VALID_CELL_SIZE);
      +                logger.debug("The crystal cell read from file does not have reasonable dimensions (at least one dimension is below {}), discarding it.", CrystalCell.MIN_VALID_CELL_SIZE);
                       return;
                   }
       
      @@ -613,7 +616,7 @@ private Date convert(LocalDate localDate) {
       
           @Override
           public void consumeDatabasePDBRev(DatabasePDBRev databasePDBrev) {
      -        logger.debug("got a database revision:" + databasePDBrev);
      +        logger.debug("got a database revision:{}", databasePDBrev);
       
               Date modDate = null;
               for (int rowIndex = 0; rowIndex < databasePDBrev.getRowCount(); rowIndex++) {
      @@ -711,8 +714,7 @@ public void consumeEntityPolySeq(EntityPolySeq entityPolySeq) {
                           // the group is actually a nucleotide group...
                           g = new NucleotideImpl();
                       } else {
      -                    logger.debug("Residue {} {} is not a standard aminoacid or nucleotide, will create a het group " +
      -                            "for it", entityPolySeq.getNum().get(rowIndex), entityPolySeq.getMonId().get(rowIndex));
      +                    logger.debug("Residue {} {} is not a standard aminoacid or nucleotide, will create a het group for it", entityPolySeq.getNum().get(rowIndex), entityPolySeq.getMonId().get(rowIndex));
                           g = new HetatomImpl();
                       }
                   }
      @@ -932,7 +934,7 @@ public void consumeStructConnType(StructConnType structConnType) {
       
           @Override
           public void consumeStructKeywords(StructKeywords structKeywords) {
      -        ArrayList keywordsList = new ArrayList();
      +        ArrayList keywordsList = new ArrayList<>();
       
               StrColumn text = structKeywords.getText();
               if (text.isDefined()) {
      @@ -970,10 +972,10 @@ public void consumeStructRefSeq(StructRefSeq structRefSeq) {
       
                   DBRef dbRef = new DBRef();
       
      -            dbRef.setIdCode(structRefSeq.getPdbxPDBIdCode().get(rowIndex));
      -            dbRef.setDbAccession(structRefSeq.getPdbxDbAccession().get(rowIndex));
      -            dbRef.setDbIdCode(structRefSeq.getPdbxDbAccession().get(rowIndex));
      -            dbRef.setChainName(structRefSeq.getPdbxStrandId().get(rowIndex));
      +            dbRef.setIdCode(structRefSeq.getPdbxPDBIdCode().isDefined()? structRefSeq.getPdbxPDBIdCode().get(rowIndex):null);
      +            dbRef.setDbAccession(structRefSeq.getPdbxDbAccession().isDefined()? structRefSeq.getPdbxDbAccession().get(rowIndex):null);
      +            dbRef.setDbIdCode(structRefSeq.getPdbxDbAccession().isDefined()? structRefSeq.getPdbxDbAccession().get(rowIndex):null);
      +            dbRef.setChainName(structRefSeq.getPdbxStrandId().isDefined()? structRefSeq.getPdbxStrandId().get(rowIndex):null);
       
                   OptionalInt structRefRowIndex = IntStream.range(0, structRef.getRowCount())
                           .filter(i -> structRef.getId().get(i).equals(refId))
      @@ -988,34 +990,39 @@ public void consumeStructRefSeq(StructRefSeq structRefSeq) {
       
                   int seqBegin;
                   int seqEnd;
      +            char beginInsCode = ' ';
      +            char endInsCode = ' ';
       
      -            try {
      -                seqBegin = Integer.parseInt(structRefSeq.getPdbxAuthSeqAlignBeg().get(rowIndex));
      -                seqEnd = Integer.parseInt(structRefSeq.getPdbxAuthSeqAlignEnd().get(rowIndex));
      -            } catch (NumberFormatException e) {
      -                // this happens in a few entries, annotation error? e.g. 6eoj
      -                logger.warn("Couldn't parse pdbx_auth_seq_align_beg/end in _struct_ref_seq. Will not store dbref " +
      -                        "alignment info for accession {}. Error: {}", dbRef.getDbAccession(), e.getMessage());
      -                return;
      -            }
      +            if (structRefSeq.getPdbxAuthSeqAlignBeg().isDefined() && structRefSeq.getPdbxAuthSeqAlignEnd().isDefined()) {
      +                try {
      +                    seqBegin = Integer.parseInt(structRefSeq.getPdbxAuthSeqAlignBeg().get(rowIndex));
      +                    seqEnd = Integer.parseInt(structRefSeq.getPdbxAuthSeqAlignEnd().get(rowIndex));
      +                } catch (NumberFormatException e) {
      +                    // this happens in a few entries, annotation error? e.g. 6eoj
      +                    logger.warn("Couldn't parse pdbx_auth_seq_align_beg/end in _struct_ref_seq. Will not store dbref " +
      +                            "alignment info for accession {}. Error: {}", dbRef.getDbAccession(), e.getMessage());
      +                    return;
      +                }
       
      -            char beginInsCode = ' ';
      -            String pdbxSeqAlignBegInsCode = structRefSeq.getPdbxSeqAlignBegInsCode().get(rowIndex);
      -            if (pdbxSeqAlignBegInsCode.length() > 0) {
      -                beginInsCode = pdbxSeqAlignBegInsCode.charAt(0);
      -            }
      +                String pdbxSeqAlignBegInsCode = structRefSeq.getPdbxSeqAlignBegInsCode().get(rowIndex);
      +                if (pdbxSeqAlignBegInsCode.length() > 0) {
      +                    beginInsCode = pdbxSeqAlignBegInsCode.charAt(0);
      +                }
       
      -            char endInsCode = ' ';
      -            String pdbxSeqAlignEndInsCode = structRefSeq.getPdbxSeqAlignEndInsCode().get(rowIndex);
      -            if (pdbxSeqAlignEndInsCode.length() > 0) {
      -                endInsCode = pdbxSeqAlignEndInsCode.charAt(0);
      -            }
      +                String pdbxSeqAlignEndInsCode = structRefSeq.getPdbxSeqAlignEndInsCode().get(rowIndex);
      +                if (pdbxSeqAlignEndInsCode.length() > 0) {
      +                    endInsCode = pdbxSeqAlignEndInsCode.charAt(0);
      +                }
       
      -            if (beginInsCode == '?') {
      -                beginInsCode = ' ';
      -            }
      -            if (endInsCode == '?') {
      -                endInsCode = ' ';
      +                if (beginInsCode == '?') {
      +                    beginInsCode = ' ';
      +                }
      +                if (endInsCode == '?') {
      +                    endInsCode = ' ';
      +                }
      +            } else {
      +                seqBegin = structRefSeq.getSeqAlignBeg().get(rowIndex);
      +                seqEnd = structRefSeq.getSeqAlignEnd().get(rowIndex);
                   }
       
                   dbRef.setSeqBegin(seqBegin);
      @@ -1154,7 +1161,7 @@ public void finish() {
                       currentModel.add(currentChain);
                   }
               } else if (!params.isHeaderOnly()) {
      -            logger.warn("current chain is null at end of document.");
      +            logger.warn("No chains were instantiated after parsing the whole CIF document. This could be due to the atom_site category being absent");
               }
       
               allModels.add(currentModel);
      @@ -1290,17 +1297,21 @@ public void finish() {
                   SeqMisMatch seqMisMatch = new SeqMisMatchImpl();
                   seqMisMatch.setDetails(structRefSeqDif.getDetails().get(rowIndex));
       
      -            String insCode = structRefSeqDif.getPdbxPdbInsCode().get(rowIndex);
      -                if (insCode != null && insCode.equals("?")) {
      -                insCode = null;
      +            String insCode = null;
      +            if (structRefSeqDif.getPdbxPdbInsCode().isDefined()) {
      +                insCode = structRefSeqDif.getPdbxPdbInsCode().get(rowIndex);
      +                if ("?".equals(insCode)) {
      +                    insCode = null;
      +                }
                   }
                   seqMisMatch.setInsCode(insCode);
                   seqMisMatch.setOrigGroup(structRefSeqDif.getDbMonId().get(rowIndex));
                   seqMisMatch.setPdbGroup(structRefSeqDif.getMonId().get(rowIndex));
      -            seqMisMatch.setPdbResNum(structRefSeqDif.getPdbxAuthSeqNum().get(rowIndex));
      -            seqMisMatch.setUniProtId(structRefSeqDif.getPdbxSeqDbAccessionCode().get(rowIndex));
      +            seqMisMatch.setPdbResNum(structRefSeqDif.getPdbxAuthSeqNum().isDefined()? structRefSeqDif.getPdbxAuthSeqNum().get(rowIndex):null);
      +            seqMisMatch.setUniProtId(structRefSeqDif.getPdbxSeqDbAccessionCode().isDefined()? structRefSeqDif.getPdbxSeqDbAccessionCode().get(rowIndex):null);
                   seqMisMatch.setSeqNum(structRefSeqDif.getSeqNum().get(rowIndex));
       
      +            if (!structRefSeqDif.getPdbxPdbStrandId().isDefined()) continue;
                   String strandId = structRefSeqDif.getPdbxPdbStrandId().get(rowIndex);
                   List seqMisMatches = misMatchMap.computeIfAbsent(strandId, k -> new ArrayList<>());
                   seqMisMatches.add(seqMisMatch);
      @@ -1328,7 +1339,7 @@ private String getEntityType(String entityId) {
           private String getEntityDescription(String entityId) {
               return IntStream.range(0, entity.getRowCount())
                       .filter(i -> entity.getId().get(i).equals(entityId))
      -                .mapToObj(i -> entity.getPdbxDescription().get(i))
      +                .mapToObj(i -> entity.getPdbxDescription().isDefined()? entity.getPdbxDescription().get(i):"")
                       .findFirst()
                       .orElseThrow(() -> new NoSuchElementException("could not find entity with id " + entityId));
           }
      @@ -1505,7 +1516,7 @@ private void addSites() {
                   String auth_seq_id = structSiteGen.getAuthSeqId().get(rowIndex); // Res num
       
                   String insCode = structSiteGen.getPdbxAuthInsCode().get(rowIndex);
      -            if (insCode != null && insCode.equals("?")) {
      +            if ("?".equals(insCode)) {
                       insCode = null;
                   }
       
      @@ -1591,8 +1602,7 @@ private static Chain removeSeqResHeterogeneity(Chain c) {
                   if (lastResNum == null || !lastResNum.equals(currentResNum)) {
                       trimmedChain.addGroup(g);
                   } else {
      -                logger.debug("Removing seqres group because it seems to be repeated in entity_poly_seq, most likely " +
      -                        "has hetero='y': {}", g);
      +                logger.debug("Removing seqres group because it seems to be repeated in entity_poly_seq, most likely has hetero='y': {}", g);
                   }
                   lastResNum = currentResNum;
       
      @@ -1813,6 +1823,10 @@ private void initMaps() {
       
                   String[] chainNames = entityPoly.getPdbxStrandId().get(rowIndex).split(",");
                   List asymIds = entityId2asymId.get(entityPoly.getEntityId().get(rowIndex));
      +            if (asymIds == null) {
      +                logger.warn("No asym ids found for entity {} in _struct_asym. Can't provide a mapping from asym ids to author chain ids for this entity", entityPoly.getEntityId().get(rowIndex));
      +                break;
      +            }
                   if (chainNames.length != asymIds.size()) {
                       logger.warn("The list of asym ids (from _struct_asym) and the list of author ids (from _entity_poly) " +
                               "for entity {} have different lengths! Can't provide a mapping from asym ids to author chain " +
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java
      index 7b9cd4642f..0b8572ab8c 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java
      @@ -85,22 +85,6 @@ public static void writeToOutputStream(Structure structure, OutputStream outputS
       		outputStream.write(outputBytes,0,outputBytes.length);
       	}
       
      -
      -	/**
      -	 * Get a Biojava structure from the mmtf REST service.
      -	 * @param pdbId the PDB code of the required structure
      -	 * @return a Structure object relating to the input byte array
      -	 * @throws IOException
      -	 */
      -	public static Structure readFromWeb(String pdbId) throws IOException {
      -		// Get the reader - this is the bit that people need to implement.
      -		MmtfStructureReader mmtfStructureReader = new MmtfStructureReader();
      -		// Do the inflation
      -		new StructureDataToAdapter(new GenericDecoder(ReaderUtils.getDataFromUrl(pdbId)), mmtfStructureReader);
      -		// Get the structue
      -		return mmtfStructureReader.getStructure();
      -	}
      -
       	/**
       	 * Read a Biojava structure from an {@link InputStream}
       	 * @param inStream the {@link InputStream} to read from
      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/io/mmtf/MmtfUtils.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
      index 622f16122f..5b9fe460c6 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
      @@ -256,8 +256,8 @@ public static int getNumGroups(Structure structure) {
       	 * @return the atoms for the input Biojava Group
       	 */
       	public static List getAtomsForGroup(Group inputGroup) {
      -		Set uniqueAtoms = new HashSet();
      -		List theseAtoms = new ArrayList();
      +		Set uniqueAtoms = new HashSet<>();
      +		List theseAtoms = new ArrayList<>();
       		for(Atom a: inputGroup.getAtoms()){
       			theseAtoms.add(a);
       			uniqueAtoms.add(a);
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsChainToUniprotMapping.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsChainToUniprotMapping.java
      index 84cd9ae138..d4c11544ca 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsChainToUniprotMapping.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsChainToUniprotMapping.java
      @@ -156,9 +156,9 @@ private static void download() throws IOException {
       
       	}
       
      -	private Map byChainId = new HashMap();
      +	private Map byChainId = new HashMap<>();
       
      -	private Map byUniProtId = new HashMap();
      +	private Map byUniProtId = new HashMap<>();
       
       	private SiftsChainToUniprotMapping() {
       
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsEntity.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsEntity.java
      index 34b2ba1bc4..20e1008859 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsEntity.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsEntity.java
      @@ -46,7 +46,7 @@ public SiftsEntity(){
       	public SiftsEntity(String type, String entityId) {
       		this.type = type;
       		this.entityId = entityId;
      -		segments = new ArrayList();
      +		segments = new ArrayList<>();
       	}
       
       	public void addSegment(SiftsSegment s) {
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsMappingProvider.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsMappingProvider.java
      index f386140cdf..13e038cadd 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsMappingProvider.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsMappingProvider.java
      @@ -81,7 +81,7 @@ public static List getSiftsMapping(String pdbId) throws IOException
       		}
       		File dest = new File( hashDir, pdbId + ".sifts.xml.gz");
       
      -		logger.debug("testing SIFTS file " + dest.getAbsolutePath());
      +		logger.debug("testing SIFTS file {}", dest.getAbsolutePath());
       
       
       		if ( ! dest.exists()){
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsSegment.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsSegment.java
      index 1594228a05..e582a3881a 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsSegment.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsSegment.java
      @@ -49,7 +49,7 @@ public SiftsSegment(String segId, String start, String end) {
       		this.segId = segId;
       		this.start = start;
       		this.end = end;
      -		residues = new ArrayList();
      +		residues = new ArrayList<>();
       	}
       
       	public String getSegId() {
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsXMLParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsXMLParser.java
      index a563aca4ff..6922f49366 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsXMLParser.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsXMLParser.java
      @@ -51,7 +51,7 @@ public class SiftsXMLParser {
       
       	static boolean debug = false;
       	public SiftsXMLParser(){
      -		entities = new ArrayList();
      +		entities = new ArrayList<>();
       	}
       
       	public List getEntities(){
      @@ -60,7 +60,7 @@ public List getEntities(){
       
       
       	public void parseXmlFile(InputStream is){
      -		entities = new ArrayList();
      +		entities = new ArrayList<>();
       
       		//get the factory
       		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      @@ -131,13 +131,13 @@ private SiftsEntity getSiftsEntity(Element empEl) {
       
       					SiftsSegment s = getSiftsSegment(el);
       
      -					logger.debug("new segment: " + s);
      +					logger.debug("new segment: {}", s);
       					entity.addSegment(s);
       
       				}
       			}
       
      -			logger.debug("new SIFTS entity: " + entity);
      +			logger.debug("new SIFTS entity: {}", entity);
       			return entity;
       		}
       
      @@ -233,12 +233,12 @@ private SiftsResidue getResidue(Element residue) {
       
       				//	System.out.println(dbSource + " " + dbCoordSys + " " + dbAccessionId + " " + dbResNum + " " + dbResName + " " + dbChainId);
       
      -					if ( dbSource.equals("PDB") && ( dbCoordSys.equals("PDBresnum"))){
      +					if ( "PDB".equals(dbSource) && "PDBresnum".equals(dbCoordSys)){
       						res.setPdbResNum(dbResNum);
       						res.setPdbResName(dbResName);
       						res.setChainId(dbChainId);
       						res.setPdbId(dbAccessionId);
      -					} else if ( dbSource.equals("UniProt")){
      +					} else if ( "UniProt".equals(dbSource)){
       						res.setUniProtPos(Integer.parseInt(dbResNum));
       						res.setUniProtResName(dbResName);
       						res.setUniProtAccessionId(dbAccessionId);
      @@ -269,7 +269,7 @@ private String getTextValue(Element ele, String tagName) {
       		}
       
       	private List getTextValues(Element ele, String tagName) {
      -		Listvalues = new ArrayList();
      +		Listvalues = new ArrayList<>();
       		NodeList nl = ele.getElementsByTagName(tagName);
       		if(nl != null && nl.getLength() > 0) {
       			for ( int i = 0 ;i < nl.getLength() ; i ++) {
      diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/jama/LUDecomposition.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/jama/LUDecomposition.java
      index 00f5d302ec..64c77c3665 100644
      --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/jama/LUDecomposition.java
      +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/jama/LUDecomposition.java
      @@ -22,10 +22,10 @@
       
       	/** LU Decomposition.
       	

      - For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n + For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv,:) = L*U. - If m < n, then L is m-by-m and U is m-by-n. + If m < n, then L is m-by-m and U is m-by-n.

      The LU decompostion with pivoting always exists, even if the matrix is singular, so the constructor will never fail. The primary use of the diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/jama/Matrix.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/jama/Matrix.java index 15bd130b99..fab188ce98 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/jama/Matrix.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/jama/Matrix.java @@ -53,7 +53,7 @@ * decomposition classes. These decompositions are accessed by the Matrix * class to compute solutions of simultaneous linear equations, determinants, * inverses and other matrix functions. The five decompositions are: - *

        + *
          *
        • Cholesky Decomposition of symmetric, positive definite matrices. *
        • LU Decomposition of rectangular matrices. *
        • QR Decomposition of rectangular matrices. @@ -62,7 +62,7 @@ *
        *
        *
        Example of use:
        - *

        + * *

        Solve a linear system A x = b and compute the residual norm, ||b - A x||. *

          * 		double[][] vals = {{1.,2.,3},{4.,5.,6.},{7.,8.,10.}};
        diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java
        index 124b44d1c2..d4e7d19d93 100644
        --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java
        +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java
        @@ -54,7 +54,7 @@ public class SparseVector implements Serializable{
         	 */
         	public SparseVector(int N) {
         		this.N  = N;
        -		this.symbolTable = new SymbolTable();
        +		this.symbolTable = new SymbolTable<>();
         	}
         
         	/** Setter method (should it be renamed to set?)
        diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java
        index 39d7926d9f..960e18b019 100644
        --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java
        +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java
        @@ -35,7 +35,7 @@
          *  Does not allow duplicate keys.
          *
          *  This class represents an ordered symbol table. It assumes that
        - *  the elements are Comparable.
        + *  the elements are Comparable.
          *  It supports the usual put, get, contains,
          *  and delete methods.
          *  It also provides ordered methods for finding the minimum,
        @@ -69,7 +69,7 @@ public class SymbolTable, Value> implements Iterable
         	 * Create an empty symbol table.
         	 */
         	public SymbolTable() {
        -		st = new TreeMap();
        +		st = new TreeMap<>();
         	}
         
         	/**
        @@ -111,9 +111,9 @@ public int size() {
         	}
         
         	/**
        -	 * Return an Iterator for the keys in the table.
        -	 * To iterate over all of the keys in the symbol table st, use the
        -	 * foreach notation: for (Key key : st).
        +	 * Return an Iterator for the keys in the table.
        +	 * To iterate over all of the keys in the symbol table st, use the
        +	 * foreach notation: for (Key key : st).
         	 */
         	@Override
         	public Iterator iterator() {
        @@ -121,9 +121,9 @@ public Iterator iterator() {
         	}
         
         	/**
        -	 * Return an Iterable for the keys in the table.
        -	 * To iterate over all of the keys in the symbol table st, use the
        -	 * foreach notation: for (Key key : st.keys()).
        +	 * Return an Iterable for the keys in the table.
        +	 * To iterate over all of the keys in the symbol table st, use the
        +	 * foreach notation: for (Key key : st.keys()).
         	 */
         	public Iterable keys() {
         		return st.keySet();
        @@ -153,7 +153,7 @@ public Key ceil(Key k) {
         	}
         
         	/**
        -	 * Return the largest key in the table <= k.
        +	 * Return the largest key in the table <= k.
         	 */
         	public Key floor(Key k) {
         		if (st.containsKey(k)) return k;
        diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/package-info.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/package-info.java
        index fecc3afee6..8d5fb81573 100644
        --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/package-info.java
        +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/package-info.java
        @@ -19,10 +19,8 @@
          *
          */
         /**
        - * 
        - * 

        * Interfaces and classes for protein structure (PDB). - *

        + * *

        * See also the BioJava 3 tutorial for more information on the protein structure modules. *

        @@ -62,8 +60,7 @@ * For more documentation on how to work with the Structure API please * see * http://biojava.org/wiki/BioJava:CookBook#Protein_Structure - *

        - * + * * @since 1.5 */ package org.biojava.nbio.structure; \ No newline at end of file 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 92bdc89ead..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) { @@ -76,7 +76,7 @@ private static List parseSubExpression(String expression) { } // expand ranges if present, i.e. 1-60 -> 1, 2, 3, ..., 60 - List operators = new ArrayList(); + List operators = new ArrayList<>(); for (String component : components) { if (component.contains("-")) { operators.addAll(expandRange(component)); @@ -104,7 +104,7 @@ private static List expandRange(String expression) { throw new IllegalArgumentException("Invalid range specification in oper_expression: " + expression); } - List expandedExpression = new ArrayList(last-first+1); + List expandedExpression = new ArrayList<>(last-first+1); for (int i = first; i <= last; i++) { expandedExpression.add(String.valueOf(i)); } @@ -127,7 +127,7 @@ public static List> parseBinaryOperatorExpression(String exp List rightSide = parseSubExpression(subExpressions[1]); // form the cartesian product of the two lists - CartesianProduct product = new CartesianProduct(leftSide, rightSide); + CartesianProduct product = new CartesianProduct<>(leftSide, rightSide); return product.getOrderedPairs(); } @@ -262,12 +262,11 @@ public static double getBiologicalMoleculeMaximumExtend( final Structure structu /** * Returns the centroid of the biological molecule. - * @param structure + * @param asymUnit * @return centroid * @throws IllegalArgumentException if structure is null */ - - public static double[] getBiologicalMoleculeCentroid( final Structure asymUnit,List transformations ) { + public static double[] getBiologicalMoleculeCentroid( final Structure asymUnit, List transformations ) { if ( asymUnit == null ) { throw new IllegalArgumentException( "null structure" ); } @@ -280,7 +279,7 @@ public static double[] getBiologicalMoleculeCentroid( final Structure asymUnit,L 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 083633c28f..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 @@ -75,6 +75,7 @@ public BiologicalAssemblyBuilder(){ * Builds a Structure object containing the quaternary structure built from given asymUnit and transformations, * by adding symmetry partners as new models. * The output Structure will be different depending on the multiModel parameter: + *
          *
        • * the symmetry-expanded chains are added as new models, one per transformId. All original models but * the first one are discarded. @@ -83,6 +84,7 @@ public BiologicalAssemblyBuilder(){ * as original with symmetry-expanded chains added with renamed chain ids and names (in the form * originalAsymId_transformId and originalAuthId_transformId) *
        • + *
        * @param asymUnit * @param transformations * @param useAsymIds if true use {@link Chain#getId()} to match the ids in the BiologicalAssemblyTransformation (needed if data read from mmCIF), @@ -184,7 +186,7 @@ public int compare(BiologicalAssemblyTransformation t1, BiologicalAssemblyTransf * @return */ private List getChainIds(Structure asymUnit) { - List chainIds = new ArrayList(); + List chainIds = new ArrayList<>(); for ( Chain c : asymUnit.getChains()){ String intChainID = c.getId(); chainIds.add(intChainID); @@ -203,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/quaternary/BiologicalAssemblyTransformation.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java index cf5a7a1ea4..36bccd7b39 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java @@ -236,7 +236,7 @@ public static BiologicalAssemblyTransformation fromXML(String xml) public static List fromMultiXML(String xml) throws ParserConfigurationException, SAXException, IOException{ - List transformations = new ArrayList(); + List transformations = new ArrayList<>(); // read the XML of a string and returns a ModelTransformationmatrix DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); @@ -268,10 +268,10 @@ public static List fromMultiXML(String xml) th Node block = listOfChildren.item(i); // we only look at blocks. - if ( block.getNodeName().equals("matrix")) + if ( "matrix".equals(block.getNodeName())) max.setRotationMatrix(getMatrixFromXML(block)); - if ( block.getNodeName().equals("shift")) + if ( "shift".equals(block.getNodeName())) max.setTranslation(getVectorFromXML(block)); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/CartesianProduct.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/CartesianProduct.java index da6853a6fb..7aa4690b5c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/CartesianProduct.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/CartesianProduct.java @@ -60,7 +60,7 @@ public CartesianProduct(List list1, List list2) { * @return the list of ordered pairs */ public List> getOrderedPairs() { - List> pairs = new ArrayList>(list1.size()*list2.size()); + List> pairs = new ArrayList<>(list1.size()*list2.size()); for (T element1: list1) { for (T element2: list2) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/Astral.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/Astral.java index d7c1ebe5d5..9d30e42248 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/Astral.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/Astral.java @@ -101,7 +101,7 @@ public String toString() { } } - private static Map> instances = new HashMap>(); + private static Map> instances = new HashMap<>(); private static final Logger logger = LoggerFactory.getLogger(Astral.class); @@ -203,8 +203,8 @@ public LinkedHashMap getFailedLines() { * Parses the FASTA file opened by reader. */ private void init(Reader reader) { - names = new TreeSet(); - failedLines = new LinkedHashMap(); + names = new TreeSet<>(); + failedLines = new LinkedHashMap<>(); BufferedReader br = null; @@ -222,7 +222,7 @@ private void init(Reader reader) { String scopId = line.split("\\s")[0].substring(1); names.add(scopId); if (i % 1000 == 0) { - logger.debug("Reading ASTRAL line for " + scopId); + logger.debug("Reading ASTRAL line for {}", scopId); } i++; } catch (RuntimeException e) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/BerkeleyScopInstallation.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/BerkeleyScopInstallation.java index f0aab86b95..d688beadac 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/BerkeleyScopInstallation.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/BerkeleyScopInstallation.java @@ -45,7 +45,7 @@ public class BerkeleyScopInstallation extends ScopInstallation { * A map from SCOP version names which the Berkeley server offers as a * download to an array of equivalent deprecated SCOP version names. */ - public static final Map EQUIVALENT_VERSIONS = new HashMap(); + public static final Map EQUIVALENT_VERSIONS = new HashMap<>(); static { EQUIVALENT_VERSIONS.put("2.01", new String[] {"1.75A"}); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopCategory.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopCategory.java index c60e2c06e5..d680430602 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopCategory.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopCategory.java @@ -41,17 +41,17 @@ public enum ScopCategory implements Serializable Class,Fold, Superfamily, Family, Domain, Species, Px; public static ScopCategory fromString(String type){ - if ( type.equals("cl")) + if ( "cl".equals(type)) return Class; - else if ( type.equals("cf")) + else if ( "cf".equals(type)) return Fold; - else if ( type.equals("sf")) + else if ( "sf".equals(type)) return Superfamily; - else if ( type.equals("fa")) + else if ( "fa".equals(type)) return Family; - else if ( type.equals("dm")) + else if ( "dm".equals(type)) return Domain; - else if ( type.equals("sp")) + else if ( "sp".equals(type)) return Species; else return Px; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopDescription.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopDescription.java index b85845ce2c..b7ef2881f7 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopDescription.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopDescription.java @@ -20,9 +20,9 @@ */ package org.biojava.nbio.structure.scop; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; import java.io.Serializable; /** Contains data from diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopDomain.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopDomain.java index 7d1446cb9d..b6783316c8 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopDomain.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopDomain.java @@ -26,9 +26,9 @@ import java.util.List; import java.util.Set; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; import org.biojava.nbio.structure.PdbId; import org.biojava.nbio.structure.ResidueRange; @@ -243,7 +243,7 @@ protected Object clone() throws CloneNotSupportedException { * Returns the chains this domain is defined over; contains more than 1 element only if this domains is a multi-chain domain. */ public Set getChains() { - Set chains = new HashSet(); + Set chains = new HashSet<>(); List rrs = ResidueRange.parseMultiple(getRanges()); for (ResidueRange rr : rrs) chains.add(rr.getChainName()); return chains; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopInstallation.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopInstallation.java index b7ee585279..d092d5485e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopInstallation.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopInstallation.java @@ -85,8 +85,8 @@ public class ScopInstallation implements LocalScopDatabase { public static final String comFileName = "dir.com.scop.txt_"; // Download locations - public static final String SCOP_DOWNLOAD = "http://scop.berkeley.edu/downloads/parse/"; - public static final String SCOP_DOWNLOAD_ALTERNATE = "http://scop.berkeley.edu/downloads/parse/"; + public static final String SCOP_DOWNLOAD = "https://scop.berkeley.edu/downloads/parse/"; + public static final String SCOP_DOWNLOAD_ALTERNATE = "https://scop.berkeley.edu/downloads/parse/"; //public static final String NEWLINE = System.getProperty("line.separator"); public static final String FILESPLIT = System.getProperty("file.separator"); @@ -123,12 +123,12 @@ public ScopInstallation(String cacheLocation){ installedCom.set(false); scopVersion = DEFAULT_VERSION; - mirrors = new ArrayList(1); + mirrors = new ArrayList<>(1); - domainMap = new HashMap>(); + domainMap = new HashMap<>(); - sunidMap = new HashMap(); - scopTree = new TreeMap(); + sunidMap = new HashMap<>(); + scopTree = new TreeMap<>(); } @@ -189,7 +189,7 @@ public List getByCategory(ScopCategory category){ throw new ScopIOException(e); } - List matches = new ArrayList(); + List matches = new ArrayList<>(); for (Integer i : sunidMap.keySet()){ ScopDescription sc = sunidMap.get(i); if ( sc.getCategory().equals(category)) @@ -216,7 +216,7 @@ public List filterByClassificationId(String query){ throw new ScopIOException(e); } - List matches = new ArrayList(); + List matches = new ArrayList<>(); for (Integer i : sunidMap.keySet()){ ScopDescription sc = sunidMap.get(i); @@ -238,7 +238,7 @@ public List getTree(ScopDomain domain){ ScopNode node = getScopNode(domain.getSunid()); - List tree = new ArrayList(); + List tree = new ArrayList<>(); while (node != null){ //System.out.println("This node: sunid:" + node.getSunid() ); @@ -257,7 +257,7 @@ public List getTree(ScopDomain domain){ @Override public List filterByDomainName(String query) { - List domains = new ArrayList(); + List domains = new ArrayList<>(); if (query.length() <5){ return domains; } @@ -292,7 +292,7 @@ public List filterByDescription(String query) { } query = query.toLowerCase(); - List matches = new ArrayList(); + List matches = new ArrayList<>(); for (Integer i : sunidMap.keySet()){ ScopDescription sc = sunidMap.get(i); @@ -332,7 +332,7 @@ public List getDomainsForPDB(String pdbId) { List doms = domainMap.get(pdbId.toLowerCase()); - List retdoms = new ArrayList(); + List retdoms = new ArrayList<>(); if ( doms == null) return retdoms; @@ -439,10 +439,10 @@ private void parseHierarchy(BufferedReader buffer) throws IOException { String children = spl[2]; String[] childIds = children.split(","); - List chis = new ArrayList(); + List chis = new ArrayList<>(); for ( String id : childIds){ - if ( id.equals("-")) + if ( "-".equals(id)) continue; chis.add(Integer.parseInt(id)); } @@ -483,7 +483,7 @@ private void parseComments() throws IOException{ private void parseComments(BufferedReader buffer) throws IOException { - commentsMap = new HashMap>(); + commentsMap = new HashMap<>(); int counter = 0; String line; @@ -495,7 +495,7 @@ private void parseComments(BufferedReader buffer) throws IOException { commentsMap.put(sunId, new ArrayList(1)); continue; } - List comments = new ArrayList(parts.length - 1); + List comments = new ArrayList<>(parts.length - 1); for (int i = 1; i < parts.length; i++) { String trimmed = parts[i].trim(); if( !trimmed.isEmpty() ) { @@ -611,7 +611,7 @@ private void parseClassification(BufferedReader buffer) throws IOException { if ( domainMap.containsKey(pdbId)){ domainList = domainMap.get(pdbId); } else { - domainList = new ArrayList(); + domainList = new ArrayList<>(); domainMap.put(pdbId,domainList); } @@ -862,7 +862,7 @@ public List getScopDomainsBySunid(Integer sunid) throw new ScopIOException(e); } - List domains = new ArrayList(); + List domains = new ArrayList<>(); for (String pdbId: domainMap.keySet()){ for (ScopDomain d : domainMap.get(pdbId)){ @@ -900,7 +900,7 @@ public List getComments(int sunid) { } catch (IOException e) { throw new ScopIOException(e); } - if (!commentsMap.containsKey(sunid)) return new ArrayList(1); + if (!commentsMap.containsKey(sunid)) return new ArrayList<>(1); return commentsMap.get(sunid); } @@ -913,10 +913,19 @@ private void initScopURLs() { // first, try default scop ScopMirror primary = new ScopMirror(); // If unreachable, try alternate Berkeley location - ScopMirror alt = new ScopMirror( - SCOP_DOWNLOAD_ALTERNATE, - "dir.cla.scop.%s.txt","dir.des.scop.%s.txt", - "dir.hie.scop.%s.txt","dir.com.scop.%s.txt"); + ScopMirror alt; + if (scopVersion.startsWith("2.")) { + alt = new ScopMirror( + SCOP_DOWNLOAD_ALTERNATE, + "dir.cla.scope.%s.txt","dir.des.scope.%s.txt", + "dir.hie.scope.%s.txt","dir.com.scope.%s.txt"); + } + else { + alt = new ScopMirror( + SCOP_DOWNLOAD_ALTERNATE, + "dir.cla.scop.%s.txt","dir.des.scop.%s.txt", + "dir.hie.scop.%s.txt","dir.com.scop.%s.txt"); + } mirrors.add(primary); mirrors.add(alt); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopNode.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopNode.java index 8faf5dd6c7..40012d8d52 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopNode.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/ScopNode.java @@ -24,9 +24,9 @@ package org.biojava.nbio.structure.scop; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.List; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/BridgeType.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/BridgeType.java index 04e35fe14d..26b4656767 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/BridgeType.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/BridgeType.java @@ -22,7 +22,7 @@ /** * A bridge is formed by two non-overlapping stretches of three residues each - * (i-1,i,i+1) and (j-1,j,j+1), where i * Depending on two basic patterns, a Bridge can be either of type parallel (H * bonds in {(i-1,j) and (j,i+1)} OR {(j-1,i) and (i,j-1)}) or antiparallel (H diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/DSSPParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/DSSPParser.java index 69e9cd6d67..f6fb7bff42 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/DSSPParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/DSSPParser.java @@ -124,7 +124,7 @@ private static List generalParse(BufferedReader reader, String startLine = " # RESIDUE AA STRUCTURE BP1 BP2 ACC"; String line; - List secstruc = new ArrayList(); + List secstruc = new ArrayList<>(); //Find the first line of the DSSP output while((line = reader.readLine()) != null) { @@ -137,7 +137,7 @@ private static List generalParse(BufferedReader reader, String resNumStr = line.substring(5,10).trim(); //Only happens if dssp inserts a line indicating a chain break - if(!resNumStr.equals("")) { + if(!"".equals(resNumStr)) { int index = Integer.parseInt(indexStr); //Get the group of the structure corresponding to the residue @@ -155,14 +155,14 @@ private static List generalParse(BufferedReader reader, //Parse the Bridge partners - TODO parallel or antiparallel? String bp = line.substring(25,29).trim(); - if (!bp.equals("")) { + if (!"".equals(bp)) { BetaBridge bb = new BetaBridge( index, Integer.parseInt(bp), BridgeType.parallel); ss.addBridge(bb); } else logger.warn("Unable to parse beta Bridge for resn "+index); bp = line.substring(29,33).trim(); - if (!bp.equals("")) { + if (!"".equals(bp)) { BetaBridge bb = new BetaBridge( index, Integer.parseInt(bp), BridgeType.parallel); ss.addBridge(bb); @@ -175,7 +175,7 @@ private static List generalParse(BufferedReader reader, int b = a + 8; String val = line.substring(a,b).trim(); - if (val.equals("")) { + if ("".equals(val)) { logger.warn("Unable to parse energy for resn "+index); continue; } @@ -208,15 +208,15 @@ private static List generalParse(BufferedReader reader, //Angle properties String val = line.substring(91,97).trim(); - if (!val.equals("")) ss.setKappa(Float.parseFloat(val)); + if (!"".equals(val)) ss.setKappa(Float.parseFloat(val)); else logger.warn("Unable to parse kappa for resn "+index); val = line.substring(103,109).trim(); - if (!val.equals("")) ss.setPhi(Float.parseFloat(val)); + if (!"".equals(val)) ss.setPhi(Float.parseFloat(val)); else logger.warn("Unable to parse phi for resn "+index); val = line.substring(109,116).trim(); - if (!val.equals("")) ss.setPsi(Float.parseFloat(val)); + if (!"".equals(val)) ss.setPsi(Float.parseFloat(val)); else logger.warn("Unable to parse psi for resn "+index); if (assign) parent.setProperty(Group.SEC_STRUC, ss); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java index 44f797fbda..c4d308e366 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java @@ -104,8 +104,8 @@ public class SecStrucCalc { private AtomContactSet contactSet; private Map indResMap; public SecStrucCalc(){ - ladders = new ArrayList(); - bridges = new ArrayList(); + ladders = new ArrayList<>(); + bridges = new ArrayList<>(); } @@ -120,11 +120,11 @@ public SecStrucCalc(){ public List calculate(Structure s, boolean assign) throws StructureException { - List secstruc = new ArrayList(); + List secstruc = new ArrayList<>(); for(int i=0; i(); - bridges = new ArrayList(); + ladders = new ArrayList<>(); + bridges = new ArrayList<>(); groups = initGroupArray(s, i); // Initialise the contact set for this structure initContactSet(); @@ -424,7 +424,7 @@ private boolean shouldExtendLadder(Ladder ladder, BetaBridge b) { private void findBridges() { // Get the interator of contacts Iterator myIter = contactSet.iterator(); - List> outList = new ArrayList>(); + List> outList = new ArrayList<>(); // Now iterate through this while(myIter.hasNext()){ @@ -461,7 +461,7 @@ private void findBridges() { continue; } - Pair thisPair = new Pair(i,j); + Pair thisPair = new Pair<>(i,j); outList.add(thisPair); } // @@ -705,7 +705,7 @@ public boolean equals(Object o){ } private static SecStrucGroup[] initGroupArray(Structure s, int modelId) { - List groupList = new ArrayList(); + List groupList = new ArrayList<>(); // for ( Chain c : s.getChains(modelId)){ @@ -798,7 +798,7 @@ private void checkAddHBond(int i, int j){ SecStrucGroup one = groups[i]; - if (one.getPDBName().equals("PRO")){ + if ("PRO".equals(one.getPDBName())){ logger.debug("Ignore: PRO {}", one.getResidueNumber()); return; } @@ -877,7 +877,7 @@ private static double calculateHBondEnergy(SecStrucGroup one, */ private void trackHBondEnergy(int i, int j, double energy) { - if (groups[i].getPDBName().equals("PRO")) { + if ("PRO".equals(groups[i].getPDBName())) { logger.debug("Ignore: PRO {}",groups[i].getResidueNumber()); return; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucState.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucState.java index 33bdc7c931..6faebae39c 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucState.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucState.java @@ -107,7 +107,7 @@ public char[] getTurn() { /** * Set the turn column corresponding to 3,4 or 5 helix patterns. If starting - * > or ending < was set and the opposite is being set, the value will be + * > or ending < was set and the opposite is being set, the value will be * converted to X. If a number was set, it will be overwritten by the new * character. * 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 d90c5ba263..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); } @@ -99,7 +99,7 @@ public static List getSecStrucElements(Structure s) { int count = 0; // counts the number of residues in SSE // Create a map for the IDs of the SSE in the structure - Map ids = new TreeMap(); + Map ids = new TreeMap<>(); for (SecStrucType t : SecStrucType.values()) ids.put(t, 1); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/AxisAligner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/AxisAligner.java index 4721f101b3..b2a6034751 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/AxisAligner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/AxisAligner.java @@ -40,7 +40,7 @@ public abstract class AxisAligner { public static AxisAligner getInstance(QuatSymmetryResults results) { String symmetry = results.getSymmetry(); - if (symmetry.equals("H")) { + if ("H".equals(symmetry)) { return new HelixAxisAligner(results); } else { return new RotationAxisAligner(results); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/HelixAxisAligner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/HelixAxisAligner.java index b76e844965..10d9144db4 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/HelixAxisAligner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/HelixAxisAligner.java @@ -356,7 +356,7 @@ private Matrix4d reorientHelix(int index) { * @return list of orbits ordered by z-depth */ private void calcAlignedOrbits() { - Map> depthMap = new TreeMap>(); + Map> depthMap = new TreeMap<>(); double[] depth = getSubunitZDepth(); alignedOrbits = calcOrbits(); @@ -585,7 +585,7 @@ private double[] getSubunitZDepth() { private List> calcOrbits() { int n = subunits.getSubunitCount(); - List> orbits = new ArrayList>(); + List> orbits = new ArrayList<>(); for (int i = 0; i < n; i++) { orbits.add(Collections.singletonList(i)); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java index 30539a98ca..65621135d1 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java @@ -223,7 +223,7 @@ private void run () { } calcReverseTransformation(); calcBoundaries(); - if (! rotationGroup.getPointGroup().equals("Helical")) { + if (! "Helical".equals(rotationGroup.getPointGroup())) { calcAlignedOrbits(); } modified = false; @@ -236,7 +236,7 @@ private void run () { * @return list of orbits ordered by z-depth */ private void calcAlignedOrbits() { - Map> depthMap = new TreeMap>(); + Map> depthMap = new TreeMap<>(); double[] depth = getSubunitZDepth(); alignedOrbits = calcOrbits(); @@ -340,7 +340,7 @@ private List alignWithReferenceAxis(List orbit) { private void calcTransformation() { - if (rotationGroup.getPointGroup().equals("C1")) { + if ("C1".equals(rotationGroup.getPointGroup())) { calcTransformationByInertiaAxes(); } else { calcTransformationBySymmetryAxes(); @@ -539,7 +539,7 @@ private void calcZDirection() { * */ private List> getOrbitsByXYWidth() { - Map> widthMap = new TreeMap>(); + Map> widthMap = new TreeMap<>(); double[] width = getSubunitXYWidth(); List> orbits = calcOrbits(); @@ -608,14 +608,14 @@ private List> calcOrbits() { int n = subunits.getSubunitCount(); int fold = rotationGroup.getRotation(0).getFold(); - List> orbits = new ArrayList>(); + List> orbits = new ArrayList<>(); boolean[] used = new boolean[n]; Arrays.fill(used, false); for (int i = 0; i < n; i++) { if (! used[i]) { // determine the equivalent subunits - List orbit = new ArrayList(fold); + List orbit = new ArrayList<>(fold); for (int j = 0; j < fold; j++) { List permutation = rotationGroup.getRotation(j).getPermutation(); orbit.add(permutation.get(i)); @@ -637,7 +637,7 @@ private List deconvolute(List orbit) { // System.out.println("Permutation0: " + p0); // System.out.println("Permutation1: " + p1); - List inRotationOrder = new ArrayList(orbit.size()); + List inRotationOrder = new ArrayList<>(orbit.size()); inRotationOrder.add(orbit.get(0)); for (int i = 1; i < orbit.size(); i++) { int current = inRotationOrder.get(i-1); @@ -675,13 +675,13 @@ private void calcReferenceVector() { referenceVector = getReferenceAxisCylic(); } else if (rotationGroup.getPointGroup().startsWith("D")) { referenceVector = getReferenceAxisDihedral(); - } else if (rotationGroup.getPointGroup().equals("T")) { + } else if ("T".equals(rotationGroup.getPointGroup())) { referenceVector = getReferenceAxisTetrahedral(); - } else if (rotationGroup.getPointGroup().equals("O")) { + } else if ("O".equals(rotationGroup.getPointGroup())) { referenceVector = getReferenceAxisOctahedral(); - } else if (rotationGroup.getPointGroup().equals("I")) { + } else if ("I".equals(rotationGroup.getPointGroup())) { referenceVector = getReferenceAxisIcosahedral(); - } else if (rotationGroup.getPointGroup().equals("Helical")) { + } else if ("Helical".equals(rotationGroup.getPointGroup())) { // TODO what should the reference vector be?? referenceVector = getReferenceAxisCylic(); } @@ -735,7 +735,7 @@ private Vector3d orthogonalize(Vector3d vector1, Vector3d vector2) { * @return */ private Vector3d getReferenceAxisCylic() { - if (rotationGroup.getPointGroup().equals("C2")) { + if ("C2".equals(rotationGroup.getPointGroup())) { Vector3d vr = new Vector3d(subunits.getOriginalCenters().get(0)); vr.sub(subunits.getCentroid()); vr.normalize(); @@ -765,7 +765,7 @@ private Vector3d getReferenceAxisCylic() { * @return reference vector */ private Vector3d getReferenceAxisCylicWithSubunitAlignment() { - if (rotationGroup.getPointGroup().equals("C2")) { + if ("C2".equals(rotationGroup.getPointGroup())) { return referenceVector; } @@ -797,7 +797,7 @@ private Vector3d getReferenceAxisDihedralWithSubunitAlignment() { for (int i = 0; i < rotationGroup.getOrder(); i++) { if (rotationGroup.getRotation(i).getDirection() == 1 && (rotationGroup.getRotation(i).getFold() < maxFold) || - rotationGroup.getPointGroup().equals("D2")) { + "D2".equals(rotationGroup.getPointGroup())) { AxisAngle4d axisAngle = rotationGroup.getRotation(i).getAxisAngle(); Vector3d v = new Vector3d(axisAngle.x, axisAngle.y, axisAngle.z); 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 f62208aadf..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 @@ -30,7 +30,7 @@ public class HelicalRepeatUnit { private QuatSymmetrySubunits subunits = null; private List repeatUnitCenters = new ArrayList(); private List repeatUnits = new ArrayList(); - private List> repeatUnitIndices = new ArrayList>(); + private List> repeatUnitIndices = new ArrayList<>(); private Map interactingNeighbors = Collections.emptyMap(); public HelicalRepeatUnit(QuatSymmetrySubunits subunits) { @@ -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(); @@ -74,10 +74,10 @@ private void run() { private List calcRepeatUnitCenters() { // TODO why do we use models here? it should not matter. Setting to 0 all - List models = new ArrayList(subunits.getSubunitCount()); + List models = new ArrayList<>(subunits.getSubunitCount()); for (int s = 0; s uniqueModels = new HashSet(Arrays.asList(1)); + Set uniqueModels = new HashSet<>(Arrays.asList(1)); int modelCount = uniqueModels.size(); List folds = this.subunits.getFolds(); @@ -90,7 +90,7 @@ private List calcRepeatUnitCenters() { if (maxFold%modelCount == 0 && modelCount > 1 && subunits.getSubunitCount() > 3) { // System.out.println("calcRepeatUnitCenters case 1"); for (int i = 0; i < modelCount; i++) { - List subunitIndices = new ArrayList(); + List subunitIndices = new ArrayList<>(); Point3d p = new Point3d(); int count = 0; // System.out.println("Models: " + models.size()); @@ -113,7 +113,7 @@ private List calcRepeatUnitCenters() { // Case of 3B5U: A14, but seems to form (A2)*7 and symmetry related subunits don't have direct contact List sequenceClusterIds = subunits.getClusterIds(); for (int i = 0; i < subunits.getSubunitCount(); i++) { - List subunitIndices = new ArrayList(1); + List subunitIndices = new ArrayList<>(1); if (sequenceClusterIds.get(i) == 0) { repeatCenters.add(new Point3d(centers.get(i))); // System.out.println("Orig Repeat unit: " + centers.get(i)); @@ -135,11 +135,11 @@ private List calcRepeatUnitCenters() { private List calcRepeatUnits() { // TODO why do we use models here? it should not matter. Setting to 0 all - List models = new ArrayList( + List models = new ArrayList<>( subunits.getSubunitCount()); for (int s = 0; s < subunits.getSubunitCount(); s++) models.add(0); - Set uniqueModels = new HashSet(Arrays.asList(1)); + Set uniqueModels = new HashSet<>(Arrays.asList(1)); int modelCount = uniqueModels.size(); List folds = this.subunits.getFolds(); @@ -180,7 +180,7 @@ private List calcRepeatUnits() { } private Map findInteractingNeigbors() { - Map contactMap = new HashMap(); + Map contactMap = new HashMap<>(); Map> distanceMap = findClosestPairs(8); for (List pairs: distanceMap.values()) @@ -196,9 +196,9 @@ private Map findInteractingNeigbors() { } private Map> findClosestPairs(int maxNeighbors) { - Map> reducedMap = new TreeMap>(); + Map> reducedMap = new TreeMap<>(); - Map> distanceMap = new TreeMap>(); + Map> distanceMap = new TreeMap<>(); int nCenters = repeatUnitCenters.size(); // System.out.println("repeatUnitCenters: " + repeatUnitCenters); @@ -212,7 +212,7 @@ private Map> findClosestPairs(int maxNeighbors) { List pairs = distanceMap.get(intDist); // save only one representative pair for each distance if (pairs == null) { - pairs = new ArrayList(); + pairs = new ArrayList<>(); } Integer[] pair = new Integer[2]; pair[0] = i; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Helix.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Helix.java index d25f14ec34..2c399185f1 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Helix.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Helix.java @@ -101,7 +101,6 @@ public void setRise(double rise) { /** * Returns the pitch angle of the helix - * @param transformation helix transformation * @return */ public double getAngle() { @@ -110,7 +109,6 @@ public double getAngle() { /** * Returns the AxisAngle of the helix transformation - * @param transformation helix transformation * @return */ public AxisAngle4d getAxisAngle() { @@ -161,7 +159,7 @@ public String toString() { } public List> getLayerLines() { - List> layerLines = new ArrayList>(); + List> layerLines = new ArrayList<>(); createLineSegments(permutation, layerLines); @@ -192,7 +190,7 @@ private static void createLineSegments(List permutation, List> layerLines) { for (int i = 0; i < permutation.size(); i++) { if (permutation.get(i) != -1 ) { - List lineSegment = new ArrayList(); + List lineSegment = new ArrayList<>(); lineSegment.add(i); lineSegment.add(permutation.get(i)); layerLines.add(lineSegment); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixExtender.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixExtender.java index 30d799b6f3..f99a998131 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixExtender.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixExtender.java @@ -40,7 +40,7 @@ public Point3d[] extendHelix(int steps) { List> layerLines = helix.getLayerLines(); // get list of subunit indices to be used for helix extension - List indices = new ArrayList(); + List indices = new ArrayList<>(); for (List line: layerLines) { if (steps < 0) { indices.add(line.get(0)); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixLayers.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixLayers.java index a42958d062..bbcce99df0 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixLayers.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixLayers.java @@ -29,7 +29,7 @@ * @author Peter */ public class HelixLayers { - private List helices = new ArrayList(); + private List helices = new ArrayList<>(); private double symmetryDeviation = 0; public int size() { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java index 361522fbd4..ff76812152 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java @@ -73,7 +73,7 @@ private void solve() { HelicalRepeatUnit unit = new HelicalRepeatUnit(subunits); List repeatUnitCenters = unit.getRepeatUnitCenters(); List repeatUnits = unit.getRepeatUnits(); - Set> permutations = new HashSet>(); + Set> permutations = new HashSet<>(); double minRise = parameters.getMinimumHelixRise() * fold; // for n-start // helix, @@ -87,7 +87,7 @@ private void solve() { for (Entry entry : interactionMap.entrySet()) { Integer[] pair = entry.getKey(); - logger.debug("HelixSolver: pair: " + Arrays.toString(pair)); + logger.debug("HelixSolver: pair: {}", Arrays.toString(pair)); int contacts = entry.getValue(); Point3d[] h1 = CalcPoint.clonePoint3dArray(repeatUnits.get(pair[0])); @@ -125,11 +125,11 @@ private void solve() { continue; } permutations.add(permutation); - logger.debug("Permutation: " + permutation); + logger.debug("Permutation: {}", permutation); // keep track of which subunits are permuted - Set permSet = new HashSet(); + Set permSet = new HashSet<>(); int count = 0; boolean valid = true; for (int i = 0; i < permutation.size(); i++) { @@ -238,10 +238,10 @@ private void solve() { repeatUnitCenters.get(pair[1])); angle = getAngle(transformation); - logger.debug("Trace rmsd: " + traceRmsd); - logger.debug("Trace rise: " + rise); - logger.debug("Trace angle: " + Math.toDegrees(angle)); - logger.debug("Permutation: " + permutation); + logger.debug("Trace rmsd: {}", traceRmsd); + logger.debug("Trace rise: {}", rise); + logger.debug("Trace angle: {}", Math.toDegrees(angle)); + logger.debug("Permutation: {}", permutation); if (traceRmsd > parameters.getRmsdThreshold()) { continue; @@ -280,7 +280,7 @@ private void solve() { helix.setFold(fold); helix.setContacts(contacts); helix.setRepeatUnits(unit.getRepeatUnitIndices()); - logger.debug("Layerlines: " + helix.getLayerLines()); + logger.debug("Layerlines: {}", helix.getLayerLines()); for (List line : helix.getLayerLines()) { maxLayerLineLength = Math.max(maxLayerLineLength, line.size()); @@ -355,7 +355,7 @@ private List getPermutation(Matrix4d transformation) { List centers = subunits.getOriginalCenters(); List seqClusterId = subunits.getClusterIds(); - List permutations = new ArrayList(centers.size()); + List permutations = new ArrayList<>(centers.size()); double[] dSqs = new double[centers.size()]; boolean[] used = new boolean[centers.size()]; Arrays.fill(used, false); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java index 8bbcb5a650..e1f4792410 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/PermutationGroup.java @@ -32,7 +32,7 @@ * @author Peter */ public class PermutationGroup implements Iterable> { - List> permutations = new ArrayList>(); + List> permutations = new ArrayList<>(); public void addPermutation(List permutation) { if (!permutations.contains(permutation)) { @@ -60,13 +60,13 @@ public int getOrder() { */ public void completeGroup() { // Copy initial set to allow permutations to grow - List> gens = new ArrayList>(permutations); + List> gens = new ArrayList<>(permutations); // Keep HashSet version of permutations for fast lookup. - Set> known = new HashSet>(permutations); + Set> known = new HashSet<>(permutations); //breadth-first search through the map of all members - List> currentLevel = new ArrayList>(permutations); + List> currentLevel = new ArrayList<>(permutations); while( currentLevel.size() > 0) { - List> nextLevel = new ArrayList>(); + List> nextLevel = new ArrayList<>(); for( List p : currentLevel) { for(List gen : gens) { List y = combine(p,gen); @@ -93,7 +93,7 @@ public String toString() { } public static List combine(List permutation1, List permutation2) { - List intermediate = new ArrayList(permutation1.size()); + List intermediate = new ArrayList<>(permutation1.size()); for (int i = 0, n = permutation1.size(); i < n; i++) { intermediate.add(permutation2.get(permutation1.get(i))); } @@ -101,7 +101,7 @@ public static List combine(List permutation1, List pe } public static int getOrder(List permutation) { - List copy = new ArrayList(permutation); + List copy = new ArrayList<>(permutation); for (int i = 0, n = permutation.size(); i < n; i++) { copy = combine(copy, permutation); if (copy.equals(permutation)) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSuperpositionScorer.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSuperpositionScorer.java index 5df1278563..1964132a0d 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSuperpositionScorer.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSuperpositionScorer.java @@ -40,7 +40,7 @@ public class QuatSuperpositionScorer { * TM score: Yang Zhang and Jeffrey Skolnick, PROTEINS: Structure, Function, and Bioinformatics 57:702–710 (2004) * @param subunits subunits to be scored * @param transformation transformation matrix - * @param permutations permutation that determines which subunits are superposed + * @param permutation permutation that determines which subunits are superposed * @return */ public static QuatSymmetryScores calcScores(QuatSymmetrySubunits subunits, Matrix4d transformation, List permutation) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java index 62906fd6b7..2f524e9171 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java @@ -315,7 +315,7 @@ private static List calcLocalSymmetriesCluster(Stoichiometr QuatSymmetryResults localResult = calcQuatSymmetry(nontrivialComposition.getComponent(i),symmParams); - if(localResult!=null && !localResult.getSymmetry().equals("C1")) { + if(localResult!=null && !"C1".equals(localResult.getSymmetry())) { localResult.setLocal(true); clusterSymmetries.add(localResult); Set knownResult = new HashSet<>(clusterIdToSubunitIds.get(i)); @@ -346,7 +346,7 @@ private static List calcLocalSymmetriesCluster(Stoichiometr //check if grouped clusters also have symmetry QuatSymmetryResults localResult = calcQuatSymmetry(groupComposition,symmParams); - if(localResult!=null && !localResult.getSymmetry().equals("C1")) { + if(localResult!=null && !"C1".equals(localResult.getSymmetry())) { localResult.setLocal(true); clusterSymmetries.add(localResult); // find subunit ids in this cluster list @@ -417,7 +417,7 @@ private static List calcLocalSymmetriesGraph(final Stoichio } QuatSymmetryResults localResult = calcQuatSymmetry(localStoichiometry,symmParams); - if(localResult!=null && !localResult.getSymmetry().equals("C1")) { + if(localResult!=null && !"C1".equals(localResult.getSymmetry())) { localResult.setLocal(true); localSymmetries.add(localResult); continue; @@ -544,8 +544,8 @@ private static QuatSymmetryResults calcQuatSymmetry(Stoichiometry composition, Q double hRmsd = helixLayers.getScores().getRmsd(); // System.out.println("cRMSD: " + cRmsd + " hRMSD: " + hRmsd); double deltaRmsd = hRmsd - cRmsd; - if (symmetry.equals("C1") - || (!symmetry.equals("C1") && deltaRmsd <= parameters + if ("C1".equals(symmetry) + || (!"C1".equals(symmetry) && deltaRmsd <= parameters .getHelixRmsdThreshold())) { method = SymmetryPerceptionMethod.ROTO_TRANSLATION; results = new QuatSymmetryResults(composition, helixLayers, diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryResults.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryResults.java index cdc7341c4b..db5cb229a2 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryResults.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryResults.java @@ -72,7 +72,7 @@ public QuatSymmetryResults(Stoichiometry stoichiometry, this.stoichiometry = stoichiometry; this.clusters = stoichiometry.getClusters(); - subunits = new ArrayList(); + subunits = new ArrayList<>(); for (SubunitCluster c : clusters) { subunits.addAll(c.getSubunits()); } @@ -95,7 +95,7 @@ public QuatSymmetryResults(Stoichiometry stoichiometry, this.stoichiometry = stoichiometry; this.clusters = stoichiometry.getClusters(); - subunits = new ArrayList(); + subunits = new ArrayList<>(); for (SubunitCluster c : clusters) { subunits.addAll(c.getSubunits()); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetrySubunits.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetrySubunits.java index 27d16cd6fe..b0bef7f1e6 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetrySubunits.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetrySubunits.java @@ -76,6 +76,10 @@ public QuatSymmetrySubunits(List clusters) { clusterIds.add(c); Atom[] atoms = clusters.get(c).getAlignedAtomsSubunit(s); + if( atoms.length == 0) { + throw new IllegalArgumentException("No aligned atoms in subunit"); + } + Point3d[] points = Calc.atomsToPoints(atoms); caCoords.add(points); @@ -105,7 +109,7 @@ public List getClusterIds() { */ public List getChainIds() { - List chains = new ArrayList(getSubunitCount()); + List chains = new ArrayList<>(getSubunitCount()); // Loop through all subunits in the clusters and fill Lists for (int c = 0; c < clusters.size(); c++) { @@ -125,7 +129,7 @@ public List getChainIds() { */ public List getModelNumbers() { - List models = new ArrayList(getSubunitCount()); + List models = new ArrayList<>(getSubunitCount()); // Loop through all subunits in the clusters and fill Lists for (int c = 0; c < clusters.size(); c++) { @@ -213,7 +217,7 @@ private void run() { calcOriginalCenters(); calcCentroid(); calcCenters(); - calcMomentsOfIntertia(); + calcMomentsOfInertia(); } private void calcOriginalCenters() { @@ -272,7 +276,7 @@ public Point3d getUpperBound() { return upper; } - private void calcMomentsOfIntertia() { + private void calcMomentsOfInertia() { for (Point3d[] trace : caCoords) { for (Point3d p : trace) { momentsOfInertia.addPoint(p, 1.0f); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Rotation.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Rotation.java index 9f1410abc6..6a9b95c3a6 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Rotation.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Rotation.java @@ -147,7 +147,7 @@ public int getDirection() { } /** - * @param direction the direction to set + * @param axis the direction to set */ public void setDirection(int axis) { this.direction = axis; 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 9a13d35813..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 @@ -31,11 +31,11 @@ import java.util.List; /** - * @see http://en.wikipedia.org/wiki/Rotation_group_SO(3) + * See http://en.wikipedia.org/wiki/Rotation_group_SO(3) * @author Peter */ public class RotationGroup implements Iterable { - private List rotations = new ArrayList(); + private List rotations = new ArrayList<>(); private int principalAxisIndex = 0; private int higherOrderRotationAxis = 0; private int twoFoldsPerpendicular = 0; @@ -61,7 +61,7 @@ public void addRotation(Rotation rotation) { public void setC1(int n) { Rotation r = new Rotation(); - List permutation = new ArrayList(n); + List permutation = new ArrayList<>(n); for (int i = 0; i < n; i++) { permutation.add(i); } @@ -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 95c73cb540..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 @@ -282,7 +282,7 @@ private List getAngles() { n = 60; } List folds = subunits.getFolds(); - List angles = new ArrayList(folds.size()-1); + List angles = new ArrayList<>(folds.size()-1); // note this loop starts at 1, we do ignore 1-fold symmetry, which is the first entry for (int fold: folds) { @@ -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; } @@ -370,7 +370,7 @@ private static Rotation createSymmetryOperation(List permutation, Matri private void setupDistanceBox() { distanceThreshold = calcDistanceThreshold(); - box = new DistanceBox(distanceThreshold); + box = new DistanceBox<>(distanceThreshold); for (int i = 0; i < originalCoords.length; i++) { box.addPoint(originalCoords[i], i); @@ -402,7 +402,7 @@ private double calcDistanceThreshold() { * @return A list mapping each subunit to the closest transformed subunit */ private List getPermutation() { - List permutation = new ArrayList(transformedCoords.length); + List permutation = new ArrayList<>(transformedCoords.length); double sum = 0.0f; for (Point3d t: transformedCoords) { @@ -432,7 +432,7 @@ private List getPermutation() { } // check uniqueness of indices - Set set = new HashSet(permutation); + Set set = new HashSet<>(permutation); // if size mismatch, clear permutation (its invalid) if (set.size() != originalCoords.length) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java index dc6a09053f..697ee41f82 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java @@ -238,7 +238,7 @@ public int numberOfComponents() { } /** - * Make a combined Stoichiometry object of this and the other. + * Make a combined Stoichiometry object of this and the other. * The combined list of clusters will be ordered by the number of subunits. * @return new {@link Stoichiometry} object. */ 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 4ad0494c28..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 @@ -50,7 +50,7 @@ public class SystematicSolver implements QuatSymmetrySolver { private RotationGroup rotations = new RotationGroup(); private Vector3d centroid = new Vector3d(); private Matrix4d centroidInverse = new Matrix4d(); - private Set> hashCodes = new HashSet>(); + private Set> hashCodes = new HashSet<>(); public SystematicSolver(QuatSymmetrySubunits subunits, QuatSymmetryParameters parameters) { if (subunits.getSubunitCount()== 2) { @@ -77,7 +77,7 @@ private void solve() { // loop over all permutations while (g.hasMore()) { int[] perm = g.getNext(); - List permutation = new ArrayList(perm.length); + List permutation = new ArrayList<>(perm.length); for (int j = 0; j < n; j++) { permutation.add(perm[j]); } @@ -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 37430260ca..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 @@ -63,12 +63,12 @@ public class DistanceBox { 1 + ( 1 * 10000) + ( 1 * 1000000000L) }; - private List tempBox = new ArrayList(offset.length); + private List tempBox = new ArrayList<>(offset.length); /** Creates a new instance of DistanceBox */ public DistanceBox(double binWidth) { - map = new HashMap>(); - layerMap = new HashMap>(); + map = new HashMap<>(); + layerMap = new HashMap<>(); this.inverseBinWidth = 1.0f/binWidth; this.modified = true; } @@ -82,7 +82,7 @@ public void addPoint(Point3d point, T object) { List box = map.get(location); if (box == null) { - box = new ArrayList(); + box = new ArrayList<>(); map.put(location, box); } @@ -127,8 +127,8 @@ public List getNeighbors(Point3d point) { } public List getIntersection(DistanceBox distanceBox) { - List intersection = new ArrayList(); - HashSet checkedLocations = new HashSet(); + List intersection = new ArrayList<>(); + HashSet checkedLocations = new HashSet<>(); for (Iterator iter = map.keySet().iterator(); iter.hasNext();) { long location = iter.next(); @@ -166,12 +166,12 @@ 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)); } else { - boxTwo = new ArrayList(tempBox); + boxTwo = new ArrayList<>(tempBox); } return boxTwo; } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Icosahedron.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Icosahedron.java index 7de37ee842..5cb5a99458 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Icosahedron.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Icosahedron.java @@ -67,7 +67,7 @@ public double getInscribedRadius() { /** * Sets the radius of an inscribed sphere, that is tangent to each * of the icosahedron's faces - * @param inscribedRadius the inscribedRadius to set + * @param radius the inscribedRadius to set */ public void setInscribedRadius(double radius) { double side = getSideLengthFromInscribedRadius(radius); @@ -88,7 +88,7 @@ public double getMidRadius() { /** * Sets the radius of radius of a sphere, that is tangent to each * of the icosahedron's edges - * @param midRadius the midRadius to set + * @param radius the midRadius to set */ public void setMidRadius(double radius) { double side = getSideLengthFromMiddleRadius(radius); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Octahedron.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Octahedron.java index 6cc5842dda..3165093908 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Octahedron.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Octahedron.java @@ -62,7 +62,7 @@ public double getInscribedRadius() { /** * Sets the radius of an inscribed sphere, that is tangent to each * of the octahedron's faces - * @param inscribedRadius the inscribedRadius to set + * @param radius the inscribedRadius to set */ public void setInscribedRadius(double radius) { double side = getSideLengthFromInscribedRadius(radius); @@ -83,7 +83,7 @@ public double getMidRadius() { /** * Sets the radius of radius of a sphere, that is tangent to each * of the octahedron's edges - * @param midRadius the midRadius to set + * @param radius the midRadius to set */ public void setMidRadius(double radius) { double side = getSideLengthFromMiddleRadius(radius); @@ -92,9 +92,6 @@ public void setMidRadius(double radius) { /** * Returns the vertices of an n-fold polygon of given radius and center - * @param n - * @param radius - * @param center * @return */ @Override diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java index 6b5d7edacf..24166059fc 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java @@ -87,7 +87,7 @@ public double getInscribedRadius() { /** * Sets the radius of an inscribed sphere, that is tangent to each * of the icosahedron's faces - * @param inscribedRadius the inscribedRadius to set + * @param radius the inscribedRadius to set */ public void setInscribedRadius(double radius) { double side = getSideLengthFromInscribedRadius(radius, n); @@ -119,7 +119,7 @@ public Point3d[] getVertices() { @Override public List getLineLoops() { - List list = new ArrayList(); + List list = new ArrayList<>(); int[] l1 = new int[2*n+2]; for (int i = 0; i < n; i++) { l1[i] = i; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/RectangularPrism.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/RectangularPrism.java index 45d32828c3..295c6275e9 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/RectangularPrism.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/RectangularPrism.java @@ -82,9 +82,6 @@ public double getCirumscribedRadius() { /** * Returns the vertices of an n-fold polygon of given radius and center - * @param n - * @param radius - * @param center * @return */ @Override diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Tetrahedron.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Tetrahedron.java index 7effd81cbe..a402cbef7e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Tetrahedron.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Tetrahedron.java @@ -66,7 +66,7 @@ public double getInscribedRadius() { /** * Sets the radius of an inscribed sphere, that is tangent to each * of the tetrahedron's faces - * @param inscribedRadius the inscribedRadius to set + * @param radius the inscribedRadius to set */ public void setInscribedRadius(double radius) { double side = getSideLengthFromInscribedRadius(radius); @@ -87,7 +87,7 @@ public double getMidRadius() { /** * Sets the radius of radius of a sphere, that is tangent to each * of the tetrahedron's edges - * @param midRadius the midRadius to set + * @param radius the midRadius to set */ public void setMidRadius(double radius) { double side = getSideLengthFromMiddleRadius(radius); @@ -96,9 +96,6 @@ public void setMidRadius(double radius) { /** * Returns the vertices of an n-fold polygon of given radius and center - * @param n - * @param radius - * @param center * @return */ @Override diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/AngleOrderDetectorPlus.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/AngleOrderDetectorPlus.java index 96b41f48e9..345493ce91 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/AngleOrderDetectorPlus.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/AngleOrderDetectorPlus.java @@ -45,7 +45,7 @@ public class AngleOrderDetectorPlus implements OrderDetector { private boolean normalizeError; /** - * @param error + * @param angleError * maximum angular error, in radians */ public AngleOrderDetectorPlus(double angleError) { @@ -61,7 +61,7 @@ public AngleOrderDetectorPlus(int maxOrder) { * * @param maxOrder * maximum order to consider - * @param error + * @param angleError * maximum angular error, in radians */ public AngleOrderDetectorPlus(int maxOrder, double angleError) { @@ -82,7 +82,7 @@ public AngleOrderDetectorPlus(int maxOrder, double angleError) { * * @param maxOrder * maximum order to consider - * @param error + * @param angleError * maximum angular error * @param normalize * indicates whether error should be normalized by the order diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java index 641242a0bf..b8ea01d6a1 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java @@ -82,7 +82,6 @@ public class CeSymm { *
      • 2.2 - run multiple symmetry levels recursively to find PG and * hierarchical symmetries. *
      - *
    • */ public static final String version = "2.2"; public static final String algorithmName = "jCE-symm"; @@ -189,7 +188,7 @@ protected static CeSymmResult align(Atom[] atoms, CESymmParameters params) CECalculator calculator = new CECalculator(params); Matrix lastMatrix = null; - List selfAlignments = new ArrayList(); + List selfAlignments = new ArrayList<>(); AFPChain optimalAFP = null; // STEP 2: perform the self-alignments of the structure @@ -364,7 +363,7 @@ public static CeSymmResult analyze(Atom[] atoms) throws StructureException { * * @param atoms * representative Atom array of the Structure - * @param param + * @param params * CeSymmParameters bean * @return CeSymmResult * @throws StructureException @@ -431,7 +430,7 @@ public static CeSymmResult analyzeLevel(Atom[] atoms, msa = optimizer.optimize(); result.setMultipleAlignment(msa); } catch (RefinerFailedException e) { - logger.debug("Optimization failed:" + e.getMessage()); + logger.debug("Optimization failed:{}", e.getMessage()); } } } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmIterative.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmIterative.java index 66df0f2658..0700e34571 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmIterative.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmIterative.java @@ -63,7 +63,6 @@ *
    • Repeat the last two steps until no more significant results are found. *
    • Map back all residues in a multiple alignment of the repeats. * - *
    • * * @author Aleix Lafita * @since 4.1.1 @@ -89,7 +88,7 @@ public class CeSymmIterative { public CeSymmIterative(CESymmParameters param) { params = param; alignGraph = new SimpleGraph(DefaultEdge.class); - levels = new ArrayList(); + levels = new ArrayList<>(); } /** @@ -128,8 +127,7 @@ private void iterate(Atom[] atoms) throws StructureException { if ((atoms.length <= params.getWinSize() || atoms.length <= params.getMinCoreLength()) && !levels.isEmpty()) { - logger.debug("Aborting iteration due to insufficient Atom " - + "array length: %d", atoms.length); + logger.debug("Aborting iteration due to insufficient Atom array length: %d", atoms.length); return; } @@ -232,7 +230,7 @@ private CeSymmResult reconstructSymmResult(Atom[] atoms) ConnectivityInspector inspector = new ConnectivityInspector( alignGraph); List> comps = inspector.connectedSets(); - List groups = new ArrayList(comps.size()); + List groups = new ArrayList<>(comps.size()); for (Set comp : comps) groups.add(new ResidueGroup(comp)); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmResult.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmResult.java index 0c4665a580..67d91362bd 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmResult.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmResult.java @@ -106,7 +106,7 @@ public List getRepeatsID() throws StructureException { if (!isRefined()) return null; - List repeats = new ArrayList( + List repeats = new ArrayList<>( numRepeats); PdbId pdbId = structureId.toCanonical().getPdbId(); @@ -203,7 +203,7 @@ public String getSymmGroup() { } catch (StructureException e) { symmGroup = "C1"; } - if (symmGroup.equals("C1")) + if ("C1".equals(symmGroup)) symmGroup = "R"; // could not find group } else { // in case significant but not refined diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/GraphComponentOrderDetector.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/GraphComponentOrderDetector.java index 822e62a8c2..db1dbb8939 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/GraphComponentOrderDetector.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/GraphComponentOrderDetector.java @@ -59,7 +59,7 @@ public int calculateOrder(AFPChain selfAlignment, Atom[] ca) List> components = inspector.connectedSets(); // The order maximizes the residues aligned - Map counts = new HashMap(); + Map counts = new HashMap<>(); for (Set c : components) { if (counts.containsKey(c.size())) counts.put(c.size(), counts.get(c.size()) + c.size()); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/GraphComponentRefiner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/GraphComponentRefiner.java index 6c7d44f6a7..efcd4c34b0 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/GraphComponentRefiner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/GraphComponentRefiner.java @@ -68,7 +68,7 @@ public MultipleAlignment refine(AFPChain selfAlignment, Atom[] atoms, int order) List> components = inspector.connectedSets(); // Filter components with size != order, and transform to ResidueGroups - List groups = new ArrayList(); + List groups = new ArrayList<>(); for (Set comp : components) { if (comp.size() == order) { ResidueGroup group = new ResidueGroup(comp); @@ -103,7 +103,7 @@ public MultipleAlignment refine(AFPChain selfAlignment, Atom[] atoms, int order) } // The compatibility score is the sum of rows of the matrix - List rowScores = new ArrayList(size); + List rowScores = new ArrayList<>(size); for (int i = 0; i < size; i++) { GVector row = new GVector(size); matrix.getRow(i, row); @@ -113,7 +113,7 @@ public MultipleAlignment refine(AFPChain selfAlignment, Atom[] atoms, int order) } // Refined multiple alignment Block as a result - List> alignRes = new ArrayList>(order); + List> alignRes = new ArrayList<>(order); for (int i = 0; i < order; i++) alignRes.add(new ArrayList()); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/ResidueGroup.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/ResidueGroup.java index 2fb0b0e64e..79053f55f9 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/ResidueGroup.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/ResidueGroup.java @@ -48,7 +48,7 @@ public class ResidueGroup { */ public ResidueGroup(Set component) { // Transform component into sorted List of residues - residues = new ArrayList(component); + residues = new ArrayList<>(component); Collections.sort(residues); } @@ -76,7 +76,7 @@ public int order() { * ResidueGroups {A,B,C}, if A is compatible with B and B is compatible with * C, then A is not necessarily compatible with C. * - * @param c2 + * @param other * second maximally connected component * @return true if compatible, false otherwise */ diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java index 9635debb05..a6ad226698 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java @@ -61,12 +61,12 @@ public MultipleAlignment refine(AFPChain selfAlignment, Atom[] atoms, /** * Refines a CE-Symm alignment so that it is perfectly symmetric. - * + *

      * The resulting alignment will have a one-to-one correspondance between * aligned residues of each symmetric part. * * @param afpChain Input alignment from CE-Symm - * @param k Symmetry order. This can be guessed by {@link CeSymm#getSymmetryOrder(AFPChain)} + * @param k Symmetry order. This can be guessed by {@link AlignmentTools#getSymmetryOrder(Map, Map, int, float)} * @return The refined alignment * @throws StructureException * @throws RefinerFailedException @@ -97,11 +97,11 @@ public static AFPChain refineSymmetry(AFPChain afpChain, Atom[] ca1, Atom[] ca2, /** * Refines a CE-Symm alignment so that it is perfectly symmetric. - * + *

      * The resulting alignment will have a one-to-one correspondance between * aligned residues of each symmetric part. * @param alignment The input alignment, as a map. This will be modified. - * @param k Symmetry order. This can be guessed by {@link CeSymm#getSymmetryOrder(AFPChain)} + * @param k Symmetry order. This can be guessed by {@link AlignmentTools#getSymmetryOrder(Map, Map, int, float)} * @return A modified map with the refined alignment * @throws StructureException */ @@ -117,8 +117,8 @@ public static Map refineSymmetry(Map alignme // 2. f^K-1(x) is defined // 3. score(f^K-1(x))>0 - TreeSet forwardLoops = new TreeSet(); - TreeSet backwardLoops = new TreeSet(); + TreeSet forwardLoops = new TreeSet<>(); + TreeSet backwardLoops = new TreeSet<>(); List eligible = null; @@ -240,7 +240,7 @@ private static List initializeEligible(Map alignment, // Assume all residues are eligible to start if(eligible == null) { - eligible = new LinkedList(alignment.keySet()); + eligible = new LinkedList<>(alignment.keySet()); } // Precalculate f^K-1(x) @@ -334,8 +334,8 @@ private static List initializeEligible(Map alignment, private static Map applyAlignmentAndCheckCycles(Map alignmentMap, int k, List eligible) { // Convert to lists to establish a fixed order (avoid concurrent modification) - List preimage = new ArrayList(alignmentMap.keySet()); // currently unmodified - List image = new ArrayList(preimage); + List preimage = new ArrayList<>(alignmentMap.keySet()); // currently unmodified + List image = new ArrayList<>(preimage); for (int n = 1; n <= k; n++) { // apply alignment @@ -351,7 +351,7 @@ private static Map applyAlignmentAndCheckCycles(Map imageMap = new HashMap(alignmentMap.size()); + Map imageMap = new HashMap<>(alignmentMap.size()); // now populate with actual values for (int i = 0; i < preimage.size(); i++) { @@ -372,7 +372,7 @@ private static Map applyAlignmentAndCheckCycles(Map initializeScores(Map alignment, Map scores, int k) { if(scores == null) { - scores = new HashMap(alignment.size()); + scores = new HashMap<>(alignment.size()); } else { scores.clear(); } @@ -444,7 +444,7 @@ private static AFPChain partitionAFPchain(AFPChain afpChain, int repeatLen = afpChain.getOptLength()/order; //Extract all the residues considered in the first chain of the alignment - List alignedRes = new ArrayList(); + List alignedRes = new ArrayList<>(); for (int su=0; su @@ -101,14 +101,12 @@ public class SymmOptimizer { private List mcScoreHistory; /** - * Constructor with a seed MultipleAligment storing a refined symmetry + * Constructor with a seed MultipleAlignment storing a refined symmetry * alignment of the repeats. To perform the optimization use the call or * optimize methods after instantiation. * * @param symmResult * CeSymmResult with all the information - * @throws RefinerFailedException - * @throws StructureException */ public SymmOptimizer(CeSymmResult symmResult) { @@ -146,21 +144,21 @@ private void initialize() throws StructureException, RefinerFailedException { "Seed alignment too short: repeat core length < 1"); // Initialize the history variables - timeHistory = new ArrayList(); - lengthHistory = new ArrayList(); - rmsdHistory = new ArrayList(); - mcScoreHistory = new ArrayList(); - tmScoreHistory = new ArrayList(); + timeHistory = new ArrayList<>(); + lengthHistory = new ArrayList<>(); + rmsdHistory = new ArrayList<>(); + mcScoreHistory = new ArrayList<>(); + tmScoreHistory = new ArrayList<>(); C = 20 * order; // Initialize alignment variables block = msa.getBlock(0).getAlignRes(); - freePool = new ArrayList(); + freePool = new ArrayList<>(); length = block.get(0).size(); // Store the residues aligned in the block - List aligned = new ArrayList(); + List aligned = new ArrayList<>(); for (int su = 0; su < order; su++) aligned.addAll(block.get(su)); @@ -181,11 +179,12 @@ private void initialize() throws StructureException, RefinerFailedException { * Optimization method based in a Monte-Carlo approach. Starting from the * refined alignment uses 4 types of moves: *

      + *

        *
      • 1- Shift Row: if there are enough freePool residues available. *
      • 2- Expand Block: add another alignment column. *
      • 3- Shrink Block: move a block column to the freePool. *
      • 4- Insert gap: insert a gap in a position of the alignment. - * + *
      * @throws StructureException * @throws RefinerFailedException * if the alignment is not symmetric or too short. @@ -196,11 +195,11 @@ public MultipleAlignment optimize() throws StructureException, initialize(); // Save the optimal alignment - List> optBlock = new ArrayList>(); - List optFreePool = new ArrayList(); + List> optBlock = new ArrayList<>(); + List optFreePool = new ArrayList<>(); optFreePool.addAll(freePool); for (int k = 0; k < order; k++) { - List b = new ArrayList(); + List b = new ArrayList<>(); b.addAll(block.get(k)); optBlock.add(b); } @@ -214,11 +213,11 @@ public MultipleAlignment optimize() throws StructureException, while (i < maxIter && conv < stepsToConverge) { // Save the state of the system - List> lastBlock = new ArrayList>(); - List lastFreePool = new ArrayList(); + List> lastBlock = new ArrayList<>(); + List lastFreePool = new ArrayList<>(); lastFreePool.addAll(freePool); for (int k = 0; k < order; k++) { - List b = new ArrayList(); + List b = new ArrayList<>(); b.addAll(block.get(k)); lastBlock.add(b); } @@ -281,11 +280,11 @@ public MultipleAlignment optimize() throws StructureException, // Store as the optimal alignment if better if (mcScore > optScore) { - optBlock = new ArrayList>(); - optFreePool = new ArrayList(); + optBlock = new ArrayList<>(); + optFreePool = new ArrayList<>(); optFreePool.addAll(freePool); for (int k = 0; k < order; k++) { - List b = new ArrayList(); + List b = new ArrayList<>(); b.addAll(block.get(k)); optBlock.add(b); } @@ -366,7 +365,7 @@ private void updateMultipleAlignment() throws StructureException, */ private boolean checkGaps() { - List shrinkColumns = new ArrayList(); + List shrinkColumns = new ArrayList<>(); // Loop for each column for (int res = 0; res < length; res++) { int gapCount = 0; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java index fcf9ff29d0..5eb2584401 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmetryAxes.java @@ -541,7 +541,7 @@ private int getNumRepeats(int level) { * @return List of first Repeats of each index, sorted in ascending order */ public List getFirstRepeats(int level) { - List firstRepeats = new ArrayList(); + List firstRepeats = new ArrayList<>(); int m = getNumRepeats(level+1); //size of the level int d = axes.get(level).getOrder(); //degree of this level int n = m*d; // number of repeats included in each axis diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/misc/ProteinComplexSignature.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/misc/ProteinComplexSignature.java index 492e1485e1..892e326fb5 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/misc/ProteinComplexSignature.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/misc/ProteinComplexSignature.java @@ -29,7 +29,7 @@ public class ProteinComplexSignature { private BlastClustReader blastClust = null; private String pdbId = ""; private List chainIds = null; - private List chainSignatures = new ArrayList(); + private List chainSignatures = new ArrayList<>(); public ProteinComplexSignature(String pdbId, List chainIds, BlastClustReader blastClust) { @@ -75,15 +75,15 @@ public int getSubunitTypeCount() { private List getChainSignatures() { String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - Map mapCounts = new TreeMap(); - Map> mapChainIds = new TreeMap>(); + Map mapCounts = new TreeMap<>(); + Map> mapChainIds = new TreeMap<>(); for (String chainId: chainIds) { String rep = blastClust.getRepresentativeChain(pdbId, chainId); Integer value = mapCounts.get(rep); if (value == null) { mapCounts.put(rep, 1); - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(chainId); mapChainIds.put(rep, list); } else { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/BlastClustReader.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/BlastClustReader.java index a0653c2055..b2b3298157 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/BlastClustReader.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/BlastClustReader.java @@ -102,7 +102,7 @@ public List> getPdbChainIdClusters(String pdbId) { loadClusters(sequenceIdentity); String pdbIdUpper = pdbId.toUpperCase(); - List> matches = new ArrayList>(); + List> matches = new ArrayList<>(); for (List cluster: clusters) { for (String chainId: cluster) { if (chainId.startsWith(pdbIdUpper)) { @@ -117,14 +117,14 @@ public List> getPdbChainIdClusters(String pdbId) { public List> getChainIdsInEntry(String pdbId) { loadClusters(sequenceIdentity); - List> matches = new ArrayList>(); + List> matches = new ArrayList<>(); List match = null; for (List cluster: clusters) { for (String chainId: cluster) { if (chainId.startsWith(pdbId)) { if (match == null) { - match = new ArrayList(); + match = new ArrayList<>(); } match.add(chainId.substring(5)); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/PowerSet.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/PowerSet.java index 10b5652ea1..bfaa0e375e 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/PowerSet.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/PowerSet.java @@ -52,16 +52,16 @@ public PowerSet() { * @return the set of power Sets of the original Set */ public Set> powerSet(Set originalSet) { - Set> sets = new LinkedHashSet>(); + Set> sets = new LinkedHashSet<>(); if (originalSet.isEmpty()) { sets.add(new LinkedHashSet()); return sets; } - List list = new ArrayList(originalSet); + List list = new ArrayList<>(originalSet); T head = list.get(0); - Set rest = new LinkedHashSet(list.subList(1, list.size())); + Set rest = new LinkedHashSet<>(list.subList(1, list.size())); for (Set set : powerSet(rest)) { - Set newSet = new LinkedHashSet(); + Set newSet = new LinkedHashSet<>(); newSet.add(head); newSet.addAll(set); sets.add(newSet); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java index 3cac9be3f1..76822af35f 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java @@ -53,8 +53,10 @@ import org.biojava.nbio.structure.align.multiple.MultipleAlignmentImpl; import org.biojava.nbio.structure.align.multiple.util.CoreSuperimposer; import org.biojava.nbio.structure.align.multiple.util.MultipleAlignmentScorer; +import org.biojava.nbio.structure.align.multiple.util.MultipleAlignmentTools; import org.biojava.nbio.structure.align.multiple.util.MultipleSuperimposer; import org.biojava.nbio.structure.cluster.Subunit; +import org.biojava.nbio.structure.cluster.SubunitCluster; import org.biojava.nbio.structure.cluster.SubunitClustererMethod; import org.biojava.nbio.structure.cluster.SubunitClustererParameters; import org.biojava.nbio.structure.geometry.SuperPositions; @@ -62,6 +64,7 @@ import org.biojava.nbio.structure.symmetry.core.QuatSymmetryDetector; import org.biojava.nbio.structure.symmetry.core.QuatSymmetryParameters; import org.biojava.nbio.structure.symmetry.core.QuatSymmetryResults; +import org.biojava.nbio.structure.symmetry.core.Stoichiometry; import org.biojava.nbio.structure.symmetry.internal.CeSymmResult; import org.biojava.nbio.structure.symmetry.internal.SymmetryAxes; import org.jgrapht.Graph; @@ -443,7 +446,7 @@ public static double getAngle(AFPChain afpChain, Atom[] ca1, Atom[] ca2) { public static List> buildSymmetryGraph(List afps, Atom[] atoms, boolean undirected) { - List> graph = new ArrayList>(); + List> graph = new ArrayList<>(); for (int n = 0; n < atoms.length; n++) { graph.add(new ArrayList()); @@ -498,7 +501,7 @@ public static Graph buildSymmetryGraph( * @param symmetry * CeSymmResult * @throws StructureException - * @result List of structures, by repeat index sequentially + * @return List of structures, by repeat index sequentially * */ public static List divideStructure(CeSymmResult symmetry) @@ -512,7 +515,7 @@ public static List divideStructure(CeSymmResult symmetry) Atom[] atoms = symmetry.getAtoms(); Set allGroups = StructureTools.getAllGroupsFromSubset(atoms, GroupType.HETATM); List repeatsId = symmetry.getRepeatsID(); - List repeats = new ArrayList(order); + List repeats = new ArrayList<>(order); // Create new structure containing the repeat atoms for (int i = 0; i < order; i++) { @@ -613,7 +616,7 @@ public static MultipleAlignment toRepeatsAlignment(CeSymmResult result) MultipleAlignment repeats = newEnsemble.getMultipleAlignment(0); Block block = repeats.getBlock(0); - List atomArrays = new ArrayList(); + List atomArrays = new ArrayList<>(); for (Structure s : repSt) atomArrays.add(StructureTools.getRepresentativeAtomArray(s)); @@ -706,21 +709,18 @@ public static QuatSymmetryResults getQuaternarySymmetry(CeSymmResult result) throws StructureException { // Obtain the subunits of the repeats - List atoms = toRepeatsAlignment(result).getAtomArrays(); + MultipleAlignment msa = toRepeatsAlignment(result); + List atoms = msa.getAtomArrays(); List subunits = atoms.stream() .map(a -> new Subunit(a, null, null, null)) .collect(Collectors.toList()); - - // The clustering thresholds are set to 0 so that all always merged - SubunitClustererParameters cp = new SubunitClustererParameters(); - cp.setClustererMethod(SubunitClustererMethod.STRUCTURE); - cp.setRMSDThreshold(10.0); - cp.setStructureCoverageThreshold(0.0); + List> eqr = MultipleAlignmentTools.getEquivalentResidues(msa, true); + SubunitCluster cluster = new SubunitCluster(subunits, eqr); + Stoichiometry composition = new Stoichiometry(Arrays.asList(cluster)); QuatSymmetryParameters sp = new QuatSymmetryParameters(); - QuatSymmetryResults gSymmetry = QuatSymmetryDetector - .calcGlobalSymmetry(subunits, sp, cp); + .calcGlobalSymmetry(composition, sp); return gSymmetry; } @@ -737,7 +737,7 @@ public static QuatSymmetryResults getQuaternarySymmetry(CeSymmResult result) */ public static List getGroups(Atom[] rAtoms) { - List groups = new ArrayList(rAtoms.length); + List groups = new ArrayList<>(rAtoms.length); for (Atom a : rAtoms) { Group g = a.getGroup(); @@ -774,8 +774,8 @@ public static void updateSymmetryTransformation(SymmetryAxes axes, for (int level = 0; level < axes.getNumLevels(); level++) { // Calculate the aligned atom arrays to superimpose - List list1 = new ArrayList(); - List list2 = new ArrayList(); + List list1 = new ArrayList<>(); + List list2 = new ArrayList<>(); for (int firstRepeat : axes.getFirstRepeats(level)) { @@ -866,7 +866,7 @@ public static Atom[] getRepresentativeAtoms(Structure structure) { else { // Get Atoms of all models - List atomList = new ArrayList(); + List atomList = new ArrayList<>(); for (int m = 0; m < structure.nrModels(); m++) { for (Chain c : structure.getModel(m)) atomList.addAll(Arrays.asList(StructureTools @@ -888,7 +888,7 @@ public static Atom[] getRepresentativeAtoms(Structure structure) { */ public static List getValidFolds(List stoichiometry) { - List denominators = new ArrayList(); + List denominators = new ArrayList<>(); if (stoichiometry.isEmpty()) return denominators; @@ -896,7 +896,7 @@ public static List getValidFolds(List stoichiometry) { int nChains = Collections.max(stoichiometry); // Remove duplicate stoichiometries - Set nominators = new TreeSet(stoichiometry); + Set nominators = new TreeSet<>(stoichiometry); // find common denominators for (int d = 1; d <= nChains; d++) { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/BravaisLattice.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/BravaisLattice.java index 02efe5be5a..69eca10550 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/BravaisLattice.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/BravaisLattice.java @@ -62,7 +62,7 @@ public CrystalCell getExampleUnitCell() { } private static HashMap initname2bl(){ - HashMap name2bl = new HashMap(); + HashMap name2bl = new HashMap<>(); for (BravaisLattice bl:BravaisLattice.values()) { name2bl.put(bl.getName(), bl); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalBuilder.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalBuilder.java index 2bc6806b77..4b5975cbaa 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalBuilder.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalBuilder.java @@ -280,12 +280,12 @@ private void calcInterfacesCrystal(StructureInterfaceList set, double cutoff) { int neighbors = (2*numCells+1)*(2*numCells+1)*(2*numCells+1)-1; int auTrials = (numPolyChainsAu*(numPolyChainsAu-1))/2; int trials = numPolyChainsAu*numOperatorsSg*numPolyChainsAu*neighbors; - logger.debug("Chain clash trials within original AU: "+auTrials); + logger.debug("Chain clash trials within original AU: {}", auTrials); logger.debug( "Chain clash trials between the original AU and the neighbouring "+neighbors+ " whole unit cells ("+numCells+" neighbours)" + "(2x"+numPolyChainsAu+"chains x "+numOperatorsSg+"AUs x "+neighbors+"cells) : "+trials); - logger.debug("Total trials: "+(auTrials+trials)); + logger.debug("Total trials: {}", (auTrials+trials)); } List polyChains = structure.getPolyChains(); @@ -404,12 +404,12 @@ else if (selfEquivalent) } end = System.currentTimeMillis(); - logger.debug("\n"+trialCount+" chain-chain clash trials done. Time "+(end-start)/1000+"s"); - logger.debug(" skipped (not overlapping AUs) : "+skippedAUsNoOverlap); - logger.debug(" skipped (not overlapping chains) : "+skippedChainsNoOverlap); - logger.debug(" skipped (sym redundant op pairs) : "+skippedRedundant); - logger.debug(" skipped (sym redundant self op) : "+skippedSelfEquivalent); - logger.debug("Found "+set.size()+" interfaces."); + logger.debug("\n{} chain-chain clash trials done. Time {}{}s", trialCount, (end-start), 1000); + logger.debug(" skipped (not overlapping AUs) : {}", skippedAUsNoOverlap); + logger.debug(" skipped (not overlapping chains) : {}", skippedChainsNoOverlap); + logger.debug(" skipped (sym redundant op pairs) : {}", skippedRedundant); + logger.debug(" skipped (sym redundant self op) : {}", skippedSelfEquivalent); + logger.debug("Found {} interfaces.", set.size()); } diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java index b1449475f0..d8fa098458 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java @@ -489,7 +489,7 @@ public double getMaxDimension() { Point3d vert7 = new Point3d(1,1,1); transfToOrthonormal(vert7); - ArrayList vertDists = new ArrayList(); + ArrayList vertDists = new ArrayList<>(); vertDists.add(vert0.distance(vert7)); vertDists.add(vert3.distance(vert4)); vertDists.add(vert1.distance(vert6)); 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 b7be721a87..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 @@ -30,13 +30,13 @@ import javax.vecmath.Matrix3d; import javax.vecmath.Matrix4d; import javax.vecmath.Vector3d; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -105,7 +105,7 @@ public SpaceGroup(int id, int multiplicity, int primitiveMultiplicity, String sh this.shortSymbol = shortSymbol; this.altShortSymbol = altShortSymbol; transformations = new ArrayList(multiplicity); - transfAlgebraic = new ArrayList(multiplicity); + transfAlgebraic = new ArrayList<>(multiplicity); cellTranslations = new Vector3d[multiplicity/primitiveMultiplicity]; this.bravLattice = bravLattice; } @@ -212,15 +212,15 @@ private static double[] convertAlgebraicStrToCoefficients(String algString) { sign = m.group(1); } double s = 1.0; - if (sign.equals("-")){ + if ("-".equals(sign)){ s = -1.0; } String coord = m.group(2); - if (coord.equals("X")) { + if ("X".equals(coord)) { coefficients[0] = s; - } else if (coord.equals("Y")) { + } else if ("Y".equals(coord)) { coefficients[1] = s; - } else if (coord.equals("Z")) { + } else if ("Z".equals(coord)) { coefficients[2] = s; } } @@ -645,11 +645,11 @@ 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) - this.transfAlgebraic = new ArrayList(transfAlgebraic.size()); + if ( this.transfAlgebraic == null || this.transfAlgebraic.isEmpty()) + this.transfAlgebraic = new ArrayList<>(transfAlgebraic.size()); for ( String transf : transfAlgebraic){ addTransformation(transf); diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SymoplibParser.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SymoplibParser.java index 93896000b1..0de5e33bc4 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SymoplibParser.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SymoplibParser.java @@ -24,7 +24,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -98,7 +98,7 @@ private static TreeMap parseSpaceGroupsXML() { System.exit(1); } - TreeMap map = new TreeMap(); + TreeMap map = new TreeMap<>(); try { map = parseSpaceGroupsXML(spaceGroupIS); @@ -110,7 +110,7 @@ private static TreeMap parseSpaceGroupsXML() { System.exit(1); } - name2sgs = new HashMap(); + name2sgs = new HashMap<>(); for (SpaceGroup sg:map.values()) { @@ -167,7 +167,7 @@ public static SpaceGroup getSpaceGroup(String shortName) { // PDB uses group "P 1-" for 13 racemic mixture entries (as of Sep2011), e.g. 3e7r // they call the space group "P 1-" unusually (symop.lib and everyone else call it "P -1") - if (shortName.equals("P 1-")) shortName="P -1"; + if ("P 1-".equals(shortName)) shortName="P -1"; // enantiomorphic space groups contain sometime letters indicating glide planes which should always be lower case // in some PDB entries like 4gwv they are in upper case, we fix that here: convert any non-first letter to lower case @@ -185,16 +185,16 @@ public static TreeMap getAllSpaceGroups() { * A parser for the symop.lib file provided by CCP4. Note: this file is not getting re-distributed by BioJava. * It can be downloaded from: * - * http://www.ccp4.ac.uk/cvs/viewvc.cgi/libccp4/data/symop.lib?revision=1.10&view=markup - * + * http://www.ccp4.ac.uk/cvs/viewvc.cgi/libccp4/data/symop.lib?revision=1.10&view=markup + *

      * Note: this file is not needed by BioJava. BioJava loads equivalent information from the file spacegroups.xml * * @param symoplibIS * @return */ public static TreeMap parseSymopLib(InputStream symoplibIS) { - TreeMap map = new TreeMap(); - name2sgs = new HashMap(); + TreeMap map = new TreeMap<>(); + name2sgs = new HashMap<>(); try { BufferedReader br = new BufferedReader(new InputStreamReader(symoplibIS)); String line; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapAdapter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapAdapter.java index 6c068f51e3..2116b94471 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapAdapter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapAdapter.java @@ -25,7 +25,7 @@ import org.biojava.nbio.structure.xtal.SpaceGroup; -import javax.xml.bind.annotation.adapters.XmlAdapter; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; import java.util.Map; import java.util.TreeMap; @@ -42,7 +42,7 @@ public SpaceGroupMapElements[] marshal(Map arg0) throws Exc @Override public Map unmarshal(SpaceGroupMapElements[] arg0) throws Exception { - Map r = new TreeMap(); + Map r = new TreeMap<>(); for (SpaceGroupMapElements mapelement : arg0) r.put(mapelement.key, mapelement.value); return r; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapElements.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapElements.java index 6572570964..49170edf16 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapElements.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapElements.java @@ -25,7 +25,7 @@ import org.biojava.nbio.structure.xtal.SpaceGroup; -import javax.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElement; public class SpaceGroupMapElements { diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapRoot.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapRoot.java index e7998ee8dd..b711e3179b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapRoot.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/SpaceGroupMapRoot.java @@ -25,12 +25,12 @@ import org.biojava.nbio.structure.xtal.SpaceGroup; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.Unmarshaller; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -43,7 +43,7 @@ public class SpaceGroupMapRoot { private TreeMap mapProperty; public SpaceGroupMapRoot() { - mapProperty = new TreeMap(); + mapProperty = new TreeMap<>(); } @XmlJavaTypeAdapter(SpaceGroupMapAdapter.class) diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/TransfAlgebraicAdapter.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/TransfAlgebraicAdapter.java index 7e707002d8..e4d4847597 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/TransfAlgebraicAdapter.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/TransfAlgebraicAdapter.java @@ -24,7 +24,7 @@ package org.biojava.nbio.structure.xtal.io; -import javax.xml.bind.annotation.adapters.XmlAdapter; +import jakarta.xml.bind.annotation.adapters.XmlAdapter; import java.util.ArrayList; import java.util.List; @@ -41,7 +41,7 @@ public String[] marshal(List arg0) throws Exception { @Override public List unmarshal(String[] arg0) throws Exception { - List l = new ArrayList(); + List l = new ArrayList<>(); for (String s : arg0) l.add(s); return l; diff --git a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/TreeMapSpaceGroupWrapper.java b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/TreeMapSpaceGroupWrapper.java index 8aabe9b2f1..2a5f760f2b 100644 --- a/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/TreeMapSpaceGroupWrapper.java +++ b/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/io/TreeMapSpaceGroupWrapper.java @@ -26,13 +26,13 @@ import org.biojava.nbio.structure.xtal.SpaceGroup; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.Unmarshaller; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -52,7 +52,7 @@ public class TreeMapSpaceGroupWrapper implements Serializable{ public TreeMapSpaceGroupWrapper(){ - data = new TreeMap(); + data = new TreeMap<>(); } public TreeMap getData() { diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/HetatomImplTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/HetatomImplTest.java index 74556c2434..8f9d190a71 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/HetatomImplTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/HetatomImplTest.java @@ -29,7 +29,7 @@ /** * - * @author Jules Jacobsen + * @author Jules Jacobsen jacobsen@ebi.ac.uk */ public class HetatomImplTest { diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/PDBStatusTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/PDBStatusTest.java index 82e26bd802..6d97b0889d 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/PDBStatusTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/PDBStatusTest.java @@ -27,7 +27,7 @@ import java.io.IOException; /** - * @author Spencer Bliven + * @author Spencer Bliven sbliven@ucsd.edu * */ public class PDBStatusTest { diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/ResidueNumberTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/ResidueNumberTest.java index c594f0dd18..c5ebb6c028 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/ResidueNumberTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/ResidueNumberTest.java @@ -29,7 +29,7 @@ /** * - * @author Jules Jacobsen + * @author Jules Jacobsen jacobsen@ebi.ac.uk */ public class ResidueNumberTest { diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/SiteTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/SiteTest.java index d7a64d0017..5e39000e90 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/SiteTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/SiteTest.java @@ -29,7 +29,7 @@ /** * Tests functionality of Site class. - * @author Jules Jacobsen + * @author Jules Jacobsen jacobsen@ebi.ac.uk */ public class SiteTest { diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/align/util/AtomCacheTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/align/util/AtomCacheTest.java index af56e67046..073a679dbb 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/align/util/AtomCacheTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/align/util/AtomCacheTest.java @@ -33,6 +33,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; @@ -164,7 +165,7 @@ public void testGetStructureForDomain3() throws IOException, StructureException } /** - * Test parsing of chain-less ranges (present in SCOP < 1.73) + * Test parsing of chain-less ranges (present in SCOP < 1.73) * @throws IOException * @throws StructureException */ @@ -390,7 +391,7 @@ public void testEmptyChemComp() throws IOException, StructureException { Files.createDirectories(testCif.getParent()); URL resource = AtomCacheTest.class.getResource("/atp.cif.gz"); File src = new File(resource.getPath()); - FileDownloadUtils.copy(src, testCif.toFile()); + Files.copy(src.toPath(), testCif, StandardCopyOption.REPLACE_EXISTING); // Load structure Structure s = cache.getStructure("1ABC"); @@ -453,7 +454,7 @@ public void testEmptyGZChemComp() throws IOException, StructureException { Files.createDirectories(testCif.getParent()); URL resource = AtomCacheTest.class.getResource("/atp.cif.gz"); File src = new File(resource.getPath()); - FileDownloadUtils.copy(src, testCif.toFile()); + Files.copy(src.toPath(), testCif, StandardCopyOption.REPLACE_EXISTING); // Load structure Structure s = cache.getStructure("1ABC"); diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestNonDepositedFiles.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestNonDepositedFiles.java index e2bd13bea5..afe4fa8e65 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestNonDepositedFiles.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestNonDepositedFiles.java @@ -478,12 +478,12 @@ private static int[] countEntityTypes(List entities) { @Test public void testStructureWithBranchedEntities() throws IOException { // Example carbohydrate remediation file to be released in July 2020 - URL url = new URL("https://raw.githubusercontent.com/pdbxmmcifwg/carbohydrate-extension/master/examples/models/1B5F-carb.cif"); - InputStream inStream = url.openStream(); + URL url = new URL("https://models.rcsb.org/1B5F.bcif.gz"); + InputStream inStream = new GZIPInputStream(url.openStream()); Structure structure = CifStructureConverter.fromInputStream(inStream); - assertEquals(7, structure.getEntityInfos().size()); + assertEquals(6, structure.getEntityInfos().size()); assertEquals(2, structure.getEntityById(1).getChains().size()); assertEquals(2, structure.getEntityById(2).getChains().size()); diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestQuaternaryStructureProviders.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestQuaternaryStructureProviders.java index 0b67e66aaa..7a60a6e095 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestQuaternaryStructureProviders.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestQuaternaryStructureProviders.java @@ -31,8 +31,7 @@ import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; public class TestQuaternaryStructureProviders { @@ -51,35 +50,20 @@ public void test3FAD() throws IOException, StructureException{ public void test5LDH() throws IOException, StructureException{ comparePdbVsMmcif("5LDH",1, 4); - // the pdb file of 5ldh contains only 1 bioassembly, whilst the mmcif contains 2, - // thus we can't test here the comparison between the 2 - //testID("5LDH",2, 2); + // Note 1: since v5 remediation there's 4 bioassemblies with numerical ids for 5ldh, no more PAU and XAU + // Note 2: before March 2024 remediation, this entry had 4 assemblies. Now only 1 - // since v5 remediation there's 4 bioassemblies with numerical ids for 5ldh, no more PAU and XAU + // bioassembly 1 does exist in mmcif file, let's check that boolean gotException = false; try { AtomCache cache = new AtomCache(); cache.setFiletype(StructureFiletype.CIF); StructureIO.setAtomCache(cache); - StructureIO.getBiologicalAssembly("5LDH",3); + StructureIO.getBiologicalAssembly("5LDH",1); } catch (StructureException e) { gotException = true; } - - assertTrue("Bioassembly 3 for PDB id 5LDH should fail with a StructureException!", !gotException); - - // bioassembly 2 does exist in mmcif file, let's check that - gotException = false; - try { - AtomCache cache = new AtomCache(); - cache.setFiletype(StructureFiletype.CIF); - StructureIO.setAtomCache(cache); - StructureIO.getBiologicalAssembly("5LDH",2); - } catch (StructureException e) { - gotException = true; - } - assertTrue("Bioassembly 2 for PDB id 5LDH should not fail with a StructureException!", !gotException); - + assertFalse("Bioassembly 1 for PDB id 5LDH should exist and not fail with a StructureException!", gotException); } @Test @@ -94,17 +78,9 @@ public void test1A29() throws IOException, StructureException{ @Test public void test1EI7() throws IOException, StructureException { - comparePdbVsMmcif("1ei7",1, 68); - } - @Test - public void testGetNrBioAssemblies5LDH() throws IOException, StructureException { - assertEquals("There should be 4 bioassemblies for 5LDH, see github issue #230", 4, StructureIO.getBiologicalAssemblies("5LDH").size()); - } - - /** * Bioassembly tests for a single PDB entry * @param pdbId @@ -115,9 +91,7 @@ public void testGetNrBioAssemblies5LDH() throws IOException, StructureException */ private void comparePdbVsMmcif(String pdbId, int bioMolecule, int mmSize) throws IOException, StructureException{ - Structure pdbS = getPdbBioAssembly(pdbId, bioMolecule, true); - Structure mmcifS = getMmcifBioAssembly(pdbId, bioMolecule, true); PDBHeader pHeader = pdbS.getPDBHeader(); @@ -129,16 +103,13 @@ private void comparePdbVsMmcif(String pdbId, int bioMolecule, int mmSize) throws // mmcif files contain sometimes partial virus assemblies, so they can contain more info than pdb assertTrue(pHeader.getNrBioAssemblies() <= mHeader.getNrBioAssemblies()); - Map pMap = pHeader.getBioAssemblies(); Map mMap = mHeader.getBioAssemblies(); - assertTrue(pMap.keySet().size()<= mMap.keySet().size()); assertEquals(mmSize, mMap.get(bioMolecule).getMacromolecularSize()); - for ( int k : pMap.keySet()) { assertTrue(mMap.containsKey(k)); @@ -154,45 +125,32 @@ private void comparePdbVsMmcif(String pdbId, int bioMolecule, int mmSize) throws //assertEquals(pL.size(), mL.size()); - - for (BiologicalAssemblyTransformation m1 : pL){ - + for (BiologicalAssemblyTransformation m1 : pL) { boolean found = false; - for ( BiologicalAssemblyTransformation m2 : mL){ - - if (! m1.getChainId().equals(m2.getChainId())) + for (BiologicalAssemblyTransformation m2 : mL) { + if (! m1.getChainId().equals(m2.getChainId())) continue; - if ( ! m1.getTransformationMatrix().epsilonEquals(m2.getTransformationMatrix(), 0.0001)) + if (! m1.getTransformationMatrix().epsilonEquals(m2.getTransformationMatrix(), 0.0001)) continue; found = true; - } - - if ( ! found ){ + if (! found) { System.err.println("did not find matching matrix " + m1); System.err.println(mL); } assertTrue(found); - } } - assertEquals("Not the same number of chains!" , pdbS.size(),mmcifS.size()); Atom[] pdbA = StructureTools.getAllAtomArray(pdbS); - Atom[] mmcifA = StructureTools.getAllAtomArray(mmcifS); assertEquals(pdbA.length, mmcifA.length); - assertEquals(pdbA[0].toPDB(), mmcifA[0].toPDB()); - - - - } private Structure getPdbBioAssembly(String pdbId, int bioMolecule, boolean multiModel) throws IOException, StructureException { @@ -213,6 +171,4 @@ private Structure getMmcifBioAssembly(String pdbId, int bioMolecule, boolean mul return mmcifS; } - - } diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/cif/CifFileConsumerImplTest.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/cif/CifFileConsumerImplTest.java index 0d2ddaf4f6..a8925afa88 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/cif/CifFileConsumerImplTest.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/cif/CifFileConsumerImplTest.java @@ -181,7 +181,7 @@ private static int[] countEntityTypes(List entities) { /** * This tests for cases where dots appear in integer fields. Unusual but it happens in some PDB entries like 1s32. - * See issue https://github.com/biojava/biojava/issues/368 + * See issue ... */ @Test public void specialCases() throws IOException { @@ -220,4 +220,51 @@ public void specialCases() throws IOException { column.valueKinds().forEach(vk -> assertEquals(ValueKind.NOT_PRESENT, vk)); column.stringData().forEach(sd -> assertTrue(sd.isEmpty())); } + + /** + * Testing files with atom_site that doesn't have author fields. E.g. cif files from Meta's ESM Atlas (...) + */ + @Test + public void testAtomSiteWithMissingAuthFields() throws IOException { + // taken from MGYP000911143359.cif + String mmcifStr = + "data_\n" + + "loop_\n" + + "_atom_site.group_PDB\n" + + "_atom_site.id\n" + + "_atom_site.type_symbol\n" + + "_atom_site.label_atom_id\n" + + "_atom_site.label_comp_id\n" + + "_atom_site.label_asym_id\n" + + "_atom_site.label_entity_id\n" + + "_atom_site.label_seq_id\n" + + "_atom_site.Cartn_x\n" + + "_atom_site.Cartn_y\n" + + "_atom_site.Cartn_z\n" + + "_atom_site.occupancy\n" + + "_atom_site.B_iso_or_equiv\n" + + "_atom_site.pdbx_PDB_model_num\n" + + "\n" + + "ATOM 1 N N MET A 1 1 -26.091 68.903 7.841 1.00 90.0 1\n" + + "ATOM 2 C CA MET A 1 1 -26.275 67.677 7.069 1.00 91.0 1\n" + + "ATOM 3 C C MET A 1 1 -24.933 67.025 6.755 1.00 90.0 1\n" + + "ATOM 4 C CB MET A 1 1 -27.033 67.967 5.773 1.00 89.0 1\n" + + "ATOM 5 O O MET A 1 1 -24.314 67.331 5.734 1.00 90.0 1\n" + + "ATOM 6 C CG MET A 1 1 -28.544 67.973 5.934 1.00 86.0 1\n" + + "ATOM 7 S SD MET A 1 1 -29.390 68.904 4.598 1.00 86.0 1\n" + + "ATOM 8 C CE MET A 1 1 -29.202 67.734 3.224 1.00 83.0 1\n" + + "ATOM 9 N N ASN A 1 2 -24.267 66.233 7.730 1.00 90.0 1\n" + + "ATOM 10 C CA ASN A 1 2 -22.897 65.827 8.029 1.00 91.0 1\n" + + "ATOM 11 C C ASN A 1 2 -22.600 64.427 7.500 1.00 90.0 1\n" + + "ATOM 12 C CB ASN A 1 2 -22.634 65.893 9.535 1.00 88.0 1\n" + + "ATOM 13 O O ASN A 1 2 -23.092 63.436 8.044 1.00 89.0 1\n" + + "ATOM 14 C CG ASN A 1 2 -22.191 67.269 9.990 1.00 86.0 1\n" + + "ATOM 15 N ND2 ASN A 1 2 -22.255 67.511 11.294 1.00 87.0 1\n" + + "ATOM 16 O OD1 ASN A 1 2 -21.795 68.108 9.177 1.00 87.0 1\n" ; + MmCifFile cifFile = CifIO.readFromInputStream(new ByteArrayInputStream(mmcifStr.getBytes())).as(StandardSchemata.MMCIF); + Structure s = CifStructureConverter.fromCifFile(cifFile); + assertNotNull(s); + assertEquals(2, s.getPolyChain("A").getAtomGroups().size()); + assertEquals(2, s.getPolyChainByPDB("A").getAtomGroups().size()); + } } \ No newline at end of file diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfPerformance.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfPerformance.java deleted file mode 100644 index e0b576d79a..0000000000 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfPerformance.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * BioJava development code - * - * This code may be freely distributed and modified under the - * terms of the GNU Lesser General Public Licence. This should - * be distributed with the code. If you do not have a copy, - * see: - * - * http://www.gnu.org/copyleft/lesser.html - * - * Copyright for this code is held jointly by the individual - * authors. These should be listed in @author doc comments. - * - * For more information on the BioJava project and its aims, - * or to join the biojava-l mailing list, visit the home page - * at: - * - * http://www.biojava.org/ - * - */ -package org.biojava.nbio.structure.io.mmtf; - -import org.biojava.nbio.structure.io.PDBFileParser; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.*; -import java.net.URL; -import java.util.zip.GZIPInputStream; - -import static org.junit.Assert.assertTrue; - -/** - * Test the performance of MMTF format in BioJava. - * - * @author Andreas Prlic - * on 1/9/17. - * - */ -public class TestMmtfPerformance { - - private static final Logger logger = LoggerFactory.getLogger(TestMmtfPerformance.class); - - private static final int NUMBER_OF_REPEATS = 10; - - private static String convertStreamToString(java.io.InputStream is) { - try ( - java.util.Scanner s = new java.util.Scanner(is)){ - return s.useDelimiter("\\A").hasNext() ? s.next() : ""; - } - } - - private byte[] getByteArrayFromInputStream(InputStream is) throws IOException { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - - int nRead; - byte[] data = new byte[16384]; - - while ((nRead = is.read(data, 0, data.length)) != -1) { - buffer.write(data, 0, nRead); - } - - buffer.flush(); - - return buffer.toByteArray(); - } - - @Test - public void test3HBX() throws Exception{ - String pdbId = "3hbx"; - - pdbId = pdbId.toUpperCase(); - - URL url = new URL("https://files.rcsb.org/download/"+pdbId+".pdb.gz"); - - String pdbFile = convertStreamToString(new GZIPInputStream(url.openStream())); - - long totalTimePDB = 0; - long totalTimeMMTF = 0; - - byte[] pdbBytes = pdbFile.getBytes(); - - PDBFileParser parser = new PDBFileParser(); - - URL mmtfURL = new URL("https://mmtf.rcsb.org/v1.0/full/" + pdbId + ".mmtf.gz"); - - byte[] mmtfdata = getByteArrayFromInputStream(new GZIPInputStream((mmtfURL.openStream()))); - - // first make sure chemcomp cache is warmed up (chemcomp files are parsed). Like that we count the parsing time without the influence of chemcomp parsing - MmtfActions.readFromInputStream(new ByteArrayInputStream(mmtfdata)); - parser.parsePDBFile(new ByteArrayInputStream(pdbBytes)); - - for ( int i =0 ; i< NUMBER_OF_REPEATS ; i++) { - - long mmtfStart = System.nanoTime(); - MmtfActions.readFromInputStream(new ByteArrayInputStream(mmtfdata)); - long mmtfEnd = System.nanoTime(); - - long pdbStart = System.nanoTime(); - parser.parsePDBFile(new ByteArrayInputStream(pdbBytes)); - long pdbEnd = System.nanoTime(); - - totalTimePDB += (pdbEnd - pdbStart); - - totalTimeMMTF += (mmtfEnd-mmtfStart); - } - - long timePDB = (totalTimePDB/NUMBER_OF_REPEATS); - long timeMMTF = (totalTimeMMTF/NUMBER_OF_REPEATS); - - logger.info("average time to parse mmtf: " + timeMMTF/(1000*1000) + " ms."); - logger.info("average time to parse PDB : " + timePDB/(1000*1000) + " ms. "); - - assertTrue( "It should not be the case, but it is faster to parse a PDB file ("+timePDB+" ns.) than MMTF ("+( timeMMTF)+" ns.)!",( timePDB) > ( timeMMTF)); - - } -} diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfRoundTrip.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfRoundTrip.java index e362c2a35f..5190bd38c1 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfRoundTrip.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/io/mmtf/TestMmtfRoundTrip.java @@ -354,8 +354,8 @@ private void checkBioAssemblies1(Structure structOne, Structure structTwo) throw @Test public void testStructWithBranchedEntitiesRoundTrip() throws IOException { - // Example carbohydrate remediation file to be released in July 2020 - URL url = new URL("https://raw.githubusercontent.com/pdbxmmcifwg/carbohydrate-extension/master/examples/models/1B5F-carb.cif"); + // Example carbohydrate remediation, remediated in July 2020 + URL url = new URL("https://files.rcsb.org/download/1B5F.cif.gz"); InputStream inStream = url.openStream(); Structure structure = CifStructureConverter.fromInputStream(inStream); @@ -366,7 +366,7 @@ public void testStructWithBranchedEntitiesRoundTrip() throws IOException { new StructureDataToAdapter(writerToEncoder, mmtfStructureReader); Structure structure2 = mmtfStructureReader.getStructure(); - assertEquals(7, structure2.getEntityInfos().size()); + assertEquals(6, structure2.getEntityInfos().size()); assertEquals(2, structure2.getEntityById(1).getChains().size()); assertEquals(2, structure2.getEntityById(2).getChains().size()); diff --git a/biojava-structure/src/test/java/org/biojava/nbio/structure/symmetry/internal/TestCeSymm.java b/biojava-structure/src/test/java/org/biojava/nbio/structure/symmetry/internal/TestCeSymm.java index a21019711b..9d3b67e3ef 100644 --- a/biojava-structure/src/test/java/org/biojava/nbio/structure/symmetry/internal/TestCeSymm.java +++ b/biojava-structure/src/test/java/org/biojava/nbio/structure/symmetry/internal/TestCeSymm.java @@ -22,6 +22,7 @@ import static org.junit.Assert.*; import static org.junit.Assume.assumeNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.IOException; import java.io.InputStream; @@ -60,7 +61,7 @@ public void testEasyCases() throws IOException, StructureException { CeSymmResult result = CeSymm.analyze(atoms); assertTrue(result.isSignificant()); - assertEquals(result.getNumRepeats(), orders[i]); + assertEquals(orders[i], result.getNumRepeats()); } } @@ -75,4 +76,26 @@ public void testAlphafold() throws IOException, StructureException { CeSymmResult result = CeSymm.analyze(atoms); assertNotNull(result); } + + @Test + public void testShort() throws IOException, StructureException { + // ERIC2_c35200, a near-perfect 15 residue beta-solenoid + // At 15 residues this should reliably trigger rcsb/symmetry#118 + URL url = this.getClass().getResource("/AF-V9WDR2-F1-model_v4.cif"); + assumeNotNull(url); + String file = url.getPath(); + Structure s = StructureIO.getStructure(file); + assertNull(s.getPdbId()); + Atom[] atoms = StructureTools.getRepresentativeAtomArray(s); + CESymmParameters params = new CESymmParameters(); + params.setMinCoreLength(10); // Ensure it gets refined (should be 15 long) + CeSymmResult result = CeSymm.analyze(atoms, params); + assertNotNull(result); + assertTrue(result.isSignificant()); + assertEquals(9, result.getNumRepeats()); + assertEquals("H",result.getSymmGroup()); + assertNotNull(result.getAxes()); + assertNotEquals("Error", result.getReason()); + + } } diff --git a/biojava-structure/src/test/resources/AF-V9WDR2-F1-model_v4.cif b/biojava-structure/src/test/resources/AF-V9WDR2-F1-model_v4.cif new file mode 100644 index 0000000000..c959135a6e --- /dev/null +++ b/biojava-structure/src/test/resources/AF-V9WDR2-F1-model_v4.cif @@ -0,0 +1,2012 @@ +data_AF-V9WDR2-F1 +# +_entry.id AF-V9WDR2-F1 +# +loop_ +_atom_type.symbol +C +N +O +S +# +loop_ +_audit_author.name +_audit_author.pdbx_ordinal +"Jumper, John" 1 +"Evans, Richard" 2 +"Pritzel, Alexander" 3 +"Green, Tim" 4 +"Figurnov, Michael" 5 +"Ronneberger, Olaf" 6 +"Tunyasuvunakool, Kathryn" 7 +"Bates, Russ" 8 +"Zidek, Augustin" 9 +"Potapenko, Anna" 10 +"Bridgland, Alex" 11 +"Meyer, Clemens" 12 +"Kohl, Simon A. A." 13 +"Ballard, Andrew J." 14 +"Cowie, Andrew" 15 +"Romera-Paredes, Bernardino" 16 +"Nikolov, Stanislav" 17 +"Jain, Rishub" 18 +"Adler, Jonas" 19 +"Back, Trevor" 20 +"Petersen, Stig" 21 +"Reiman, David" 22 +"Clancy, Ellen" 23 +"Zielinski, Michal" 24 +"Steinegger, Martin" 25 +"Pacholska, Michalina" 26 +"Berghammer, Tamas" 27 +"Silver, David" 28 +"Vinyals, Oriol" 29 +"Senior, Andrew W." 30 +"Kavukcuoglu, Koray" 31 +"Kohli, Pushmeet" 32 +"Hassabis, Demis" 33 +# +_audit_conform.dict_location https://raw.githubusercontent.com/ihmwg/ModelCIF/master/dist/mmcif_ma.dic +_audit_conform.dict_name mmcif_ma.dic +_audit_conform.dict_version 1.3.9 +# +loop_ +_chem_comp.formula +_chem_comp.formula_weight +_chem_comp.id +_chem_comp.mon_nstd_flag +_chem_comp.name +_chem_comp.pdbx_synonyms +_chem_comp.type +"C3 H7 N O2" 89.093 ALA y ALANINE ? "L-PEPTIDE LINKING" +"C6 H15 N4 O2" 175.209 ARG y ARGININE ? "L-PEPTIDE LINKING" +"C4 H8 N2 O3" 132.118 ASN y ASPARAGINE ? "L-PEPTIDE LINKING" +"C4 H7 N O4" 133.103 ASP y "ASPARTIC ACID" ? "L-PEPTIDE LINKING" +"C3 H7 N O2 S" 121.158 CYS y CYSTEINE ? "L-PEPTIDE LINKING" +"C5 H10 N2 O3" 146.144 GLN y GLUTAMINE ? "L-PEPTIDE LINKING" +"C5 H9 N O4" 147.129 GLU y "GLUTAMIC ACID" ? "L-PEPTIDE LINKING" +"C2 H5 N O2" 75.067 GLY y GLYCINE ? "PEPTIDE LINKING" +"C6 H10 N3 O2" 156.162 HIS y HISTIDINE ? "L-PEPTIDE LINKING" +"C6 H13 N O2" 131.173 ILE y ISOLEUCINE ? "L-PEPTIDE LINKING" +"C6 H15 N2 O2" 147.195 LYS y LYSINE ? "L-PEPTIDE LINKING" +"C5 H11 N O2 S" 149.211 MET y METHIONINE ? "L-PEPTIDE LINKING" +"C9 H11 N O2" 165.189 PHE y PHENYLALANINE ? "L-PEPTIDE LINKING" +"C3 H7 N O3" 105.093 SER y SERINE ? "L-PEPTIDE LINKING" +"C4 H9 N O3" 119.119 THR y THREONINE ? "L-PEPTIDE LINKING" +"C5 H11 N O2" 117.146 VAL y VALINE ? "L-PEPTIDE LINKING" +# +_citation.book_publisher ? +_citation.country UK +_citation.id primary +_citation.journal_full Nature +_citation.journal_id_ASTM NATUAS +_citation.journal_id_CSD 0006 +_citation.journal_id_ISSN 0028-0836 +_citation.journal_volume 596 +_citation.page_first 583 +_citation.page_last 589 +_citation.pdbx_database_id_DOI 10.1038/s41586-021-03819-2 +_citation.pdbx_database_id_PubMed 34265844 +_citation.title "Highly accurate protein structure prediction with AlphaFold" +_citation.year 2021 +# +loop_ +_citation_author.citation_id +_citation_author.name +_citation_author.ordinal +1 "Jumper, John" 1 +1 "Evans, Richard" 2 +1 "Pritzel, Alexander" 3 +1 "Green, Tim" 4 +1 "Figurnov, Michael" 5 +1 "Ronneberger, Olaf" 6 +1 "Tunyasuvunakool, Kathryn" 7 +1 "Bates, Russ" 8 +1 "Zidek, Augustin" 9 +1 "Potapenko, Anna" 10 +1 "Bridgland, Alex" 11 +1 "Meyer, Clemens" 12 +1 "Kohl, Simon A. A." 13 +1 "Ballard, Andrew J." 14 +1 "Cowie, Andrew" 15 +1 "Romera-Paredes, Bernardino" 16 +1 "Nikolov, Stanislav" 17 +1 "Jain, Rishub" 18 +1 "Adler, Jonas" 19 +1 "Back, Trevor" 20 +1 "Petersen, Stig" 21 +1 "Reiman, David" 22 +1 "Clancy, Ellen" 23 +1 "Zielinski, Michal" 24 +1 "Steinegger, Martin" 25 +1 "Pacholska, Michalina" 26 +1 "Berghammer, Tamas" 27 +1 "Silver, David" 28 +1 "Vinyals, Oriol" 29 +1 "Senior, Andrew W." 30 +1 "Kavukcuoglu, Koray" 31 +1 "Kohli, Pushmeet" 32 +1 "Hassabis, Demis" 33 +# +_database_2.database_code AF-V9WDR2-F1 +_database_2.database_id AlphaFoldDB +# +_entity.details ? +_entity.formula_weight ? +_entity.id 1 +_entity.pdbx_description "Uncharacterized protein" +_entity.pdbx_ec ? +_entity.pdbx_fragment ? +_entity.pdbx_mutation ? +_entity.pdbx_number_of_molecules 1 +_entity.src_method man +_entity.type polymer +# +_entity_poly.entity_id 1 +_entity_poly.nstd_linkage no +_entity_poly.nstd_monomer no +_entity_poly.pdbx_seq_one_letter_code +;MIMKNKNKQNRKAFADTEFASEAGANRTAADTEFASEAGANRTVADTEFASEAGANTTAADTEFASEAGANRTAADTEFA +SEAGANRTAADTEFASEAGANTTAADTEFASEAGANRTAADTEFASEVRANRTSADTEFANEVTSKQNRCGH +; +_entity_poly.pdbx_seq_one_letter_code_can +;MIMKNKNKQNRKAFADTEFASEAGANRTAADTEFASEAGANRTVADTEFASEAGANTTAADTEFASEAGANRTAADTEFA +SEAGANRTAADTEFASEAGANTTAADTEFASEAGANRTAADTEFASEVRANRTSADTEFANEVTSKQNRCGH +; +_entity_poly.pdbx_strand_id A +_entity_poly.type polypeptide(L) +# +loop_ +_entity_poly_seq.entity_id +_entity_poly_seq.hetero +_entity_poly_seq.mon_id +_entity_poly_seq.num +1 n MET 1 +1 n ILE 2 +1 n MET 3 +1 n LYS 4 +1 n ASN 5 +1 n LYS 6 +1 n ASN 7 +1 n LYS 8 +1 n GLN 9 +1 n ASN 10 +1 n ARG 11 +1 n LYS 12 +1 n ALA 13 +1 n PHE 14 +1 n ALA 15 +1 n ASP 16 +1 n THR 17 +1 n GLU 18 +1 n PHE 19 +1 n ALA 20 +1 n SER 21 +1 n GLU 22 +1 n ALA 23 +1 n GLY 24 +1 n ALA 25 +1 n ASN 26 +1 n ARG 27 +1 n THR 28 +1 n ALA 29 +1 n ALA 30 +1 n ASP 31 +1 n THR 32 +1 n GLU 33 +1 n PHE 34 +1 n ALA 35 +1 n SER 36 +1 n GLU 37 +1 n ALA 38 +1 n GLY 39 +1 n ALA 40 +1 n ASN 41 +1 n ARG 42 +1 n THR 43 +1 n VAL 44 +1 n ALA 45 +1 n ASP 46 +1 n THR 47 +1 n GLU 48 +1 n PHE 49 +1 n ALA 50 +1 n SER 51 +1 n GLU 52 +1 n ALA 53 +1 n GLY 54 +1 n ALA 55 +1 n ASN 56 +1 n THR 57 +1 n THR 58 +1 n ALA 59 +1 n ALA 60 +1 n ASP 61 +1 n THR 62 +1 n GLU 63 +1 n PHE 64 +1 n ALA 65 +1 n SER 66 +1 n GLU 67 +1 n ALA 68 +1 n GLY 69 +1 n ALA 70 +1 n ASN 71 +1 n ARG 72 +1 n THR 73 +1 n ALA 74 +1 n ALA 75 +1 n ASP 76 +1 n THR 77 +1 n GLU 78 +1 n PHE 79 +1 n ALA 80 +1 n SER 81 +1 n GLU 82 +1 n ALA 83 +1 n GLY 84 +1 n ALA 85 +1 n ASN 86 +1 n ARG 87 +1 n THR 88 +1 n ALA 89 +1 n ALA 90 +1 n ASP 91 +1 n THR 92 +1 n GLU 93 +1 n PHE 94 +1 n ALA 95 +1 n SER 96 +1 n GLU 97 +1 n ALA 98 +1 n GLY 99 +1 n ALA 100 +1 n ASN 101 +1 n THR 102 +1 n THR 103 +1 n ALA 104 +1 n ALA 105 +1 n ASP 106 +1 n THR 107 +1 n GLU 108 +1 n PHE 109 +1 n ALA 110 +1 n SER 111 +1 n GLU 112 +1 n ALA 113 +1 n GLY 114 +1 n ALA 115 +1 n ASN 116 +1 n ARG 117 +1 n THR 118 +1 n ALA 119 +1 n ALA 120 +1 n ASP 121 +1 n THR 122 +1 n GLU 123 +1 n PHE 124 +1 n ALA 125 +1 n SER 126 +1 n GLU 127 +1 n VAL 128 +1 n ARG 129 +1 n ALA 130 +1 n ASN 131 +1 n ARG 132 +1 n THR 133 +1 n SER 134 +1 n ALA 135 +1 n ASP 136 +1 n THR 137 +1 n GLU 138 +1 n PHE 139 +1 n ALA 140 +1 n ASN 141 +1 n GLU 142 +1 n VAL 143 +1 n THR 144 +1 n SER 145 +1 n LYS 146 +1 n GLN 147 +1 n ASN 148 +1 n ARG 149 +1 n CYS 150 +1 n GLY 151 +1 n HIS 152 +# +loop_ +_ma_data.content_type +_ma_data.id +_ma_data.name +"model coordinates" 1 Model +"input structure" 2 "Input structure" +# +_ma_model_list.data_id 1 +_ma_model_list.model_group_id 1 +_ma_model_list.model_group_name "AlphaFold Monomer v2.0 model" +_ma_model_list.model_id 1 +_ma_model_list.model_name "Top ranked model" +_ma_model_list.model_type "Ab initio model" +_ma_model_list.ordinal_id 1 +# +loop_ +_ma_protocol_step.method_type +_ma_protocol_step.ordinal_id +_ma_protocol_step.protocol_id +_ma_protocol_step.step_id +"coevolution MSA" 1 1 1 +"template search" 2 1 2 +modeling 3 1 3 +# +loop_ +_ma_qa_metric.id +_ma_qa_metric.mode +_ma_qa_metric.name +_ma_qa_metric.software_group_id +_ma_qa_metric.type +1 global pLDDT 1 pLDDT +2 local pLDDT 1 pLDDT +# +_ma_qa_metric_global.metric_id 1 +_ma_qa_metric_global.metric_value 90.14 +_ma_qa_metric_global.model_id 1 +_ma_qa_metric_global.ordinal_id 1 +# +loop_ +_ma_qa_metric_local.label_asym_id +_ma_qa_metric_local.label_comp_id +_ma_qa_metric_local.label_seq_id +_ma_qa_metric_local.metric_id +_ma_qa_metric_local.metric_value +_ma_qa_metric_local.model_id +_ma_qa_metric_local.ordinal_id +A MET 1 2 34.44 1 1 +A ILE 2 2 38.03 1 2 +A MET 3 2 39.03 1 3 +A LYS 4 2 45.03 1 4 +A ASN 5 2 42.38 1 5 +A LYS 6 2 47.50 1 6 +A ASN 7 2 44.88 1 7 +A LYS 8 2 44.59 1 8 +A GLN 9 2 48.12 1 9 +A ASN 10 2 55.12 1 10 +A ARG 11 2 56.03 1 11 +A LYS 12 2 73.56 1 12 +A ALA 13 2 77.81 1 13 +A PHE 14 2 80.12 1 14 +A ALA 15 2 80.38 1 15 +A ASP 16 2 87.81 1 16 +A THR 17 2 90.19 1 17 +A GLU 18 2 91.25 1 18 +A PHE 19 2 90.44 1 19 +A ALA 20 2 88.88 1 20 +A SER 21 2 92.38 1 21 +A GLU 22 2 87.19 1 22 +A ALA 23 2 90.38 1 23 +A GLY 24 2 86.38 1 24 +A ALA 25 2 84.62 1 25 +A ASN 26 2 89.00 1 26 +A ARG 27 2 88.31 1 27 +A THR 28 2 91.44 1 28 +A ALA 29 2 90.12 1 29 +A ALA 30 2 90.31 1 30 +A ASP 31 2 92.75 1 31 +A THR 32 2 95.44 1 32 +A GLU 33 2 95.38 1 33 +A PHE 34 2 95.44 1 34 +A ALA 35 2 94.94 1 35 +A SER 36 2 96.62 1 36 +A GLU 37 2 94.25 1 37 +A ALA 38 2 95.38 1 38 +A GLY 39 2 92.50 1 39 +A ALA 40 2 92.38 1 40 +A ASN 41 2 93.56 1 41 +A ARG 42 2 93.56 1 42 +A THR 43 2 95.69 1 43 +A VAL 44 2 94.94 1 44 +A ALA 45 2 95.31 1 45 +A ASP 46 2 96.00 1 46 +A THR 47 2 97.12 1 47 +A GLU 48 2 97.81 1 48 +A PHE 49 2 97.81 1 49 +A ALA 50 2 97.12 1 50 +A SER 51 2 98.19 1 51 +A GLU 52 2 97.38 1 52 +A ALA 53 2 97.81 1 53 +A GLY 54 2 96.44 1 54 +A ALA 55 2 96.31 1 55 +A ASN 56 2 97.44 1 56 +A THR 57 2 96.94 1 57 +A THR 58 2 98.06 1 58 +A ALA 59 2 96.69 1 59 +A ALA 60 2 97.00 1 60 +A ASP 61 2 97.75 1 61 +A THR 62 2 97.94 1 62 +A GLU 63 2 98.44 1 63 +A PHE 64 2 98.50 1 64 +A ALA 65 2 97.81 1 65 +A SER 66 2 98.56 1 66 +A GLU 67 2 98.00 1 67 +A ALA 68 2 98.38 1 68 +A GLY 69 2 97.75 1 69 +A ALA 70 2 97.75 1 70 +A ASN 71 2 98.25 1 71 +A ARG 72 2 97.94 1 72 +A THR 73 2 98.50 1 73 +A ALA 74 2 96.81 1 74 +A ALA 75 2 97.69 1 75 +A ASP 76 2 98.12 1 76 +A THR 77 2 98.19 1 77 +A GLU 78 2 98.62 1 78 +A PHE 79 2 98.56 1 79 +A ALA 80 2 97.94 1 80 +A SER 81 2 98.62 1 81 +A GLU 82 2 98.19 1 82 +A ALA 83 2 98.50 1 83 +A GLY 84 2 98.00 1 84 +A ALA 85 2 98.06 1 85 +A ASN 86 2 98.44 1 86 +A ARG 87 2 98.12 1 87 +A THR 88 2 98.50 1 88 +A ALA 89 2 97.12 1 89 +A ALA 90 2 97.75 1 90 +A ASP 91 2 98.25 1 91 +A THR 92 2 98.06 1 92 +A GLU 93 2 98.56 1 93 +A PHE 94 2 98.56 1 94 +A ALA 95 2 97.81 1 95 +A SER 96 2 98.56 1 96 +A GLU 97 2 98.25 1 97 +A ALA 98 2 98.44 1 98 +A GLY 99 2 97.88 1 99 +A ALA 100 2 98.12 1 100 +A ASN 101 2 98.44 1 101 +A THR 102 2 97.62 1 102 +A THR 103 2 98.12 1 103 +A ALA 104 2 96.81 1 104 +A ALA 105 2 97.00 1 105 +A ASP 106 2 97.88 1 106 +A THR 107 2 97.62 1 107 +A GLU 108 2 98.44 1 108 +A PHE 109 2 98.31 1 109 +A ALA 110 2 97.31 1 110 +A SER 111 2 98.31 1 111 +A GLU 112 2 97.62 1 112 +A ALA 113 2 98.06 1 113 +A GLY 114 2 97.62 1 114 +A ALA 115 2 97.62 1 115 +A ASN 116 2 97.75 1 116 +A ARG 117 2 96.31 1 117 +A THR 118 2 97.12 1 118 +A ALA 119 2 94.94 1 119 +A ALA 120 2 95.56 1 120 +A ASP 121 2 96.00 1 121 +A THR 122 2 95.94 1 122 +A GLU 123 2 97.62 1 123 +A PHE 124 2 97.56 1 124 +A ALA 125 2 96.31 1 125 +A SER 126 2 97.81 1 126 +A GLU 127 2 96.75 1 127 +A VAL 128 2 97.75 1 128 +A ARG 129 2 97.06 1 129 +A ALA 130 2 96.44 1 130 +A ASN 131 2 96.19 1 131 +A ARG 132 2 94.06 1 132 +A THR 133 2 95.19 1 133 +A SER 134 2 91.88 1 134 +A ALA 135 2 93.06 1 135 +A ASP 136 2 92.88 1 136 +A THR 137 2 93.31 1 137 +A GLU 138 2 95.25 1 138 +A PHE 139 2 95.06 1 139 +A ALA 140 2 94.06 1 140 +A ASN 141 2 95.62 1 141 +A GLU 142 2 93.50 1 142 +A VAL 143 2 94.88 1 143 +A THR 144 2 93.44 1 144 +A SER 145 2 93.50 1 145 +A LYS 146 2 91.69 1 146 +A GLN 147 2 89.00 1 147 +A ASN 148 2 91.25 1 148 +A ARG 149 2 85.00 1 149 +A CYS 150 2 71.25 1 150 +A GLY 151 2 59.62 1 151 +A HIS 152 2 47.81 1 152 +# +_ma_software_group.group_id 1 +_ma_software_group.ordinal_id 1 +_ma_software_group.software_id 1 +# +_ma_target_entity.data_id 1 +_ma_target_entity.entity_id 1 +_ma_target_entity.origin "reference database" +# +_ma_target_entity_instance.asym_id A +_ma_target_entity_instance.details . +_ma_target_entity_instance.entity_id 1 +# +_ma_target_ref_db_details.db_accession V9WDR2 +_ma_target_ref_db_details.db_code V9WDR2_9BACL +_ma_target_ref_db_details.db_name UNP +_ma_target_ref_db_details.gene_name ERIC2_c35200 +_ma_target_ref_db_details.ncbi_taxonomy_id 697284 +_ma_target_ref_db_details.organism_scientific "Paenibacillus larvae subsp. larvae DSM 25430" +_ma_target_ref_db_details.seq_db_align_begin 1 +_ma_target_ref_db_details.seq_db_align_end 152 +_ma_target_ref_db_details.seq_db_isoform ? +_ma_target_ref_db_details.seq_db_sequence_checksum 35E70E5C15D19AFF +_ma_target_ref_db_details.seq_db_sequence_version_date 2014-03-19 +_ma_target_ref_db_details.target_entity_id 1 +# +loop_ +_ma_template_details.ordinal_id +_ma_template_details.target_asym_id +_ma_template_details.template_auth_asym_id +_ma_template_details.template_data_id +_ma_template_details.template_entity_type +_ma_template_details.template_id +_ma_template_details.template_model_num +_ma_template_details.template_origin +_ma_template_details.template_trans_matrix_id +1 A J 2 polymer 1 1 "reference database" 1 +2 A A 2 polymer 2 1 "reference database" 1 +# +loop_ +_ma_template_ref_db_details.db_accession_code +_ma_template_ref_db_details.db_name +_ma_template_ref_db_details.template_id +6J9E PDB 1 +2MC6 PDB 2 +# +_ma_template_trans_matrix.id 1 +_ma_template_trans_matrix.rot_matrix[1][1] 1.0 +_ma_template_trans_matrix.rot_matrix[1][2] 0.0 +_ma_template_trans_matrix.rot_matrix[1][3] 0.0 +_ma_template_trans_matrix.rot_matrix[2][1] 0.0 +_ma_template_trans_matrix.rot_matrix[2][2] 1.0 +_ma_template_trans_matrix.rot_matrix[2][3] 0.0 +_ma_template_trans_matrix.rot_matrix[3][1] 0.0 +_ma_template_trans_matrix.rot_matrix[3][2] 0.0 +_ma_template_trans_matrix.rot_matrix[3][3] 1.0 +_ma_template_trans_matrix.tr_vector[1] 0.0 +_ma_template_trans_matrix.tr_vector[2] 0.0 +_ma_template_trans_matrix.tr_vector[3] 0.0 +# +loop_ +_pdbx_audit_revision_details.data_content_type +_pdbx_audit_revision_details.description +_pdbx_audit_revision_details.ordinal +_pdbx_audit_revision_details.provider +_pdbx_audit_revision_details.revision_ordinal +_pdbx_audit_revision_details.type +"Structure model" "Format fixes, new metadata, initial UniProt release" 3 repository 3 Remediation +"Structure model" "Improved prediction accuracy, small format fixes" 4 repository 4 Remediation +# +loop_ +_pdbx_audit_revision_history.data_content_type +_pdbx_audit_revision_history.major_revision +_pdbx_audit_revision_history.minor_revision +_pdbx_audit_revision_history.ordinal +_pdbx_audit_revision_history.revision_date +"Structure model" 3 0 3 2022-06-01 +"Structure model" 4 0 4 2022-09-30 +# +loop_ +_pdbx_data_usage.details +_pdbx_data_usage.id +_pdbx_data_usage.name +_pdbx_data_usage.type +_pdbx_data_usage.url +"Data in this file is available under a CC-BY-4.0 license." 1 CC-BY-4.0 license https://creativecommons.org/licenses/by/4.0/ +;ALPHAFOLD DATA, COPYRIGHT (2021) DEEPMIND TECHNOLOGIES LIMITED. THE INFORMATION +PROVIDED IS THEORETICAL MODELLING ONLY AND CAUTION SHOULD BE EXERCISED IN ITS +USE. IT IS PROVIDED "AS-IS" WITHOUT ANY WARRANTY OF ANY KIND, WHETHER EXPRESSED +OR IMPLIED. NO WARRANTY IS GIVEN THAT USE OF THE INFORMATION SHALL NOT INFRINGE +THE RIGHTS OF ANY THIRD PARTY. DISCLAIMER: THE INFORMATION IS NOT INTENDED TO BE +A SUBSTITUTE FOR PROFESSIONAL MEDICAL ADVICE, DIAGNOSIS, OR TREATMENT, AND DOES +NOT CONSTITUTE MEDICAL OR OTHER PROFESSIONAL ADVICE. IT IS AVAILABLE FOR +ACADEMIC AND COMMERCIAL PURPOSES, UNDER CC-BY 4.0 LICENCE. +; +2 ? disclaimer ? +# +_pdbx_database_status.entry_id AF-V9WDR2-F1 +_pdbx_database_status.recvd_initial_deposition_date 2022-06-01 +_pdbx_database_status.status_code REL +# +loop_ +_pdbx_poly_seq_scheme.asym_id +_pdbx_poly_seq_scheme.auth_seq_num +_pdbx_poly_seq_scheme.entity_id +_pdbx_poly_seq_scheme.hetero +_pdbx_poly_seq_scheme.mon_id +_pdbx_poly_seq_scheme.pdb_ins_code +_pdbx_poly_seq_scheme.pdb_mon_id +_pdbx_poly_seq_scheme.pdb_seq_num +_pdbx_poly_seq_scheme.pdb_strand_id +_pdbx_poly_seq_scheme.seq_id +A 1 1 n MET . MET 1 A 1 +A 2 1 n ILE . ILE 2 A 2 +A 3 1 n MET . MET 3 A 3 +A 4 1 n LYS . LYS 4 A 4 +A 5 1 n ASN . ASN 5 A 5 +A 6 1 n LYS . LYS 6 A 6 +A 7 1 n ASN . ASN 7 A 7 +A 8 1 n LYS . LYS 8 A 8 +A 9 1 n GLN . GLN 9 A 9 +A 10 1 n ASN . ASN 10 A 10 +A 11 1 n ARG . ARG 11 A 11 +A 12 1 n LYS . LYS 12 A 12 +A 13 1 n ALA . ALA 13 A 13 +A 14 1 n PHE . PHE 14 A 14 +A 15 1 n ALA . ALA 15 A 15 +A 16 1 n ASP . ASP 16 A 16 +A 17 1 n THR . THR 17 A 17 +A 18 1 n GLU . GLU 18 A 18 +A 19 1 n PHE . PHE 19 A 19 +A 20 1 n ALA . ALA 20 A 20 +A 21 1 n SER . SER 21 A 21 +A 22 1 n GLU . GLU 22 A 22 +A 23 1 n ALA . ALA 23 A 23 +A 24 1 n GLY . GLY 24 A 24 +A 25 1 n ALA . ALA 25 A 25 +A 26 1 n ASN . ASN 26 A 26 +A 27 1 n ARG . ARG 27 A 27 +A 28 1 n THR . THR 28 A 28 +A 29 1 n ALA . ALA 29 A 29 +A 30 1 n ALA . ALA 30 A 30 +A 31 1 n ASP . ASP 31 A 31 +A 32 1 n THR . THR 32 A 32 +A 33 1 n GLU . GLU 33 A 33 +A 34 1 n PHE . PHE 34 A 34 +A 35 1 n ALA . ALA 35 A 35 +A 36 1 n SER . SER 36 A 36 +A 37 1 n GLU . GLU 37 A 37 +A 38 1 n ALA . ALA 38 A 38 +A 39 1 n GLY . GLY 39 A 39 +A 40 1 n ALA . ALA 40 A 40 +A 41 1 n ASN . ASN 41 A 41 +A 42 1 n ARG . ARG 42 A 42 +A 43 1 n THR . THR 43 A 43 +A 44 1 n VAL . VAL 44 A 44 +A 45 1 n ALA . ALA 45 A 45 +A 46 1 n ASP . ASP 46 A 46 +A 47 1 n THR . THR 47 A 47 +A 48 1 n GLU . GLU 48 A 48 +A 49 1 n PHE . PHE 49 A 49 +A 50 1 n ALA . ALA 50 A 50 +A 51 1 n SER . SER 51 A 51 +A 52 1 n GLU . GLU 52 A 52 +A 53 1 n ALA . ALA 53 A 53 +A 54 1 n GLY . GLY 54 A 54 +A 55 1 n ALA . ALA 55 A 55 +A 56 1 n ASN . ASN 56 A 56 +A 57 1 n THR . THR 57 A 57 +A 58 1 n THR . THR 58 A 58 +A 59 1 n ALA . ALA 59 A 59 +A 60 1 n ALA . ALA 60 A 60 +A 61 1 n ASP . ASP 61 A 61 +A 62 1 n THR . THR 62 A 62 +A 63 1 n GLU . GLU 63 A 63 +A 64 1 n PHE . PHE 64 A 64 +A 65 1 n ALA . ALA 65 A 65 +A 66 1 n SER . SER 66 A 66 +A 67 1 n GLU . GLU 67 A 67 +A 68 1 n ALA . ALA 68 A 68 +A 69 1 n GLY . GLY 69 A 69 +A 70 1 n ALA . ALA 70 A 70 +A 71 1 n ASN . ASN 71 A 71 +A 72 1 n ARG . ARG 72 A 72 +A 73 1 n THR . THR 73 A 73 +A 74 1 n ALA . ALA 74 A 74 +A 75 1 n ALA . ALA 75 A 75 +A 76 1 n ASP . ASP 76 A 76 +A 77 1 n THR . THR 77 A 77 +A 78 1 n GLU . GLU 78 A 78 +A 79 1 n PHE . PHE 79 A 79 +A 80 1 n ALA . ALA 80 A 80 +A 81 1 n SER . SER 81 A 81 +A 82 1 n GLU . GLU 82 A 82 +A 83 1 n ALA . ALA 83 A 83 +A 84 1 n GLY . GLY 84 A 84 +A 85 1 n ALA . ALA 85 A 85 +A 86 1 n ASN . ASN 86 A 86 +A 87 1 n ARG . ARG 87 A 87 +A 88 1 n THR . THR 88 A 88 +A 89 1 n ALA . ALA 89 A 89 +A 90 1 n ALA . ALA 90 A 90 +A 91 1 n ASP . ASP 91 A 91 +A 92 1 n THR . THR 92 A 92 +A 93 1 n GLU . GLU 93 A 93 +A 94 1 n PHE . PHE 94 A 94 +A 95 1 n ALA . ALA 95 A 95 +A 96 1 n SER . SER 96 A 96 +A 97 1 n GLU . GLU 97 A 97 +A 98 1 n ALA . ALA 98 A 98 +A 99 1 n GLY . GLY 99 A 99 +A 100 1 n ALA . ALA 100 A 100 +A 101 1 n ASN . ASN 101 A 101 +A 102 1 n THR . THR 102 A 102 +A 103 1 n THR . THR 103 A 103 +A 104 1 n ALA . ALA 104 A 104 +A 105 1 n ALA . ALA 105 A 105 +A 106 1 n ASP . ASP 106 A 106 +A 107 1 n THR . THR 107 A 107 +A 108 1 n GLU . GLU 108 A 108 +A 109 1 n PHE . PHE 109 A 109 +A 110 1 n ALA . ALA 110 A 110 +A 111 1 n SER . SER 111 A 111 +A 112 1 n GLU . GLU 112 A 112 +A 113 1 n ALA . ALA 113 A 113 +A 114 1 n GLY . GLY 114 A 114 +A 115 1 n ALA . ALA 115 A 115 +A 116 1 n ASN . ASN 116 A 116 +A 117 1 n ARG . ARG 117 A 117 +A 118 1 n THR . THR 118 A 118 +A 119 1 n ALA . ALA 119 A 119 +A 120 1 n ALA . ALA 120 A 120 +A 121 1 n ASP . ASP 121 A 121 +A 122 1 n THR . THR 122 A 122 +A 123 1 n GLU . GLU 123 A 123 +A 124 1 n PHE . PHE 124 A 124 +A 125 1 n ALA . ALA 125 A 125 +A 126 1 n SER . SER 126 A 126 +A 127 1 n GLU . GLU 127 A 127 +A 128 1 n VAL . VAL 128 A 128 +A 129 1 n ARG . ARG 129 A 129 +A 130 1 n ALA . ALA 130 A 130 +A 131 1 n ASN . ASN 131 A 131 +A 132 1 n ARG . ARG 132 A 132 +A 133 1 n THR . THR 133 A 133 +A 134 1 n SER . SER 134 A 134 +A 135 1 n ALA . ALA 135 A 135 +A 136 1 n ASP . ASP 136 A 136 +A 137 1 n THR . THR 137 A 137 +A 138 1 n GLU . GLU 138 A 138 +A 139 1 n PHE . PHE 139 A 139 +A 140 1 n ALA . ALA 140 A 140 +A 141 1 n ASN . ASN 141 A 141 +A 142 1 n GLU . GLU 142 A 142 +A 143 1 n VAL . VAL 143 A 143 +A 144 1 n THR . THR 144 A 144 +A 145 1 n SER . SER 145 A 145 +A 146 1 n LYS . LYS 146 A 146 +A 147 1 n GLN . GLN 147 A 147 +A 148 1 n ASN . ASN 148 A 148 +A 149 1 n ARG . ARG 149 A 149 +A 150 1 n CYS . CYS 150 A 150 +A 151 1 n GLY . GLY 151 A 151 +A 152 1 n HIS . HIS 152 A 152 +# +loop_ +_software.classification +_software.date +_software.description +_software.name +_software.pdbx_ordinal +_software.type +_software.version +other ? "Structure prediction" AlphaFold 1 package v2.0 +other ? "Secondary structure" dssp 2 library 4 +# +_struct_asym.entity_id 1 +_struct_asym.id A +# +loop_ +_struct_conf.beg_auth_asym_id +_struct_conf.beg_auth_comp_id +_struct_conf.beg_auth_seq_id +_struct_conf.beg_label_asym_id +_struct_conf.beg_label_comp_id +_struct_conf.beg_label_seq_id +_struct_conf.conf_type_id +_struct_conf.end_auth_asym_id +_struct_conf.end_auth_comp_id +_struct_conf.end_auth_seq_id +_struct_conf.end_label_asym_id +_struct_conf.end_label_comp_id +_struct_conf.end_label_seq_id +_struct_conf.id +_struct_conf.pdbx_beg_PDB_ins_code +_struct_conf.pdbx_end_PDB_ins_code +A ARG 11 A ARG 11 STRN A ALA 23 A ALA 23 STRN1 ? ? +A GLY 24 A GLY 24 BEND A GLY 24 A GLY 24 BEND1 ? ? +A ASN 26 A ASN 26 STRN A ALA 38 A ALA 38 STRN2 ? ? +A GLY 39 A GLY 39 BEND A GLY 39 A GLY 39 BEND2 ? ? +A ASN 41 A ASN 41 STRN A THR 43 A THR 43 STRN3 ? ? +A ALA 45 A ALA 45 BEND A ALA 45 A ALA 45 BEND3 ? ? +A ASP 46 A ASP 46 STRN A ALA 53 A ALA 53 STRN4 ? ? +A GLY 54 A GLY 54 BEND A GLY 54 A GLY 54 BEND4 ? ? +A ASN 56 A ASN 56 STRN A THR 58 A THR 58 STRN5 ? ? +A ALA 60 A ALA 60 BEND A ALA 60 A ALA 60 BEND5 ? ? +A ASP 61 A ASP 61 STRN A ALA 68 A ALA 68 STRN6 ? ? +A GLY 69 A GLY 69 BEND A GLY 69 A GLY 69 BEND6 ? ? +A ASN 71 A ASN 71 STRN A THR 73 A THR 73 STRN7 ? ? +A ALA 75 A ALA 75 BEND A ALA 75 A ALA 75 BEND7 ? ? +A ASP 76 A ASP 76 STRN A ALA 83 A ALA 83 STRN8 ? ? +A GLY 84 A GLY 84 BEND A GLY 84 A GLY 84 BEND8 ? ? +A ASN 86 A ASN 86 STRN A THR 88 A THR 88 STRN9 ? ? +A ALA 90 A ALA 90 BEND A ALA 90 A ALA 90 BEND9 ? ? +A ASP 91 A ASP 91 STRN A ALA 98 A ALA 98 STRN10 ? ? +A GLY 99 A GLY 99 BEND A GLY 99 A GLY 99 BEND10 ? ? +A ASN 101 A ASN 101 STRN A THR 103 A THR 103 STRN11 ? ? +A ALA 105 A ALA 105 BEND A ALA 105 A ALA 105 BEND11 ? ? +A ASP 106 A ASP 106 STRN A ALA 113 A ALA 113 STRN12 ? ? +A GLY 114 A GLY 114 BEND A GLY 114 A GLY 114 BEND12 ? ? +A ASN 116 A ASN 116 STRN A THR 118 A THR 118 STRN13 ? ? +A ALA 120 A ALA 120 BEND A ALA 120 A ALA 120 BEND13 ? ? +A ASP 121 A ASP 121 STRN A VAL 128 A VAL 128 STRN14 ? ? +A ARG 129 A ARG 129 BEND A ARG 129 A ARG 129 BEND14 ? ? +A ASN 131 A ASN 131 STRN A SER 134 A SER 134 STRN15 ? ? +A ALA 135 A ALA 135 BEND A ALA 135 A ALA 135 BEND15 ? ? +A ASP 136 A ASP 136 STRN A VAL 143 A VAL 143 STRN16 ? ? +A THR 144 A THR 144 BEND A THR 144 A THR 144 BEND16 ? ? +A LYS 146 A LYS 146 STRN A ARG 149 A ARG 149 STRN17 ? ? +A CYS 150 A CYS 150 HELX_LH_PP_P A GLY 151 A GLY 151 HELX_LH_PP_P1 ? ? +# +loop_ +_struct_conf_type.criteria +_struct_conf_type.id +DSSP STRN +DSSP BEND +DSSP HELX_LH_PP_P +# +_struct_ref.db_code V9WDR2_9BACL +_struct_ref.db_name UNP +_struct_ref.entity_id 1 +_struct_ref.id 1 +_struct_ref.pdbx_align_begin 1 +_struct_ref.pdbx_align_end 152 +_struct_ref.pdbx_db_accession V9WDR2 +_struct_ref.pdbx_db_isoform ? +_struct_ref.pdbx_seq_one_letter_code +;MIMKNKNKQNRKAFADTEFASEAGANRTAADTEFASEAGANRTVADTEFASEAGANTTAADTEFASEAGANRTAADTEFA +SEAGANRTAADTEFASEAGANTTAADTEFASEAGANRTAADTEFASEVRANRTSADTEFANEVTSKQNRCGH +; +# +_struct_ref_seq.align_id 1 +_struct_ref_seq.db_align_beg 1 +_struct_ref_seq.db_align_end 152 +_struct_ref_seq.pdbx_PDB_id_code AF-V9WDR2-F1 +_struct_ref_seq.pdbx_auth_seq_align_beg 1 +_struct_ref_seq.pdbx_auth_seq_align_end 152 +_struct_ref_seq.pdbx_db_accession V9WDR2 +_struct_ref_seq.pdbx_db_align_beg_ins_code ? +_struct_ref_seq.pdbx_db_align_end_ins_code ? +_struct_ref_seq.pdbx_seq_align_beg_ins_code ? +_struct_ref_seq.pdbx_seq_align_end_ins_code ? +_struct_ref_seq.pdbx_strand_id A +_struct_ref_seq.ref_id 1 +_struct_ref_seq.seq_align_beg 1 +_struct_ref_seq.seq_align_end 152 +# +loop_ +_atom_site.group_PDB +_atom_site.id +_atom_site.type_symbol +_atom_site.label_atom_id +_atom_site.label_alt_id +_atom_site.label_comp_id +_atom_site.label_asym_id +_atom_site.label_entity_id +_atom_site.label_seq_id +_atom_site.pdbx_PDB_ins_code +_atom_site.Cartn_x +_atom_site.Cartn_y +_atom_site.Cartn_z +_atom_site.occupancy +_atom_site.B_iso_or_equiv +_atom_site.pdbx_formal_charge +_atom_site.auth_seq_id +_atom_site.auth_comp_id +_atom_site.auth_asym_id +_atom_site.auth_atom_id +_atom_site.pdbx_PDB_model_num +_atom_site.pdbx_sifts_xref_db_acc +_atom_site.pdbx_sifts_xref_db_name +_atom_site.pdbx_sifts_xref_db_num +_atom_site.pdbx_sifts_xref_db_res +ATOM 1 N N . MET A 1 1 ? -4.984 -19.848 45.023 1.0 34.44 ? 1 MET A N 1 V9WDR2 UNP 1 M +ATOM 2 C CA . MET A 1 1 ? -4.373 -18.588 44.547 1.0 34.44 ? 1 MET A CA 1 V9WDR2 UNP 1 M +ATOM 3 C C . MET A 1 1 ? -4.055 -18.774 43.067 1.0 34.44 ? 1 MET A C 1 V9WDR2 UNP 1 M +ATOM 4 C CB . MET A 1 1 ? -3.142 -18.277 45.423 1.0 34.44 ? 1 MET A CB 1 V9WDR2 UNP 1 M +ATOM 5 O O . MET A 1 1 ? -3.075 -19.425 42.745 1.0 34.44 ? 1 MET A O 1 V9WDR2 UNP 1 M +ATOM 6 C CG . MET A 1 1 ? -2.706 -16.810 45.457 1.0 34.44 ? 1 MET A CG 1 V9WDR2 UNP 1 M +ATOM 7 S SD . MET A 1 1 ? -1.706 -16.488 46.937 1.0 34.44 ? 1 MET A SD 1 V9WDR2 UNP 1 M +ATOM 8 C CE . MET A 1 1 ? -1.283 -14.738 46.734 1.0 34.44 ? 1 MET A CE 1 V9WDR2 UNP 1 M +ATOM 9 N N . ILE A 1 2 ? -4.958 -18.367 42.169 1.0 38.03 ? 2 ILE A N 1 V9WDR2 UNP 2 I +ATOM 10 C CA . ILE A 1 2 ? -4.807 -18.602 40.723 1.0 38.03 ? 2 ILE A CA 1 V9WDR2 UNP 2 I +ATOM 11 C C . ILE A 1 2 ? -4.126 -17.371 40.130 1.0 38.03 ? 2 ILE A C 1 V9WDR2 UNP 2 I +ATOM 12 C CB . ILE A 1 2 ? -6.163 -18.933 40.049 1.0 38.03 ? 2 ILE A CB 1 V9WDR2 UNP 2 I +ATOM 13 O O . ILE A 1 2 ? -4.718 -16.292 40.093 1.0 38.03 ? 2 ILE A O 1 V9WDR2 UNP 2 I +ATOM 14 C CG1 . ILE A 1 2 ? -6.749 -20.233 40.653 1.0 38.03 ? 2 ILE A CG1 1 V9WDR2 UNP 2 I +ATOM 15 C CG2 . ILE A 1 2 ? -5.997 -19.071 38.522 1.0 38.03 ? 2 ILE A CG2 1 V9WDR2 UNP 2 I +ATOM 16 C CD1 . ILE A 1 2 ? -8.159 -20.585 40.161 1.0 38.03 ? 2 ILE A CD1 1 V9WDR2 UNP 2 I +ATOM 17 N N . MET A 1 3 ? -2.874 -17.527 39.701 1.0 39.03 ? 3 MET A N 1 V9WDR2 UNP 3 M +ATOM 18 C CA . MET A 1 3 ? -2.173 -16.510 38.922 1.0 39.03 ? 3 MET A CA 1 V9WDR2 UNP 3 M +ATOM 19 C C . MET A 1 3 ? -2.892 -16.363 37.579 1.0 39.03 ? 3 MET A C 1 V9WDR2 UNP 3 M +ATOM 20 C CB . MET A 1 3 ? -0.698 -16.894 38.716 1.0 39.03 ? 3 MET A CB 1 V9WDR2 UNP 3 M +ATOM 21 O O . MET A 1 3 ? -2.768 -17.209 36.696 1.0 39.03 ? 3 MET A O 1 V9WDR2 UNP 3 M +ATOM 22 C CG . MET A 1 3 ? 0.110 -16.899 40.016 1.0 39.03 ? 3 MET A CG 1 V9WDR2 UNP 3 M +ATOM 23 S SD . MET A 1 3 ? 1.854 -17.302 39.747 1.0 39.03 ? 3 MET A SD 1 V9WDR2 UNP 3 M +ATOM 24 C CE . MET A 1 3 ? 2.256 -18.070 41.338 1.0 39.03 ? 3 MET A CE 1 V9WDR2 UNP 3 M +ATOM 25 N N . LYS A 1 4 ? -3.683 -15.298 37.426 1.0 45.03 ? 4 LYS A N 1 V9WDR2 UNP 4 K +ATOM 26 C CA . LYS A 1 4 ? -4.209 -14.903 36.119 1.0 45.03 ? 4 LYS A CA 1 V9WDR2 UNP 4 K +ATOM 27 C C . LYS A 1 4 ? -3.031 -14.403 35.283 1.0 45.03 ? 4 LYS A C 1 V9WDR2 UNP 4 K +ATOM 28 C CB . LYS A 1 4 ? -5.328 -13.857 36.259 1.0 45.03 ? 4 LYS A CB 1 V9WDR2 UNP 4 K +ATOM 29 O O . LYS A 1 4 ? -2.419 -13.389 35.614 1.0 45.03 ? 4 LYS A O 1 V9WDR2 UNP 4 K +ATOM 30 C CG . LYS A 1 4 ? -6.620 -14.469 36.831 1.0 45.03 ? 4 LYS A CG 1 V9WDR2 UNP 4 K +ATOM 31 C CD . LYS A 1 4 ? -7.749 -13.429 36.904 1.0 45.03 ? 4 LYS A CD 1 V9WDR2 UNP 4 K +ATOM 32 C CE . LYS A 1 4 ? -9.048 -14.074 37.411 1.0 45.03 ? 4 LYS A CE 1 V9WDR2 UNP 4 K +ATOM 33 N NZ . LYS A 1 4 ? -10.164 -13.095 37.503 1.0 45.03 ? 4 LYS A NZ 1 V9WDR2 UNP 4 K +ATOM 34 N N . ASN A 1 5 ? -2.710 -15.155 34.235 1.0 42.38 ? 5 ASN A N 1 V9WDR2 UNP 5 N +ATOM 35 C CA . ASN A 1 5 ? -1.707 -14.825 33.232 1.0 42.38 ? 5 ASN A CA 1 V9WDR2 UNP 5 N +ATOM 36 C C . ASN A 1 5 ? -1.987 -13.418 32.662 1.0 42.38 ? 5 ASN A C 1 V9WDR2 UNP 5 N +ATOM 37 C CB . ASN A 1 5 ? -1.761 -15.948 32.173 1.0 42.38 ? 5 ASN A CB 1 V9WDR2 UNP 5 N +ATOM 38 O O . ASN A 1 5 ? -3.040 -13.181 32.071 1.0 42.38 ? 5 ASN A O 1 V9WDR2 UNP 5 N +ATOM 39 C CG . ASN A 1 5 ? -0.670 -15.851 31.125 1.0 42.38 ? 5 ASN A CG 1 V9WDR2 UNP 5 N +ATOM 40 N ND2 . ASN A 1 5 ? -0.554 -16.835 30.265 1.0 42.38 ? 5 ASN A ND2 1 V9WDR2 UNP 5 N +ATOM 41 O OD1 . ASN A 1 5 ? 0.077 -14.890 31.072 1.0 42.38 ? 5 ASN A OD1 1 V9WDR2 UNP 5 N +ATOM 42 N N . LYS A 1 6 ? -1.061 -12.476 32.886 1.0 47.50 ? 6 LYS A N 1 V9WDR2 UNP 6 K +ATOM 43 C CA . LYS A 1 6 ? -1.152 -11.066 32.465 1.0 47.50 ? 6 LYS A CA 1 V9WDR2 UNP 6 K +ATOM 44 C C . LYS A 1 6 ? -0.837 -10.848 30.974 1.0 47.50 ? 6 LYS A C 1 V9WDR2 UNP 6 K +ATOM 45 C CB . LYS A 1 6 ? -0.270 -10.174 33.365 1.0 47.50 ? 6 LYS A CB 1 V9WDR2 UNP 6 K +ATOM 46 O O . LYS A 1 6 ? -0.666 -9.703 30.564 1.0 47.50 ? 6 LYS A O 1 V9WDR2 UNP 6 K +ATOM 47 C CG . LYS A 1 6 ? -0.824 -9.952 34.782 1.0 47.50 ? 6 LYS A CG 1 V9WDR2 UNP 6 K +ATOM 48 C CD . LYS A 1 6 ? 0.055 -8.921 35.512 1.0 47.50 ? 6 LYS A CD 1 V9WDR2 UNP 6 K +ATOM 49 C CE . LYS A 1 6 ? -0.459 -8.609 36.922 1.0 47.50 ? 6 LYS A CE 1 V9WDR2 UNP 6 K +ATOM 50 N NZ . LYS A 1 6 ? 0.400 -7.596 37.592 1.0 47.50 ? 6 LYS A NZ 1 V9WDR2 UNP 6 K +ATOM 51 N N . ASN A 1 7 ? -0.805 -11.897 30.149 1.0 44.88 ? 7 ASN A N 1 V9WDR2 UNP 7 N +ATOM 52 C CA . ASN A 1 7 ? -0.631 -11.779 28.697 1.0 44.88 ? 7 ASN A CA 1 V9WDR2 UNP 7 N +ATOM 53 C C . ASN A 1 7 ? -1.951 -11.465 27.957 1.0 44.88 ? 7 ASN A C 1 V9WDR2 UNP 7 N +ATOM 54 C CB . ASN A 1 7 ? 0.119 -13.009 28.159 1.0 44.88 ? 7 ASN A CB 1 V9WDR2 UNP 7 N +ATOM 55 O O . ASN A 1 7 ? -2.340 -12.127 27.000 1.0 44.88 ? 7 ASN A O 1 V9WDR2 UNP 7 N +ATOM 56 C CG . ASN A 1 7 ? 0.746 -12.713 26.805 1.0 44.88 ? 7 ASN A CG 1 V9WDR2 UNP 7 N +ATOM 57 N ND2 . ASN A 1 7 ? 1.404 -13.671 26.199 1.0 44.88 ? 7 ASN A ND2 1 V9WDR2 UNP 7 N +ATOM 58 O OD1 . ASN A 1 7 ? 0.691 -11.607 26.300 1.0 44.88 ? 7 ASN A OD1 1 V9WDR2 UNP 7 N +ATOM 59 N N . LYS A 1 8 ? -2.686 -10.475 28.470 1.0 44.59 ? 8 LYS A N 1 V9WDR2 UNP 8 K +ATOM 60 C CA . LYS A 1 8 ? -3.946 -9.947 27.923 1.0 44.59 ? 8 LYS A CA 1 V9WDR2 UNP 8 K +ATOM 61 C C . LYS A 1 8 ? -3.755 -8.486 27.484 1.0 44.59 ? 8 LYS A C 1 V9WDR2 UNP 8 K +ATOM 62 C CB . LYS A 1 8 ? -5.083 -10.162 28.951 1.0 44.59 ? 8 LYS A CB 1 V9WDR2 UNP 8 K +ATOM 63 O O . LYS A 1 8 ? -4.651 -7.667 27.654 1.0 44.59 ? 8 LYS A O 1 V9WDR2 UNP 8 K +ATOM 64 C CG . LYS A 1 8 ? -6.322 -10.825 28.334 1.0 44.59 ? 8 LYS A CG 1 V9WDR2 UNP 8 K +ATOM 65 C CD . LYS A 1 8 ? -7.481 -10.870 29.340 1.0 44.59 ? 8 LYS A CD 1 V9WDR2 UNP 8 K +ATOM 66 C CE . LYS A 1 8 ? -8.605 -11.764 28.803 1.0 44.59 ? 8 LYS A CE 1 V9WDR2 UNP 8 K +ATOM 67 N NZ . LYS A 1 8 ? -9.854 -11.635 29.595 1.0 44.59 ? 8 LYS A NZ 1 V9WDR2 UNP 8 K +ATOM 68 N N . GLN A 1 9 ? -2.546 -8.142 27.041 1.0 48.12 ? 9 GLN A N 1 V9WDR2 UNP 9 Q +ATOM 69 C CA . GLN A 1 9 ? -2.172 -6.767 26.720 1.0 48.12 ? 9 GLN A CA 1 V9WDR2 UNP 9 Q +ATOM 70 C C . GLN A 1 9 ? -2.788 -6.366 25.371 1.0 48.12 ? 9 GLN A C 1 V9WDR2 UNP 9 Q +ATOM 71 C CB . GLN A 1 9 ? -0.639 -6.608 26.733 1.0 48.12 ? 9 GLN A CB 1 V9WDR2 UNP 9 Q +ATOM 72 O O . GLN A 1 9 ? -2.524 -7.004 24.358 1.0 48.12 ? 9 GLN A O 1 V9WDR2 UNP 9 Q +ATOM 73 C CG . GLN A 1 9 ? 0.026 -6.971 28.075 1.0 48.12 ? 9 GLN A CG 1 V9WDR2 UNP 9 Q +ATOM 74 C CD . GLN A 1 9 ? -0.430 -6.113 29.254 1.0 48.12 ? 9 GLN A CD 1 V9WDR2 UNP 9 Q +ATOM 75 N NE2 . GLN A 1 9 ? -0.540 -6.677 30.438 1.0 48.12 ? 9 GLN A NE2 1 V9WDR2 UNP 9 Q +ATOM 76 O OE1 . GLN A 1 9 ? -0.723 -4.938 29.153 1.0 48.12 ? 9 GLN A OE1 1 V9WDR2 UNP 9 Q +ATOM 77 N N . ASN A 1 10 ? -3.620 -5.322 25.405 1.0 55.12 ? 10 ASN A N 1 V9WDR2 UNP 10 N +ATOM 78 C CA . ASN A 1 10 ? -4.056 -4.505 24.270 1.0 55.12 ? 10 ASN A CA 1 V9WDR2 UNP 10 N +ATOM 79 C C . ASN A 1 10 ? -4.683 -5.232 23.075 1.0 55.12 ? 10 ASN A C 1 V9WDR2 UNP 10 N +ATOM 80 C CB . ASN A 1 10 ? -2.877 -3.606 23.838 1.0 55.12 ? 10 ASN A CB 1 V9WDR2 UNP 10 N +ATOM 81 O O . ASN A 1 10 ? -4.072 -5.297 22.026 1.0 55.12 ? 10 ASN A O 1 V9WDR2 UNP 10 N +ATOM 82 C CG . ASN A 1 10 ? -2.715 -2.368 24.685 1.0 55.12 ? 10 ASN A CG 1 V9WDR2 UNP 10 N +ATOM 83 N ND2 . ASN A 1 10 ? -1.611 -1.676 24.552 1.0 55.12 ? 10 ASN A ND2 1 V9WDR2 UNP 10 N +ATOM 84 O OD1 . ASN A 1 10 ? -3.587 -2.003 25.460 1.0 55.12 ? 10 ASN A OD1 1 V9WDR2 UNP 10 N +ATOM 85 N N . ARG A 1 11 ? -5.930 -5.700 23.174 1.0 56.03 ? 11 ARG A N 1 V9WDR2 UNP 11 R +ATOM 86 C CA . ARG A 1 11 ? -6.805 -5.787 21.990 1.0 56.03 ? 11 ARG A CA 1 V9WDR2 UNP 11 R +ATOM 87 C C . ARG A 1 11 ? -8.107 -5.073 22.307 1.0 56.03 ? 11 ARG A C 1 V9WDR2 UNP 11 R +ATOM 88 C CB . ARG A 1 11 ? -7.030 -7.234 21.513 1.0 56.03 ? 11 ARG A CB 1 V9WDR2 UNP 11 R +ATOM 89 O O . ARG A 1 11 ? -8.853 -5.528 23.173 1.0 56.03 ? 11 ARG A O 1 V9WDR2 UNP 11 R +ATOM 90 C CG . ARG A 1 11 ? -6.021 -7.624 20.420 1.0 56.03 ? 11 ARG A CG 1 V9WDR2 UNP 11 R +ATOM 91 C CD . ARG A 1 11 ? -6.353 -8.976 19.779 1.0 56.03 ? 11 ARG A CD 1 V9WDR2 UNP 11 R +ATOM 92 N NE . ARG A 1 11 ? -6.050 -10.107 20.680 1.0 56.03 ? 11 ARG A NE 1 V9WDR2 UNP 11 R +ATOM 93 N NH1 . ARG A 1 11 ? -6.962 -11.755 19.368 1.0 56.03 ? 11 ARG A NH1 1 V9WDR2 UNP 11 R +ATOM 94 N NH2 . ARG A 1 11 ? -5.897 -12.306 21.252 1.0 56.03 ? 11 ARG A NH2 1 V9WDR2 UNP 11 R +ATOM 95 C CZ . ARG A 1 11 ? -6.309 -11.379 20.432 1.0 56.03 ? 11 ARG A CZ 1 V9WDR2 UNP 11 R +ATOM 96 N N . LYS A 1 12 ? -8.332 -3.937 21.652 1.0 73.56 ? 12 LYS A N 1 V9WDR2 UNP 12 K +ATOM 97 C CA . LYS A 1 12 ? -9.582 -3.174 21.713 1.0 73.56 ? 12 LYS A CA 1 V9WDR2 UNP 12 K +ATOM 98 C C . LYS A 1 12 ? -10.297 -3.329 20.373 1.0 73.56 ? 12 LYS A C 1 V9WDR2 UNP 12 K +ATOM 99 C CB . LYS A 1 12 ? -9.298 -1.697 22.006 1.0 73.56 ? 12 LYS A CB 1 V9WDR2 UNP 12 K +ATOM 100 O O . LYS A 1 12 ? -9.627 -3.272 19.348 1.0 73.56 ? 12 LYS A O 1 V9WDR2 UNP 12 K +ATOM 101 C CG . LYS A 1 12 ? -8.531 -1.408 23.308 1.0 73.56 ? 12 LYS A CG 1 V9WDR2 UNP 12 K +ATOM 102 C CD . LYS A 1 12 ? -8.327 0.111 23.424 1.0 73.56 ? 12 LYS A CD 1 V9WDR2 UNP 12 K +ATOM 103 C CE . LYS A 1 12 ? -7.247 0.515 24.432 1.0 73.56 ? 12 LYS A CE 1 V9WDR2 UNP 12 K +ATOM 104 N NZ . LYS A 1 12 ? -6.620 1.803 24.021 1.0 73.56 ? 12 LYS A NZ 1 V9WDR2 UNP 12 K +ATOM 105 N N . ALA A 1 13 ? -11.607 -3.553 20.414 1.0 77.81 ? 13 ALA A N 1 V9WDR2 UNP 13 A +ATOM 106 C CA . ALA A 1 13 ? -12.470 -3.613 19.241 1.0 77.81 ? 13 ALA A CA 1 V9WDR2 UNP 13 A +ATOM 107 C C . ALA A 1 13 ? -13.385 -2.383 19.241 1.0 77.81 ? 13 ALA A C 1 V9WDR2 UNP 13 A +ATOM 108 C CB . ALA A 1 13 ? -13.250 -4.932 19.237 1.0 77.81 ? 13 ALA A CB 1 V9WDR2 UNP 13 A +ATOM 109 O O . ALA A 1 13 ? -14.021 -2.112 20.263 1.0 77.81 ? 13 ALA A O 1 V9WDR2 UNP 13 A +ATOM 110 N N . PHE A 1 14 ? -13.436 -1.660 18.128 1.0 80.12 ? 14 PHE A N 1 V9WDR2 UNP 14 F +ATOM 111 C CA . PHE A 1 14 ? -14.290 -0.488 17.927 1.0 80.12 ? 14 PHE A CA 1 V9WDR2 UNP 14 F +ATOM 112 C C . PHE A 1 14 ? -15.118 -0.675 16.653 1.0 80.12 ? 14 PHE A C 1 V9WDR2 UNP 14 F +ATOM 113 C CB . PHE A 1 14 ? -13.419 0.772 17.871 1.0 80.12 ? 14 PHE A CB 1 V9WDR2 UNP 14 F +ATOM 114 O O . PHE A 1 14 ? -14.660 -1.358 15.743 1.0 80.12 ? 14 PHE A O 1 V9WDR2 UNP 14 F +ATOM 115 C CG . PHE A 1 14 ? -12.605 1.007 19.132 1.0 80.12 ? 14 PHE A CG 1 V9WDR2 UNP 14 F +ATOM 116 C CD1 . PHE A 1 14 ? -13.190 1.651 20.236 1.0 80.12 ? 14 PHE A CD1 1 V9WDR2 UNP 14 F +ATOM 117 C CD2 . PHE A 1 14 ? -11.262 0.593 19.196 1.0 80.12 ? 14 PHE A CD2 1 V9WDR2 UNP 14 F +ATOM 118 C CE1 . PHE A 1 14 ? -12.431 1.908 21.391 1.0 80.12 ? 14 PHE A CE1 1 V9WDR2 UNP 14 F +ATOM 119 C CE2 . PHE A 1 14 ? -10.488 0.892 20.331 1.0 80.12 ? 14 PHE A CE2 1 V9WDR2 UNP 14 F +ATOM 120 C CZ . PHE A 1 14 ? -11.074 1.546 21.430 1.0 80.12 ? 14 PHE A CZ 1 V9WDR2 UNP 14 F +ATOM 121 N N . ALA A 1 15 ? -16.330 -0.119 16.612 1.0 80.38 ? 15 ALA A N 1 V9WDR2 UNP 15 A +ATOM 122 C CA . ALA A 1 15 ? -17.080 -0.025 15.361 1.0 80.38 ? 15 ALA A CA 1 V9WDR2 UNP 15 A +ATOM 123 C C . ALA A 1 15 ? -16.466 1.118 14.548 1.0 80.38 ? 15 ALA A C 1 V9WDR2 UNP 15 A +ATOM 124 C CB . ALA A 1 15 ? -18.579 0.117 15.656 1.0 80.38 ? 15 ALA A CB 1 V9WDR2 UNP 15 A +ATOM 125 O O . ALA A 1 15 ? -15.577 0.862 13.746 1.0 80.38 ? 15 ALA A O 1 V9WDR2 UNP 15 A +ATOM 126 N N . ASP A 1 16 ? -16.759 2.357 14.937 1.0 87.81 ? 16 ASP A N 1 V9WDR2 UNP 16 D +ATOM 127 C CA . ASP A 1 16 ? -16.306 3.541 14.206 1.0 87.81 ? 16 ASP A CA 1 V9WDR2 UNP 16 D +ATOM 128 C C . ASP A 1 16 ? -15.365 4.357 15.090 1.0 87.81 ? 16 ASP A C 1 V9WDR2 UNP 16 D +ATOM 129 C CB . ASP A 1 16 ? -17.507 4.379 13.735 1.0 87.81 ? 16 ASP A CB 1 V9WDR2 UNP 16 D +ATOM 130 O O . ASP A 1 16 ? -15.596 4.527 16.296 1.0 87.81 ? 16 ASP A O 1 V9WDR2 UNP 16 D +ATOM 131 C CG . ASP A 1 16 ? -18.658 3.534 13.173 1.0 87.81 ? 16 ASP A CG 1 V9WDR2 UNP 16 D +ATOM 132 O OD1 . ASP A 1 16 ? -18.384 2.448 12.626 1.0 87.81 ? 16 ASP A OD1 1 V9WDR2 UNP 16 D +ATOM 133 O OD2 . ASP A 1 16 ? -19.820 3.877 13.493 1.0 87.81 ? 16 ASP A OD2 1 V9WDR2 UNP 16 D +ATOM 134 N N . THR A 1 17 ? -14.263 4.830 14.516 1.0 90.19 ? 17 THR A N 1 V9WDR2 UNP 17 T +ATOM 135 C CA . THR A 1 17 ? -13.298 5.662 15.233 1.0 90.19 ? 17 THR A CA 1 V9WDR2 UNP 17 T +ATOM 136 C C . THR A 1 17 ? -12.857 6.849 14.395 1.0 90.19 ? 17 THR A C 1 V9WDR2 UNP 17 T +ATOM 137 C CB . THR A 1 17 ? -12.046 4.868 15.631 1.0 90.19 ? 17 THR A CB 1 V9WDR2 UNP 17 T +ATOM 138 O O . THR A 1 17 ? -12.113 6.686 13.447 1.0 90.19 ? 17 THR A O 1 V9WDR2 UNP 17 T +ATOM 139 C CG2 . THR A 1 17 ? -11.279 5.643 16.708 1.0 90.19 ? 17 THR A CG2 1 V9WDR2 UNP 17 T +ATOM 140 O OG1 . THR A 1 17 ? -12.384 3.591 16.145 1.0 90.19 ? 17 THR A OG1 1 V9WDR2 UNP 17 T +ATOM 141 N N . GLU A 1 18 ? -13.174 8.060 14.830 1.0 91.25 ? 18 GLU A N 1 V9WDR2 UNP 18 E +ATOM 142 C CA . GLU A 1 18 ? -12.619 9.270 14.205 1.0 91.25 ? 18 GLU A CA 1 V9WDR2 UNP 18 E +ATOM 143 C C . GLU A 1 18 ? -11.085 9.306 14.357 1.0 91.25 ? 18 GLU A C 1 V9WDR2 UNP 18 E +ATOM 144 C CB . GLU A 1 18 ? -13.241 10.495 14.883 1.0 91.25 ? 18 GLU A CB 1 V9WDR2 UNP 18 E +ATOM 145 O O . GLU A 1 18 ? -10.344 9.444 13.396 1.0 91.25 ? 18 GLU A O 1 V9WDR2 UNP 18 E +ATOM 146 C CG . GLU A 1 18 ? -14.773 10.540 14.818 1.0 91.25 ? 18 GLU A CG 1 V9WDR2 UNP 18 E +ATOM 147 C CD . GLU A 1 18 ? -15.318 11.115 13.510 1.0 91.25 ? 18 GLU A CD 1 V9WDR2 UNP 18 E +ATOM 148 O OE1 . GLU A 1 18 ? -16.140 10.402 12.892 1.0 91.25 ? 18 GLU A OE1 1 V9WDR2 UNP 18 E +ATOM 149 O OE2 . GLU A 1 18 ? -15.100 12.331 13.338 1.0 91.25 ? 18 GLU A OE2 1 V9WDR2 UNP 18 E +ATOM 150 N N . PHE A 1 19 ? -10.568 9.083 15.574 1.0 90.44 ? 19 PHE A N 1 V9WDR2 UNP 19 F +ATOM 151 C CA . PHE A 1 19 ? -9.128 9.149 15.850 1.0 90.44 ? 19 PHE A CA 1 V9WDR2 UNP 19 F +ATOM 152 C C . PHE A 1 19 ? -8.605 7.924 16.606 1.0 90.44 ? 19 PHE A C 1 V9WDR2 UNP 19 F +ATOM 153 C CB . PHE A 1 19 ? -8.798 10.447 16.602 1.0 90.44 ? 19 PHE A CB 1 V9WDR2 UNP 19 F +ATOM 154 O O . PHE A 1 19 ? -9.034 7.612 17.724 1.0 90.44 ? 19 PHE A O 1 V9WDR2 UNP 19 F +ATOM 155 C CG . PHE A 1 19 ? -9.130 11.707 15.826 1.0 90.44 ? 19 PHE A CG 1 V9WDR2 UNP 19 F +ATOM 156 C CD1 . PHE A 1 19 ? -8.223 12.210 14.874 1.0 90.44 ? 19 PHE A CD1 1 V9WDR2 UNP 19 F +ATOM 157 C CD2 . PHE A 1 19 ? -10.376 12.340 16.002 1.0 90.44 ? 19 PHE A CD2 1 V9WDR2 UNP 19 F +ATOM 158 C CE1 . PHE A 1 19 ? -8.568 13.325 14.090 1.0 90.44 ? 19 PHE A CE1 1 V9WDR2 UNP 19 F +ATOM 159 C CE2 . PHE A 1 19 ? -10.725 13.445 15.208 1.0 90.44 ? 19 PHE A CE2 1 V9WDR2 UNP 19 F +ATOM 160 C CZ . PHE A 1 19 ? -9.824 13.933 14.247 1.0 90.44 ? 19 PHE A CZ 1 V9WDR2 UNP 19 F +ATOM 161 N N . ALA A 1 20 ? -7.601 7.268 16.033 1.0 88.88 ? 20 ALA A N 1 V9WDR2 UNP 20 A +ATOM 162 C CA . ALA A 1 20 ? -6.832 6.195 16.640 1.0 88.88 ? 20 ALA A CA 1 V9WDR2 UNP 20 A +ATOM 163 C C . ALA A 1 20 ? -5.346 6.570 16.677 1.0 88.88 ? 20 ALA A C 1 V9WDR2 UNP 20 A +ATOM 164 C CB . ALA A 1 20 ? -7.075 4.904 15.849 1.0 88.88 ? 20 ALA A CB 1 V9WDR2 UNP 20 A +ATOM 165 O O . ALA A 1 20 ? -4.713 6.759 15.646 1.0 88.88 ? 20 ALA A O 1 V9WDR2 UNP 20 A +ATOM 166 N N . SER A 1 21 ? -4.766 6.638 17.875 1.0 92.38 ? 21 SER A N 1 V9WDR2 UNP 21 S +ATOM 167 C CA . SER A 1 21 ? -3.317 6.750 18.040 1.0 92.38 ? 21 SER A CA 1 V9WDR2 UNP 21 S +ATOM 168 C C . SER A 1 21 ? -2.840 5.690 19.017 1.0 92.38 ? 21 SER A C 1 V9WDR2 UNP 21 S +ATOM 169 C CB . SER A 1 21 ? -2.910 8.159 18.465 1.0 92.38 ? 21 SER A CB 1 V9WDR2 UNP 21 S +ATOM 170 O O . SER A 1 21 ? -3.323 5.624 20.150 1.0 92.38 ? 21 SER A O 1 V9WDR2 UNP 21 S +ATOM 171 O OG . SER A 1 21 ? -1.500 8.258 18.525 1.0 92.38 ? 21 SER A OG 1 V9WDR2 UNP 21 S +ATOM 172 N N . GLU A 1 22 ? -1.942 4.823 18.562 1.0 87.19 ? 22 GLU A N 1 V9WDR2 UNP 22 E +ATOM 173 C CA . GLU A 1 22 ? -1.471 3.676 19.331 1.0 87.19 ? 22 GLU A CA 1 V9WDR2 UNP 22 E +ATOM 174 C C . GLU A 1 22 ? 0.049 3.508 19.166 1.0 87.19 ? 22 GLU A C 1 V9WDR2 UNP 22 E +ATOM 175 C CB . GLU A 1 22 ? -2.247 2.404 18.925 1.0 87.19 ? 22 GLU A CB 1 V9WDR2 UNP 22 E +ATOM 176 O O . GLU A 1 22 ? 0.609 3.622 18.075 1.0 87.19 ? 22 GLU A O 1 V9WDR2 UNP 22 E +ATOM 177 C CG . GLU A 1 22 ? -3.749 2.344 19.333 1.0 87.19 ? 22 GLU A CG 1 V9WDR2 UNP 22 E +ATOM 178 C CD . GLU A 1 22 ? -4.070 2.157 20.842 1.0 87.19 ? 22 GLU A CD 1 V9WDR2 UNP 22 E +ATOM 179 O OE1 . GLU A 1 22 ? -5.277 2.091 21.225 1.0 87.19 ? 22 GLU A OE1 1 V9WDR2 UNP 22 E +ATOM 180 O OE2 . GLU A 1 22 ? -3.138 2.004 21.663 1.0 87.19 ? 22 GLU A OE2 1 V9WDR2 UNP 22 E +ATOM 181 N N . ALA A 1 23 ? 0.728 3.211 20.276 1.0 90.38 ? 23 ALA A N 1 V9WDR2 UNP 23 A +ATOM 182 C CA . ALA A 1 23 ? 2.153 2.899 20.300 1.0 90.38 ? 23 ALA A CA 1 V9WDR2 UNP 23 A +ATOM 183 C C . ALA A 1 23 ? 2.367 1.565 21.023 1.0 90.38 ? 23 ALA A C 1 V9WDR2 UNP 23 A +ATOM 184 C CB . ALA A 1 23 ? 2.927 4.057 20.942 1.0 90.38 ? 23 ALA A CB 1 V9WDR2 UNP 23 A +ATOM 185 O O . ALA A 1 23 ? 2.037 1.436 22.205 1.0 90.38 ? 23 ALA A O 1 V9WDR2 UNP 23 A +ATOM 186 N N . GLY A 1 24 ? 2.891 0.556 20.321 1.0 86.38 ? 24 GLY A N 1 V9WDR2 UNP 24 G +ATOM 187 C CA . GLY A 1 24 ? 3.130 -0.775 20.900 1.0 86.38 ? 24 GLY A CA 1 V9WDR2 UNP 24 G +ATOM 188 C C . GLY A 1 24 ? 1.865 -1.536 21.329 1.0 86.38 ? 24 GLY A C 1 V9WDR2 UNP 24 G +ATOM 189 O O . GLY A 1 24 ? 1.930 -2.383 22.224 1.0 86.38 ? 24 GLY A O 1 V9WDR2 UNP 24 G +ATOM 190 N N . ALA A 1 25 ? 0.703 -1.219 20.753 1.0 84.62 ? 25 ALA A N 1 V9WDR2 UNP 25 A +ATOM 191 C CA . ALA A 1 25 ? -0.584 -1.829 21.089 1.0 84.62 ? 25 ALA A CA 1 V9WDR2 UNP 25 A +ATOM 192 C C . ALA A 1 25 ? -1.178 -2.596 19.903 1.0 84.62 ? 25 ALA A C 1 V9WDR2 UNP 25 A +ATOM 193 C CB . ALA A 1 25 ? -1.533 -0.726 21.560 1.0 84.62 ? 25 ALA A CB 1 V9WDR2 UNP 25 A +ATOM 194 O O . ALA A 1 25 ? -0.813 -2.329 18.763 1.0 84.62 ? 25 ALA A O 1 V9WDR2 UNP 25 A +ATOM 195 N N . ASN A 1 26 ? -2.120 -3.513 20.170 1.0 89.00 ? 26 ASN A N 1 V9WDR2 UNP 26 N +ATOM 196 C CA . ASN A 1 26 ? -2.925 -4.107 19.107 1.0 89.00 ? 26 ASN A CA 1 V9WDR2 UNP 26 N +ATOM 197 C C . ASN A 1 26 ? -4.351 -3.542 19.108 1.0 89.00 ? 26 ASN A C 1 V9WDR2 UNP 26 N +ATOM 198 C CB . ASN A 1 26 ? -2.895 -5.646 19.095 1.0 89.00 ? 26 ASN A CB 1 V9WDR2 UNP 26 N +ATOM 199 O O . ASN A 1 26 ? -4.991 -3.397 20.159 1.0 89.00 ? 26 ASN A O 1 V9WDR2 UNP 26 N +ATOM 200 C CG . ASN A 1 26 ? -1.516 -6.259 19.227 1.0 89.00 ? 26 ASN A CG 1 V9WDR2 UNP 26 N +ATOM 201 N ND2 . ASN A 1 26 ? -1.418 -7.440 19.789 1.0 89.00 ? 26 ASN A ND2 1 V9WDR2 UNP 26 N +ATOM 202 O OD1 . ASN A 1 26 ? -0.499 -5.730 18.825 1.0 89.00 ? 26 ASN A OD1 1 V9WDR2 UNP 26 N +ATOM 203 N N . ARG A 1 27 ? -4.877 -3.274 17.915 1.0 88.31 ? 27 ARG A N 1 V9WDR2 UNP 27 R +ATOM 204 C CA . ARG A 1 27 ? -6.211 -2.705 17.721 1.0 88.31 ? 27 ARG A CA 1 V9WDR2 UNP 27 R +ATOM 205 C C . ARG A 1 27 ? -6.984 -3.457 16.647 1.0 88.31 ? 27 ARG A C 1 V9WDR2 UNP 27 R +ATOM 206 C CB . ARG A 1 27 ? -6.060 -1.212 17.389 1.0 88.31 ? 27 ARG A CB 1 V9WDR2 UNP 27 R +ATOM 207 O O . ARG A 1 27 ? -6.421 -3.899 15.652 1.0 88.31 ? 27 ARG A O 1 V9WDR2 UNP 27 R +ATOM 208 C CG . ARG A 1 27 ? -7.415 -0.504 17.263 1.0 88.31 ? 27 ARG A CG 1 V9WDR2 UNP 27 R +ATOM 209 C CD . ARG A 1 27 ? -7.223 0.979 16.960 1.0 88.31 ? 27 ARG A CD 1 V9WDR2 UNP 27 R +ATOM 210 N NE . ARG A 1 27 ? -8.528 1.663 16.945 1.0 88.31 ? 27 ARG A NE 1 V9WDR2 UNP 27 R +ATOM 211 N NH1 . ARG A 1 27 ? -8.137 3.200 18.617 1.0 88.31 ? 27 ARG A NH1 1 V9WDR2 UNP 27 R +ATOM 212 N NH2 . ARG A 1 27 ? -10.132 3.081 17.671 1.0 88.31 ? 27 ARG A NH2 1 V9WDR2 UNP 27 R +ATOM 213 C CZ . ARG A 1 27 ? -8.920 2.640 17.735 1.0 88.31 ? 27 ARG A CZ 1 V9WDR2 UNP 27 R +ATOM 214 N N . THR A 1 28 ? -8.288 -3.562 16.861 1.0 91.44 ? 28 THR A N 1 V9WDR2 UNP 28 T +ATOM 215 C CA . THR A 1 28 ? -9.250 -3.932 15.831 1.0 91.44 ? 28 THR A CA 1 V9WDR2 UNP 28 T +ATOM 216 C C . THR A 1 28 ? -10.310 -2.835 15.733 1.0 91.44 ? 28 THR A C 1 V9WDR2 UNP 28 T +ATOM 217 C CB . THR A 1 28 ? -9.848 -5.319 16.089 1.0 91.44 ? 28 THR A CB 1 V9WDR2 UNP 28 T +ATOM 218 O O . THR A 1 28 ? -10.817 -2.382 16.760 1.0 91.44 ? 28 THR A O 1 V9WDR2 UNP 28 T +ATOM 219 C CG2 . THR A 1 28 ? -10.705 -5.799 14.921 1.0 91.44 ? 28 THR A CG2 1 V9WDR2 UNP 28 T +ATOM 220 O OG1 . THR A 1 28 ? -8.810 -6.267 16.264 1.0 91.44 ? 28 THR A OG1 1 V9WDR2 UNP 28 T +ATOM 221 N N . ALA A 1 29 ? -10.634 -2.382 14.532 1.0 90.12 ? 29 ALA A N 1 V9WDR2 UNP 29 A +ATOM 222 C CA . ALA A 1 29 ? -11.752 -1.472 14.280 1.0 90.12 ? 29 ALA A CA 1 V9WDR2 UNP 29 A +ATOM 223 C C . ALA A 1 29 ? -12.519 -1.935 13.032 1.0 90.12 ? 29 ALA A C 1 V9WDR2 UNP 29 A +ATOM 224 C CB . ALA A 1 29 ? -11.230 -0.033 14.181 1.0 90.12 ? 29 ALA A CB 1 V9WDR2 UNP 29 A +ATOM 225 O O . ALA A 1 29 ? -11.959 -2.707 12.257 1.0 90.12 ? 29 ALA A O 1 V9WDR2 UNP 29 A +ATOM 226 N N . ALA A 1 30 ? -13.779 -1.528 12.866 1.0 90.31 ? 30 ALA A N 1 V9WDR2 UNP 30 A +ATOM 227 C CA . ALA A 1 30 ? -14.408 -1.606 11.550 1.0 90.31 ? 30 ALA A CA 1 V9WDR2 UNP 30 A +ATOM 228 C C . ALA A 1 30 ? -13.888 -0.427 10.728 1.0 90.31 ? 30 ALA A C 1 V9WDR2 UNP 30 A +ATOM 229 C CB . ALA A 1 30 ? -15.936 -1.679 11.664 1.0 90.31 ? 30 ALA A CB 1 V9WDR2 UNP 30 A +ATOM 230 O O . ALA A 1 30 ? -13.056 -0.645 9.857 1.0 90.31 ? 30 ALA A O 1 V9WDR2 UNP 30 A +ATOM 231 N N . ASP A 1 31 ? -14.191 0.794 11.169 1.0 92.75 ? 31 ASP A N 1 V9WDR2 UNP 31 D +ATOM 232 C CA . ASP A 1 31 ? -13.874 2.006 10.419 1.0 92.75 ? 31 ASP A CA 1 V9WDR2 UNP 31 D +ATOM 233 C C . ASP A 1 31 ? -12.980 2.934 11.243 1.0 92.75 ? 31 ASP A C 1 V9WDR2 UNP 31 D +ATOM 234 C CB . ASP A 1 31 ? -15.175 2.693 9.969 1.0 92.75 ? 31 ASP A CB 1 V9WDR2 UNP 31 D +ATOM 235 O O . ASP A 1 31 ? -13.087 3.039 12.478 1.0 92.75 ? 31 ASP A O 1 V9WDR2 UNP 31 D +ATOM 236 C CG . ASP A 1 31 ? -16.095 1.750 9.175 1.0 92.75 ? 31 ASP A CG 1 V9WDR2 UNP 31 D +ATOM 237 O OD1 . ASP A 1 31 ? -15.565 0.793 8.574 1.0 92.75 ? 31 ASP A OD1 1 V9WDR2 UNP 31 D +ATOM 238 O OD2 . ASP A 1 31 ? -17.328 1.926 9.269 1.0 92.75 ? 31 ASP A OD2 1 V9WDR2 UNP 31 D +ATOM 239 N N . THR A 1 32 ? -12.030 3.595 10.586 1.0 95.44 ? 32 THR A N 1 V9WDR2 UNP 32 T +ATOM 240 C CA . THR A 1 32 ? -11.206 4.628 11.219 1.0 95.44 ? 32 THR A CA 1 V9WDR2 UNP 32 T +ATOM 241 C C . THR A 1 32 ? -10.917 5.780 10.267 1.0 95.44 ? 32 THR A C 1 V9WDR2 UNP 32 T +ATOM 242 C CB . THR A 1 32 ? -9.897 4.046 11.761 1.0 95.44 ? 32 THR A CB 1 V9WDR2 UNP 32 T +ATOM 243 O O . THR A 1 32 ? -10.283 5.567 9.248 1.0 95.44 ? 32 THR A O 1 V9WDR2 UNP 32 T +ATOM 244 C CG2 . THR A 1 32 ? -9.020 5.065 12.488 1.0 95.44 ? 32 THR A CG2 1 V9WDR2 UNP 32 T +ATOM 245 O OG1 . THR A 1 32 ? -10.163 3.009 12.693 1.0 95.44 ? 32 THR A OG1 1 V9WDR2 UNP 32 T +ATOM 246 N N . GLU A 1 33 ? -11.293 7.002 10.625 1.0 95.38 ? 33 GLU A N 1 V9WDR2 UNP 33 E +ATOM 247 C CA . GLU A 1 33 ? -10.997 8.183 9.799 1.0 95.38 ? 33 GLU A CA 1 V9WDR2 UNP 33 E +ATOM 248 C C . GLU A 1 33 ? -9.491 8.497 9.851 1.0 95.38 ? 33 GLU A C 1 V9WDR2 UNP 33 E +ATOM 249 C CB . GLU A 1 33 ? -11.855 9.349 10.302 1.0 95.38 ? 33 GLU A CB 1 V9WDR2 UNP 33 E +ATOM 250 O O . GLU A 1 33 ? -8.803 8.483 8.839 1.0 95.38 ? 33 GLU A O 1 V9WDR2 UNP 33 E +ATOM 251 C CG . GLU A 1 33 ? -12.002 10.508 9.306 1.0 95.38 ? 33 GLU A CG 1 V9WDR2 UNP 33 E +ATOM 252 C CD . GLU A 1 33 ? -12.645 11.751 9.949 1.0 95.38 ? 33 GLU A CD 1 V9WDR2 UNP 33 E +ATOM 253 O OE1 . GLU A 1 33 ? -12.783 12.802 9.277 1.0 95.38 ? 33 GLU A OE1 1 V9WDR2 UNP 33 E +ATOM 254 O OE2 . GLU A 1 33 ? -12.889 11.703 11.178 1.0 95.38 ? 33 GLU A OE2 1 V9WDR2 UNP 33 E +ATOM 255 N N . PHE A 1 34 ? -8.925 8.649 11.054 1.0 95.44 ? 34 PHE A N 1 V9WDR2 UNP 34 F +ATOM 256 C CA . PHE A 1 34 ? -7.506 8.954 11.249 1.0 95.44 ? 34 PHE A CA 1 V9WDR2 UNP 34 F +ATOM 257 C C . PHE A 1 34 ? -6.802 7.932 12.144 1.0 95.44 ? 34 PHE A C 1 V9WDR2 UNP 34 F +ATOM 258 C CB . PHE A 1 34 ? -7.361 10.364 11.828 1.0 95.44 ? 34 PHE A CB 1 V9WDR2 UNP 34 F +ATOM 259 O O . PHE A 1 34 ? -7.110 7.792 13.332 1.0 95.44 ? 34 PHE A O 1 V9WDR2 UNP 34 F +ATOM 260 C CG . PHE A 1 34 ? -7.950 11.462 10.967 1.0 95.44 ? 34 PHE A CG 1 V9WDR2 UNP 34 F +ATOM 261 C CD1 . PHE A 1 34 ? -7.235 11.954 9.860 1.0 95.44 ? 34 PHE A CD1 1 V9WDR2 UNP 34 F +ATOM 262 C CD2 . PHE A 1 34 ? -9.223 11.984 11.260 1.0 95.44 ? 34 PHE A CD2 1 V9WDR2 UNP 34 F +ATOM 263 C CE1 . PHE A 1 34 ? -7.802 12.941 9.035 1.0 95.44 ? 34 PHE A CE1 1 V9WDR2 UNP 34 F +ATOM 264 C CE2 . PHE A 1 34 ? -9.767 12.998 10.460 1.0 95.44 ? 34 PHE A CE2 1 V9WDR2 UNP 34 F +ATOM 265 C CZ . PHE A 1 34 ? -9.076 13.453 9.328 1.0 95.44 ? 34 PHE A CZ 1 V9WDR2 UNP 34 F +ATOM 266 N N . ALA A 1 35 ? -5.780 7.269 11.608 1.0 94.94 ? 35 ALA A N 1 V9WDR2 UNP 35 A +ATOM 267 C CA . ALA A 1 35 ? -4.913 6.338 12.318 1.0 94.94 ? 35 ALA A CA 1 V9WDR2 UNP 35 A +ATOM 268 C C . ALA A 1 35 ? -3.453 6.820 12.329 1.0 94.94 ? 35 ALA A C 1 V9WDR2 UNP 35 A +ATOM 269 C CB . ALA A 1 35 ? -5.062 4.942 11.705 1.0 94.94 ? 35 ALA A CB 1 V9WDR2 UNP 35 A +ATOM 270 O O . ALA A 1 35 ? -2.875 7.158 11.297 1.0 94.94 ? 35 ALA A O 1 V9WDR2 UNP 35 A +ATOM 271 N N . SER A 1 36 ? -2.830 6.810 13.508 1.0 96.62 ? 36 SER A N 1 V9WDR2 UNP 36 S +ATOM 272 C CA . SER A 1 36 ? -1.396 7.048 13.676 1.0 96.62 ? 36 SER A CA 1 V9WDR2 UNP 36 S +ATOM 273 C C . SER A 1 36 ? -0.776 5.978 14.567 1.0 96.62 ? 36 SER A C 1 V9WDR2 UNP 36 S +ATOM 274 C CB . SER A 1 36 ? -1.140 8.448 14.227 1.0 96.62 ? 36 SER A CB 1 V9WDR2 UNP 36 S +ATOM 275 O O . SER A 1 36 ? -1.115 5.860 15.748 1.0 96.62 ? 36 SER A O 1 V9WDR2 UNP 36 S +ATOM 276 O OG . SER A 1 36 ? 0.253 8.685 14.325 1.0 96.62 ? 36 SER A OG 1 V9WDR2 UNP 36 S +ATOM 277 N N . GLU A 1 37 ? 0.142 5.198 14.004 1.0 94.25 ? 37 GLU A N 1 V9WDR2 UNP 37 E +ATOM 278 C CA . GLU A 1 37 ? 0.661 3.993 14.642 1.0 94.25 ? 37 GLU A CA 1 V9WDR2 UNP 37 E +ATOM 279 C C . GLU A 1 37 ? 2.183 3.947 14.671 1.0 94.25 ? 37 GLU A C 1 V9WDR2 UNP 37 E +ATOM 280 C CB . GLU A 1 37 ? 0.114 2.747 13.952 1.0 94.25 ? 37 GLU A CB 1 V9WDR2 UNP 37 E +ATOM 281 O O . GLU A 1 37 ? 2.854 4.136 13.659 1.0 94.25 ? 37 GLU A O 1 V9WDR2 UNP 37 E +ATOM 282 C CG . GLU A 1 37 ? -1.417 2.725 13.998 1.0 94.25 ? 37 GLU A CG 1 V9WDR2 UNP 37 E +ATOM 283 C CD . GLU A 1 37 ? -2.005 1.322 13.948 1.0 94.25 ? 37 GLU A CD 1 V9WDR2 UNP 37 E +ATOM 284 O OE1 . GLU A 1 37 ? -3.127 1.206 14.490 1.0 94.25 ? 37 GLU A OE1 1 V9WDR2 UNP 37 E +ATOM 285 O OE2 . GLU A 1 37 ? -1.333 0.369 13.494 1.0 94.25 ? 37 GLU A OE2 1 V9WDR2 UNP 37 E +ATOM 286 N N . ALA A 1 38 ? 2.734 3.634 15.844 1.0 95.38 ? 38 ALA A N 1 V9WDR2 UNP 38 A +ATOM 287 C CA . ALA A 1 38 ? 4.167 3.443 16.030 1.0 95.38 ? 38 ALA A CA 1 V9WDR2 UNP 38 A +ATOM 288 C C . ALA A 1 38 ? 4.447 2.092 16.698 1.0 95.38 ? 38 ALA A C 1 V9WDR2 UNP 38 A +ATOM 289 C CB . ALA A 1 38 ? 4.733 4.628 16.817 1.0 95.38 ? 38 ALA A CB 1 V9WDR2 UNP 38 A +ATOM 290 O O . ALA A 1 38 ? 4.137 1.890 17.876 1.0 95.38 ? 38 ALA A O 1 V9WDR2 UNP 38 A +ATOM 291 N N . GLY A 1 39 ? 5.029 1.144 15.960 1.0 92.50 ? 39 GLY A N 1 V9WDR2 UNP 39 G +ATOM 292 C CA . GLY A 1 39 ? 5.297 -0.199 16.491 1.0 92.50 ? 39 GLY A CA 1 V9WDR2 UNP 39 G +ATOM 293 C C . GLY A 1 39 ? 4.040 -0.951 16.950 1.0 92.50 ? 39 GLY A C 1 V9WDR2 UNP 39 G +ATOM 294 O O . GLY A 1 39 ? 4.124 -1.775 17.862 1.0 92.50 ? 39 GLY A O 1 V9WDR2 UNP 39 G +ATOM 295 N N . ALA A 1 40 ? 2.872 -0.609 16.405 1.0 92.38 ? 40 ALA A N 1 V9WDR2 UNP 40 A +ATOM 296 C CA . ALA A 1 40 ? 1.581 -1.194 16.757 1.0 92.38 ? 40 ALA A CA 1 V9WDR2 UNP 40 A +ATOM 297 C C . ALA A 1 40 ? 1.172 -2.281 15.748 1.0 92.38 ? 40 ALA A C 1 V9WDR2 UNP 40 A +ATOM 298 C CB . ALA A 1 40 ? 0.554 -0.060 16.850 1.0 92.38 ? 40 ALA A CB 1 V9WDR2 UNP 40 A +ATOM 299 O O . ALA A 1 40 ? 1.777 -2.397 14.682 1.0 92.38 ? 40 ALA A O 1 V9WDR2 UNP 40 A +ATOM 300 N N . ASN A 1 41 ? 0.156 -3.080 16.093 1.0 93.56 ? 41 ASN A N 1 V9WDR2 UNP 41 N +ATOM 301 C CA . ASN A 1 41 ? -0.509 -3.948 15.122 1.0 93.56 ? 41 ASN A CA 1 V9WDR2 UNP 41 N +ATOM 302 C C . ASN A 1 41 ? -1.987 -3.578 14.988 1.0 93.56 ? 41 ASN A C 1 V9WDR2 UNP 41 N +ATOM 303 C CB . ASN A 1 41 ? -0.353 -5.441 15.454 1.0 93.56 ? 41 ASN A CB 1 V9WDR2 UNP 41 N +ATOM 304 O O . ASN A 1 41 ? -2.717 -3.607 15.986 1.0 93.56 ? 41 ASN A O 1 V9WDR2 UNP 41 N +ATOM 305 C CG . ASN A 1 41 ? 1.080 -5.887 15.657 1.0 93.56 ? 41 ASN A CG 1 V9WDR2 UNP 41 N +ATOM 306 N ND2 . ASN A 1 41 ? 1.442 -6.267 16.856 1.0 93.56 ? 41 ASN A ND2 1 V9WDR2 UNP 41 N +ATOM 307 O OD1 . ASN A 1 41 ? 1.906 -5.933 14.767 1.0 93.56 ? 41 ASN A OD1 1 V9WDR2 UNP 41 N +ATOM 308 N N . ARG A 1 42 ? -2.465 -3.334 13.769 1.0 93.56 ? 42 ARG A N 1 V9WDR2 UNP 42 R +ATOM 309 C CA . ARG A 1 42 ? -3.877 -3.017 13.528 1.0 93.56 ? 42 ARG A CA 1 V9WDR2 UNP 42 R +ATOM 310 C C . ARG A 1 42 ? -4.527 -3.952 12.536 1.0 93.56 ? 42 ARG A C 1 V9WDR2 UNP 42 R +ATOM 311 C CB . ARG A 1 42 ? -4.034 -1.551 13.119 1.0 93.56 ? 42 ARG A CB 1 V9WDR2 UNP 42 R +ATOM 312 O O . ARG A 1 42 ? -3.950 -4.318 11.522 1.0 93.56 ? 42 ARG A O 1 V9WDR2 UNP 42 R +ATOM 313 C CG . ARG A 1 42 ? -5.504 -1.104 13.137 1.0 93.56 ? 42 ARG A CG 1 V9WDR2 UNP 42 R +ATOM 314 C CD . ARG A 1 42 ? -5.752 0.387 12.916 1.0 93.56 ? 42 ARG A CD 1 V9WDR2 UNP 42 R +ATOM 315 N NE . ARG A 1 42 ? -5.499 0.795 11.533 1.0 93.56 ? 42 ARG A NE 1 V9WDR2 UNP 42 R +ATOM 316 N NH1 . ARG A 1 42 ? -7.397 2.076 11.222 1.0 93.56 ? 42 ARG A NH1 1 V9WDR2 UNP 42 R +ATOM 317 N NH2 . ARG A 1 42 ? -6.008 1.741 9.553 1.0 93.56 ? 42 ARG A NH2 1 V9WDR2 UNP 42 R +ATOM 318 C CZ . ARG A 1 42 ? -6.298 1.532 10.792 1.0 93.56 ? 42 ARG A CZ 1 V9WDR2 UNP 42 R +ATOM 319 N N . THR A 1 43 ? -5.774 -4.282 12.832 1.0 95.69 ? 43 THR A N 1 V9WDR2 UNP 43 T +ATOM 320 C CA . THR A 1 43 ? -6.723 -4.792 11.849 1.0 95.69 ? 43 THR A CA 1 V9WDR2 UNP 43 T +ATOM 321 C C . THR A 1 43 ? -7.874 -3.804 11.745 1.0 95.69 ? 43 THR A C 1 V9WDR2 UNP 43 T +ATOM 322 C CB . THR A 1 43 ? -7.218 -6.189 12.223 1.0 95.69 ? 43 THR A CB 1 V9WDR2 UNP 43 T +ATOM 323 O O . THR A 1 43 ? -8.468 -3.448 12.764 1.0 95.69 ? 43 THR A O 1 V9WDR2 UNP 43 T +ATOM 324 C CG2 . THR A 1 43 ? -8.036 -6.823 11.103 1.0 95.69 ? 43 THR A CG2 1 V9WDR2 UNP 43 T +ATOM 325 O OG1 . THR A 1 43 ? -6.124 -7.042 12.490 1.0 95.69 ? 43 THR A OG1 1 V9WDR2 UNP 43 T +ATOM 326 N N . VAL A 1 44 ? -8.181 -3.351 10.544 1.0 94.94 ? 44 VAL A N 1 V9WDR2 UNP 44 V +ATOM 327 C CA . VAL A 1 44 ? -9.313 -2.473 10.255 1.0 94.94 ? 44 VAL A CA 1 V9WDR2 UNP 44 V +ATOM 328 C C . VAL A 1 44 ? -10.036 -2.998 9.015 1.0 94.94 ? 44 VAL A C 1 V9WDR2 UNP 44 V +ATOM 329 C CB . VAL A 1 44 ? -8.829 -1.022 10.135 1.0 94.94 ? 44 VAL A CB 1 V9WDR2 UNP 44 V +ATOM 330 O O . VAL A 1 44 ? -9.414 -3.726 8.243 1.0 94.94 ? 44 VAL A O 1 V9WDR2 UNP 44 V +ATOM 331 C CG1 . VAL A 1 44 ? -8.008 -0.815 8.860 1.0 94.94 ? 44 VAL A CG1 1 V9WDR2 UNP 44 V +ATOM 332 C CG2 . VAL A 1 44 ? -9.995 -0.043 10.222 1.0 94.94 ? 44 VAL A CG2 1 V9WDR2 UNP 44 V +ATOM 333 N N . ALA A 1 45 ? -11.322 -2.704 8.842 1.0 95.31 ? 45 ALA A N 1 V9WDR2 UNP 45 A +ATOM 334 C CA . ALA A 1 45 ? -11.922 -2.834 7.518 1.0 95.31 ? 45 ALA A CA 1 V9WDR2 UNP 45 A +ATOM 335 C C . ALA A 1 45 ? -11.460 -1.633 6.689 1.0 95.31 ? 45 ALA A C 1 V9WDR2 UNP 45 A +ATOM 336 C CB . ALA A 1 45 ? -13.445 -2.990 7.615 1.0 95.31 ? 45 ALA A CB 1 V9WDR2 UNP 45 A +ATOM 337 O O . ALA A 1 45 ? -10.574 -1.801 5.855 1.0 95.31 ? 45 ALA A O 1 V9WDR2 UNP 45 A +ATOM 338 N N . ASP A 1 46 ? -11.894 -0.430 7.066 1.0 96.00 ? 46 ASP A N 1 V9WDR2 UNP 46 D +ATOM 339 C CA . ASP A 1 46 ? -11.712 0.757 6.234 1.0 96.00 ? 46 ASP A CA 1 V9WDR2 UNP 46 D +ATOM 340 C C . ASP A 1 46 ? -10.944 1.855 6.971 1.0 96.00 ? 46 ASP A C 1 V9WDR2 UNP 46 D +ATOM 341 C CB . ASP A 1 46 ? -13.083 1.245 5.736 1.0 96.00 ? 46 ASP A CB 1 V9WDR2 UNP 46 D +ATOM 342 O O . ASP A 1 46 ? -11.102 2.082 8.182 1.0 96.00 ? 46 ASP A O 1 V9WDR2 UNP 46 D +ATOM 343 C CG . ASP A 1 46 ? -13.874 0.149 4.999 1.0 96.00 ? 46 ASP A CG 1 V9WDR2 UNP 46 D +ATOM 344 O OD1 . ASP A 1 46 ? -13.232 -0.800 4.498 1.0 96.00 ? 46 ASP A OD1 1 V9WDR2 UNP 46 D +ATOM 345 O OD2 . ASP A 1 46 ? -15.123 0.215 5.014 1.0 96.00 ? 46 ASP A OD2 1 V9WDR2 UNP 46 D +ATOM 346 N N . THR A 1 47 ? -10.053 2.553 6.267 1.0 97.12 ? 47 THR A N 1 V9WDR2 UNP 47 T +ATOM 347 C CA . THR A 1 47 ? -9.393 3.741 6.817 1.0 97.12 ? 47 THR A CA 1 V9WDR2 UNP 47 T +ATOM 348 C C . THR A 1 47 ? -9.164 4.841 5.808 1.0 97.12 ? 47 THR A C 1 V9WDR2 UNP 47 T +ATOM 349 C CB . THR A 1 47 ? -8.086 3.378 7.518 1.0 97.12 ? 47 THR A CB 1 V9WDR2 UNP 47 T +ATOM 350 O O . THR A 1 47 ? -8.559 4.617 4.769 1.0 97.12 ? 47 THR A O 1 V9WDR2 UNP 47 T +ATOM 351 C CG2 . THR A 1 47 ? -7.254 4.557 8.029 1.0 97.12 ? 47 THR A CG2 1 V9WDR2 UNP 47 T +ATOM 352 O OG1 . THR A 1 47 ? -8.454 2.633 8.655 1.0 97.12 ? 47 THR A OG1 1 V9WDR2 UNP 47 T +ATOM 353 N N . GLU A 1 48 ? -9.559 6.055 6.176 1.0 97.81 ? 48 GLU A N 1 V9WDR2 UNP 48 E +ATOM 354 C CA . GLU A 1 48 ? -9.361 7.228 5.326 1.0 97.81 ? 48 GLU A CA 1 V9WDR2 UNP 48 E +ATOM 355 C C . GLU A 1 48 ? -7.890 7.665 5.353 1.0 97.81 ? 48 GLU A C 1 V9WDR2 UNP 48 E +ATOM 356 C CB . GLU A 1 48 ? -10.320 8.338 5.778 1.0 97.81 ? 48 GLU A CB 1 V9WDR2 UNP 48 E +ATOM 357 O O . GLU A 1 48 ? -7.227 7.717 4.327 1.0 97.81 ? 48 GLU A O 1 V9WDR2 UNP 48 E +ATOM 358 C CG . GLU A 1 48 ? -10.580 9.355 4.663 1.0 97.81 ? 48 GLU A CG 1 V9WDR2 UNP 48 E +ATOM 359 C CD . GLU A 1 48 ? -11.533 10.483 5.089 1.0 97.81 ? 48 GLU A CD 1 V9WDR2 UNP 48 E +ATOM 360 O OE1 . GLU A 1 48 ? -11.513 11.575 4.469 1.0 97.81 ? 48 GLU A OE1 1 V9WDR2 UNP 48 E +ATOM 361 O OE2 . GLU A 1 48 ? -12.264 10.278 6.083 1.0 97.81 ? 48 GLU A OE2 1 V9WDR2 UNP 48 E +ATOM 362 N N . PHE A 1 49 ? -7.312 7.872 6.538 1.0 97.81 ? 49 PHE A N 1 V9WDR2 UNP 49 F +ATOM 363 C CA . PHE A 1 49 ? -5.925 8.311 6.692 1.0 97.81 ? 49 PHE A CA 1 V9WDR2 UNP 49 F +ATOM 364 C C . PHE A 1 49 ? -5.146 7.427 7.661 1.0 97.81 ? 49 PHE A C 1 V9WDR2 UNP 49 F +ATOM 365 C CB . PHE A 1 49 ? -5.896 9.768 7.164 1.0 97.81 ? 49 PHE A CB 1 V9WDR2 UNP 49 F +ATOM 366 O O . PHE A 1 49 ? -5.452 7.354 8.852 1.0 97.81 ? 49 PHE A O 1 V9WDR2 UNP 49 F +ATOM 367 C CG . PHE A 1 49 ? -6.559 10.749 6.220 1.0 97.81 ? 49 PHE A CG 1 V9WDR2 UNP 49 F +ATOM 368 C CD1 . PHE A 1 49 ? -5.848 11.272 5.123 1.0 97.81 ? 49 PHE A CD1 1 V9WDR2 UNP 49 F +ATOM 369 C CD2 . PHE A 1 49 ? -7.897 11.126 6.428 1.0 97.81 ? 49 PHE A CD2 1 V9WDR2 UNP 49 F +ATOM 370 C CE1 . PHE A 1 49 ? -6.483 12.148 4.225 1.0 97.81 ? 49 PHE A CE1 1 V9WDR2 UNP 49 F +ATOM 371 C CE2 . PHE A 1 49 ? -8.516 12.028 5.550 1.0 97.81 ? 49 PHE A CE2 1 V9WDR2 UNP 49 F +ATOM 372 C CZ . PHE A 1 49 ? -7.823 12.515 4.433 1.0 97.81 ? 49 PHE A CZ 1 V9WDR2 UNP 49 F +ATOM 373 N N . ALA A 1 50 ? -4.061 6.816 7.190 1.0 97.12 ? 50 ALA A N 1 V9WDR2 UNP 50 A +ATOM 374 C CA . ALA A 1 50 ? -3.180 5.980 7.995 1.0 97.12 ? 50 ALA A CA 1 V9WDR2 UNP 50 A +ATOM 375 C C . ALA A 1 50 ? -1.716 6.429 7.902 1.0 97.12 ? 50 ALA A C 1 V9WDR2 UNP 50 A +ATOM 376 C CB . ALA A 1 50 ? -3.371 4.524 7.569 1.0 97.12 ? 50 ALA A CB 1 V9WDR2 UNP 50 A +ATOM 377 O O . ALA A 1 50 ? -1.096 6.391 6.839 1.0 97.12 ? 50 ALA A O 1 V9WDR2 UNP 50 A +ATOM 378 N N . SER A 1 51 ? -1.134 6.793 9.047 1.0 98.19 ? 51 SER A N 1 V9WDR2 UNP 51 S +ATOM 379 C CA . SER A 1 51 ? 0.292 7.090 9.196 1.0 98.19 ? 51 SER A CA 1 V9WDR2 UNP 51 S +ATOM 380 C C . SER A 1 51 ? 0.963 6.060 10.100 1.0 98.19 ? 51 SER A C 1 V9WDR2 UNP 51 S +ATOM 381 C CB . SER A 1 51 ? 0.482 8.505 9.735 1.0 98.19 ? 51 SER A CB 1 V9WDR2 UNP 51 S +ATOM 382 O O . SER A 1 51 ? 0.610 5.923 11.271 1.0 98.19 ? 51 SER A O 1 V9WDR2 UNP 51 S +ATOM 383 O OG . SER A 1 51 ? 1.860 8.827 9.789 1.0 98.19 ? 51 SER A OG 1 V9WDR2 UNP 51 S +ATOM 384 N N . GLU A 1 52 ? 1.942 5.338 9.565 1.0 97.38 ? 52 GLU A N 1 V9WDR2 UNP 52 E +ATOM 385 C CA . GLU A 1 52 ? 2.520 4.161 10.208 1.0 97.38 ? 52 GLU A CA 1 V9WDR2 UNP 52 E +ATOM 386 C C . GLU A 1 52 ? 4.045 4.220 10.242 1.0 97.38 ? 52 GLU A C 1 V9WDR2 UNP 52 E +ATOM 387 C CB . GLU A 1 52 ? 2.046 2.899 9.483 1.0 97.38 ? 52 GLU A CB 1 V9WDR2 UNP 52 E +ATOM 388 O O . GLU A 1 52 ? 4.708 4.421 9.225 1.0 97.38 ? 52 GLU A O 1 V9WDR2 UNP 52 E +ATOM 389 C CG . GLU A 1 52 ? 0.542 2.694 9.698 1.0 97.38 ? 52 GLU A CG 1 V9WDR2 UNP 52 E +ATOM 390 C CD . GLU A 1 52 ? -0.004 1.465 8.987 1.0 97.38 ? 52 GLU A CD 1 V9WDR2 UNP 52 E +ATOM 391 O OE1 . GLU A 1 52 ? -1.233 1.451 8.746 1.0 97.38 ? 52 GLU A OE1 1 V9WDR2 UNP 52 E +ATOM 392 O OE2 . GLU A 1 52 ? 0.766 0.538 8.666 1.0 97.38 ? 52 GLU A OE2 1 V9WDR2 UNP 52 E +ATOM 393 N N . ALA A 1 53 ? 4.615 4.001 11.425 1.0 97.81 ? 53 ALA A N 1 V9WDR2 UNP 53 A +ATOM 394 C CA . ALA A 1 53 ? 6.052 3.917 11.641 1.0 97.81 ? 53 ALA A CA 1 V9WDR2 UNP 53 A +ATOM 395 C C . ALA A 1 53 ? 6.403 2.605 12.350 1.0 97.81 ? 53 ALA A C 1 V9WDR2 UNP 53 A +ATOM 396 C CB . ALA A 1 53 ? 6.509 5.155 12.418 1.0 97.81 ? 53 ALA A CB 1 V9WDR2 UNP 53 A +ATOM 397 O O . ALA A 1 53 ? 6.111 2.422 13.535 1.0 97.81 ? 53 ALA A O 1 V9WDR2 UNP 53 A +ATOM 398 N N . GLY A 1 54 ? 7.029 1.667 11.637 1.0 96.44 ? 54 GLY A N 1 V9WDR2 UNP 54 G +ATOM 399 C CA . GLY A 1 54 ? 7.355 0.351 12.200 1.0 96.44 ? 54 GLY A CA 1 V9WDR2 UNP 54 G +ATOM 400 C C . GLY A 1 54 ? 6.139 -0.466 12.653 1.0 96.44 ? 54 GLY A C 1 V9WDR2 UNP 54 G +ATOM 401 O O . GLY A 1 54 ? 6.291 -1.339 13.507 1.0 96.44 ? 54 GLY A O 1 V9WDR2 UNP 54 G +ATOM 402 N N . ALA A 1 55 ? 4.940 -0.141 12.165 1.0 96.31 ? 55 ALA A N 1 V9WDR2 UNP 55 A +ATOM 403 C CA . ALA A 1 55 ? 3.699 -0.833 12.501 1.0 96.31 ? 55 ALA A CA 1 V9WDR2 UNP 55 A +ATOM 404 C C . ALA A 1 55 ? 3.449 -2.018 11.553 1.0 96.31 ? 55 ALA A C 1 V9WDR2 UNP 55 A +ATOM 405 C CB . ALA A 1 55 ? 2.549 0.182 12.487 1.0 96.31 ? 55 ALA A CB 1 V9WDR2 UNP 55 A +ATOM 406 O O . ALA A 1 55 ? 4.068 -2.102 10.492 1.0 96.31 ? 55 ALA A O 1 V9WDR2 UNP 55 A +ATOM 407 N N . ASN A 1 56 ? 2.551 -2.927 11.946 1.0 97.44 ? 56 ASN A N 1 V9WDR2 UNP 56 N +ATOM 408 C CA . ASN A 1 56 ? 2.006 -3.938 11.042 1.0 97.44 ? 56 ASN A CA 1 V9WDR2 UNP 56 N +ATOM 409 C C . ASN A 1 56 ? 0.494 -3.779 10.926 1.0 97.44 ? 56 ASN A C 1 V9WDR2 UNP 56 N +ATOM 410 C CB . ASN A 1 56 ? 2.349 -5.371 11.464 1.0 97.44 ? 56 ASN A CB 1 V9WDR2 UNP 56 N +ATOM 411 O O . ASN A 1 56 ? -0.217 -3.907 11.928 1.0 97.44 ? 56 ASN A O 1 V9WDR2 UNP 56 N +ATOM 412 C CG . ASN A 1 56 ? 3.816 -5.582 11.747 1.0 97.44 ? 56 ASN A CG 1 V9WDR2 UNP 56 N +ATOM 413 N ND2 . ASN A 1 56 ? 4.163 -5.822 12.987 1.0 97.44 ? 56 ASN A ND2 1 V9WDR2 UNP 56 N +ATOM 414 O OD1 . ASN A 1 56 ? 4.673 -5.563 10.882 1.0 97.44 ? 56 ASN A OD1 1 V9WDR2 UNP 56 N +ATOM 415 N N . THR A 1 57 ? -0.008 -3.561 9.720 1.0 96.94 ? 57 THR A N 1 V9WDR2 UNP 57 T +ATOM 416 C CA . THR A 1 57 ? -1.427 -3.289 9.515 1.0 96.94 ? 57 THR A CA 1 V9WDR2 UNP 57 T +ATOM 417 C C . THR A 1 57 ? -2.056 -4.202 8.484 1.0 96.94 ? 57 THR A C 1 V9WDR2 UNP 57 T +ATOM 418 C CB . THR A 1 57 ? -1.682 -1.808 9.230 1.0 96.94 ? 57 THR A CB 1 V9WDR2 UNP 57 T +ATOM 419 O O . THR A 1 57 ? -1.440 -4.642 7.516 1.0 96.94 ? 57 THR A O 1 V9WDR2 UNP 57 T +ATOM 420 C CG2 . THR A 1 57 ? -1.275 -1.017 10.480 1.0 96.94 ? 57 THR A CG2 1 V9WDR2 UNP 57 T +ATOM 421 O OG1 . THR A 1 57 ? -0.959 -1.413 8.089 1.0 96.94 ? 57 THR A OG1 1 V9WDR2 UNP 57 T +ATOM 422 N N . THR A 1 58 ? -3.310 -4.541 8.749 1.0 98.06 ? 58 THR A N 1 V9WDR2 UNP 58 T +ATOM 423 C CA . THR A 1 58 ? -4.194 -5.224 7.817 1.0 98.06 ? 58 THR A CA 1 V9WDR2 UNP 58 T +ATOM 424 C C . THR A 1 58 ? -5.445 -4.376 7.666 1.0 98.06 ? 58 THR A C 1 V9WDR2 UNP 58 T +ATOM 425 C CB . THR A 1 58 ? -4.529 -6.642 8.284 1.0 98.06 ? 58 THR A CB 1 V9WDR2 UNP 58 T +ATOM 426 O O . THR A 1 58 ? -6.126 -4.129 8.665 1.0 98.06 ? 58 THR A O 1 V9WDR2 UNP 58 T +ATOM 427 C CG2 . THR A 1 58 ? -5.327 -7.412 7.234 1.0 98.06 ? 58 THR A CG2 1 V9WDR2 UNP 58 T +ATOM 428 O OG1 . THR A 1 58 ? -3.342 -7.368 8.527 1.0 98.06 ? 58 THR A OG1 1 V9WDR2 UNP 58 T +ATOM 429 N N . ALA A 1 59 ? -5.722 -3.939 6.446 1.0 96.69 ? 59 ALA A N 1 V9WDR2 UNP 59 A +ATOM 430 C CA . ALA A 1 59 ? -6.935 -3.237 6.056 1.0 96.69 ? 59 ALA A CA 1 V9WDR2 UNP 59 A +ATOM 431 C C . ALA A 1 59 ? -7.640 -4.019 4.939 1.0 96.69 ? 59 ALA A C 1 V9WDR2 UNP 59 A +ATOM 432 C CB . ALA A 1 59 ? -6.578 -1.804 5.651 1.0 96.69 ? 59 ALA A CB 1 V9WDR2 UNP 59 A +ATOM 433 O O . ALA A 1 59 ? -7.001 -4.819 4.253 1.0 96.69 ? 59 ALA A O 1 V9WDR2 UNP 59 A +ATOM 434 N N . ALA A 1 60 ? -8.945 -3.826 4.778 1.0 97.00 ? 60 ALA A N 1 V9WDR2 UNP 60 A +ATOM 435 C CA . ALA A 1 60 ? -9.571 -4.065 3.486 1.0 97.00 ? 60 ALA A CA 1 V9WDR2 UNP 60 A +ATOM 436 C C . ALA A 1 60 ? -9.218 -2.874 2.593 1.0 97.00 ? 60 ALA A C 1 V9WDR2 UNP 60 A +ATOM 437 C CB . ALA A 1 60 ? -11.078 -4.294 3.655 1.0 97.00 ? 60 ALA A CB 1 V9WDR2 UNP 60 A +ATOM 438 O O . ALA A 1 60 ? -8.388 -3.032 1.702 1.0 97.00 ? 60 ALA A O 1 V9WDR2 UNP 60 A +ATOM 439 N N . ASP A 1 61 ? -9.678 -1.682 2.972 1.0 97.75 ? 61 ASP A N 1 V9WDR2 UNP 61 D +ATOM 440 C CA . ASP A 1 61 ? -9.566 -0.491 2.137 1.0 97.75 ? 61 ASP A CA 1 V9WDR2 UNP 61 D +ATOM 441 C C . ASP A 1 61 ? -8.795 0.621 2.858 1.0 97.75 ? 61 ASP A C 1 V9WDR2 UNP 61 D +ATOM 442 C CB . ASP A 1 61 ? -10.970 -0.053 1.683 1.0 97.75 ? 61 ASP A CB 1 V9WDR2 UNP 61 D +ATOM 443 O O . ASP A 1 61 ? -8.899 0.822 4.077 1.0 97.75 ? 61 ASP A O 1 V9WDR2 UNP 61 D +ATOM 444 C CG . ASP A 1 61 ? -11.734 -1.162 0.932 1.0 97.75 ? 61 ASP A CG 1 V9WDR2 UNP 61 D +ATOM 445 O OD1 . ASP A 1 61 ? -11.065 -2.061 0.376 1.0 97.75 ? 61 ASP A OD1 1 V9WDR2 UNP 61 D +ATOM 446 O OD2 . ASP A 1 61 ? -12.985 -1.144 0.950 1.0 97.75 ? 61 ASP A OD2 1 V9WDR2 UNP 61 D +ATOM 447 N N . THR A 1 62 ? -7.955 1.345 2.119 1.0 97.94 ? 62 THR A N 1 V9WDR2 UNP 62 T +ATOM 448 C CA . THR A 1 62 ? -7.251 2.528 2.630 1.0 97.94 ? 62 THR A CA 1 V9WDR2 UNP 62 T +ATOM 449 C C . THR A 1 62 ? -7.199 3.636 1.588 1.0 97.94 ? 62 THR A C 1 V9WDR2 UNP 62 T +ATOM 450 C CB . THR A 1 62 ? -5.844 2.171 3.131 1.0 97.94 ? 62 THR A CB 1 V9WDR2 UNP 62 T +ATOM 451 O O . THR A 1 62 ? -6.617 3.454 0.525 1.0 97.94 ? 62 THR A O 1 V9WDR2 UNP 62 T +ATOM 452 C CG2 . THR A 1 62 ? -5.080 3.375 3.689 1.0 97.94 ? 62 THR A CG2 1 V9WDR2 UNP 62 T +ATOM 453 O OG1 . THR A 1 62 ? -5.959 1.251 4.199 1.0 97.94 ? 62 THR A OG1 1 V9WDR2 UNP 62 T +ATOM 454 N N . GLU A 1 63 ? -7.740 4.810 1.905 1.0 98.44 ? 63 GLU A N 1 V9WDR2 UNP 63 E +ATOM 455 C CA . GLU A 1 63 ? -7.710 5.949 0.977 1.0 98.44 ? 63 GLU A CA 1 V9WDR2 UNP 63 E +ATOM 456 C C . GLU A 1 63 ? -6.307 6.573 0.941 1.0 98.44 ? 63 GLU A C 1 V9WDR2 UNP 63 E +ATOM 457 C CB . GLU A 1 63 ? -8.808 6.955 1.356 1.0 98.44 ? 63 GLU A CB 1 V9WDR2 UNP 63 E +ATOM 458 O O . GLU A 1 63 ? -5.655 6.619 -0.097 1.0 98.44 ? 63 GLU A O 1 V9WDR2 UNP 63 E +ATOM 459 C CG . GLU A 1 63 ? -9.081 7.963 0.232 1.0 98.44 ? 63 GLU A CG 1 V9WDR2 UNP 63 E +ATOM 460 C CD . GLU A 1 63 ? -10.205 8.962 0.566 1.0 98.44 ? 63 GLU A CD 1 V9WDR2 UNP 63 E +ATOM 461 O OE1 . GLU A 1 63 ? -10.260 10.052 -0.054 1.0 98.44 ? 63 GLU A OE1 1 V9WDR2 UNP 63 E +ATOM 462 O OE2 . GLU A 1 63 ? -11.007 8.655 1.475 1.0 98.44 ? 63 GLU A OE2 1 V9WDR2 UNP 63 E +ATOM 463 N N . PHE A 1 64 ? -5.766 6.956 2.100 1.0 98.50 ? 64 PHE A N 1 V9WDR2 UNP 64 F +ATOM 464 C CA . PHE A 1 64 ? -4.447 7.572 2.220 1.0 98.50 ? 64 PHE A CA 1 V9WDR2 UNP 64 F +ATOM 465 C C . PHE A 1 64 ? -3.541 6.834 3.197 1.0 98.50 ? 64 PHE A C 1 V9WDR2 UNP 64 F +ATOM 466 C CB . PHE A 1 64 ? -4.569 9.039 2.624 1.0 98.50 ? 64 PHE A CB 1 V9WDR2 UNP 64 F +ATOM 467 O O . PHE A 1 64 ? -3.806 6.688 4.392 1.0 98.50 ? 64 PHE A O 1 V9WDR2 UNP 64 F +ATOM 468 C CG . PHE A 1 64 ? -5.297 9.893 1.614 1.0 98.50 ? 64 PHE A CG 1 V9WDR2 UNP 64 F +ATOM 469 C CD1 . PHE A 1 64 ? -4.619 10.393 0.487 1.0 98.50 ? 64 PHE A CD1 1 V9WDR2 UNP 64 F +ATOM 470 C CD2 . PHE A 1 64 ? -6.662 10.170 1.791 1.0 98.50 ? 64 PHE A CD2 1 V9WDR2 UNP 64 F +ATOM 471 C CE1 . PHE A 1 64 ? -5.313 11.152 -0.472 1.0 98.50 ? 64 PHE A CE1 1 V9WDR2 UNP 64 F +ATOM 472 C CE2 . PHE A 1 64 ? -7.342 10.959 0.853 1.0 98.50 ? 64 PHE A CE2 1 V9WDR2 UNP 64 F +ATOM 473 C CZ . PHE A 1 64 ? -6.680 11.423 -0.293 1.0 98.50 ? 64 PHE A CZ 1 V9WDR2 UNP 64 F +ATOM 474 N N . ALA A 1 65 ? -2.376 6.461 2.692 1.0 97.81 ? 65 ALA A N 1 V9WDR2 UNP 65 A +ATOM 475 C CA . ALA A 1 65 ? -1.426 5.590 3.343 1.0 97.81 ? 65 ALA A CA 1 V9WDR2 UNP 65 A +ATOM 476 C C . ALA A 1 65 ? -0.027 6.223 3.345 1.0 97.81 ? 65 ALA A C 1 V9WDR2 UNP 65 A +ATOM 477 C CB . ALA A 1 65 ? -1.483 4.271 2.560 1.0 97.81 ? 65 ALA A CB 1 V9WDR2 UNP 65 A +ATOM 478 O O . ALA A 1 65 ? 0.592 6.392 2.300 1.0 97.81 ? 65 ALA A O 1 V9WDR2 UNP 65 A +ATOM 479 N N . SER A 1 66 ? 0.526 6.512 4.525 1.0 98.56 ? 66 SER A N 1 V9WDR2 UNP 66 S +ATOM 480 C CA . SER A 1 66 ? 1.925 6.927 4.687 1.0 98.56 ? 66 SER A CA 1 V9WDR2 UNP 66 S +ATOM 481 C C . SER A 1 66 ? 2.663 5.967 5.612 1.0 98.56 ? 66 SER A C 1 V9WDR2 UNP 66 S +ATOM 482 C CB . SER A 1 66 ? 2.008 8.361 5.212 1.0 98.56 ? 66 SER A CB 1 V9WDR2 UNP 66 S +ATOM 483 O O . SER A 1 66 ? 2.339 5.864 6.792 1.0 98.56 ? 66 SER A O 1 V9WDR2 UNP 66 S +ATOM 484 O OG . SER A 1 66 ? 3.362 8.771 5.335 1.0 98.56 ? 66 SER A OG 1 V9WDR2 UNP 66 S +ATOM 485 N N . GLU A 1 67 ? 3.706 5.319 5.104 1.0 98.00 ? 67 GLU A N 1 V9WDR2 UNP 67 E +ATOM 486 C CA . GLU A 1 67 ? 4.420 4.245 5.797 1.0 98.00 ? 67 GLU A CA 1 V9WDR2 UNP 67 E +ATOM 487 C C . GLU A 1 67 ? 5.928 4.506 5.854 1.0 98.00 ? 67 GLU A C 1 V9WDR2 UNP 67 E +ATOM 488 C CB . GLU A 1 67 ? 4.175 2.920 5.077 1.0 98.00 ? 67 GLU A CB 1 V9WDR2 UNP 67 E +ATOM 489 O O . GLU A 1 67 ? 6.575 4.789 4.844 1.0 98.00 ? 67 GLU A O 1 V9WDR2 UNP 67 E +ATOM 490 C CG . GLU A 1 67 ? 2.723 2.443 5.122 1.0 98.00 ? 67 GLU A CG 1 V9WDR2 UNP 67 E +ATOM 491 C CD . GLU A 1 67 ? 2.557 1.124 4.349 1.0 98.00 ? 67 GLU A CD 1 V9WDR2 UNP 67 E +ATOM 492 O OE1 . GLU A 1 67 ? 1.718 1.086 3.412 1.0 98.00 ? 67 GLU A OE1 1 V9WDR2 UNP 67 E +ATOM 493 O OE2 . GLU A 1 67 ? 3.269 0.169 4.717 1.0 98.00 ? 67 GLU A OE2 1 V9WDR2 UNP 67 E +ATOM 494 N N . ALA A 1 68 ? 6.513 4.357 7.039 1.0 98.38 ? 68 ALA A N 1 V9WDR2 UNP 68 A +ATOM 495 C CA . ALA A 1 68 ? 7.953 4.421 7.255 1.0 98.38 ? 68 ALA A CA 1 V9WDR2 UNP 68 A +ATOM 496 C C . ALA A 1 68 ? 8.426 3.174 8.008 1.0 98.38 ? 68 ALA A C 1 V9WDR2 UNP 68 A +ATOM 497 C CB . ALA A 1 68 ? 8.289 5.722 7.990 1.0 98.38 ? 68 ALA A CB 1 V9WDR2 UNP 68 A +ATOM 498 O O . ALA A 1 68 ? 8.158 3.009 9.202 1.0 98.38 ? 68 ALA A O 1 V9WDR2 UNP 68 A +ATOM 499 N N . GLY A 1 69 ? 9.133 2.276 7.318 1.0 97.75 ? 69 GLY A N 1 V9WDR2 UNP 69 G +ATOM 500 C CA . GLY A 1 69 ? 9.581 1.013 7.912 1.0 97.75 ? 69 GLY A CA 1 V9WDR2 UNP 69 G +ATOM 501 C C . GLY A 1 69 ? 8.445 0.116 8.415 1.0 97.75 ? 69 GLY A C 1 V9WDR2 UNP 69 G +ATOM 502 O O . GLY A 1 69 ? 8.677 -0.679 9.323 1.0 97.75 ? 69 GLY A O 1 V9WDR2 UNP 69 G +ATOM 503 N N . ALA A 1 70 ? 7.227 0.295 7.902 1.0 97.75 ? 70 ALA A N 1 V9WDR2 UNP 70 A +ATOM 504 C CA . ALA A 1 70 ? 6.041 -0.459 8.292 1.0 97.75 ? 70 ALA A CA 1 V9WDR2 UNP 70 A +ATOM 505 C C . ALA A 1 70 ? 5.828 -1.680 7.384 1.0 97.75 ? 70 ALA A C 1 V9WDR2 UNP 70 A +ATOM 506 C CB . ALA A 1 70 ? 4.838 0.493 8.289 1.0 97.75 ? 70 ALA A CB 1 V9WDR2 UNP 70 A +ATOM 507 O O . ALA A 1 70 ? 6.496 -1.823 6.356 1.0 97.75 ? 70 ALA A O 1 V9WDR2 UNP 70 A +ATOM 508 N N . ASN A 1 71 ? 4.918 -2.565 7.795 1.0 98.25 ? 71 ASN A N 1 V9WDR2 UNP 71 N +ATOM 509 C CA . ASN A 1 71 ? 4.402 -3.627 6.943 1.0 98.25 ? 71 ASN A CA 1 V9WDR2 UNP 71 N +ATOM 510 C C . ASN A 1 71 ? 2.884 -3.505 6.822 1.0 98.25 ? 71 ASN A C 1 V9WDR2 UNP 71 N +ATOM 511 C CB . ASN A 1 71 ? 4.788 -5.018 7.464 1.0 98.25 ? 71 ASN A CB 1 V9WDR2 UNP 71 N +ATOM 512 O O . ASN A 1 71 ? 2.185 -3.607 7.832 1.0 98.25 ? 71 ASN A O 1 V9WDR2 UNP 71 N +ATOM 513 C CG . ASN A 1 71 ? 6.275 -5.198 7.676 1.0 98.25 ? 71 ASN A CG 1 V9WDR2 UNP 71 N +ATOM 514 N ND2 . ASN A 1 71 ? 6.692 -5.395 8.903 1.0 98.25 ? 71 ASN A ND2 1 V9WDR2 UNP 71 N +ATOM 515 O OD1 . ASN A 1 71 ? 7.090 -5.200 6.767 1.0 98.25 ? 71 ASN A OD1 1 V9WDR2 UNP 71 N +ATOM 516 N N . ARG A 1 72 ? 2.370 -3.382 5.603 1.0 97.94 ? 72 ARG A N 1 V9WDR2 UNP 72 R +ATOM 517 C CA . ARG A 1 72 ? 0.931 -3.303 5.357 1.0 97.94 ? 72 ARG A CA 1 V9WDR2 UNP 72 R +ATOM 518 C C . ARG A 1 72 ? 0.438 -4.429 4.461 1.0 97.94 ? 72 ARG A C 1 V9WDR2 UNP 72 R +ATOM 519 C CB . ARG A 1 72 ? 0.586 -1.904 4.835 1.0 97.94 ? 72 ARG A CB 1 V9WDR2 UNP 72 R +ATOM 520 O O . ARG A 1 72 ? 1.092 -4.844 3.506 1.0 97.94 ? 72 ARG A O 1 V9WDR2 UNP 72 R +ATOM 521 C CG . ARG A 1 72 ? -0.927 -1.738 4.623 1.0 97.94 ? 72 ARG A CG 1 V9WDR2 UNP 72 R +ATOM 522 C CD . ARG A 1 72 ? -1.304 -0.292 4.324 1.0 97.94 ? 72 ARG A CD 1 V9WDR2 UNP 72 R +ATOM 523 N NE . ARG A 1 72 ? -1.150 0.585 5.505 1.0 97.94 ? 72 ARG A NE 1 V9WDR2 UNP 72 R +ATOM 524 N NH1 . ARG A 1 72 ? -0.317 2.379 4.395 1.0 97.94 ? 72 ARG A NH1 1 V9WDR2 UNP 72 R +ATOM 525 N NH2 . ARG A 1 72 ? -1.013 2.685 6.419 1.0 97.94 ? 72 ARG A NH2 1 V9WDR2 UNP 72 R +ATOM 526 C CZ . ARG A 1 72 ? -0.836 1.861 5.442 1.0 97.94 ? 72 ARG A CZ 1 V9WDR2 UNP 72 R +ATOM 527 N N . THR A 1 73 ? -0.756 -4.913 4.765 1.0 98.50 ? 73 THR A N 1 V9WDR2 UNP 73 T +ATOM 528 C CA . THR A 1 73 ? -1.576 -5.702 3.848 1.0 98.50 ? 73 THR A CA 1 V9WDR2 UNP 73 T +ATOM 529 C C . THR A 1 73 ? -2.913 -4.997 3.669 1.0 98.50 ? 73 THR A C 1 V9WDR2 UNP 73 T +ATOM 530 C CB . THR A 1 73 ? -1.756 -7.138 4.348 1.0 98.50 ? 73 THR A CB 1 V9WDR2 UNP 73 T +ATOM 531 O O . THR A 1 73 ? -3.596 -4.751 4.660 1.0 98.50 ? 73 THR A O 1 V9WDR2 UNP 73 T +ATOM 532 C CG2 . THR A 1 73 ? -2.507 -8.008 3.342 1.0 98.50 ? 73 THR A CG2 1 V9WDR2 UNP 73 T +ATOM 533 O OG1 . THR A 1 73 ? -0.490 -7.733 4.551 1.0 98.50 ? 73 THR A OG1 1 V9WDR2 UNP 73 T +ATOM 534 N N . ALA A 1 74 ? -3.276 -4.681 2.433 1.0 96.81 ? 74 ALA A N 1 V9WDR2 UNP 74 A +ATOM 535 C CA . ALA A 1 74 ? -4.579 -4.132 2.068 1.0 96.81 ? 74 ALA A CA 1 V9WDR2 UNP 74 A +ATOM 536 C C . ALA A 1 74 ? -5.200 -4.976 0.947 1.0 96.81 ? 74 ALA A C 1 V9WDR2 UNP 74 A +ATOM 537 C CB . ALA A 1 74 ? -4.425 -2.652 1.705 1.0 96.81 ? 74 ALA A CB 1 V9WDR2 UNP 74 A +ATOM 538 O O . ALA A 1 74 ? -4.479 -5.708 0.266 1.0 96.81 ? 74 ALA A O 1 V9WDR2 UNP 74 A +ATOM 539 N N . ALA A 1 75 ? -6.518 -4.921 0.775 1.0 97.69 ? 75 ALA A N 1 V9WDR2 UNP 75 A +ATOM 540 C CA . ALA A 1 75 ? -7.109 -5.272 -0.510 1.0 97.69 ? 75 ALA A CA 1 V9WDR2 UNP 75 A +ATOM 541 C C . ALA A 1 75 ? -6.856 -4.098 -1.459 1.0 97.69 ? 75 ALA A C 1 V9WDR2 UNP 75 A +ATOM 542 C CB . ALA A 1 75 ? -8.591 -5.631 -0.346 1.0 97.69 ? 75 ALA A CB 1 V9WDR2 UNP 75 A +ATOM 543 O O . ALA A 1 75 ? -6.045 -4.241 -2.370 1.0 97.69 ? 75 ALA A O 1 V9WDR2 UNP 75 A +ATOM 544 N N . ASP A 1 76 ? -7.386 -2.924 -1.119 1.0 98.12 ? 76 ASP A N 1 V9WDR2 UNP 76 D +ATOM 545 C CA . ASP A 1 76 ? -7.357 -1.758 -1.994 1.0 98.12 ? 76 ASP A CA 1 V9WDR2 UNP 76 D +ATOM 546 C C . ASP A 1 76 ? -6.657 -0.574 -1.315 1.0 98.12 ? 76 ASP A C 1 V9WDR2 UNP 76 D +ATOM 547 C CB . ASP A 1 76 ? -8.790 -1.436 -2.458 1.0 98.12 ? 76 ASP A CB 1 V9WDR2 UNP 76 D +ATOM 548 O O . ASP A 1 76 ? -6.765 -0.341 -0.104 1.0 98.12 ? 76 ASP A O 1 V9WDR2 UNP 76 D +ATOM 549 C CG . ASP A 1 76 ? -9.460 -2.617 -3.191 1.0 98.12 ? 76 ASP A CG 1 V9WDR2 UNP 76 D +ATOM 550 O OD1 . ASP A 1 76 ? -8.718 -3.450 -3.758 1.0 98.12 ? 76 ASP A OD1 1 V9WDR2 UNP 76 D +ATOM 551 O OD2 . ASP A 1 76 ? -10.707 -2.718 -3.166 1.0 98.12 ? 76 ASP A OD2 1 V9WDR2 UNP 76 D +ATOM 552 N N . THR A 1 77 ? -5.868 0.177 -2.084 1.0 98.19 ? 77 THR A N 1 V9WDR2 UNP 77 T +ATOM 553 C CA . THR A 1 77 ? -5.250 1.424 -1.616 1.0 98.19 ? 77 THR A CA 1 V9WDR2 UNP 77 T +ATOM 554 C C . THR A 1 77 ? -5.276 2.496 -2.697 1.0 98.19 ? 77 THR A C 1 V9WDR2 UNP 77 T +ATOM 555 C CB . THR A 1 77 ? -3.820 1.193 -1.105 1.0 98.19 ? 77 THR A CB 1 V9WDR2 UNP 77 T +ATOM 556 O O . THR A 1 77 ? -4.690 2.312 -3.759 1.0 98.19 ? 77 THR A O 1 V9WDR2 UNP 77 T +ATOM 557 C CG2 . THR A 1 77 ? -3.179 2.464 -0.542 1.0 98.19 ? 77 THR A CG2 1 V9WDR2 UNP 77 T +ATOM 558 O OG1 . THR A 1 77 ? -3.843 0.266 -0.038 1.0 98.19 ? 77 THR A OG1 1 V9WDR2 UNP 77 T +ATOM 559 N N . GLU A 1 78 ? -5.895 3.641 -2.418 1.0 98.62 ? 78 GLU A N 1 V9WDR2 UNP 78 E +ATOM 560 C CA . GLU A 1 78 ? -5.974 4.734 -3.397 1.0 98.62 ? 78 GLU A CA 1 V9WDR2 UNP 78 E +ATOM 561 C C . GLU A 1 78 ? -4.633 5.476 -3.488 1.0 98.62 ? 78 GLU A C 1 V9WDR2 UNP 78 E +ATOM 562 C CB . GLU A 1 78 ? -7.155 5.660 -3.059 1.0 98.62 ? 78 GLU A CB 1 V9WDR2 UNP 78 E +ATOM 563 O O . GLU A 1 78 ? -3.992 5.508 -4.535 1.0 98.62 ? 78 GLU A O 1 V9WDR2 UNP 78 E +ATOM 564 C CG . GLU A 1 78 ? -7.537 6.545 -4.253 1.0 98.62 ? 78 GLU A CG 1 V9WDR2 UNP 78 E +ATOM 565 C CD . GLU A 1 78 ? -8.745 7.464 -3.985 1.0 98.62 ? 78 GLU A CD 1 V9WDR2 UNP 78 E +ATOM 566 O OE1 . GLU A 1 78 ? -8.897 8.494 -4.687 1.0 98.62 ? 78 GLU A OE1 1 V9WDR2 UNP 78 E +ATOM 567 O OE2 . GLU A 1 78 ? -9.518 7.155 -3.054 1.0 98.62 ? 78 GLU A OE2 1 V9WDR2 UNP 78 E +ATOM 568 N N . PHE A 1 79 ? -4.124 5.988 -2.365 1.0 98.56 ? 79 PHE A N 1 V9WDR2 UNP 79 F +ATOM 569 C CA . PHE A 1 79 ? -2.868 6.734 -2.313 1.0 98.56 ? 79 PHE A CA 1 V9WDR2 UNP 79 F +ATOM 570 C C . PHE A 1 79 ? -1.903 6.167 -1.286 1.0 98.56 ? 79 PHE A C 1 V9WDR2 UNP 79 F +ATOM 571 C CB . PHE A 1 79 ? -3.138 8.200 -1.985 1.0 98.56 ? 79 PHE A CB 1 V9WDR2 UNP 79 F +ATOM 572 O O . PHE A 1 79 ? -2.141 6.220 -0.081 1.0 98.56 ? 79 PHE A O 1 V9WDR2 UNP 79 F +ATOM 573 C CG . PHE A 1 79 ? -3.946 8.924 -3.030 1.0 98.56 ? 79 PHE A CG 1 V9WDR2 UNP 79 F +ATOM 574 C CD1 . PHE A 1 79 ? -3.320 9.434 -4.182 1.0 98.56 ? 79 PHE A CD1 1 V9WDR2 UNP 79 F +ATOM 575 C CD2 . PHE A 1 79 ? -5.332 9.072 -2.857 1.0 98.56 ? 79 PHE A CD2 1 V9WDR2 UNP 79 F +ATOM 576 C CE1 . PHE A 1 79 ? -4.084 10.079 -5.169 1.0 98.56 ? 79 PHE A CE1 1 V9WDR2 UNP 79 F +ATOM 577 C CE2 . PHE A 1 79 ? -6.086 9.744 -3.829 1.0 98.56 ? 79 PHE A CE2 1 V9WDR2 UNP 79 F +ATOM 578 C CZ . PHE A 1 79 ? -5.472 10.220 -4.997 1.0 98.56 ? 79 PHE A CZ 1 V9WDR2 UNP 79 F +ATOM 579 N N . ALA A 1 80 ? -0.736 5.736 -1.748 1.0 97.94 ? 80 ALA A N 1 V9WDR2 UNP 80 A +ATOM 580 C CA . ALA A 1 80 ? 0.263 5.089 -0.922 1.0 97.94 ? 80 ALA A CA 1 V9WDR2 UNP 80 A +ATOM 581 C C . ALA A 1 80 ? 1.641 5.757 -1.059 1.0 97.94 ? 80 ALA A C 1 V9WDR2 UNP 80 A +ATOM 582 C CB . ALA A 1 80 ? 0.251 3.599 -1.277 1.0 97.94 ? 80 ALA A CB 1 V9WDR2 UNP 80 A +ATOM 583 O O . ALA A 1 80 ? 2.200 5.884 -2.147 1.0 97.94 ? 80 ALA A O 1 V9WDR2 UNP 80 A +ATOM 584 N N . SER A 1 81 ? 2.228 6.158 0.067 1.0 98.62 ? 81 SER A N 1 V9WDR2 UNP 81 S +ATOM 585 C CA . SER A 1 81 ? 3.579 6.711 0.159 1.0 98.62 ? 81 SER A CA 1 V9WDR2 UNP 81 S +ATOM 586 C C . SER A 1 81 ? 4.421 5.892 1.130 1.0 98.62 ? 81 SER A C 1 V9WDR2 UNP 81 S +ATOM 587 C CB . SER A 1 81 ? 3.526 8.180 0.582 1.0 98.62 ? 81 SER A CB 1 V9WDR2 UNP 81 S +ATOM 588 O O . SER A 1 81 ? 4.110 5.813 2.318 1.0 98.62 ? 81 SER A O 1 V9WDR2 UNP 81 S +ATOM 589 O OG . SER A 1 81 ? 4.837 8.698 0.744 1.0 98.62 ? 81 SER A OG 1 V9WDR2 UNP 81 S +ATOM 590 N N . GLU A 1 82 ? 5.537 5.346 0.655 1.0 98.19 ? 82 GLU A N 1 V9WDR2 UNP 82 E +ATOM 591 C CA . GLU A 1 82 ? 6.414 4.471 1.435 1.0 98.19 ? 82 GLU A CA 1 V9WDR2 UNP 82 E +ATOM 592 C C . GLU A 1 82 ? 7.860 4.918 1.471 1.0 98.19 ? 82 GLU A C 1 V9WDR2 UNP 82 E +ATOM 593 C CB . GLU A 1 82 ? 6.435 3.068 0.855 1.0 98.19 ? 82 GLU A CB 1 V9WDR2 UNP 82 E +ATOM 594 O O . GLU A 1 82 ? 8.471 5.233 0.449 1.0 98.19 ? 82 GLU A O 1 V9WDR2 UNP 82 E +ATOM 595 C CG . GLU A 1 82 ? 5.212 2.313 1.311 1.0 98.19 ? 82 GLU A CG 1 V9WDR2 UNP 82 E +ATOM 596 C CD . GLU A 1 82 ? 5.090 0.995 0.552 1.0 98.19 ? 82 GLU A CD 1 V9WDR2 UNP 82 E +ATOM 597 O OE1 . GLU A 1 82 ? 4.484 0.067 1.090 1.0 98.19 ? 82 GLU A OE1 1 V9WDR2 UNP 82 E +ATOM 598 O OE2 . GLU A 1 82 ? 5.472 0.942 -0.628 1.0 98.19 ? 82 GLU A OE2 1 V9WDR2 UNP 82 E +ATOM 599 N N . ALA A 1 83 ? 8.448 4.797 2.656 1.0 98.50 ? 83 ALA A N 1 V9WDR2 UNP 83 A +ATOM 600 C CA . ALA A 1 83 ? 9.882 4.870 2.859 1.0 98.50 ? 83 ALA A CA 1 V9WDR2 UNP 83 A +ATOM 601 C C . ALA A 1 83 ? 10.371 3.630 3.617 1.0 98.50 ? 83 ALA A C 1 V9WDR2 UNP 83 A +ATOM 602 C CB . ALA A 1 83 ? 10.200 6.182 3.579 1.0 98.50 ? 83 ALA A CB 1 V9WDR2 UNP 83 A +ATOM 603 O O . ALA A 1 83 ? 10.107 3.469 4.811 1.0 98.50 ? 83 ALA A O 1 V9WDR2 UNP 83 A +ATOM 604 N N . GLY A 1 84 ? 11.112 2.752 2.936 1.0 98.00 ? 84 GLY A N 1 V9WDR2 UNP 84 G +ATOM 605 C CA . GLY A 1 84 ? 11.689 1.553 3.553 1.0 98.00 ? 84 GLY A CA 1 V9WDR2 UNP 84 G +ATOM 606 C C . GLY A 1 84 ? 10.660 0.569 4.119 1.0 98.00 ? 84 GLY A C 1 V9WDR2 UNP 84 G +ATOM 607 O O . GLY A 1 84 ? 10.976 -0.142 5.069 1.0 98.00 ? 84 GLY A O 1 V9WDR2 UNP 84 G +ATOM 608 N N . ALA A 1 85 ? 9.433 0.583 3.600 1.0 98.06 ? 85 ALA A N 1 V9WDR2 UNP 85 A +ATOM 609 C CA . ALA A 1 85 ? 8.318 -0.239 4.061 1.0 98.06 ? 85 ALA A CA 1 V9WDR2 UNP 85 A +ATOM 610 C C . ALA A 1 85 ? 8.109 -1.467 3.162 1.0 98.06 ? 85 ALA A C 1 V9WDR2 UNP 85 A +ATOM 611 C CB . ALA A 1 85 ? 7.082 0.655 4.102 1.0 98.06 ? 85 ALA A CB 1 V9WDR2 UNP 85 A +ATOM 612 O O . ALA A 1 85 ? 8.720 -1.569 2.093 1.0 98.06 ? 85 ALA A O 1 V9WDR2 UNP 85 A +ATOM 613 N N . ASN A 1 86 ? 7.256 -2.391 3.607 1.0 98.44 ? 86 ASN A N 1 V9WDR2 UNP 86 N +ATOM 614 C CA . ASN A 1 86 ? 6.788 -3.497 2.781 1.0 98.44 ? 86 ASN A CA 1 V9WDR2 UNP 86 N +ATOM 615 C C . ASN A 1 86 ? 5.260 -3.499 2.692 1.0 98.44 ? 86 ASN A C 1 V9WDR2 UNP 86 N +ATOM 616 C CB . ASN A 1 86 ? 7.295 -4.853 3.301 1.0 98.44 ? 86 ASN A CB 1 V9WDR2 UNP 86 N +ATOM 617 O O . ASN A 1 86 ? 4.594 -3.581 3.724 1.0 98.44 ? 86 ASN A O 1 V9WDR2 UNP 86 N +ATOM 618 C CG . ASN A 1 86 ? 8.785 -4.903 3.574 1.0 98.44 ? 86 ASN A CG 1 V9WDR2 UNP 86 N +ATOM 619 N ND2 . ASN A 1 86 ? 9.163 -5.049 4.821 1.0 98.44 ? 86 ASN A ND2 1 V9WDR2 UNP 86 N +ATOM 620 O OD1 . ASN A 1 86 ? 9.638 -4.847 2.699 1.0 98.44 ? 86 ASN A OD1 1 V9WDR2 UNP 86 N +ATOM 621 N N . ARG A 1 87 ? 4.708 -3.537 1.479 1.0 98.12 ? 87 ARG A N 1 V9WDR2 UNP 87 R +ATOM 622 C CA . ARG A 1 87 ? 3.258 -3.640 1.279 1.0 98.12 ? 87 ARG A CA 1 V9WDR2 UNP 87 R +ATOM 623 C C . ARG A 1 87 ? 2.877 -4.805 0.393 1.0 98.12 ? 87 ARG A C 1 V9WDR2 UNP 87 R +ATOM 624 C CB . ARG A 1 87 ? 2.692 -2.309 0.777 1.0 98.12 ? 87 ARG A CB 1 V9WDR2 UNP 87 R +ATOM 625 O O . ARG A 1 87 ? 3.547 -5.130 -0.585 1.0 98.12 ? 87 ARG A O 1 V9WDR2 UNP 87 R +ATOM 626 C CG . ARG A 1 87 ? 1.167 -2.267 0.571 1.0 98.12 ? 87 ARG A CG 1 V9WDR2 UNP 87 R +ATOM 627 C CD . ARG A 1 87 ? 0.679 -1.031 -0.189 1.0 98.12 ? 87 ARG A CD 1 V9WDR2 UNP 87 R +ATOM 628 N NE . ARG A 1 87 ? 1.335 0.201 0.257 1.0 98.12 ? 87 ARG A NE 1 V9WDR2 UNP 87 R +ATOM 629 N NH1 . ARG A 1 87 ? 2.842 0.450 -1.489 1.0 98.12 ? 87 ARG A NH1 1 V9WDR2 UNP 87 R +ATOM 630 N NH2 . ARG A 1 87 ? 2.568 2.042 0.004 1.0 98.12 ? 87 ARG A NH2 1 V9WDR2 UNP 87 R +ATOM 631 C CZ . ARG A 1 87 ? 2.239 0.872 -0.418 1.0 98.12 ? 87 ARG A CZ 1 V9WDR2 UNP 87 R +ATOM 632 N N . THR A 1 88 ? 1.749 -5.407 0.736 1.0 98.50 ? 88 THR A N 1 V9WDR2 UNP 88 T +ATOM 633 C CA . THR A 1 88 ? 0.972 -6.259 -0.157 1.0 98.50 ? 88 THR A CA 1 V9WDR2 UNP 88 T +ATOM 634 C C . THR A 1 88 ? -0.411 -5.645 -0.355 1.0 98.50 ? 88 THR A C 1 V9WDR2 UNP 88 T +ATOM 635 C CB . THR A 1 88 ? 0.894 -7.684 0.391 1.0 98.50 ? 88 THR A CB 1 V9WDR2 UNP 88 T +ATOM 636 O O . THR A 1 88 ? -1.085 -5.369 0.634 1.0 98.50 ? 88 THR A O 1 V9WDR2 UNP 88 T +ATOM 637 C CG2 . THR A 1 88 ? 0.203 -8.637 -0.579 1.0 98.50 ? 88 THR A CG2 1 V9WDR2 UNP 88 T +ATOM 638 O OG1 . THR A 1 88 ? 2.206 -8.170 0.592 1.0 98.50 ? 88 THR A OG1 1 V9WDR2 UNP 88 T +ATOM 639 N N . ALA A 1 89 ? -0.817 -5.436 -1.602 1.0 97.12 ? 89 ALA A N 1 V9WDR2 UNP 89 A +ATOM 640 C CA . ALA A 1 89 ? -2.160 -5.009 -1.982 1.0 97.12 ? 89 ALA A CA 1 V9WDR2 UNP 89 A +ATOM 641 C C . ALA A 1 89 ? -2.717 -5.941 -3.070 1.0 97.12 ? 89 ALA A C 1 V9WDR2 UNP 89 A +ATOM 642 C CB . ALA A 1 89 ? -2.135 -3.538 -2.405 1.0 97.12 ? 89 ALA A CB 1 V9WDR2 UNP 89 A +ATOM 643 O O . ALA A 1 89 ? -1.945 -6.645 -3.726 1.0 97.12 ? 89 ALA A O 1 V9WDR2 UNP 89 A +ATOM 644 N N . ALA A 1 90 ? -4.034 -5.982 -3.250 1.0 97.75 ? 90 ALA A N 1 V9WDR2 UNP 90 A +ATOM 645 C CA . ALA A 1 90 ? -4.599 -6.429 -4.517 1.0 97.75 ? 90 ALA A CA 1 V9WDR2 UNP 90 A +ATOM 646 C C . ALA A 1 90 ? -4.451 -5.282 -5.519 1.0 97.75 ? 90 ALA A C 1 V9WDR2 UNP 90 A +ATOM 647 C CB . ALA A 1 90 ? -6.047 -6.900 -4.329 1.0 97.75 ? 90 ALA A CB 1 V9WDR2 UNP 90 A +ATOM 648 O O . ALA A 1 90 ? -3.647 -5.404 -6.442 1.0 97.75 ? 90 ALA A O 1 V9WDR2 UNP 90 A +ATOM 649 N N . ASP A 1 91 ? -5.070 -4.140 -5.224 1.0 98.25 ? 91 ASP A N 1 V9WDR2 UNP 91 D +ATOM 650 C CA . ASP A 1 91 ? -5.121 -3.003 -6.135 1.0 98.25 ? 91 ASP A CA 1 V9WDR2 UNP 91 D +ATOM 651 C C . ASP A 1 91 ? -4.493 -1.754 -5.505 1.0 98.25 ? 91 ASP A C 1 V9WDR2 UNP 91 D +ATOM 652 C CB . ASP A 1 91 ? -6.571 -2.790 -6.608 1.0 98.25 ? 91 ASP A CB 1 V9WDR2 UNP 91 D +ATOM 653 O O . ASP A 1 91 ? -4.578 -1.499 -4.297 1.0 98.25 ? 91 ASP A O 1 V9WDR2 UNP 91 D +ATOM 654 C CG . ASP A 1 91 ? -7.144 -4.025 -7.334 1.0 98.25 ? 91 ASP A CG 1 V9WDR2 UNP 91 D +ATOM 655 O OD1 . ASP A 1 91 ? -6.336 -4.790 -7.907 1.0 98.25 ? 91 ASP A OD1 1 V9WDR2 UNP 91 D +ATOM 656 O OD2 . ASP A 1 91 ? -8.380 -4.224 -7.321 1.0 98.25 ? 91 ASP A OD2 1 V9WDR2 UNP 91 D +ATOM 657 N N . THR A 1 92 ? -3.786 -0.969 -6.318 1.0 98.06 ? 92 THR A N 1 V9WDR2 UNP 92 T +ATOM 658 C CA . THR A 1 92 ? -3.234 0.324 -5.900 1.0 98.06 ? 92 THR A CA 1 V9WDR2 UNP 92 T +ATOM 659 C C . THR A 1 92 ? -3.361 1.361 -7.007 1.0 98.06 ? 92 THR A C 1 V9WDR2 UNP 92 T +ATOM 660 C CB . THR A 1 92 ? -1.778 0.191 -5.434 1.0 98.06 ? 92 THR A CB 1 V9WDR2 UNP 92 T +ATOM 661 O O . THR A 1 92 ? -2.806 1.180 -8.088 1.0 98.06 ? 92 THR A O 1 V9WDR2 UNP 92 T +ATOM 662 C CG2 . THR A 1 92 ? -1.191 1.512 -4.930 1.0 98.06 ? 92 THR A CG2 1 V9WDR2 UNP 92 T +ATOM 663 O OG1 . THR A 1 92 ? -1.717 -0.708 -4.346 1.0 98.06 ? 92 THR A OG1 1 V9WDR2 UNP 92 T +ATOM 664 N N . GLU A 1 93 ? -4.039 2.475 -6.740 1.0 98.56 ? 93 GLU A N 1 V9WDR2 UNP 93 E +ATOM 665 C CA . GLU A 1 93 ? -4.202 3.530 -7.750 1.0 98.56 ? 93 GLU A CA 1 V9WDR2 UNP 93 E +ATOM 666 C C . GLU A 1 93 ? -2.918 4.361 -7.878 1.0 98.56 ? 93 GLU A C 1 V9WDR2 UNP 93 E +ATOM 667 C CB . GLU A 1 93 ? -5.443 4.381 -7.440 1.0 98.56 ? 93 GLU A CB 1 V9WDR2 UNP 93 E +ATOM 668 O O . GLU A 1 93 ? -2.315 4.438 -8.946 1.0 98.56 ? 93 GLU A O 1 V9WDR2 UNP 93 E +ATOM 669 C CG . GLU A 1 93 ? -5.877 5.198 -8.666 1.0 98.56 ? 93 GLU A CG 1 V9WDR2 UNP 93 E +ATOM 670 C CD . GLU A 1 93 ? -7.136 6.054 -8.425 1.0 98.56 ? 93 GLU A CD 1 V9WDR2 UNP 93 E +ATOM 671 O OE1 . GLU A 1 93 ? -7.345 7.046 -9.166 1.0 98.56 ? 93 GLU A OE1 1 V9WDR2 UNP 93 E +ATOM 672 O OE2 . GLU A 1 93 ? -7.894 5.725 -7.489 1.0 98.56 ? 93 GLU A OE2 1 V9WDR2 UNP 93 E +ATOM 673 N N . PHE A 1 94 ? -2.410 4.902 -6.768 1.0 98.56 ? 94 PHE A N 1 V9WDR2 UNP 94 F +ATOM 674 C CA . PHE A 1 94 ? -1.196 5.714 -6.742 1.0 98.56 ? 94 PHE A CA 1 V9WDR2 UNP 94 F +ATOM 675 C C . PHE A 1 94 ? -0.197 5.221 -5.696 1.0 98.56 ? 94 PHE A C 1 V9WDR2 UNP 94 F +ATOM 676 C CB . PHE A 1 94 ? -1.555 7.181 -6.482 1.0 98.56 ? 94 PHE A CB 1 V9WDR2 UNP 94 F +ATOM 677 O O . PHE A 1 94 ? -0.442 5.283 -4.492 1.0 98.56 ? 94 PHE A O 1 V9WDR2 UNP 94 F +ATOM 678 C CG . PHE A 1 94 ? -2.416 7.817 -7.550 1.0 98.56 ? 94 PHE A CG 1 V9WDR2 UNP 94 F +ATOM 679 C CD1 . PHE A 1 94 ? -1.829 8.353 -8.712 1.0 98.56 ? 94 PHE A CD1 1 V9WDR2 UNP 94 F +ATOM 680 C CD2 . PHE A 1 94 ? -3.810 7.872 -7.384 1.0 98.56 ? 94 PHE A CD2 1 V9WDR2 UNP 94 F +ATOM 681 C CE1 . PHE A 1 94 ? -2.636 8.913 -9.719 1.0 98.56 ? 94 PHE A CE1 1 V9WDR2 UNP 94 F +ATOM 682 C CE2 . PHE A 1 94 ? -4.609 8.468 -8.371 1.0 98.56 ? 94 PHE A CE2 1 V9WDR2 UNP 94 F +ATOM 683 C CZ . PHE A 1 94 ? -4.031 8.958 -9.551 1.0 98.56 ? 94 PHE A CZ 1 V9WDR2 UNP 94 F +ATOM 684 N N . ALA A 1 95 ? 0.999 4.841 -6.145 1.0 97.81 ? 95 ALA A N 1 V9WDR2 UNP 95 A +ATOM 685 C CA . ALA A 1 95 ? 2.110 4.442 -5.289 1.0 97.81 ? 95 ALA A CA 1 V9WDR2 UNP 95 A +ATOM 686 C C . ALA A 1 95 ? 3.343 5.333 -5.493 1.0 97.81 ? 95 ALA A C 1 V9WDR2 UNP 95 A +ATOM 687 C CB . ALA A 1 95 ? 2.431 2.967 -5.538 1.0 97.81 ? 95 ALA A CB 1 V9WDR2 UNP 95 A +ATOM 688 O O . ALA A 1 95 ? 3.851 5.502 -6.603 1.0 97.81 ? 95 ALA A O 1 V9WDR2 UNP 95 A +ATOM 689 N N . SER A 1 96 ? 3.884 5.856 -4.393 1.0 98.56 ? 96 SER A N 1 V9WDR2 UNP 96 S +ATOM 690 C CA . SER A 1 96 ? 5.182 6.526 -4.336 1.0 98.56 ? 96 SER A CA 1 V9WDR2 UNP 96 S +ATOM 691 C C . SER A 1 96 ? 6.097 5.808 -3.349 1.0 98.56 ? 96 SER A C 1 V9WDR2 UNP 96 S +ATOM 692 C CB . SER A 1 96 ? 5.008 7.998 -3.967 1.0 98.56 ? 96 SER A CB 1 V9WDR2 UNP 96 S +ATOM 693 O O . SER A 1 96 ? 5.865 5.819 -2.142 1.0 98.56 ? 96 SER A O 1 V9WDR2 UNP 96 S +ATOM 694 O OG . SER A 1 96 ? 6.278 8.613 -3.816 1.0 98.56 ? 96 SER A OG 1 V9WDR2 UNP 96 S +ATOM 695 N N . GLU A 1 97 ? 7.181 5.229 -3.849 1.0 98.25 ? 97 GLU A N 1 V9WDR2 UNP 97 E +ATOM 696 C CA . GLU A 1 97 ? 7.997 4.272 -3.108 1.0 98.25 ? 97 GLU A CA 1 V9WDR2 UNP 97 E +ATOM 697 C C . GLU A 1 97 ? 9.470 4.681 -3.081 1.0 98.25 ? 97 GLU A C 1 V9WDR2 UNP 97 E +ATOM 698 C CB . GLU A 1 97 ? 7.858 2.892 -3.752 1.0 98.25 ? 97 GLU A CB 1 V9WDR2 UNP 97 E +ATOM 699 O O . GLU A 1 97 ? 10.115 4.849 -4.118 1.0 98.25 ? 97 GLU A O 1 V9WDR2 UNP 97 E +ATOM 700 C CG . GLU A 1 97 ? 6.424 2.354 -3.693 1.0 98.25 ? 97 GLU A CG 1 V9WDR2 UNP 97 E +ATOM 701 C CD . GLU A 1 97 ? 6.317 1.008 -4.409 1.0 98.25 ? 97 GLU A CD 1 V9WDR2 UNP 97 E +ATOM 702 O OE1 . GLU A 1 97 ? 5.309 0.795 -5.119 1.0 98.25 ? 97 GLU A OE1 1 V9WDR2 UNP 97 E +ATOM 703 O OE2 . GLU A 1 97 ? 7.260 0.195 -4.317 1.0 98.25 ? 97 GLU A OE2 1 V9WDR2 UNP 97 E +ATOM 704 N N . ALA A 1 98 ? 10.041 4.792 -1.882 1.0 98.44 ? 98 ALA A N 1 V9WDR2 UNP 98 A +ATOM 705 C CA . ALA A 1 98 ? 11.459 5.057 -1.676 1.0 98.44 ? 98 ALA A CA 1 V9WDR2 UNP 98 A +ATOM 706 C C . ALA A 1 98 ? 12.101 3.930 -0.859 1.0 98.44 ? 98 ALA A C 1 V9WDR2 UNP 98 A +ATOM 707 C CB . ALA A 1 98 ? 11.616 6.434 -1.024 1.0 98.44 ? 98 ALA A CB 1 V9WDR2 UNP 98 A +ATOM 708 O O . ALA A 1 98 ? 11.889 3.816 0.350 1.0 98.44 ? 98 ALA A O 1 V9WDR2 UNP 98 A +ATOM 709 N N . GLY A 1 99 ? 12.911 3.092 -1.509 1.0 97.88 ? 99 GLY A N 1 V9WDR2 UNP 99 G +ATOM 710 C CA . GLY A 1 99 ? 13.550 1.951 -0.844 1.0 97.88 ? 99 GLY A CA 1 V9WDR2 UNP 99 G +ATOM 711 C C . GLY A 1 99 ? 12.567 0.922 -0.276 1.0 97.88 ? 99 GLY A C 1 V9WDR2 UNP 99 G +ATOM 712 O O . GLY A 1 99 ? 12.921 0.226 0.673 1.0 97.88 ? 99 GLY A O 1 V9WDR2 UNP 99 G +ATOM 713 N N . ALA A 1 100 ? 11.340 0.879 -0.796 1.0 98.12 ? 100 ALA A N 1 V9WDR2 UNP 100 A +ATOM 714 C CA . ALA A 1 100 ? 10.280 -0.014 -0.341 1.0 98.12 ? 100 ALA A CA 1 V9WDR2 UNP 100 A +ATOM 715 C C . ALA A 1 100 ? 10.281 -1.340 -1.115 1.0 98.12 ? 100 ALA A C 1 V9WDR2 UNP 100 A +ATOM 716 C CB . ALA A 1 100 ? 8.944 0.725 -0.466 1.0 98.12 ? 100 ALA A CB 1 V9WDR2 UNP 100 A +ATOM 717 O O . ALA A 1 100 ? 10.928 -1.452 -2.162 1.0 98.12 ? 100 ALA A O 1 V9WDR2 UNP 100 A +ATOM 718 N N . ASN A 1 101 ? 9.562 -2.335 -0.591 1.0 98.44 ? 101 ASN A N 1 V9WDR2 UNP 101 N +ATOM 719 C CA . ASN A 1 101 ? 9.231 -3.548 -1.333 1.0 98.44 ? 101 ASN A CA 1 V9WDR2 UNP 101 N +ATOM 720 C C . ASN A 1 101 ? 7.718 -3.720 -1.420 1.0 98.44 ? 101 ASN A C 1 V9WDR2 UNP 101 N +ATOM 721 C CB . ASN A 1 101 ? 9.875 -4.800 -0.730 1.0 98.44 ? 101 ASN A CB 1 V9WDR2 UNP 101 N +ATOM 722 O O . ASN A 1 101 ? 7.051 -3.906 -0.403 1.0 98.44 ? 101 ASN A O 1 V9WDR2 UNP 101 N +ATOM 723 C CG . ASN A 1 101 ? 11.365 -4.670 -0.524 1.0 98.44 ? 101 ASN A CG 1 V9WDR2 UNP 101 N +ATOM 724 N ND2 . ASN A 1 101 ? 11.791 -4.664 0.716 1.0 98.44 ? 101 ASN A ND2 1 V9WDR2 UNP 101 N +ATOM 725 O OD1 . ASN A 1 101 ? 12.167 -4.597 -1.445 1.0 98.44 ? 101 ASN A OD1 1 V9WDR2 UNP 101 N +ATOM 726 N N . THR A 1 102 ? 7.187 -3.729 -2.632 1.0 97.62 ? 102 THR A N 1 V9WDR2 UNP 102 T +ATOM 727 C CA . THR A 1 102 ? 5.747 -3.793 -2.861 1.0 97.62 ? 102 THR A CA 1 V9WDR2 UNP 102 T +ATOM 728 C C . THR A 1 102 ? 5.364 -5.002 -3.687 1.0 97.62 ? 102 THR A C 1 V9WDR2 UNP 102 T +ATOM 729 C CB . THR A 1 102 ? 5.226 -2.497 -3.479 1.0 97.62 ? 102 THR A CB 1 V9WDR2 UNP 102 T +ATOM 730 O O . THR A 1 102 ? 6.095 -5.485 -4.557 1.0 97.62 ? 102 THR A O 1 V9WDR2 UNP 102 T +ATOM 731 C CG2 . THR A 1 102 ? 5.369 -1.375 -2.465 1.0 97.62 ? 102 THR A CG2 1 V9WDR2 UNP 102 T +ATOM 732 O OG1 . THR A 1 102 ? 5.967 -2.188 -4.628 1.0 97.62 ? 102 THR A OG1 1 V9WDR2 UNP 102 T +ATOM 733 N N . THR A 1 103 ? 4.204 -5.554 -3.365 1.0 98.12 ? 103 THR A N 1 V9WDR2 UNP 103 T +ATOM 734 C CA . THR A 1 103 ? 3.535 -6.567 -4.169 1.0 98.12 ? 103 THR A CA 1 V9WDR2 UNP 103 T +ATOM 735 C C . THR A 1 103 ? 2.092 -6.142 -4.362 1.0 98.12 ? 103 THR A C 1 V9WDR2 UNP 103 T +ATOM 736 C CB . THR A 1 103 ? 3.650 -7.954 -3.534 1.0 98.12 ? 103 THR A CB 1 V9WDR2 UNP 103 T +ATOM 737 O O . THR A 1 103 ? 1.389 -5.947 -3.375 1.0 98.12 ? 103 THR A O 1 V9WDR2 UNP 103 T +ATOM 738 C CG2 . THR A 1 103 ? 3.000 -9.041 -4.388 1.0 98.12 ? 103 THR A CG2 1 V9WDR2 UNP 103 T +ATOM 739 O OG1 . THR A 1 103 ? 5.021 -8.277 -3.422 1.0 98.12 ? 103 THR A OG1 1 V9WDR2 UNP 103 T +ATOM 740 N N . ALA A 1 104 ? 1.671 -6.004 -5.611 1.0 96.81 ? 104 ALA A N 1 V9WDR2 UNP 104 A +ATOM 741 C CA . ALA A 1 104 ? 0.291 -5.740 -5.996 1.0 96.81 ? 104 ALA A CA 1 V9WDR2 UNP 104 A +ATOM 742 C C . ALA A 1 104 ? -0.157 -6.770 -7.042 1.0 96.81 ? 104 ALA A C 1 V9WDR2 UNP 104 A +ATOM 743 C CB . ALA A 1 104 ? 0.165 -4.290 -6.470 1.0 96.81 ? 104 ALA A CB 1 V9WDR2 UNP 104 A +ATOM 744 O O . ALA A 1 104 ? 0.686 -7.406 -7.678 1.0 96.81 ? 104 ALA A O 1 V9WDR2 UNP 104 A +ATOM 745 N N . ALA A 1 105 ? -1.460 -6.972 -7.213 1.0 97.00 ? 105 ALA A N 1 V9WDR2 UNP 105 A +ATOM 746 C CA . ALA A 1 105 ? -1.960 -7.533 -8.462 1.0 97.00 ? 105 ALA A CA 1 V9WDR2 UNP 105 A +ATOM 747 C C . ALA A 1 105 ? -1.900 -6.428 -9.520 1.0 97.00 ? 105 ALA A C 1 V9WDR2 UNP 105 A +ATOM 748 C CB . ALA A 1 105 ? -3.362 -8.123 -8.269 1.0 97.00 ? 105 ALA A CB 1 V9WDR2 UNP 105 A +ATOM 749 O O . ALA A 1 105 ? -1.099 -6.539 -10.448 1.0 97.00 ? 105 ALA A O 1 V9WDR2 UNP 105 A +ATOM 750 N N . ASP A 1 106 ? -2.596 -5.320 -9.272 1.0 97.88 ? 106 ASP A N 1 V9WDR2 UNP 106 D +ATOM 751 C CA . ASP A 1 106 ? -2.724 -4.225 -10.226 1.0 97.88 ? 106 ASP A CA 1 V9WDR2 UNP 106 D +ATOM 752 C C . ASP A 1 106 ? -2.212 -2.904 -9.636 1.0 97.88 ? 106 ASP A C 1 V9WDR2 UNP 106 D +ATOM 753 C CB . ASP A 1 106 ? -4.177 -4.154 -10.733 1.0 97.88 ? 106 ASP A CB 1 V9WDR2 UNP 106 D +ATOM 754 O O . ASP A 1 106 ? -2.334 -2.612 -8.441 1.0 97.88 ? 106 ASP A O 1 V9WDR2 UNP 106 D +ATOM 755 C CG . ASP A 1 106 ? -4.621 -5.458 -11.428 1.0 97.88 ? 106 ASP A CG 1 V9WDR2 UNP 106 D +ATOM 756 O OD1 . ASP A 1 106 ? -3.736 -6.153 -11.979 1.0 97.88 ? 106 ASP A OD1 1 V9WDR2 UNP 106 D +ATOM 757 O OD2 . ASP A 1 106 ? -5.831 -5.775 -11.429 1.0 97.88 ? 106 ASP A OD2 1 V9WDR2 UNP 106 D +ATOM 758 N N . THR A 1 107 ? -1.564 -2.094 -10.472 1.0 97.62 ? 107 THR A N 1 V9WDR2 UNP 107 T +ATOM 759 C CA . THR A 1 107 ? -1.125 -0.746 -10.094 1.0 97.62 ? 107 THR A CA 1 V9WDR2 UNP 107 T +ATOM 760 C C . THR A 1 107 ? -1.329 0.233 -11.239 1.0 97.62 ? 107 THR A C 1 V9WDR2 UNP 107 T +ATOM 761 C CB . THR A 1 107 ? 0.335 -0.729 -9.618 1.0 97.62 ? 107 THR A CB 1 V9WDR2 UNP 107 T +ATOM 762 O O . THR A 1 107 ? -0.743 0.059 -12.308 1.0 97.62 ? 107 THR A O 1 V9WDR2 UNP 107 T +ATOM 763 C CG2 . THR A 1 107 ? 0.778 0.646 -9.115 1.0 97.62 ? 107 THR A CG2 1 V9WDR2 UNP 107 T +ATOM 764 O OG1 . THR A 1 107 ? 0.504 -1.622 -8.540 1.0 97.62 ? 107 THR A OG1 1 V9WDR2 UNP 107 T +ATOM 765 N N . GLU A 1 108 ? -2.106 1.292 -11.023 1.0 98.44 ? 108 GLU A N 1 V9WDR2 UNP 108 E +ATOM 766 C CA . GLU A 1 108 ? -2.356 2.283 -12.076 1.0 98.44 ? 108 GLU A CA 1 V9WDR2 UNP 108 E +ATOM 767 C C . GLU A 1 108 ? -1.146 3.211 -12.244 1.0 98.44 ? 108 GLU A C 1 V9WDR2 UNP 108 E +ATOM 768 C CB . GLU A 1 108 ? -3.666 3.039 -11.805 1.0 98.44 ? 108 GLU A CB 1 V9WDR2 UNP 108 E +ATOM 769 O O . GLU A 1 108 ? -0.526 3.259 -13.307 1.0 98.44 ? 108 GLU A O 1 V9WDR2 UNP 108 E +ATOM 770 C CG . GLU A 1 108 ? -4.144 3.770 -13.069 1.0 98.44 ? 108 GLU A CG 1 V9WDR2 UNP 108 E +ATOM 771 C CD . GLU A 1 108 ? -5.473 4.524 -12.882 1.0 98.44 ? 108 GLU A CD 1 V9WDR2 UNP 108 E +ATOM 772 O OE1 . GLU A 1 108 ? -5.759 5.443 -13.690 1.0 98.44 ? 108 GLU A OE1 1 V9WDR2 UNP 108 E +ATOM 773 O OE2 . GLU A 1 108 ? -6.208 4.187 -11.932 1.0 98.44 ? 108 GLU A OE2 1 V9WDR2 UNP 108 E +ATOM 774 N N . PHE A 1 109 ? -0.717 3.873 -11.169 1.0 98.31 ? 109 PHE A N 1 V9WDR2 UNP 109 F +ATOM 775 C CA . PHE A 1 109 ? 0.409 4.801 -11.179 1.0 98.31 ? 109 PHE A CA 1 V9WDR2 UNP 109 F +ATOM 776 C C . PHE A 1 109 ? 1.453 4.461 -10.126 1.0 98.31 ? 109 PHE A C 1 V9WDR2 UNP 109 F +ATOM 777 C CB . PHE A 1 109 ? -0.080 6.233 -10.977 1.0 98.31 ? 109 PHE A CB 1 V9WDR2 UNP 109 F +ATOM 778 O O . PHE A 1 109 ? 1.201 4.432 -8.924 1.0 98.31 ? 109 PHE A O 1 V9WDR2 UNP 109 F +ATOM 779 C CG . PHE A 1 109 ? -0.970 6.740 -12.085 1.0 98.31 ? 109 PHE A CG 1 V9WDR2 UNP 109 F +ATOM 780 C CD1 . PHE A 1 109 ? -0.409 7.251 -13.271 1.0 98.31 ? 109 PHE A CD1 1 V9WDR2 UNP 109 F +ATOM 781 C CD2 . PHE A 1 109 ? -2.365 6.691 -11.934 1.0 98.31 ? 109 PHE A CD2 1 V9WDR2 UNP 109 F +ATOM 782 C CE1 . PHE A 1 109 ? -1.244 7.692 -14.313 1.0 98.31 ? 109 PHE A CE1 1 V9WDR2 UNP 109 F +ATOM 783 C CE2 . PHE A 1 109 ? -3.194 7.165 -12.959 1.0 98.31 ? 109 PHE A CE2 1 V9WDR2 UNP 109 F +ATOM 784 C CZ . PHE A 1 109 ? -2.640 7.636 -14.159 1.0 98.31 ? 109 PHE A CZ 1 V9WDR2 UNP 109 F +ATOM 785 N N . ALA A 1 110 ? 2.689 4.320 -10.584 1.0 97.31 ? 110 ALA A N 1 V9WDR2 UNP 110 A +ATOM 786 C CA . ALA A 1 110 ? 3.825 3.962 -9.760 1.0 97.31 ? 110 ALA A CA 1 V9WDR2 UNP 110 A +ATOM 787 C C . ALA A 1 110 ? 5.004 4.920 -9.963 1.0 97.31 ? 110 ALA A C 1 V9WDR2 UNP 110 A +ATOM 788 C CB . ALA A 1 110 ? 4.199 2.529 -10.124 1.0 97.31 ? 110 ALA A CB 1 V9WDR2 UNP 110 A +ATOM 789 O O . ALA A 1 110 ? 5.500 5.102 -11.076 1.0 97.31 ? 110 ALA A O 1 V9WDR2 UNP 110 A +ATOM 790 N N . SER A 1 111 ? 5.528 5.466 -8.866 1.0 98.31 ? 111 SER A N 1 V9WDR2 UNP 111 S +ATOM 791 C CA . SER A 1 111 ? 6.783 6.217 -8.831 1.0 98.31 ? 111 SER A CA 1 V9WDR2 UNP 111 S +ATOM 792 C C . SER A 1 111 ? 7.756 5.579 -7.846 1.0 98.31 ? 111 SER A C 1 V9WDR2 UNP 111 S +ATOM 793 C CB . SER A 1 111 ? 6.517 7.682 -8.484 1.0 98.31 ? 111 SER A CB 1 V9WDR2 UNP 111 S +ATOM 794 O O . SER A 1 111 ? 7.487 5.525 -6.651 1.0 98.31 ? 111 SER A O 1 V9WDR2 UNP 111 S +ATOM 795 O OG . SER A 1 111 ? 7.742 8.388 -8.368 1.0 98.31 ? 111 SER A OG 1 V9WDR2 UNP 111 S +ATOM 796 N N . GLU A 1 112 ? 8.921 5.141 -8.321 1.0 97.62 ? 112 GLU A N 1 V9WDR2 UNP 112 E +ATOM 797 C CA . GLU A 1 112 ? 9.907 4.420 -7.511 1.0 97.62 ? 112 GLU A CA 1 V9WDR2 UNP 112 E +ATOM 798 C C . GLU A 1 112 ? 11.277 5.079 -7.489 1.0 97.62 ? 112 GLU A C 1 V9WDR2 UNP 112 E +ATOM 799 C CB . GLU A 1 112 ? 10.133 3.010 -8.037 1.0 97.62 ? 112 GLU A CB 1 V9WDR2 UNP 112 E +ATOM 800 O O . GLU A 1 112 ? 11.841 5.443 -8.524 1.0 97.62 ? 112 GLU A O 1 V9WDR2 UNP 112 E +ATOM 801 C CG . GLU A 1 112 ? 8.877 2.167 -7.996 1.0 97.62 ? 112 GLU A CG 1 V9WDR2 UNP 112 E +ATOM 802 C CD . GLU A 1 112 ? 9.197 0.721 -8.363 1.0 97.62 ? 112 GLU A CD 1 V9WDR2 UNP 112 E +ATOM 803 O OE1 . GLU A 1 112 ? 8.546 -0.175 -7.824 1.0 97.62 ? 112 GLU A OE1 1 V9WDR2 UNP 112 E +ATOM 804 O OE2 . GLU A 1 112 ? 10.059 0.488 -9.224 1.0 97.62 ? 112 GLU A OE2 1 V9WDR2 UNP 112 E +ATOM 805 N N . ALA A 1 113 ? 11.885 5.107 -6.307 1.0 98.06 ? 113 ALA A N 1 V9WDR2 UNP 113 A +ATOM 806 C CA . ALA A 1 113 ? 13.285 5.440 -6.117 1.0 98.06 ? 113 ALA A CA 1 V9WDR2 UNP 113 A +ATOM 807 C C . ALA A 1 113 ? 13.973 4.371 -5.261 1.0 98.06 ? 113 ALA A C 1 V9WDR2 UNP 113 A +ATOM 808 C CB . ALA A 1 113 ? 13.379 6.843 -5.512 1.0 98.06 ? 113 ALA A CB 1 V9WDR2 UNP 113 A +ATOM 809 O O . ALA A 1 113 ? 13.775 4.297 -4.047 1.0 98.06 ? 113 ALA A O 1 V9WDR2 UNP 113 A +ATOM 810 N N . GLY A 1 114 ? 14.820 3.544 -5.878 1.0 97.62 ? 114 GLY A N 1 V9WDR2 UNP 114 G +ATOM 811 C CA . GLY A 1 114 ? 15.536 2.491 -5.150 1.0 97.62 ? 114 GLY A CA 1 V9WDR2 UNP 114 G +ATOM 812 C C . GLY A 1 114 ? 14.639 1.390 -4.574 1.0 97.62 ? 114 GLY A C 1 V9WDR2 UNP 114 G +ATOM 813 O O . GLY A 1 114 ? 15.062 0.736 -3.625 1.0 97.62 ? 114 GLY A O 1 V9WDR2 UNP 114 G +ATOM 814 N N . ALA A 1 115 ? 13.416 1.236 -5.085 1.0 97.62 ? 115 ALA A N 1 V9WDR2 UNP 115 A +ATOM 815 C CA . ALA A 1 115 ? 12.423 0.280 -4.599 1.0 97.62 ? 115 ALA A CA 1 V9WDR2 UNP 115 A +ATOM 816 C C . ALA A 1 115 ? 12.445 -1.036 -5.398 1.0 97.62 ? 115 ALA A C 1 V9WDR2 UNP 115 A +ATOM 817 C CB . ALA A 1 115 ? 11.047 0.959 -4.629 1.0 97.62 ? 115 ALA A CB 1 V9WDR2 UNP 115 A +ATOM 818 O O . ALA A 1 115 ? 13.075 -1.122 -6.459 1.0 97.62 ? 115 ALA A O 1 V9WDR2 UNP 115 A +ATOM 819 N N . ASN A 1 116 ? 11.764 -2.055 -4.871 1.0 97.75 ? 116 ASN A N 1 V9WDR2 UNP 116 N +ATOM 820 C CA . ASN A 1 116 ? 11.449 -3.275 -5.605 1.0 97.75 ? 116 ASN A CA 1 V9WDR2 UNP 116 N +ATOM 821 C C . ASN A 1 116 ? 9.934 -3.489 -5.642 1.0 97.75 ? 116 ASN A C 1 V9WDR2 UNP 116 N +ATOM 822 C CB . ASN A 1 116 ? 12.122 -4.510 -4.980 1.0 97.75 ? 116 ASN A CB 1 V9WDR2 UNP 116 N +ATOM 823 O O . ASN A 1 116 ? 9.335 -3.694 -4.588 1.0 97.75 ? 116 ASN A O 1 V9WDR2 UNP 116 N +ATOM 824 C CG . ASN A 1 116 ? 13.621 -4.408 -4.814 1.0 97.75 ? 116 ASN A CG 1 V9WDR2 UNP 116 N +ATOM 825 N ND2 . ASN A 1 116 ? 14.086 -4.337 -3.591 1.0 97.75 ? 116 ASN A ND2 1 V9WDR2 UNP 116 N +ATOM 826 O OD1 . ASN A 1 116 ? 14.404 -4.465 -5.751 1.0 97.75 ? 116 ASN A OD1 1 V9WDR2 UNP 116 N +ATOM 827 N N . ARG A 1 117 ? 9.343 -3.577 -6.834 1.0 96.31 ? 117 ARG A N 1 V9WDR2 UNP 117 R +ATOM 828 C CA . ARG A 1 117 ? 7.926 -3.929 -6.992 1.0 96.31 ? 117 ARG A CA 1 V9WDR2 UNP 117 R +ATOM 829 C C . ARG A 1 117 ? 7.737 -5.223 -7.750 1.0 96.31 ? 117 ARG A C 1 V9WDR2 UNP 117 R +ATOM 830 C CB . ARG A 1 117 ? 7.148 -2.768 -7.618 1.0 96.31 ? 117 ARG A CB 1 V9WDR2 UNP 117 R +ATOM 831 O O . ARG A 1 117 ? 8.431 -5.509 -8.725 1.0 96.31 ? 117 ARG A O 1 V9WDR2 UNP 117 R +ATOM 832 C CG . ARG A 1 117 ? 5.640 -3.044 -7.784 1.0 96.31 ? 117 ARG A CG 1 V9WDR2 UNP 117 R +ATOM 833 C CD . ARG A 1 117 ? 4.839 -1.888 -8.390 1.0 96.31 ? 117 ARG A CD 1 V9WDR2 UNP 117 R +ATOM 834 N NE . ARG A 1 117 ? 5.189 -0.591 -7.802 1.0 96.31 ? 117 ARG A NE 1 V9WDR2 UNP 117 R +ATOM 835 N NH1 . ARG A 1 117 ? 6.447 0.214 -9.546 1.0 96.31 ? 117 ARG A NH1 1 V9WDR2 UNP 117 R +ATOM 836 N NH2 . ARG A 1 117 ? 6.041 1.452 -7.686 1.0 96.31 ? 117 ARG A NH2 1 V9WDR2 UNP 117 R +ATOM 837 C CZ . ARG A 1 117 ? 5.901 0.355 -8.362 1.0 96.31 ? 117 ARG A CZ 1 V9WDR2 UNP 117 R +ATOM 838 N N . THR A 1 118 ? 6.744 -5.988 -7.327 1.0 97.12 ? 118 THR A N 1 V9WDR2 UNP 118 T +ATOM 839 C CA . THR A 1 118 ? 6.126 -7.034 -8.141 1.0 97.12 ? 118 THR A CA 1 V9WDR2 UNP 118 T +ATOM 840 C C . THR A 1 118 ? 4.662 -6.677 -8.362 1.0 97.12 ? 118 THR A C 1 V9WDR2 UNP 118 T +ATOM 841 C CB . THR A 1 118 ? 6.282 -8.403 -7.476 1.0 97.12 ? 118 THR A CB 1 V9WDR2 UNP 118 T +ATOM 842 O O . THR A 1 118 ? 3.946 -6.471 -7.391 1.0 97.12 ? 118 THR A O 1 V9WDR2 UNP 118 T +ATOM 843 C CG2 . THR A 1 118 ? 5.763 -9.538 -8.354 1.0 97.12 ? 118 THR A CG2 1 V9WDR2 UNP 118 T +ATOM 844 O OG1 . THR A 1 118 ? 7.658 -8.637 -7.251 1.0 97.12 ? 118 THR A OG1 1 V9WDR2 UNP 118 T +ATOM 845 N N . ALA A 1 119 ? 4.228 -6.601 -9.614 1.0 94.94 ? 119 ALA A N 1 V9WDR2 UNP 119 A +ATOM 846 C CA . ALA A 1 119 ? 2.822 -6.453 -9.981 1.0 94.94 ? 119 ALA A CA 1 V9WDR2 UNP 119 A +ATOM 847 C C . ALA A 1 119 ? 2.464 -7.497 -11.043 1.0 94.94 ? 119 ALA A C 1 V9WDR2 UNP 119 A +ATOM 848 C CB . ALA A 1 119 ? 2.544 -5.012 -10.415 1.0 94.94 ? 119 ALA A CB 1 V9WDR2 UNP 119 A +ATOM 849 O O . ALA A 1 119 ? 3.360 -7.972 -11.738 1.0 94.94 ? 119 ALA A O 1 V9WDR2 UNP 119 A +ATOM 850 N N . ALA A 1 120 ? 1.205 -7.898 -11.182 1.0 95.56 ? 120 ALA A N 1 V9WDR2 UNP 120 A +ATOM 851 C CA . ALA A 1 120 ? 0.778 -8.554 -12.414 1.0 95.56 ? 120 ALA A CA 1 V9WDR2 UNP 120 A +ATOM 852 C C . ALA A 1 120 ? 0.743 -7.497 -13.522 1.0 95.56 ? 120 ALA A C 1 V9WDR2 UNP 120 A +ATOM 853 C CB . ALA A 1 120 ? -0.561 -9.273 -12.210 1.0 95.56 ? 120 ALA A CB 1 V9WDR2 UNP 120 A +ATOM 854 O O . ALA A 1 120 ? 1.549 -7.581 -14.457 1.0 95.56 ? 120 ALA A O 1 V9WDR2 UNP 120 A +ATOM 855 N N . ASP A 1 121 ? -0.046 -6.444 -13.308 1.0 96.00 ? 121 ASP A N 1 V9WDR2 UNP 121 D +ATOM 856 C CA . ASP A 1 121 ? -0.283 -5.394 -14.289 1.0 96.00 ? 121 ASP A CA 1 V9WDR2 UNP 121 D +ATOM 857 C C . ASP A 1 121 ? 0.137 -4.021 -13.746 1.0 96.00 ? 121 ASP A C 1 V9WDR2 UNP 121 D +ATOM 858 C CB . ASP A 1 121 ? -1.744 -5.455 -14.773 1.0 96.00 ? 121 ASP A CB 1 V9WDR2 UNP 121 D +ATOM 859 O O . ASP A 1 121 ? 0.065 -3.717 -12.552 1.0 96.00 ? 121 ASP A O 1 V9WDR2 UNP 121 D +ATOM 860 C CG . ASP A 1 121 ? -2.103 -6.813 -15.415 1.0 96.00 ? 121 ASP A CG 1 V9WDR2 UNP 121 D +ATOM 861 O OD1 . ASP A 1 121 ? -1.166 -7.489 -15.905 1.0 96.00 ? 121 ASP A OD1 1 V9WDR2 UNP 121 D +ATOM 862 O OD2 . ASP A 1 121 ? -3.296 -7.176 -15.477 1.0 96.00 ? 121 ASP A OD2 1 V9WDR2 UNP 121 D +ATOM 863 N N . THR A 1 122 ? 0.675 -3.176 -14.626 1.0 95.94 ? 122 THR A N 1 V9WDR2 UNP 122 T +ATOM 864 C CA . THR A 1 122 ? 1.033 -1.794 -14.285 1.0 95.94 ? 122 THR A CA 1 V9WDR2 UNP 122 T +ATOM 865 C C . THR A 1 122 ? 0.722 -0.864 -15.446 1.0 95.94 ? 122 THR A C 1 V9WDR2 UNP 122 T +ATOM 866 C CB . THR A 1 122 ? 2.514 -1.652 -13.903 1.0 95.94 ? 122 THR A CB 1 V9WDR2 UNP 122 T +ATOM 867 O O . THR A 1 122 ? 1.297 -1.030 -16.522 1.0 95.94 ? 122 THR A O 1 V9WDR2 UNP 122 T +ATOM 868 C CG2 . THR A 1 122 ? 2.844 -0.268 -13.344 1.0 95.94 ? 122 THR A CG2 1 V9WDR2 UNP 122 T +ATOM 869 O OG1 . THR A 1 122 ? 2.896 -2.593 -12.922 1.0 95.94 ? 122 THR A OG1 1 V9WDR2 UNP 122 T +ATOM 870 N N . GLU A 1 123 ? -0.123 0.144 -15.252 1.0 97.62 ? 123 GLU A N 1 V9WDR2 UNP 123 E +ATOM 871 C CA . GLU A 1 123 ? -0.450 1.066 -16.346 1.0 97.62 ? 123 GLU A CA 1 V9WDR2 UNP 123 E +ATOM 872 C C . GLU A 1 123 ? 0.695 2.062 -16.575 1.0 97.62 ? 123 GLU A C 1 V9WDR2 UNP 123 E +ATOM 873 C CB . GLU A 1 123 ? -1.811 1.737 -16.112 1.0 97.62 ? 123 GLU A CB 1 V9WDR2 UNP 123 E +ATOM 874 O O . GLU A 1 123 ? 1.279 2.113 -17.659 1.0 97.62 ? 123 GLU A O 1 V9WDR2 UNP 123 E +ATOM 875 C CG . GLU A 1 123 ? -2.347 2.325 -17.426 1.0 97.62 ? 123 GLU A CG 1 V9WDR2 UNP 123 E +ATOM 876 C CD . GLU A 1 123 ? -3.727 2.990 -17.289 1.0 97.62 ? 123 GLU A CD 1 V9WDR2 UNP 123 E +ATOM 877 O OE1 . GLU A 1 123 ? -4.058 3.841 -18.153 1.0 97.62 ? 123 GLU A OE1 1 V9WDR2 UNP 123 E +ATOM 878 O OE2 . GLU A 1 123 ? -4.454 2.632 -16.343 1.0 97.62 ? 123 GLU A OE2 1 V9WDR2 UNP 123 E +ATOM 879 N N . PHE A 1 124 ? 1.115 2.774 -15.527 1.0 97.56 ? 124 PHE A N 1 V9WDR2 UNP 124 F +ATOM 880 C CA . PHE A 1 124 ? 2.176 3.773 -15.587 1.0 97.56 ? 124 PHE A CA 1 V9WDR2 UNP 124 F +ATOM 881 C C . PHE A 1 124 ? 3.237 3.559 -14.510 1.0 97.56 ? 124 PHE A C 1 V9WDR2 UNP 124 F +ATOM 882 C CB . PHE A 1 124 ? 1.575 5.174 -15.452 1.0 97.56 ? 124 PHE A CB 1 V9WDR2 UNP 124 F +ATOM 883 O O . PHE A 1 124 ? 2.965 3.616 -13.314 1.0 97.56 ? 124 PHE A O 1 V9WDR2 UNP 124 F +ATOM 884 C CG . PHE A 1 124 ? 0.633 5.558 -16.570 1.0 97.56 ? 124 PHE A CG 1 V9WDR2 UNP 124 F +ATOM 885 C CD1 . PHE A 1 124 ? 1.136 6.085 -17.774 1.0 97.56 ? 124 PHE A CD1 1 V9WDR2 UNP 124 F +ATOM 886 C CD2 . PHE A 1 124 ? -0.752 5.391 -16.406 1.0 97.56 ? 124 PHE A CD2 1 V9WDR2 UNP 124 F +ATOM 887 C CE1 . PHE A 1 124 ? 0.259 6.416 -18.823 1.0 97.56 ? 124 PHE A CE1 1 V9WDR2 UNP 124 F +ATOM 888 C CE2 . PHE A 1 124 ? -1.627 5.757 -17.438 1.0 97.56 ? 124 PHE A CE2 1 V9WDR2 UNP 124 F +ATOM 889 C CZ . PHE A 1 124 ? -1.125 6.238 -18.657 1.0 97.56 ? 124 PHE A CZ 1 V9WDR2 UNP 124 F +ATOM 890 N N . ALA A 1 125 ? 4.493 3.426 -14.934 1.0 96.31 ? 125 ALA A N 1 V9WDR2 UNP 125 A +ATOM 891 C CA . ALA A 1 125 ? 5.645 3.347 -14.042 1.0 96.31 ? 125 ALA A CA 1 V9WDR2 UNP 125 A +ATOM 892 C C . ALA A 1 125 ? 6.689 4.429 -14.354 1.0 96.31 ? 125 ALA A C 1 V9WDR2 UNP 125 A +ATOM 893 C CB . ALA A 1 125 ? 6.232 1.934 -14.112 1.0 96.31 ? 125 ALA A CB 1 V9WDR2 UNP 125 A +ATOM 894 O O . ALA A 1 125 ? 7.085 4.639 -15.502 1.0 96.31 ? 125 ALA A O 1 V9WDR2 UNP 125 A +ATOM 895 N N . SER A 1 126 ? 7.192 5.090 -13.315 1.0 97.81 ? 126 SER A N 1 V9WDR2 UNP 126 S +ATOM 896 C CA . SER A 1 126 ? 8.355 5.975 -13.364 1.0 97.81 ? 126 SER A CA 1 V9WDR2 UNP 126 S +ATOM 897 C C . SER A 1 126 ? 9.367 5.536 -12.317 1.0 97.81 ? 126 SER A C 1 V9WDR2 UNP 126 S +ATOM 898 C CB . SER A 1 126 ? 7.931 7.427 -13.143 1.0 97.81 ? 126 SER A CB 1 V9WDR2 UNP 126 S +ATOM 899 O O . SER A 1 126 ? 9.114 5.621 -11.120 1.0 97.81 ? 126 SER A O 1 V9WDR2 UNP 126 S +ATOM 900 O OG . SER A 1 126 ? 9.074 8.261 -13.035 1.0 97.81 ? 126 SER A OG 1 V9WDR2 UNP 126 S +ATOM 901 N N . GLU A 1 127 ? 10.543 5.107 -12.752 1.0 96.75 ? 127 GLU A N 1 V9WDR2 UNP 127 E +ATOM 902 C CA . GLU A 1 127 ? 11.485 4.405 -11.892 1.0 96.75 ? 127 GLU A CA 1 V9WDR2 UNP 127 E +ATOM 903 C C . GLU A 1 127 ? 12.882 5.015 -11.954 1.0 96.75 ? 127 GLU A C 1 V9WDR2 UNP 127 E +ATOM 904 C CB . GLU A 1 127 ? 11.563 2.939 -12.311 1.0 96.75 ? 127 GLU A CB 1 V9WDR2 UNP 127 E +ATOM 905 O O . GLU A 1 127 ? 13.444 5.233 -13.029 1.0 96.75 ? 127 GLU A O 1 V9WDR2 UNP 127 E +ATOM 906 C CG . GLU A 1 127 ? 10.241 2.174 -12.190 1.0 96.75 ? 127 GLU A CG 1 V9WDR2 UNP 127 E +ATOM 907 C CD . GLU A 1 127 ? 10.398 0.721 -12.656 1.0 96.75 ? 127 GLU A CD 1 V9WDR2 UNP 127 E +ATOM 908 O OE1 . GLU A 1 127 ? 9.352 0.108 -12.958 1.0 96.75 ? 127 GLU A OE1 1 V9WDR2 UNP 127 E +ATOM 909 O OE2 . GLU A 1 127 ? 11.554 0.255 -12.815 1.0 96.75 ? 127 GLU A OE2 1 V9WDR2 UNP 127 E +ATOM 910 N N . VAL A 1 128 ? 13.503 5.192 -10.789 1.0 97.75 ? 128 VAL A N 1 V9WDR2 UNP 128 V +ATOM 911 C CA . VAL A 1 128 ? 14.907 5.584 -10.659 1.0 97.75 ? 128 VAL A CA 1 V9WDR2 UNP 128 V +ATOM 912 C C . VAL A 1 128 ? 15.636 4.588 -9.769 1.0 97.75 ? 128 VAL A C 1 V9WDR2 UNP 128 V +ATOM 913 C CB . VAL A 1 128 ? 15.052 7.019 -10.125 1.0 97.75 ? 128 VAL A CB 1 V9WDR2 UNP 128 V +ATOM 914 O O . VAL A 1 128 ? 15.389 4.517 -8.566 1.0 97.75 ? 128 VAL A O 1 V9WDR2 UNP 128 V +ATOM 915 C CG1 . VAL A 1 128 ? 16.533 7.429 -10.079 1.0 97.75 ? 128 VAL A CG1 1 V9WDR2 UNP 128 V +ATOM 916 C CG2 . VAL A 1 128 ? 14.308 8.040 -10.996 1.0 97.75 ? 128 VAL A CG2 1 V9WDR2 UNP 128 V +ATOM 917 N N . ARG A 1 129 ? 16.606 3.861 -10.335 1.0 97.06 ? 129 ARG A N 1 V9WDR2 UNP 129 R +ATOM 918 C CA . ARG A 1 129 ? 17.394 2.845 -9.608 1.0 97.06 ? 129 ARG A CA 1 V9WDR2 UNP 129 R +ATOM 919 C C . ARG A 1 129 ? 16.521 1.765 -8.962 1.0 97.06 ? 129 ARG A C 1 V9WDR2 UNP 129 R +ATOM 920 C CB . ARG A 1 129 ? 18.334 3.497 -8.575 1.0 97.06 ? 129 ARG A CB 1 V9WDR2 UNP 129 R +ATOM 921 O O . ARG A 1 129 ? 16.886 1.256 -7.905 1.0 97.06 ? 129 ARG A O 1 V9WDR2 UNP 129 R +ATOM 922 C CG . ARG A 1 129 ? 19.309 4.495 -9.190 1.0 97.06 ? 129 ARG A CG 1 V9WDR2 UNP 129 R +ATOM 923 C CD . ARG A 1 129 ? 20.096 5.173 -8.073 1.0 97.06 ? 129 ARG A CD 1 V9WDR2 UNP 129 R +ATOM 924 N NE . ARG A 1 129 ? 21.070 6.119 -8.636 1.0 97.06 ? 129 ARG A NE 1 V9WDR2 UNP 129 R +ATOM 925 N NH1 . ARG A 1 129 ? 22.138 6.610 -6.671 1.0 97.06 ? 129 ARG A NH1 1 V9WDR2 UNP 129 R +ATOM 926 N NH2 . ARG A 1 129 ? 22.796 7.593 -8.572 1.0 97.06 ? 129 ARG A NH2 1 V9WDR2 UNP 129 R +ATOM 927 C CZ . ARG A 1 129 ? 21.996 6.767 -7.959 1.0 97.06 ? 129 ARG A CZ 1 V9WDR2 UNP 129 R +ATOM 928 N N . ALA A 1 130 ? 15.385 1.451 -9.570 1.0 96.44 ? 130 ALA A N 1 V9WDR2 UNP 130 A +ATOM 929 C CA . ALA A 1 130 ? 14.425 0.496 -9.036 1.0 96.44 ? 130 ALA A CA 1 V9WDR2 UNP 130 A +ATOM 930 C C . ALA A 1 130 ? 14.462 -0.832 -9.803 1.0 96.44 ? 130 ALA A C 1 V9WDR2 UNP 130 A +ATOM 931 C CB . ALA A 1 130 ? 13.048 1.154 -9.018 1.0 96.44 ? 130 ALA A CB 1 V9WDR2 UNP 130 A +ATOM 932 O O . ALA A 1 130 ? 15.147 -0.964 -10.827 1.0 96.44 ? 130 ALA A O 1 V9WDR2 UNP 130 A +ATOM 933 N N . ASN A 1 131 ? 13.781 -1.836 -9.265 1.0 96.19 ? 131 ASN A N 1 V9WDR2 UNP 131 N +ATOM 934 C CA . ASN A 1 131 ? 13.653 -3.142 -9.890 1.0 96.19 ? 131 ASN A CA 1 V9WDR2 UNP 131 N +ATOM 935 C C . ASN A 1 131 ? 12.198 -3.597 -9.838 1.0 96.19 ? 131 ASN A C 1 V9WDR2 UNP 131 N +ATOM 936 C CB . ASN A 1 131 ? 14.596 -4.115 -9.180 1.0 96.19 ? 131 ASN A CB 1 V9WDR2 UNP 131 N +ATOM 937 O O . ASN A 1 131 ? 11.693 -3.960 -8.776 1.0 96.19 ? 131 ASN A O 1 V9WDR2 UNP 131 N +ATOM 938 C CG . ASN A 1 131 ? 14.530 -5.534 -9.710 1.0 96.19 ? 131 ASN A CG 1 V9WDR2 UNP 131 N +ATOM 939 N ND2 . ASN A 1 131 ? 14.726 -6.494 -8.841 1.0 96.19 ? 131 ASN A ND2 1 V9WDR2 UNP 131 N +ATOM 940 O OD1 . ASN A 1 131 ? 14.388 -5.823 -10.887 1.0 96.19 ? 131 ASN A OD1 1 V9WDR2 UNP 131 N +ATOM 941 N N . ARG A 1 132 ? 11.557 -3.637 -10.999 1.0 94.06 ? 132 ARG A N 1 V9WDR2 UNP 132 R +ATOM 942 C CA . ARG A 1 132 ? 10.170 -4.054 -11.130 1.0 94.06 ? 132 ARG A CA 1 V9WDR2 UNP 132 R +ATOM 943 C C . ARG A 1 132 ? 10.069 -5.406 -11.811 1.0 94.06 ? 132 ARG A C 1 V9WDR2 UNP 132 R +ATOM 944 C CB . ARG A 1 132 ? 9.394 -2.950 -11.843 1.0 94.06 ? 132 ARG A CB 1 V9WDR2 UNP 132 R +ATOM 945 O O . ARG A 1 132 ? 10.797 -5.707 -12.753 1.0 94.06 ? 132 ARG A O 1 V9WDR2 UNP 132 R +ATOM 946 C CG . ARG A 1 132 ? 7.887 -3.250 -11.889 1.0 94.06 ? 132 ARG A CG 1 V9WDR2 UNP 132 R +ATOM 947 C CD . ARG A 1 132 ? 7.124 -2.056 -12.454 1.0 94.06 ? 132 ARG A CD 1 V9WDR2 UNP 132 R +ATOM 948 N NE . ARG A 1 132 ? 7.612 -1.736 -13.797 1.0 94.06 ? 132 ARG A NE 1 V9WDR2 UNP 132 R +ATOM 949 N NH1 . ARG A 1 132 ? 5.912 -2.636 -14.957 1.0 94.06 ? 132 ARG A NH1 1 V9WDR2 UNP 132 R +ATOM 950 N NH2 . ARG A 1 132 ? 7.710 -1.839 -16.048 1.0 94.06 ? 132 ARG A NH2 1 V9WDR2 UNP 132 R +ATOM 951 C CZ . ARG A 1 132 ? 7.079 -2.077 -14.936 1.0 94.06 ? 132 ARG A CZ 1 V9WDR2 UNP 132 R +ATOM 952 N N . THR A 1 133 ? 9.141 -6.228 -11.347 1.0 95.19 ? 133 THR A N 1 V9WDR2 UNP 133 T +ATOM 953 C CA . THR A 1 133 ? 8.708 -7.440 -12.041 1.0 95.19 ? 133 THR A CA 1 V9WDR2 UNP 133 T +ATOM 954 C C . THR A 1 133 ? 7.232 -7.307 -12.375 1.0 95.19 ? 133 THR A C 1 V9WDR2 UNP 133 T +ATOM 955 C CB . THR A 1 133 ? 8.997 -8.692 -11.207 1.0 95.19 ? 133 THR A CB 1 V9WDR2 UNP 133 T +ATOM 956 O O . THR A 1 133 ? 6.437 -7.096 -11.465 1.0 95.19 ? 133 THR A O 1 V9WDR2 UNP 133 T +ATOM 957 C CG2 . THR A 1 133 ? 8.679 -9.979 -11.969 1.0 95.19 ? 133 THR A CG2 1 V9WDR2 UNP 133 T +ATOM 958 O OG1 . THR A 1 133 ? 10.375 -8.708 -10.877 1.0 95.19 ? 133 THR A OG1 1 V9WDR2 UNP 133 T +ATOM 959 N N . SER A 1 134 ? 6.875 -7.416 -13.655 1.0 91.88 ? 134 SER A N 1 V9WDR2 UNP 134 S +ATOM 960 C CA . SER A 1 134 ? 5.478 -7.385 -14.101 1.0 91.88 ? 134 SER A CA 1 V9WDR2 UNP 134 S +ATOM 961 C C . SER A 1 134 ? 5.190 -8.368 -15.226 1.0 91.88 ? 134 SER A C 1 V9WDR2 UNP 134 S +ATOM 962 C CB . SER A 1 134 ? 5.023 -5.975 -14.473 1.0 91.88 ? 134 SER A CB 1 V9WDR2 UNP 134 S +ATOM 963 O O . SER A 1 134 ? 6.098 -8.750 -15.970 1.0 91.88 ? 134 SER A O 1 V9WDR2 UNP 134 S +ATOM 964 O OG . SER A 1 134 ? 5.783 -5.516 -15.578 1.0 91.88 ? 134 SER A OG 1 V9WDR2 UNP 134 S +ATOM 965 N N . ALA A 1 135 ? 3.945 -8.826 -15.335 1.0 93.06 ? 135 ALA A N 1 V9WDR2 UNP 135 A +ATOM 966 C CA . ALA A 1 135 ? 3.494 -9.559 -16.511 1.0 93.06 ? 135 ALA A CA 1 V9WDR2 UNP 135 A +ATOM 967 C C . ALA A 1 135 ? 3.233 -8.568 -17.651 1.0 93.06 ? 135 ALA A C 1 V9WDR2 UNP 135 A +ATOM 968 C CB . ALA A 1 135 ? 2.272 -10.413 -16.158 1.0 93.06 ? 135 ALA A CB 1 V9WDR2 UNP 135 A +ATOM 969 O O . ALA A 1 135 ? 3.911 -8.653 -18.681 1.0 93.06 ? 135 ALA A O 1 V9WDR2 UNP 135 A +ATOM 970 N N . ASP A 1 136 ? 2.375 -7.575 -17.404 1.0 92.88 ? 136 ASP A N 1 V9WDR2 UNP 136 D +ATOM 971 C CA . ASP A 1 136 ? 2.019 -6.548 -18.375 1.0 92.88 ? 136 ASP A CA 1 V9WDR2 UNP 136 D +ATOM 972 C C . ASP A 1 136 ? 2.343 -5.133 -17.893 1.0 92.88 ? 136 ASP A C 1 V9WDR2 UNP 136 D +ATOM 973 C CB . ASP A 1 136 ? 0.563 -6.713 -18.836 1.0 92.88 ? 136 ASP A CB 1 V9WDR2 UNP 136 D +ATOM 974 O O . ASP A 1 136 ? 2.459 -4.818 -16.704 1.0 92.88 ? 136 ASP A O 1 V9WDR2 UNP 136 D +ATOM 975 C CG . ASP A 1 136 ? 0.407 -7.927 -19.764 1.0 92.88 ? 136 ASP A CG 1 V9WDR2 UNP 136 D +ATOM 976 O OD1 . ASP A 1 136 ? 1.241 -8.029 -20.700 1.0 92.88 ? 136 ASP A OD1 1 V9WDR2 UNP 136 D +ATOM 977 O OD2 . ASP A 1 136 ? -0.530 -8.735 -19.598 1.0 92.88 ? 136 ASP A OD2 1 V9WDR2 UNP 136 D +ATOM 978 N N . THR A 1 137 ? 2.646 -4.263 -18.855 1.0 93.31 ? 137 THR A N 1 V9WDR2 UNP 137 T +ATOM 979 C CA . THR A 1 137 ? 2.934 -2.850 -18.599 1.0 93.31 ? 137 THR A CA 1 V9WDR2 UNP 137 T +ATOM 980 C C . THR A 1 137 ? 2.608 -2.013 -19.808 1.0 93.31 ? 137 THR A C 1 V9WDR2 UNP 137 T +ATOM 981 C CB . THR A 1 137 ? 4.398 -2.595 -18.245 1.0 93.31 ? 137 THR A CB 1 V9WDR2 UNP 137 T +ATOM 982 O O . THR A 1 137 ? 3.141 -2.286 -20.887 1.0 93.31 ? 137 THR A O 1 V9WDR2 UNP 137 T +ATOM 983 C CG2 . THR A 1 137 ? 4.651 -1.179 -17.723 1.0 93.31 ? 137 THR A CG2 1 V9WDR2 UNP 137 T +ATOM 984 O OG1 . THR A 1 137 ? 4.740 -3.509 -17.239 1.0 93.31 ? 137 THR A OG1 1 V9WDR2 UNP 137 T +ATOM 985 N N . GLU A 1 138 ? 1.804 -0.973 -19.622 1.0 95.25 ? 138 GLU A N 1 V9WDR2 UNP 138 E +ATOM 986 C CA . GLU A 1 138 ? 1.454 -0.083 -20.726 1.0 95.25 ? 138 GLU A CA 1 V9WDR2 UNP 138 E +ATOM 987 C C . GLU A 1 138 ? 2.535 0.974 -20.960 1.0 95.25 ? 138 GLU A C 1 V9WDR2 UNP 138 E +ATOM 988 C CB . GLU A 1 138 ? 0.080 0.556 -20.517 1.0 95.25 ? 138 GLU A CB 1 V9WDR2 UNP 138 E +ATOM 989 O O . GLU A 1 138 ? 3.058 1.110 -22.071 1.0 95.25 ? 138 GLU A O 1 V9WDR2 UNP 138 E +ATOM 990 C CG . GLU A 1 138 ? -1.046 -0.474 -20.337 1.0 95.25 ? 138 GLU A CG 1 V9WDR2 UNP 138 E +ATOM 991 C CD . GLU A 1 138 ? -2.423 0.088 -20.730 1.0 95.25 ? 138 GLU A CD 1 V9WDR2 UNP 138 E +ATOM 992 O OE1 . GLU A 1 138 ? -3.324 -0.749 -20.966 1.0 95.25 ? 138 GLU A OE1 1 V9WDR2 UNP 138 E +ATOM 993 O OE2 . GLU A 1 138 ? -2.523 1.312 -20.971 1.0 95.25 ? 138 GLU A OE2 1 V9WDR2 UNP 138 E +ATOM 994 N N . PHE A 1 139 ? 2.937 1.677 -19.899 1.0 95.06 ? 139 PHE A N 1 V9WDR2 UNP 139 F +ATOM 995 C CA . PHE A 1 139 ? 3.892 2.774 -19.968 1.0 95.06 ? 139 PHE A CA 1 V9WDR2 UNP 139 F +ATOM 996 C C . PHE A 1 139 ? 4.933 2.686 -18.853 1.0 95.06 ? 139 PHE A C 1 V9WDR2 UNP 139 F +ATOM 997 C CB . PHE A 1 139 ? 3.134 4.104 -19.914 1.0 95.06 ? 139 PHE A CB 1 V9WDR2 UNP 139 F +ATOM 998 O O . PHE A 1 139 ? 4.616 2.595 -17.671 1.0 95.06 ? 139 PHE A O 1 V9WDR2 UNP 139 F +ATOM 999 C CG . PHE A 1 139 ? 2.113 4.272 -21.022 1.0 95.06 ? 139 PHE A CG 1 V9WDR2 UNP 139 F +ATOM 1000 C CD1 . PHE A 1 139 ? 2.523 4.642 -22.317 1.0 95.06 ? 139 PHE A CD1 1 V9WDR2 UNP 139 F +ATOM 1001 C CD2 . PHE A 1 139 ? 0.755 4.002 -20.773 1.0 95.06 ? 139 PHE A CD2 1 V9WDR2 UNP 139 F +ATOM 1002 C CE1 . PHE A 1 139 ? 1.577 4.753 -23.354 1.0 95.06 ? 139 PHE A CE1 1 V9WDR2 UNP 139 F +ATOM 1003 C CE2 . PHE A 1 139 ? -0.189 4.110 -21.805 1.0 95.06 ? 139 PHE A CE2 1 V9WDR2 UNP 139 F +ATOM 1004 C CZ . PHE A 1 139 ? 0.220 4.488 -23.095 1.0 95.06 ? 139 PHE A CZ 1 V9WDR2 UNP 139 F +ATOM 1005 N N . ALA A 1 140 ? 6.209 2.777 -19.230 1.0 94.06 ? 140 ALA A N 1 V9WDR2 UNP 140 A +ATOM 1006 C CA . ALA A 1 140 ? 7.316 2.806 -18.283 1.0 94.06 ? 140 ALA A CA 1 V9WDR2 UNP 140 A +ATOM 1007 C C . ALA A 1 140 ? 8.369 3.845 -18.681 1.0 94.06 ? 140 ALA A C 1 V9WDR2 UNP 140 A +ATOM 1008 C CB . ALA A 1 140 ? 7.915 1.403 -18.146 1.0 94.06 ? 140 ALA A CB 1 V9WDR2 UNP 140 A +ATOM 1009 O O . ALA A 1 140 ? 8.757 3.953 -19.848 1.0 94.06 ? 140 ALA A O 1 V9WDR2 UNP 140 A +ATOM 1010 N N . ASN A 1 141 ? 8.855 4.589 -17.691 1.0 95.62 ? 141 ASN A N 1 V9WDR2 UNP 141 N +ATOM 1011 C CA . ASN A 1 141 ? 10.019 5.455 -17.794 1.0 95.62 ? 141 ASN A CA 1 V9WDR2 UNP 141 N +ATOM 1012 C C . ASN A 1 141 ? 11.068 5.017 -16.770 1.0 95.62 ? 141 ASN A C 1 V9WDR2 UNP 141 N +ATOM 1013 C CB . ASN A 1 141 ? 9.586 6.912 -17.597 1.0 95.62 ? 141 ASN A CB 1 V9WDR2 UNP 141 N +ATOM 1014 O O . ASN A 1 141 ? 10.866 5.147 -15.566 1.0 95.62 ? 141 ASN A O 1 V9WDR2 UNP 141 N +ATOM 1015 C CG . ASN A 1 141 ? 10.733 7.890 -17.772 1.0 95.62 ? 141 ASN A CG 1 V9WDR2 UNP 141 N +ATOM 1016 N ND2 . ASN A 1 141 ? 10.494 9.146 -17.483 1.0 95.62 ? 141 ASN A ND2 1 V9WDR2 UNP 141 N +ATOM 1017 O OD1 . ASN A 1 141 ? 11.838 7.578 -18.189 1.0 95.62 ? 141 ASN A OD1 1 V9WDR2 UNP 141 N +ATOM 1018 N N . GLU A 1 142 ? 12.201 4.516 -17.252 1.0 93.50 ? 142 GLU A N 1 V9WDR2 UNP 142 E +ATOM 1019 C CA . GLU A 1 142 ? 13.223 3.888 -16.420 1.0 93.50 ? 142 GLU A CA 1 V9WDR2 UNP 142 E +ATOM 1020 C C . GLU A 1 142 ? 14.549 4.652 -16.494 1.0 93.50 ? 142 GLU A C 1 V9WDR2 UNP 142 E +ATOM 1021 C CB . GLU A 1 142 ? 13.410 2.430 -16.858 1.0 93.50 ? 142 GLU A CB 1 V9WDR2 UNP 142 E +ATOM 1022 O O . GLU A 1 142 ? 15.162 4.793 -17.555 1.0 93.50 ? 142 GLU A O 1 V9WDR2 UNP 142 E +ATOM 1023 C CG . GLU A 1 142 ? 12.197 1.546 -16.522 1.0 93.50 ? 142 GLU A CG 1 V9WDR2 UNP 142 E +ATOM 1024 C CD . GLU A 1 142 ? 12.361 0.111 -17.049 1.0 93.50 ? 142 GLU A CD 1 V9WDR2 UNP 142 E +ATOM 1025 O OE1 . GLU A 1 142 ? 11.324 -0.506 -17.369 1.0 93.50 ? 142 GLU A OE1 1 V9WDR2 UNP 142 E +ATOM 1026 O OE2 . GLU A 1 142 ? 13.523 -0.358 -17.166 1.0 93.50 ? 142 GLU A OE2 1 V9WDR2 UNP 142 E +ATOM 1027 N N . VAL A 1 143 ? 15.053 5.094 -15.341 1.0 94.88 ? 143 VAL A N 1 V9WDR2 UNP 143 V +ATOM 1028 C CA . VAL A 1 143 ? 16.378 5.704 -15.200 1.0 94.88 ? 143 VAL A CA 1 V9WDR2 UNP 143 V +ATOM 1029 C C . VAL A 1 143 ? 17.232 4.816 -14.316 1.0 94.88 ? 143 VAL A C 1 V9WDR2 UNP 143 V +ATOM 1030 C CB . VAL A 1 143 ? 16.302 7.135 -14.642 1.0 94.88 ? 143 VAL A CB 1 V9WDR2 UNP 143 V +ATOM 1031 O O . VAL A 1 143 ? 17.099 4.798 -13.093 1.0 94.88 ? 143 VAL A O 1 V9WDR2 UNP 143 V +ATOM 1032 C CG1 . VAL A 1 143 ? 17.707 7.758 -14.552 1.0 94.88 ? 143 VAL A CG1 1 V9WDR2 UNP 143 V +ATOM 1033 C CG2 . VAL A 1 143 ? 15.440 8.042 -15.526 1.0 94.88 ? 143 VAL A CG2 1 V9WDR2 UNP 143 V +ATOM 1034 N N . THR A 1 144 ? 18.187 4.108 -14.920 1.0 93.44 ? 144 THR A N 1 V9WDR2 UNP 144 T +ATOM 1035 C CA . THR A 1 144 ? 19.050 3.146 -14.205 1.0 93.44 ? 144 THR A CA 1 V9WDR2 UNP 144 T +ATOM 1036 C C . THR A 1 144 ? 18.264 2.062 -13.451 1.0 93.44 ? 144 THR A C 1 V9WDR2 UNP 144 T +ATOM 1037 C CB . THR A 1 144 ? 20.115 3.839 -13.319 1.0 93.44 ? 144 THR A CB 1 V9WDR2 UNP 144 T +ATOM 1038 O O . THR A 1 144 ? 18.753 1.545 -12.448 1.0 93.44 ? 144 THR A O 1 V9WDR2 UNP 144 T +ATOM 1039 C CG2 . THR A 1 144 ? 21.057 4.715 -14.144 1.0 93.44 ? 144 THR A CG2 1 V9WDR2 UNP 144 T +ATOM 1040 O OG1 . THR A 1 144 ? 19.586 4.699 -12.334 1.0 93.44 ? 144 THR A OG1 1 V9WDR2 UNP 144 T +ATOM 1041 N N . SER A 1 145 ? 17.069 1.727 -13.939 1.0 93.50 ? 145 SER A N 1 V9WDR2 UNP 145 S +ATOM 1042 C CA . SER A 1 145 ? 16.173 0.714 -13.371 1.0 93.50 ? 145 SER A CA 1 V9WDR2 UNP 145 S +ATOM 1043 C C . SER A 1 145 ? 16.198 -0.578 -14.188 1.0 93.50 ? 145 SER A C 1 V9WDR2 UNP 145 S +ATOM 1044 C CB . SER A 1 145 ? 14.750 1.270 -13.249 1.0 93.50 ? 145 SER A CB 1 V9WDR2 UNP 145 S +ATOM 1045 O O . SER A 1 145 ? 16.890 -0.666 -15.210 1.0 93.50 ? 145 SER A O 1 V9WDR2 UNP 145 S +ATOM 1046 O OG . SER A 1 145 ? 14.786 2.470 -12.499 1.0 93.50 ? 145 SER A OG 1 V9WDR2 UNP 145 S +ATOM 1047 N N . LYS A 1 146 ? 15.517 -1.609 -13.687 1.0 91.69 ? 146 LYS A N 1 V9WDR2 UNP 146 K +ATOM 1048 C CA . LYS A 1 146 ? 15.361 -2.895 -14.368 1.0 91.69 ? 146 LYS A CA 1 V9WDR2 UNP 146 K +ATOM 1049 C C . LYS A 1 146 ? 13.910 -3.349 -14.302 1.0 91.69 ? 146 LYS A C 1 V9WDR2 UNP 146 K +ATOM 1050 C CB . LYS A 1 146 ? 16.246 -3.965 -13.712 1.0 91.69 ? 146 LYS A CB 1 V9WDR2 UNP 146 K +ATOM 1051 O O . LYS A 1 146 ? 13.405 -3.566 -13.207 1.0 91.69 ? 146 LYS A O 1 V9WDR2 UNP 146 K +ATOM 1052 C CG . LYS A 1 146 ? 17.745 -3.715 -13.896 1.0 91.69 ? 146 LYS A CG 1 V9WDR2 UNP 146 K +ATOM 1053 C CD . LYS A 1 146 ? 18.516 -4.848 -13.219 1.0 91.69 ? 146 LYS A CD 1 V9WDR2 UNP 146 K +ATOM 1054 C CE . LYS A 1 146 ? 20.018 -4.606 -13.342 1.0 91.69 ? 146 LYS A CE 1 V9WDR2 UNP 146 K +ATOM 1055 N NZ . LYS A 1 146 ? 20.757 -5.648 -12.595 1.0 91.69 ? 146 LYS A NZ 1 V9WDR2 UNP 146 K +ATOM 1056 N N . GLN A 1 147 ? 13.319 -3.627 -15.459 1.0 89.00 ? 147 GLN A N 1 V9WDR2 UNP 147 Q +ATOM 1057 C CA . GLN A 1 147 ? 12.096 -4.415 -15.553 1.0 89.00 ? 147 GLN A CA 1 V9WDR2 UNP 147 Q +ATOM 1058 C C . GLN A 1 147 ? 12.399 -5.887 -15.881 1.0 89.00 ? 147 GLN A C 1 V9WDR2 UNP 147 Q +ATOM 1059 C CB . GLN A 1 147 ? 11.149 -3.779 -16.574 1.0 89.00 ? 147 GLN A CB 1 V9WDR2 UNP 147 Q +ATOM 1060 O O . GLN A 1 147 ? 13.073 -6.201 -16.867 1.0 89.00 ? 147 GLN A O 1 V9WDR2 UNP 147 Q +ATOM 1061 C CG . GLN A 1 147 ? 9.794 -4.502 -16.607 1.0 89.00 ? 147 GLN A CG 1 V9WDR2 UNP 147 Q +ATOM 1062 C CD . GLN A 1 147 ? 8.852 -3.991 -17.689 1.0 89.00 ? 147 GLN A CD 1 V9WDR2 UNP 147 Q +ATOM 1063 N NE2 . GLN A 1 147 ? 7.634 -4.484 -17.722 1.0 89.00 ? 147 GLN A NE2 1 V9WDR2 UNP 147 Q +ATOM 1064 O OE1 . GLN A 1 147 ? 9.165 -3.165 -18.527 1.0 89.00 ? 147 GLN A OE1 1 V9WDR2 UNP 147 Q +ATOM 1065 N N . ASN A 1 148 ? 11.831 -6.800 -15.093 1.0 91.25 ? 148 ASN A N 1 V9WDR2 UNP 148 N +ATOM 1066 C CA . ASN A 1 148 ? 11.749 -8.228 -15.389 1.0 91.25 ? 148 ASN A CA 1 V9WDR2 UNP 148 N +ATOM 1067 C C . ASN A 1 148 ? 10.321 -8.581 -15.818 1.0 91.25 ? 148 ASN A C 1 V9WDR2 UNP 148 N +ATOM 1068 C CB . ASN A 1 148 ? 12.180 -9.052 -14.167 1.0 91.25 ? 148 ASN A CB 1 V9WDR2 UNP 148 N +ATOM 1069 O O . ASN A 1 148 ? 9.359 -8.134 -15.199 1.0 91.25 ? 148 ASN A O 1 V9WDR2 UNP 148 N +ATOM 1070 C CG . ASN A 1 148 ? 13.558 -8.677 -13.661 1.0 91.25 ? 148 ASN A CG 1 V9WDR2 UNP 148 N +ATOM 1071 N ND2 . ASN A 1 148 ? 13.659 -8.408 -12.382 1.0 91.25 ? 148 ASN A ND2 1 V9WDR2 UNP 148 N +ATOM 1072 O OD1 . ASN A 1 148 ? 14.536 -8.616 -14.394 1.0 91.25 ? 148 ASN A OD1 1 V9WDR2 UNP 148 N +ATOM 1073 N N . ARG A 1 149 ? 10.180 -9.419 -16.849 1.0 85.00 ? 149 ARG A N 1 V9WDR2 UNP 149 R +ATOM 1074 C CA . ARG A 1 149 ? 8.873 -9.941 -17.263 1.0 85.00 ? 149 ARG A CA 1 V9WDR2 UNP 149 R +ATOM 1075 C C . ARG A 1 149 ? 8.609 -11.316 -16.666 1.0 85.00 ? 149 ARG A C 1 V9WDR2 UNP 149 R +ATOM 1076 C CB . ARG A 1 149 ? 8.698 -9.904 -18.787 1.0 85.00 ? 149 ARG A CB 1 V9WDR2 UNP 149 R +ATOM 1077 O O . ARG A 1 149 ? 9.486 -12.181 -16.731 1.0 85.00 ? 149 ARG A O 1 V9WDR2 UNP 149 R +ATOM 1078 C CG . ARG A 1 149 ? 8.394 -8.469 -19.243 1.0 85.00 ? 149 ARG A CG 1 V9WDR2 UNP 149 R +ATOM 1079 C CD . ARG A 1 149 ? 7.898 -8.407 -20.691 1.0 85.00 ? 149 ARG A CD 1 V9WDR2 UNP 149 R +ATOM 1080 N NE . ARG A 1 149 ? 8.973 -8.110 -21.660 1.0 85.00 ? 149 ARG A NE 1 V9WDR2 UNP 149 R +ATOM 1081 N NH1 . ARG A 1 149 ? 7.561 -7.651 -23.406 1.0 85.00 ? 149 ARG A NH1 1 V9WDR2 UNP 149 R +ATOM 1082 N NH2 . ARG A 1 149 ? 9.754 -7.278 -23.635 1.0 85.00 ? 149 ARG A NH2 1 V9WDR2 UNP 149 R +ATOM 1083 C CZ . ARG A 1 149 ? 8.761 -7.689 -22.894 1.0 85.00 ? 149 ARG A CZ 1 V9WDR2 UNP 149 R +ATOM 1084 N N . CYS A 1 150 ? 7.412 -11.528 -16.122 1.0 71.25 ? 150 CYS A N 1 V9WDR2 UNP 150 C +ATOM 1085 C CA . CYS A 1 150 ? 6.962 -12.863 -15.726 1.0 71.25 ? 150 CYS A CA 1 V9WDR2 UNP 150 C +ATOM 1086 C C . CYS A 1 150 ? 6.687 -13.706 -16.985 1.0 71.25 ? 150 CYS A C 1 V9WDR2 UNP 150 C +ATOM 1087 C CB . CYS A 1 150 ? 5.750 -12.756 -14.784 1.0 71.25 ? 150 CYS A CB 1 V9WDR2 UNP 150 C +ATOM 1088 O O . CYS A 1 150 ? 5.969 -13.277 -17.884 1.0 71.25 ? 150 CYS A O 1 V9WDR2 UNP 150 C +ATOM 1089 S SG . CYS A 1 150 ? 6.230 -13.311 -13.120 1.0 71.25 ? 150 CYS A SG 1 V9WDR2 UNP 150 C +ATOM 1090 N N . GLY A 1 151 ? 7.311 -14.883 -17.092 1.0 59.62 ? 151 GLY A N 1 V9WDR2 UNP 151 G +ATOM 1091 C CA . GLY A 1 151 ? 7.154 -15.765 -18.254 1.0 59.62 ? 151 GLY A CA 1 V9WDR2 UNP 151 G +ATOM 1092 C C . GLY A 1 151 ? 5.750 -16.372 -18.330 1.0 59.62 ? 151 GLY A C 1 V9WDR2 UNP 151 G +ATOM 1093 O O . GLY A 1 151 ? 5.236 -16.827 -17.312 1.0 59.62 ? 151 GLY A O 1 V9WDR2 UNP 151 G +ATOM 1094 N N . HIS A 1 152 ? 5.160 -16.373 -19.529 1.0 47.81 ? 152 HIS A N 1 V9WDR2 UNP 152 H +ATOM 1095 C CA . HIS A 1 152 ? 3.987 -17.185 -19.880 1.0 47.81 ? 152 HIS A CA 1 V9WDR2 UNP 152 H +ATOM 1096 C C . HIS A 1 152 ? 4.379 -18.643 -20.147 1.0 47.81 ? 152 HIS A C 1 V9WDR2 UNP 152 H +ATOM 1097 C CB . HIS A 1 152 ? 3.276 -16.589 -21.106 1.0 47.81 ? 152 HIS A CB 1 V9WDR2 UNP 152 H +ATOM 1098 O O . HIS A 1 152 ? 5.435 -18.860 -20.790 1.0 47.81 ? 152 HIS A O 1 V9WDR2 UNP 152 H +ATOM 1099 C CG . HIS A 1 152 ? 2.374 -15.414 -20.827 1.0 47.81 ? 152 HIS A CG 1 V9WDR2 UNP 152 H +ATOM 1100 C CD2 . HIS A 1 152 ? 1.294 -15.052 -21.584 1.0 47.81 ? 152 HIS A CD2 1 V9WDR2 UNP 152 H +ATOM 1101 N ND1 . HIS A 1 152 ? 2.443 -14.525 -19.777 1.0 47.81 ? 152 HIS A ND1 1 V9WDR2 UNP 152 H +ATOM 1102 C CE1 . HIS A 1 152 ? 1.430 -13.647 -19.904 1.0 47.81 ? 152 HIS A CE1 1 V9WDR2 UNP 152 H +ATOM 1103 N NE2 . HIS A 1 152 ? 0.703 -13.937 -20.996 1.0 47.81 ? 152 HIS A NE2 1 V9WDR2 UNP 152 H +ATOM 1104 O OXT . HIS A 1 152 ? 3.588 -19.517 -19.735 1.0 47.81 ? 152 HIS A OXT 1 V9WDR2 UNP 152 H +# diff --git a/biojava-survival/pom.xml b/biojava-survival/pom.xml index 61bcb2369f..88f901cdea 100644 --- a/biojava-survival/pom.xml +++ b/biojava-survival/pom.xml @@ -4,7 +4,7 @@ org.biojava biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-survival @@ -37,7 +37,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxCC.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxCC.java index 728e6e925c..ccd9d1f238 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxCC.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxCC.java @@ -30,7 +30,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxCC { @@ -42,9 +42,9 @@ public class CoxCC { static public void process(CoxInfo ci) throws Exception { ArrayList survivalInfoList = ci.survivalInfoList; //r - ArrayList variables = new ArrayList(ci.getCoefficientsList().keySet()); + ArrayList variables = new ArrayList<>(ci.getCoefficientsList().keySet()); - ArrayList strataClass = new ArrayList(survivalInfoList.size()); + ArrayList strataClass = new ArrayList<>(survivalInfoList.size()); double[] wt = new double[survivalInfoList.size()]; for (int i = 0; i < survivalInfoList.size(); i++) { SurvivalInfo si = survivalInfoList.get(i); @@ -75,7 +75,7 @@ static public void process(CoxInfo ci) throws Exception { rvar = ci.getVariance(); } //nj - LinkedHashMap nj = new LinkedHashMap(); + LinkedHashMap nj = new LinkedHashMap<>(); Collections.sort(strataClass); for (Integer value : strataClass) { Double count = nj.get(value); @@ -86,7 +86,7 @@ static public void process(CoxInfo ci) throws Exception { nj.put(value, count); } //Nj - LinkedHashMap Nj = new LinkedHashMap(); + LinkedHashMap Nj = new LinkedHashMap<>(); //N = N + Nj[key]; double N = 0; for (int i = 0; i < survivalInfoList.size(); i++) { @@ -106,7 +106,7 @@ static public void process(CoxInfo ci) throws Exception { N = N + value; } - LinkedHashMap k1j = new LinkedHashMap(); + LinkedHashMap k1j = new LinkedHashMap<>(); for (Integer key : nj.keySet()) { double _nj = (nj.get(key)); //trying to copy what R is doing on precision double _Nj = (Nj.get(key)); @@ -119,7 +119,7 @@ static public void process(CoxInfo ci) throws Exception { for (Integer i : k1j.keySet()) { // System.out.println("Strata=" + i + " " + k1j.get(i) + " " + Nj.get(i) + " " + nj.get(i)); if (nj.get(i) > 1) { - LinkedHashMap variableStatsMap = new LinkedHashMap(); + LinkedHashMap variableStatsMap = new LinkedHashMap<>(); for (int p = 0; p < survivalInfoList.size(); p++) { SurvivalInfo si = survivalInfoList.get(p); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxCoefficient.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxCoefficient.java index a8023284b5..d95f85ca76 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxCoefficient.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxCoefficient.java @@ -25,7 +25,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxCoefficient { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxHelper.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxHelper.java index 920fd3cc33..4430922993 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxHelper.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxHelper.java @@ -30,7 +30,7 @@ * Given the number of options for adjusting the calculations using weighting, strata, clustering etc the helper class can be used to hide * the complexity for typical use case. * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxHelper { @@ -71,7 +71,7 @@ public static CoxInfo process(String datafile, String timeColumn, String statusC public static CoxInfo process(WorkSheet worksheet, String timeColumn, String statusColumn, String weightColumn, String strataColumn, String clusterColumn, ArrayList variables, boolean useStrata, boolean useWeights) { try { - ArrayList survivalInfoList = new ArrayList(); + ArrayList survivalInfoList = new ArrayList<>(); int i = 1; for (String row : worksheet.getRows()) { @@ -152,7 +152,7 @@ public static void main(String[] args) { try { if (true) { String datafile = "/Users/Scooter/scripps/ngs/DataSets/E2197/misc/ecoglabtransfer/500790/2013.05.10.12.28.58.313/clindasl0228.txt"; - ArrayList variables = new ArrayList(); + ArrayList variables = new ArrayList<>(); variables.add("nndpos"); variables.add("meno"); // variables.add("er1"); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java index d60d8a316e..c9f4f18056 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java @@ -32,7 +32,7 @@ /** * Holds the results of a cox analysis where calling dump(), toString() will give an output similar to R - * @author Scooter Willis + * @author Scooter Willis */ public class CoxInfo { @@ -59,9 +59,9 @@ public class CoxInfo { int numSamples = 0; int numEvents = 0; private LinkedHashMap metaDataFilter = null; - private LinkedHashMap coefficientsList = new LinkedHashMap(); - LinkedHashMap baselineSurvivorFunction = new LinkedHashMap(); - ArrayList survivalInfoList = new ArrayList(); + private LinkedHashMap coefficientsList = new LinkedHashMap<>(); + LinkedHashMap baselineSurvivorFunction = new LinkedHashMap<>(); + ArrayList survivalInfoList = new ArrayList<>(); /** * */ @@ -184,7 +184,7 @@ public double[] getWeighted() { * @return */ public double[][] getVariableResiduals() { - ArrayList variables = new ArrayList(coefficientsList.keySet()); + ArrayList variables = new ArrayList<>(coefficientsList.keySet()); double[][] rr = new double[survivalInfoList.size()][variables.size()]; int p = 0; for (SurvivalInfo si : this.survivalInfoList) { @@ -204,7 +204,7 @@ public double[][] getVariableResiduals() { * @param rr */ public void setVariableResiduals(double[][] rr) { - ArrayList variables = new ArrayList(coefficientsList.keySet()); + ArrayList variables = new ArrayList<>(coefficientsList.keySet()); int p = 0; for (SurvivalInfo si : this.survivalInfoList) { @@ -320,7 +320,7 @@ private void calcSummaryValues() { //beta - ArrayList variables = new ArrayList(coefficientsList.keySet()); + ArrayList variables = new ArrayList<>(coefficientsList.keySet()); for (int i = 0; i < variables.size(); i++) { String variable = variables.get(i); CoxCoefficient coe = coefficientsList.get(variable); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxMart.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxMart.java index d49545efa6..9c54c37618 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxMart.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxMart.java @@ -44,7 +44,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxMart { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxMethod.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxMethod.java index 64cfe1fdde..fe26661fd8 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxMethod.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxMethod.java @@ -22,7 +22,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public enum CoxMethod{ /** diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxR.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxR.java index 6a3002f492..d23ded840b 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxR.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxR.java @@ -75,7 +75,7 @@ * weights(n) :case weights * init :initial estimate for the coefficients * eps :tolerance for convergence. Iteration continues until - * the percent change in loglikelihood is <= eps. + * the percent change in loglikelihood is <= eps. * chol_tol : tolerance for the Cholesky decompostion * method : 0=Breslow, 1=Efron * doscale : 0=don't scale the X matrix, 1=scale the X matrix @@ -106,7 +106,7 @@ *

      * the data must be sorted by ascending time within strata * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxR { @@ -273,7 +273,7 @@ public CoxInfo process(ArrayList variables, ArrayList data ArrayList clusterList = null; if(cluster){ - clusterList = new ArrayList(); + clusterList = new ArrayList<>(); } //copy data over to local arrays to minimuze changing code for (person = 0; person < nused; person++) { @@ -797,7 +797,7 @@ public void coxphfitSCleanup(CoxInfo ci, boolean useWeighted,boolean robust, Arr double[] infs = Matrix.abs(Matrix.multiply(ci.u, ci.getVariance())); // StdArrayIO.print(infs); - ArrayList coxCoefficients = new ArrayList(ci.getCoefficientsList().values()); + ArrayList coxCoefficients = new ArrayList<>(ci.getCoefficientsList().values()); for (int i = 0; i < infs.length; i++) { double inf = infs[i]; @@ -958,7 +958,7 @@ public static void main(String[] args) { WorkSheet worksheet = WorkSheet.readCSV(is, '\t'); - ArrayList survivalInfoList = new ArrayList(); + ArrayList survivalInfoList = new ArrayList<>(); int i = 0; for (String row : worksheet.getRows()) { double time = worksheet.getCellDouble(row, "TIME"); @@ -977,7 +977,7 @@ public static void main(String[] args) { } CoxR cox = new CoxR(); - ArrayList variables = new ArrayList(); + ArrayList variables = new ArrayList<>(); // variables.add("AGE"); variables.add("AGE"); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxScore.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxScore.java index dd8e73822e..3de88ec20a 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxScore.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxScore.java @@ -24,7 +24,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxScore { @@ -41,7 +41,7 @@ public static double[][] process(CoxMethod method, ArrayList survi double temp; int n = survivalInfoList.size(); - ArrayList variables = new ArrayList(coxInfo.getCoefficientsList().keySet()); + ArrayList variables = new ArrayList<>(coxInfo.getCoefficientsList().keySet()); int nvar = variables.size(); double deaths; diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxVariables.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxVariables.java index bfcaa5bd97..6b477cb496 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxVariables.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxVariables.java @@ -25,7 +25,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxVariables { @@ -55,7 +55,7 @@ public int getUniqueID() { String link = geneSet + "_" + cohortName; return link.hashCode(); } - private LinkedHashMap coxInfoHashMap = new LinkedHashMap(); + private LinkedHashMap coxInfoHashMap = new LinkedHashMap<>(); /** * diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/ResidualsCoxph.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/ResidualsCoxph.java index 819ad24e0b..42b34905cc 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/ResidualsCoxph.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/ResidualsCoxph.java @@ -29,7 +29,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class ResidualsCoxph { @@ -124,7 +124,7 @@ public static double[][] process(CoxInfo ci, Type type, boolean useWeighted, Arr * @return */ private static double[][] rowsum(double[][] rr, ArrayList sets) throws Exception { - LinkedHashMap sumMap = new LinkedHashMap(); + LinkedHashMap sumMap = new LinkedHashMap<>(); if (rr.length != sets.size()) { throw new Exception("Cluster value for each sample are not of equal length n=" + rr.length + " cluster length=" + sets.size()); } @@ -144,7 +144,7 @@ private static double[][] rowsum(double[][] rr, ArrayList sets) throws E sum = new double[sumMap.size()][rr[0].length]; } - ArrayList index = new ArrayList(sumMap.keySet()); + ArrayList index = new ArrayList<>(sumMap.keySet()); //sorting does seem to make a difference in test cases at the .0000000001 // ArrayList in = new ArrayList(); // for (String s : index) { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/RiskInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/RiskInfo.java index 9e050b62da..6a8b9c4316 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/RiskInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/RiskInfo.java @@ -22,7 +22,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class RiskInfo { double weight; diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/StrataInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/StrataInfo.java index 11b01cf41c..8a50d559fb 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/StrataInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/StrataInfo.java @@ -27,23 +27,23 @@ /** * Information needed to represent a survival curve * - * @author Scooter Willis + * @author Scooter Willis */ public class StrataInfo { - private ArrayList time = new ArrayList(); - private ArrayList status = new ArrayList(); - private ArrayList nevent = new ArrayList(); - private ArrayList ncens = new ArrayList(); - private ArrayList nrisk = new ArrayList(); - private ArrayList weight = new ArrayList(); - private ArrayList surv = new ArrayList(); - private ArrayList varhaz = new ArrayList(); - private ArrayList stderr = new ArrayList(); - private ArrayList stdlow = new ArrayList(); - private ArrayList upper = new ArrayList(); - private ArrayList lower = new ArrayList(); - private LinkedHashMap ndead = new LinkedHashMap(); + private ArrayList time = new ArrayList<>(); + private ArrayList status = new ArrayList<>(); + private ArrayList nevent = new ArrayList<>(); + private ArrayList ncens = new ArrayList<>(); + private ArrayList nrisk = new ArrayList<>(); + private ArrayList weight = new ArrayList<>(); + private ArrayList surv = new ArrayList<>(); + private ArrayList varhaz = new ArrayList<>(); + private ArrayList stderr = new ArrayList<>(); + private ArrayList stdlow = new ArrayList<>(); + private ArrayList upper = new ArrayList<>(); + private ArrayList lower = new ArrayList<>(); + private LinkedHashMap ndead = new LinkedHashMap<>(); DecimalFormat df = new DecimalFormat("#.######"); DecimalFormat dfe = new DecimalFormat("0.000000E0"); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvFitInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvFitInfo.java index 0d2567a78b..fa3d30f756 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvFitInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvFitInfo.java @@ -25,12 +25,12 @@ /** * Contains info for graphing km figures * - * @author Scooter Willis + * @author Scooter Willis */ public class SurvFitInfo { - private LinkedHashMap strataInfoHashMap = new LinkedHashMap(); - private LinkedHashMap unweightedStrataInfoHashMap = new LinkedHashMap(); + private LinkedHashMap strataInfoHashMap = new LinkedHashMap<>(); + private LinkedHashMap unweightedStrataInfoHashMap = new LinkedHashMap<>(); private boolean weighted = false; diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfo.java index 6d4455193e..c60d197682 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfo.java @@ -29,7 +29,7 @@ * The code handles figuring out if a variables is continuous or categorical. If categorical will * convert to numerical values. * - * @author Scooter Willis + * @author Scooter Willis */ public class SurvivalInfo implements Comparable { @@ -45,12 +45,12 @@ public class SurvivalInfo implements Comparable { private double residual = 0.0; private String clusterValue = ""; - LinkedHashMap residualVariableMap = new LinkedHashMap(); + LinkedHashMap residualVariableMap = new LinkedHashMap<>(); - LinkedHashMap data = new LinkedHashMap(); + LinkedHashMap data = new LinkedHashMap<>(); // LinkedHashMap discreteData = new LinkedHashMap(); - LinkedHashMap unknownDataType = new LinkedHashMap(); - LinkedHashMap originalMetaData = new LinkedHashMap(); + LinkedHashMap unknownDataType = new LinkedHashMap<>(); + LinkedHashMap originalMetaData = new LinkedHashMap<>(); /** * @@ -177,7 +177,7 @@ public Double getContinuousVariable(String variable) { * @return */ public ArrayList getGroupCategories(String groupName) { - ArrayList groupNameList = new ArrayList(); + ArrayList groupNameList = new ArrayList<>(); for (String key : data.keySet()) { if (key.startsWith(groupName + "_")) { groupNameList.add(key); @@ -199,7 +199,7 @@ public ArrayList getGroupCategories(String groupName) { * @return */ public ArrayList getDataVariables(){ - ArrayList v = new ArrayList(); + ArrayList v = new ArrayList<>(); v.addAll(data.keySet()); v.addAll(unknownDataType.keySet()); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java index 4e5c0981c0..bf89f51fc8 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java @@ -27,7 +27,7 @@ /** * Used to work with SurvivalInfo - * @author Scooter Willis + * @author Scooter Willis */ public class SurvivalInfoHelper { @@ -86,13 +86,13 @@ private static boolean isCategorical(LinkedHashMap values) { public static void categorizeData(ArrayList DataT) { //Go through and get all variable value pairs - LinkedHashMap> valueMap = new LinkedHashMap>(); + LinkedHashMap> valueMap = new LinkedHashMap<>(); for (SurvivalInfo si : DataT) { for (String key : si.unknownDataType.keySet()) { LinkedHashMap map = valueMap.get(key); if (map == null) { - map = new LinkedHashMap(); + map = new LinkedHashMap<>(); valueMap.put(key, map); } map.put(si.unknownDataType.get(key), null); @@ -102,7 +102,7 @@ public static void categorizeData(ArrayList DataT) { for (String variable : valueMap.keySet()) { LinkedHashMap values = valueMap.get(variable); if (isCategorical(values)) { - ArrayList categories = new ArrayList(values.keySet()); + ArrayList categories = new ArrayList<>(values.keySet()); Collections.sort(categories); //go ahead and put in alphabetical order if (categories.size() == 2) { for (String value : values.keySet()) { @@ -147,7 +147,7 @@ public static void categorizeData(ArrayList DataT) { * @return */ public static ArrayList addInteraction(String variable1, String variable2, ArrayList survivalInfoList) { - ArrayList variables = new ArrayList(); + ArrayList variables = new ArrayList<>(); variables.add(variable1); variables.add(variable2); variables.add(variable1 + ":" + variable2); @@ -170,7 +170,7 @@ public static ArrayList addInteraction(String variable1, String variable * @throws Exception */ public static void groupByRange(double[] range, String variable, String groupName, ArrayList survivalInfoList) throws Exception { - ArrayList labels = new ArrayList(); + ArrayList labels = new ArrayList<>(); for (int i = 0; i < range.length; i++) { String label = ""; if (i == 0) { @@ -184,7 +184,7 @@ public static void groupByRange(double[] range, String variable, String groupNam } labels.add(label); } - ArrayList validLabels = new ArrayList(); + ArrayList validLabels = new ArrayList<>(); //need to find the categories so we can set 1 and 0 and not include ranges with no values for (SurvivalInfo si : survivalInfoList) { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoIndex.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoIndex.java index 51c443b0b7..1a87f906f4 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoIndex.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoIndex.java @@ -22,7 +22,7 @@ /** * Not used and probably should be deleted - * @author Scooter Willis + * @author Scooter Willis */ public class SurvivalInfoIndex implements Comparable { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/WaldTest.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/WaldTest.java index fb011e3cf4..b0996e80e6 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/WaldTest.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/WaldTest.java @@ -25,7 +25,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class WaldTest { //coxph_wtest, df=as.integer(nvar),as.integer(ntest),as.double(var),tests= as.double(b),solve= double(nvar*ntest),as.double(toler.chol)) diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/WaldTestInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/WaldTestInfo.java index f5f09d8b03..30cdd1e3f3 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/WaldTestInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/WaldTestInfo.java @@ -24,7 +24,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class WaldTestInfo { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxComparatorInterface.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxComparatorInterface.java index 703936e751..fa012ead4d 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxComparatorInterface.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxComparatorInterface.java @@ -27,7 +27,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public interface CoxComparatorInterface extends Comparator { public String getDescription(); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxVariablesOverallModelFitComparator.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxVariablesOverallModelFitComparator.java index 964b1e254f..4ec710d6c1 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxVariablesOverallModelFitComparator.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxVariablesOverallModelFitComparator.java @@ -28,7 +28,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxVariablesOverallModelFitComparator implements Comparator, Serializable { private static final long serialVersionUID = 1; diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxVariablesVariableComparator.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxVariablesVariableComparator.java index 1c48b2dcf0..3c7e2c16d8 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxVariablesVariableComparator.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/CoxVariablesVariableComparator.java @@ -25,7 +25,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class CoxVariablesVariableComparator implements CoxComparatorInterface { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/MeanModelComparator.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/MeanModelComparator.java index 5f61766a25..4ac6a3f402 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/MeanModelComparator.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/MeanModelComparator.java @@ -28,7 +28,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class MeanModelComparator implements Comparator, Serializable { private static final long serialVersionUID = 1; diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/SurvivalInfoComparator.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/SurvivalInfoComparator.java index f8415af304..899e5e0cb4 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/SurvivalInfoComparator.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/SurvivalInfoComparator.java @@ -27,7 +27,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class SurvivalInfoComparator implements Comparator, Serializable { private static final long serialVersionUID = 1; diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/SurvivalInfoValueComparator.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/SurvivalInfoValueComparator.java index 81098c46cf..f639be0079 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/SurvivalInfoValueComparator.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/comparators/SurvivalInfoValueComparator.java @@ -27,7 +27,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class SurvivalInfoValueComparator implements Comparator, Serializable { private static final long serialVersionUID = 1; diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/AgScore.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/AgScore.java index ba85c9084b..1a3488b1ec 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/AgScore.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/AgScore.java @@ -28,7 +28,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class AgScore { @@ -45,7 +45,7 @@ public static double[][] process(CoxMethod method, ArrayList survi //double temp; int n = survivalInfoList.size(); - ArrayList variables = new ArrayList(coxInfo.getCoefficientsList().keySet()); + ArrayList variables = new ArrayList<>(coxInfo.getCoefficientsList().keySet()); int nvar = variables.size(); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/ChiSq.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/ChiSq.java index 4ad714f549..d193e6104b 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/ChiSq.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/ChiSq.java @@ -22,7 +22,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class ChiSq { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/Cholesky2.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/Cholesky2.java index 8c4f81af3b..8ce9f73ff5 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/Cholesky2.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/Cholesky2.java @@ -22,7 +22,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class Cholesky2 { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/Chsolve2.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/Chsolve2.java index dad7d06688..8f62db56c3 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/Chsolve2.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/stats/Chsolve2.java @@ -22,7 +22,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class Chsolve2 { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/ChangeValue.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/ChangeValue.java index b5841d9f63..5e734a27ba 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/ChangeValue.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/ChangeValue.java @@ -23,7 +23,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public interface ChangeValue { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/CompactCharSequence.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/CompactCharSequence.java index 68cf58c0a8..eb029560cb 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/CompactCharSequence.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/CompactCharSequence.java @@ -25,7 +25,7 @@ /** *http://www.javamex.com/tutorials/memory/ascii_charsequence.shtml - * @author Scooter Willis + * @author Scooter Willis */ public class CompactCharSequence implements CharSequence, Serializable { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/HeaderInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/HeaderInfo.java index 7357eca3a3..71408271db 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/HeaderInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/HeaderInfo.java @@ -22,7 +22,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class HeaderInfo { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java index 57f0e983ce..542085942e 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java @@ -27,14 +27,14 @@ * Need to handle very large spreadsheets of expression data so keep memory * footprint low * - * @author Scooter Willis + * @author Scooter Willis */ public class WorkSheet { - private LinkedHashMap columnLookup = new LinkedHashMap(); - private LinkedHashMap rowLookup = new LinkedHashMap(); + private LinkedHashMap columnLookup = new LinkedHashMap<>(); + private LinkedHashMap rowLookup = new LinkedHashMap<>(); private CompactCharSequence[][] data = new CompactCharSequence[1][1]; - HashMap dataGrid = new HashMap(); + HashMap dataGrid = new HashMap<>(); private String indexColumnName = ""; /** @@ -233,14 +233,14 @@ public WorkSheet(CompactCharSequence[][] values) { data = values; } - private LinkedHashMap metaDataColumnsHashMap = new LinkedHashMap(); + private LinkedHashMap metaDataColumnsHashMap = new LinkedHashMap<>(); /** * * @return */ public ArrayList getMetaDataColumns() { - ArrayList metaColumns = new ArrayList(); + ArrayList metaColumns = new ArrayList<>(); for (String key : metaDataColumnsHashMap.keySet()) { HeaderInfo hi = columnLookup.get(key); if (!hi.isHide()) { @@ -255,7 +255,7 @@ public ArrayList getMetaDataColumns() { * @return */ public ArrayList getMetaDataRows() { - ArrayList metaRows = new ArrayList(); + ArrayList metaRows = new ArrayList<>(); for (String key : metaDataRowsHashMap.keySet()) { HeaderInfo hi = rowLookup.get(key); if (!hi.isHide()) { @@ -270,7 +270,7 @@ public ArrayList getMetaDataRows() { * @return */ public ArrayList getDataColumns() { - ArrayList dataColumns = new ArrayList(); + ArrayList dataColumns = new ArrayList<>(); ArrayList columns = this.getColumns(); for (String column : columns) { if (!metaDataColumnsHashMap.containsKey(column)) { @@ -292,7 +292,7 @@ public void shuffleColumnsAndThenRows(ArrayList columns, ArrayList rowIndex = new ArrayList(); + ArrayList rowIndex = new ArrayList<>(); for (int i = 0; i < rows.size(); i++) { rowIndex.add(i); } @@ -311,7 +311,7 @@ public void shuffleColumnsAndThenRows(ArrayList columns, ArrayList columnIndex = new ArrayList(); + ArrayList columnIndex = new ArrayList<>(); for (int i = 0; i < columns.size(); i++) { columnIndex.add(i); } @@ -344,7 +344,7 @@ public void shuffleColumnValues(ArrayList columns) throws Exception { doubleValues.clear(); ArrayList rows = this.getDataRows(); for (String column : columns) { //shuffle all values in the column - ArrayList rowIndex = new ArrayList(); + ArrayList rowIndex = new ArrayList<>(); for (int i = 0; i < rows.size(); i++) { rowIndex.add(i); } @@ -375,7 +375,7 @@ public void shuffleRowValues(ArrayList rows) throws Exception { doubleValues.clear(); ArrayList columns = this.getColumns(); for (String row : rows) { - ArrayList columnIndex = new ArrayList(); + ArrayList columnIndex = new ArrayList<>(); for (int i = 0; i < columns.size(); i++) { columnIndex.add(i); } @@ -521,7 +521,7 @@ public boolean isMetaDataRow(String row) { return true; } } - private LinkedHashMap metaDataRowsHashMap = new LinkedHashMap(); + private LinkedHashMap metaDataRowsHashMap = new LinkedHashMap<>(); /** * @@ -646,7 +646,7 @@ public void applyColumnFilter(String column, ChangeValue changeValue) throws Exc * @param defaultValue */ public void addColumn(String column, String defaultValue) { - ArrayList columns = new ArrayList(); + ArrayList columns = new ArrayList<>(); columns.add(column); addColumns(columns, defaultValue); } @@ -694,7 +694,7 @@ public void addColumns(ArrayList columns, String defaultValue) { * @param defaultValue */ public void addRow(String row, String defaultValue) { - ArrayList rows = new ArrayList(); + ArrayList rows = new ArrayList<>(); rows.add(row); addRows(rows, defaultValue); } @@ -808,7 +808,7 @@ public boolean isValidColumn(String col) { } } //When we do gene signatures we ask for the same data value often. This method took up 50% of the time. - HashMap doubleValues = new HashMap(); + HashMap doubleValues = new HashMap<>(); boolean cacheDoubleValues = false; /** @@ -909,7 +909,7 @@ public String getCell(String row, String col) throws Exception { * @param changeValue */ public void changeRowHeader(ChangeValue changeValue) { - ArrayList rows = new ArrayList(rowLookup.keySet()); + ArrayList rows = new ArrayList<>(rowLookup.keySet()); for (String row : rows) { String newRow = changeValue.change(row); HeaderInfo value = rowLookup.get(row); @@ -923,7 +923,7 @@ public void changeRowHeader(ChangeValue changeValue) { * @param changeValue */ public void changeColumnHeader(ChangeValue changeValue) { - ArrayList columns = new ArrayList(columnLookup.keySet()); + ArrayList columns = new ArrayList<>(columnLookup.keySet()); for (String col : columns) { String newCol = changeValue.change(col); HeaderInfo value = columnLookup.get(col); @@ -1030,8 +1030,8 @@ public ArrayList getRandomDataColumns(int number) { * @return */ public ArrayList getRandomDataColumns(int number, ArrayList columns) { - ArrayList randomColumns = new ArrayList(); - HashMap picked = new HashMap(); + ArrayList randomColumns = new ArrayList<>(); + HashMap picked = new HashMap<>(); while (picked.size() < number) { double v = Math.random(); int index = (int) (v * columns.size()); @@ -1051,7 +1051,7 @@ public ArrayList getRandomDataColumns(int number, ArrayList colu * @return */ public ArrayList getAllColumns() { - ArrayList columns = new ArrayList(); + ArrayList columns = new ArrayList<>(); for (String col : columnLookup.keySet()) { columns.add(col); } @@ -1064,7 +1064,7 @@ public ArrayList getAllColumns() { * @return */ public ArrayList getColumns() { - ArrayList columns = new ArrayList(); + ArrayList columns = new ArrayList<>(); for (String col : columnLookup.keySet()) { HeaderInfo hi = columnLookup.get(col); if (!hi.isHide()) { @@ -1082,8 +1082,8 @@ public ArrayList getColumns() { * @throws Exception */ public ArrayList getDiscreteColumnValues(String column) throws Exception { - HashMap hashMapValues = new HashMap(); - ArrayList values = new ArrayList(); + HashMap hashMapValues = new HashMap<>(); + ArrayList values = new ArrayList<>(); ArrayList rows = getDataRows(); for (String row : rows) { String value = getCell(row, column); @@ -1103,8 +1103,8 @@ public ArrayList getDiscreteColumnValues(String column) throws Exception * @throws Exception */ public ArrayList getDiscreteRowValues(String row) throws Exception { - HashMap hashMapValues = new HashMap(); - ArrayList values = new ArrayList(); + HashMap hashMapValues = new HashMap<>(); + ArrayList values = new ArrayList<>(); for (String column : getColumns()) { String value = getCell(row, column); if (!hashMapValues.containsKey(value)) { @@ -1121,7 +1121,7 @@ public ArrayList getDiscreteRowValues(String row) throws Exception { * @return */ public ArrayList getAllRows() { - ArrayList rows = new ArrayList(); + ArrayList rows = new ArrayList<>(); for (String row : rowLookup.keySet()) { rows.add(row); } @@ -1135,7 +1135,7 @@ public ArrayList getAllRows() { * @return */ public ArrayList getRows() { - ArrayList rows = new ArrayList(); + ArrayList rows = new ArrayList<>(); for (String row : rowLookup.keySet()) { HeaderInfo hi = rowLookup.get(row); if (!hi.isHide()) { @@ -1151,7 +1151,7 @@ public ArrayList getRows() { * @return */ public ArrayList getDataRows() { - ArrayList rows = new ArrayList(); + ArrayList rows = new ArrayList<>(); for (String row : rowLookup.keySet()) { if (this.isMetaDataRow(row)) { continue; @@ -1262,7 +1262,7 @@ static CompactCharSequence[][] getAllValuesCompactCharSequence(InputStream is, c BufferedReader br = new BufferedReader(new InputStreamReader(is)); - ArrayList rows = new ArrayList(); + ArrayList rows = new ArrayList<>(); String line = br.readLine(); int numcolumns = -1; @@ -1309,7 +1309,7 @@ static CompactCharSequence[][] getAllValuesCompactCharSequence(InputStream is, c static String[][] getAllValues(String fileName, char delimiter) throws Exception { FileReader reader = new FileReader(fileName); BufferedReader br = new BufferedReader(reader); - ArrayList rows = new ArrayList(); + ArrayList rows = new ArrayList<>(); String line = br.readLine(); int numcolumns = -1; @@ -1388,7 +1388,7 @@ static public WorkSheet unionWorkSheetsRowJoin(WorkSheet w1, WorkSheet w2, boole } } - ArrayList joinedColumns = new ArrayList(); + ArrayList joinedColumns = new ArrayList<>(); joinedColumns.addAll(w1DataColumns); joinedColumns.addAll(w2DataColumns); if (!joinedColumns.contains("META_DATA") && (w1MetaDataColumns.size() > 0 || w2MetaDataColumns.size() > 0)) { @@ -1406,9 +1406,9 @@ static public WorkSheet unionWorkSheetsRowJoin(WorkSheet w1, WorkSheet w2, boole } ArrayList w1Rows = w1.getRows(); ArrayList w2Rows = w2.getRows(); - ArrayList rows = new ArrayList(); + ArrayList rows = new ArrayList<>(); - HashSet w1Key = new HashSet(w1Rows); + HashSet w1Key = new HashSet<>(w1Rows); for (String key : w2Rows) { if (w1Key.contains(key)) { rows.add(key); @@ -1419,7 +1419,7 @@ static public WorkSheet unionWorkSheetsRowJoin(WorkSheet w1, WorkSheet w2, boole for (String row : rows) { for (String column : w1Columns) { - if (column.equals("META_DATA")) { + if ("META_DATA".equals(column)) { continue; } String value = w1.getCell(row, column); @@ -1429,7 +1429,7 @@ static public WorkSheet unionWorkSheetsRowJoin(WorkSheet w1, WorkSheet w2, boole for (String row : rows) { for (String column : w2Columns) { - if (column.equals("META_DATA")) { + if ("META_DATA".equals(column)) { continue; } String value = w2.getCell(row, column); @@ -1464,7 +1464,7 @@ static public WorkSheet readCSV(File f, char delimiter) throws Exception { /** * Read a CSV/Tab delimited file where you pass in the delimiter * - * @param f + * @param is * @param delimiter * @return * @throws Exception @@ -1619,11 +1619,11 @@ public void save(OutputStream outputStream, char delimitter, boolean quoteit) th String value = getCell(row, col); outputStream.write(delimitter); if (!this.isMetaDataColumn(col) && !this.isMetaDataRow(row)) { - if (value == null || value.length() == 0 || value.equalsIgnoreCase("null")) { + if (value == null || value.length() == 0 || "null".equalsIgnoreCase(value)) { value = "NaN"; } } else { - if (value == null || value.length() == 0 || value.equalsIgnoreCase("null")) { + if (value == null || value.length() == 0 || "null".equalsIgnoreCase(value)) { value = ""; } } diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/CensorStatus.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/CensorStatus.java index afad3d4dd9..1d27224485 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/CensorStatus.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/CensorStatus.java @@ -126,7 +126,7 @@ public int compareTo(CensorStatus o) { if (censored.equals(o.censored)) { return 0; } - if (censored.equals("0")) { + if ("0".equals(censored)) { return -1; } else { return 1; diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/ExpressionFigure.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/ExpressionFigure.java index a6fda3f095..51142aeab0 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/ExpressionFigure.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/ExpressionFigure.java @@ -35,13 +35,13 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class ExpressionFigure extends JPanel { private static final long serialVersionUID = 1L; - ArrayList title = new ArrayList(); + ArrayList title = new ArrayList<>(); /** * */ @@ -70,8 +70,8 @@ public class ExpressionFigure extends JPanel { FontMetrics fm; KMFigureInfo kmfi = new KMFigureInfo(); // LinkedHashMap> survivalData = new LinkedHashMap>(); - ArrayList lineInfoList = new ArrayList(); - ArrayList siList = new ArrayList(); + ArrayList lineInfoList = new ArrayList<>(); + ArrayList siList = new ArrayList<>(); String variable = ""; private String fileName = ""; @@ -120,7 +120,7 @@ public void setFigureLineInfo(ArrayList lineInfoList) { * @param variable */ public void setSurvivalInfo(ArrayList title, ArrayList _siList, String variable) { - this.siList = new ArrayList(); + this.siList = new ArrayList<>(); this.title = title; this.variable = variable; @@ -372,13 +372,13 @@ public static void main(String[] args) { application.setSize(500, 400); // window is 500 pixels wide, 400 high application.setVisible(true); - ArrayList titles = new ArrayList(); + ArrayList titles = new ArrayList<>(); titles.add("Line 1"); titles.add("line 2"); - ArrayList figureInfo = new ArrayList(); + ArrayList figureInfo = new ArrayList<>(); - ArrayList survivalInfoList = new ArrayList(); + ArrayList survivalInfoList = new ArrayList<>(); for (int i = 0; i < 600; i++) { double r = Math.random(); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/GroupResults.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/GroupResults.java index abdfe810b6..6c2e0b1b90 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/GroupResults.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/GroupResults.java @@ -24,7 +24,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class GroupResults { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KMFigureInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KMFigureInfo.java index 24f053d592..c3b9bed262 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KMFigureInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KMFigureInfo.java @@ -27,7 +27,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class KMFigureInfo { @@ -87,7 +87,7 @@ public class KMFigureInfo { * */ public Color[] legendColor = {Color.RED, Color.BLUE, Color.GREEN, Color.CYAN, Color.ORANGE, Color.YELLOW, Color.MAGENTA, Color.PINK}; - public ArrayList xAxisLabels = new ArrayList();//new ArrayList(Arrays.asList(0.0, 5.0, 10.0, 15.0, 20.0)); + public ArrayList xAxisLabels = new ArrayList<>();//new ArrayList(Arrays.asList(0.0, 5.0, 10.0, 15.0, 20.0)); public String xAxisLegend = ""; public String yAxisLegend = ""; public Color getColor(int index) { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KaplanMeierFigure.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KaplanMeierFigure.java index c5d358cbeb..21e68ccdd0 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KaplanMeierFigure.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KaplanMeierFigure.java @@ -36,13 +36,13 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class KaplanMeierFigure extends JPanel { private static final long serialVersionUID = 1L; - ArrayList title = new ArrayList(); + ArrayList title = new ArrayList<>(); /** * */ @@ -69,12 +69,12 @@ public class KaplanMeierFigure extends JPanel { double maxPercentage = 1.0; FontMetrics fm; KMFigureInfo kmfi = new KMFigureInfo(); - LinkedHashMap> survivalData = new LinkedHashMap>(); - ArrayList lineInfoList = new ArrayList(); + LinkedHashMap> survivalData = new LinkedHashMap<>(); + ArrayList lineInfoList = new ArrayList<>(); SurvFitInfo sfi = new SurvFitInfo(); private String fileName = ""; - private ArrayList xAxisTimeValues = new ArrayList(); - private ArrayList xAxisTimeCoordinates = new ArrayList(); + private ArrayList xAxisTimeValues = new ArrayList<>(); + private ArrayList xAxisTimeCoordinates = new ArrayList<>(); /** * @@ -91,7 +91,7 @@ public KaplanMeierFigure() { * @return */ public ArrayList getGroups() { - return new ArrayList(survivalData.keySet()); + return new ArrayList<>(survivalData.keySet()); } /** @@ -160,7 +160,7 @@ public void setFigureLineInfo(ArrayList lineInfoList) { * @throws Exception */ public void setCoxInfo(ArrayList title, CoxInfo ci, String strataVariable, LinkedHashMap legendMap, Boolean useWeighted) throws Exception { - LinkedHashMap> survivalData = new LinkedHashMap>(); + LinkedHashMap> survivalData = new LinkedHashMap<>(); ArrayList siList = ci.getSurvivalInfoList(); int n = 0; int event = 0; @@ -173,7 +173,7 @@ public void setCoxInfo(ArrayList title, CoxInfo ci, String strataVariabl } ArrayList censorStatusList = survivalData.get(legend); if (censorStatusList == null) { - censorStatusList = new ArrayList(); + censorStatusList = new ArrayList<>(); survivalData.put(legend, censorStatusList); } CensorStatus cs = new CensorStatus(strata, si.getTime(), si.getStatus() + ""); @@ -195,7 +195,7 @@ public void setCoxInfo(ArrayList title, CoxInfo ci, String strataVariabl // System.out.println("setCoxInfo=" + cc.pvalue + " " + title); - ArrayList lines = new ArrayList(); + ArrayList lines = new ArrayList<>(); lines.add(line1); lines.add(line2); lines.add(line3); @@ -303,7 +303,7 @@ public void setSurvivalData(ArrayList title, LinkedHashMap labels = new ArrayList(survivalData.keySet()); + ArrayList labels = new ArrayList<>(survivalData.keySet()); Collections.sort(labels); for (String legend : labels) { ArrayList censorStatusList = survivalData.get(legend); @@ -394,7 +394,7 @@ private void drawSurvivalCurves(Graphics g) { int colorIndex = 0; - ArrayList labels = new ArrayList(sfi.getStrataInfoHashMap().keySet()); + ArrayList labels = new ArrayList<>(sfi.getStrataInfoHashMap().keySet()); Collections.sort(labels); LinkedHashMap strataInfoHashMap = sfi.getStrataInfoHashMap(); @@ -763,7 +763,7 @@ public static void main(String[] args) { try { KaplanMeierFigure kaplanMeierFigure = new KaplanMeierFigure(); - LinkedHashMap> survivalDataHashMap = new LinkedHashMap>(); + LinkedHashMap> survivalDataHashMap = new LinkedHashMap<>(); // if (false) { //http://sph.bu.edu/otlt/MPH-Modules/BS/BS704_Survival/ // ArrayList graph1 = new ArrayList(); @@ -801,7 +801,7 @@ public static void main(String[] args) { - ArrayList graph1 = new ArrayList(); + ArrayList graph1 = new ArrayList<>(); graph1.add(new CensorStatus("A", 1.0, "1")); graph1.add(new CensorStatus("A", 1.0, "1")); graph1.add(new CensorStatus("A", 1.0, "1")); @@ -841,7 +841,7 @@ public static void main(String[] args) { survivalDataHashMap.put("Label 1", graph1); - ArrayList graph2 = new ArrayList(); + ArrayList graph2 = new ArrayList<>(); graph2.add(new CensorStatus("A", 1.0, "1")); graph2.add(new CensorStatus("A", 1.0, "1")); graph2.add(new CensorStatus("A", 1.0, "0")); @@ -882,7 +882,7 @@ public static void main(String[] args) { survivalDataHashMap.put("Label 2", graph2); } - ArrayList figureInfo = new ArrayList(); + ArrayList figureInfo = new ArrayList<>(); //DecimalFormat dfe = new DecimalFormat("0.00E0"); //DecimalFormat df = new DecimalFormat("0.00"); @@ -896,7 +896,7 @@ public static void main(String[] args) { application.setSize(500, 400); // window is 500 pixels wide, 400 high application.setVisible(true); - ArrayList titles = new ArrayList(); + ArrayList titles = new ArrayList<>(); titles.add("Line 1"); titles.add("Line 2"); kaplanMeierFigure.setSurvivalData(titles, survivalDataHashMap, true); 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 9bc6d0572a..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 @@ -31,7 +31,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class NumbersAtRiskPanel extends JPanel { @@ -69,14 +69,14 @@ private void paintTable(Graphics g) { g2.setStroke(kmfi.kmStroke); SurvFitInfo sfi = kmf.getSurvivalFitInfo(); - LinkedHashMap sfiHashMap = new LinkedHashMap(); + LinkedHashMap sfiHashMap = new LinkedHashMap<>(); if(sfi.isWeighted()){ sfiHashMap = sfi.getUnweightedStrataInfoHashMap(); }else{ sfiHashMap = sfi.getStrataInfoHashMap(); } - if(sfiHashMap.size() == 0) + if(sfiHashMap.isEmpty()) return; //int height = this.getHeight(); @@ -94,7 +94,7 @@ private void paintTable(Graphics g) { ArrayList xaxisTimeValues = kmf.getxAxisTimeValues(); ArrayList xAxisTimeCoordinates = kmf.getxAxisTimeCoordinates(); - ArrayList labels = new ArrayList(sfiHashMap.keySet()); + ArrayList labels = new ArrayList<>(sfiHashMap.keySet()); Collections.sort(labels); for (String group : labels) { @@ -104,7 +104,7 @@ private void paintTable(Graphics g) { g2.drawLine(15, row - fontHeight/2, left - 5, row - fontHeight/2); g2.setColor(Color.BLACK); StrataInfo si = sfiHashMap.get(group); - if(kmf.title.toString().equals("[APOBEC1 Transhera Observation Arm]")){ + if("[APOBEC1 Transhera Observation Arm]".equals(kmf.title.toString())){ //int dummy = 1; } // System.out.println(kmf.title + " Group " + group); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/SurvFitKM.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/SurvFitKM.java index f315eaaf0a..0167aa591a 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/SurvFitKM.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/SurvFitKM.java @@ -34,7 +34,7 @@ * Ported from survfitKM.S When combining multiple entries with same time not * sure how the weighting adds up * - * @author Scooter Willis + * @author Scooter Willis */ public class SurvFitKM { @@ -122,7 +122,7 @@ public enum ConfLower { * @throws Exception */ public SurvFitInfo process(LinkedHashMap> survivalData, boolean useWeights) throws Exception { - ArrayList survivalInfoList = new ArrayList(); + ArrayList survivalInfoList = new ArrayList<>(); int i = 0; for (String strata : survivalData.keySet()) { ArrayList csList = survivalData.get(strata); @@ -154,7 +154,7 @@ public SurvFitInfo process(LinkedHashMap> surviv */ public SurvFitInfo process(String datafile, String timeColumn, String statusColumn, String weightColumn, String variableColumn, boolean useWeights) throws Exception { WorkSheet worksheet = WorkSheet.readCSV(datafile, '\t'); - ArrayList survivalInfoList = new ArrayList(); + ArrayList survivalInfoList = new ArrayList<>(); int i = 1; for (String row : worksheet.getRows()) { @@ -223,8 +223,8 @@ public LinkedHashMap processStrataInfo(String variable, Arr int n = dataT.size(); - LinkedHashMap levels = new LinkedHashMap(); - LinkedHashMap> strataHashMap = new LinkedHashMap>(); + LinkedHashMap levels = new LinkedHashMap<>(); + LinkedHashMap> strataHashMap = new LinkedHashMap<>(); for (int i = 0; i < n; i++) { SurvivalInfo si = dataT.get(i); @@ -237,7 +237,7 @@ public LinkedHashMap processStrataInfo(String variable, Arr levels.put(value, count); ArrayList strataList = strataHashMap.get(value); if (strataList == null) { - strataList = new ArrayList(); + strataList = new ArrayList<>(); strataHashMap.put(value, strataList); } strataList.add(si); @@ -246,7 +246,7 @@ public LinkedHashMap processStrataInfo(String variable, Arr //int nstrat = levels.size(); - LinkedHashMap strataInfoHashMap = new LinkedHashMap(); + LinkedHashMap strataInfoHashMap = new LinkedHashMap<>(); for (String strata : strataHashMap.keySet()) { @@ -379,8 +379,8 @@ public LinkedHashMap processStrataInfo(String variable, Arr } - ArrayList events = new ArrayList(); - ArrayList nrisk = new ArrayList(); + ArrayList events = new ArrayList<>(); + ArrayList nrisk = new ArrayList<>(); for (StrataInfo strataInfo : strataInfoHashMap.values()) { boolean firsttime = true; for (int j = 0; j < strataInfo.getNevent().size(); j++) { @@ -395,19 +395,19 @@ public LinkedHashMap processStrataInfo(String variable, Arr } } - ArrayList zz = new ArrayList(); + ArrayList zz = new ArrayList<>(); for (int i = 0; i < events.size(); i++) { if (events.get(i)) { zz.add(i + 1); } } zz.add(events.size() + 1); - ArrayList diffzz = new ArrayList(); + ArrayList diffzz = new ArrayList<>(); for (int i = 0; i < zz.size() - 1; i++) { diffzz.add(zz.get(i + 1) - zz.get(i)); } //System.out.println(diffzz); - ArrayList nlag = new ArrayList(); + ArrayList nlag = new ArrayList<>(); for (int j = 0; j < nrisk.size(); j++) { int count = diffzz.get(j); for (int c = 0; c < count; c++) { @@ -542,12 +542,12 @@ public static void main(String[] args) { application.setSize(500, 400); // window is 500 pixels wide, 400 high application.setVisible(true); - ArrayList titles = new ArrayList(); + ArrayList titles = new ArrayList<>(); titles.add("Line 1"); titles.add("line 2"); kaplanMeierFigure.setSurvivalData(titles, si, null); - ArrayList figureInfo = new ArrayList(); + ArrayList figureInfo = new ArrayList<>(); // figureInfo.add("HR=2.1 95% CI(1.8-2.5)"); // figureInfo.add("p-value=.001"); kaplanMeierFigure.setFigureLineInfo(figureInfo); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/ClinicalMetaDataOutcome.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/ClinicalMetaDataOutcome.java index b75cc2d3ad..b507f41f97 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/ClinicalMetaDataOutcome.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/ClinicalMetaDataOutcome.java @@ -27,7 +27,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class ClinicalMetaDataOutcome { @@ -66,7 +66,7 @@ static public void process(WorkSheet worksheet, String sensorMapColumn, LinkedHa public static void main(String[] args) { try { - LinkedHashMap censorMap = new LinkedHashMap(); + LinkedHashMap censorMap = new LinkedHashMap<>(); censorMap.put("a", "0"); censorMap.put("d", "1"); censorMap.put("d-d.s.", "1"); @@ -74,7 +74,7 @@ public static void main(String[] args) { String timeColumn = "TIME"; String sensorMapColumn = "last_follow_up_status"; // "survstat3"; double timeScale = 1.0; - ArrayList metaDataInfoList = new ArrayList(); + ArrayList metaDataInfoList = new ArrayList<>(); metaDataInfoList.add(new MetaDataInfo("age_at_diagnosis", true, new MeanQuantizer())); metaDataInfoList.add(new MetaDataInfo("size", true, new MeanQuantizer())); metaDataInfoList.add(new MetaDataInfo("lymph_nodes_positive", true, new MeanQuantizer())); diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/DiscreteQuantizerInterface.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/DiscreteQuantizerInterface.java index 5c80054a72..4d48bd71c3 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/DiscreteQuantizerInterface.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/DiscreteQuantizerInterface.java @@ -25,7 +25,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public interface DiscreteQuantizerInterface { /** diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/MeanQuantizer.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/MeanQuantizer.java index 964a365cdc..ba64cf1727 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/MeanQuantizer.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/MeanQuantizer.java @@ -25,7 +25,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class MeanQuantizer implements DiscreteQuantizerInterface { diff --git a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/MetaDataInfo.java b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/MetaDataInfo.java index 26bcef3081..75af37ca57 100644 --- a/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/MetaDataInfo.java +++ b/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/metadata/MetaDataInfo.java @@ -26,7 +26,7 @@ /** * - * @author Scooter Willis + * @author Scooter Willis */ public class MetaDataInfo { @@ -42,7 +42,7 @@ public class MetaDataInfo { * */ public DiscreteQuantizerInterface discreteQuantizer = null; - ArrayList discreteValues = new ArrayList(); + ArrayList discreteValues = new ArrayList<>(); /** * diff --git a/biojava-ws/pom.xml b/biojava-ws/pom.xml index 86cf1004f9..7e960b4445 100644 --- a/biojava-ws/pom.xml +++ b/biojava-ws/pom.xml @@ -3,7 +3,7 @@ biojava org.biojava - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT biojava-ws biojava-ws @@ -19,7 +19,7 @@ org.biojava biojava-core - 7.0.3-SNAPSHOT + 7.2.5-SNAPSHOT compile @@ -41,7 +41,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl org.apache.logging.log4j diff --git a/biojava-ws/src/main/java/demo/HmmerDemo.java b/biojava-ws/src/main/java/demo/HmmerDemo.java index 689d62ec92..3c6f3ff1f2 100644 --- a/biojava-ws/src/main/java/demo/HmmerDemo.java +++ b/biojava-ws/src/main/java/demo/HmmerDemo.java @@ -86,7 +86,7 @@ public static void main(String[] args) throws Exception { private static ProteinSequence getUniprot(String uniProtID) throws Exception { AminoAcidCompoundSet set = AminoAcidCompoundSet.getAminoAcidCompoundSet(); - UniprotProxySequenceReader uniprotSequence = new UniprotProxySequenceReader(uniProtID,set); + UniprotProxySequenceReader uniprotSequence = new UniprotProxySequenceReader<>(uniProtID,set); ProteinSequence seq = new ProteinSequence(uniprotSequence); diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastAlignmentParameterEnum.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastAlignmentParameterEnum.java index 061475071a..d6389dba98 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastAlignmentParameterEnum.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastAlignmentParameterEnum.java @@ -26,7 +26,7 @@ /** * Alignment request parameters accepted by QBlast service.
      * Not all are mandatory. Certain parameters only work with a subset of other parameters in the list. - *

      + *

      * Taken from Blast URL API * * @author Gediminas Rimsa diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputAlignmentFormatEnum.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputAlignmentFormatEnum.java index f414fb475d..13be691e5c 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputAlignmentFormatEnum.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputAlignmentFormatEnum.java @@ -25,7 +25,7 @@ /** * Enum representing available output alignment types. - *

      + *

      * Values as used in QBlast URL API. * * @author Gediminas Rimsa diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputFormatEnum.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputFormatEnum.java index 032d7e800a..3ccb1096e6 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputFormatEnum.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputFormatEnum.java @@ -25,7 +25,7 @@ /** * Enum representing available output formats. - *

      + *

      * Values are as used by QBlast URL API. * * @author Gediminas Rimsa diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputParameterEnum.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputParameterEnum.java index dfa144864d..b0ed9354fa 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputParameterEnum.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastOutputParameterEnum.java @@ -26,7 +26,7 @@ /** * Output parameters accepted by QBlast service.
      * Not all are mandatory. Certain parameters only work with a subset of other parameters in the list. - *

      + *

      * Taken from Blast URL API * * @author Gediminas Rimsa diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastProgramEnum.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastProgramEnum.java index 90c0557c78..ee020bc38d 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastProgramEnum.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/BlastProgramEnum.java @@ -25,7 +25,7 @@ /** * Enum representing available blast programs. - *

      + *

      * Values are as used by QBlast URL API. * * @author Gediminas Rimsa diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/MapToStringTransformer.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/MapToStringTransformer.java index 3fc154d009..7da35cb04b 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/MapToStringTransformer.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/MapToStringTransformer.java @@ -41,11 +41,11 @@ public class MapToStringTransformer { /** * Creates {@code MapToStringTransformer} with defaults: * - *

      +	 * 
      {@code
       	 * mappingSequence = "=";
       	 * separatorSequence = "&";
       	 * nullValue = "null";
      -	 * 
      + * }
      */ public MapToStringTransformer() { this("=", "&", "null"); @@ -76,7 +76,7 @@ public MapToStringTransformer(String mappingSequence, String separatorSequence, *

      * For example, if we have a map with two entries: {@code ("key1", "1")} and * {@code ("key2", "2")} this method would return {@code "key1=1&key2=2"} if - * {@code mappingSequence} is "=" and separator sequence is "&"; + * {@code mappingSequence} is "=" and separator sequence is "&"; * * @param map map of arguments * @return String resulting string diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java index 3d9ad05377..ccad91b981 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java @@ -36,7 +36,7 @@ * This class wraps a QBlast search request parameter {@code Map} by adding several convenient parameter addition * methods. Other QBlast URL API parameters should be added using * {@link #setAlignmentOption(BlastAlignmentParameterEnum, String)} - *

      + *

      * Required parameters are {@code PROGRAM} and {@code DATABASE}, other parameters are optional * * @author Sylvain Foisy, Diploide BioIT @@ -45,7 +45,7 @@ public class NCBIQBlastAlignmentProperties implements RemotePairwiseAlignmentProperties { private static final long serialVersionUID = 7158270364392309841L; - private Map param = new HashMap(); + private Map param = new HashMap<>(); /** * This method forwards to {@link #getAlignmentOption(BlastAlignmentParameterEnum)}. Consider using it instead. @@ -69,7 +69,7 @@ public void setAlignementOption(String key, String val) { */ @Override public Set getAlignmentOptions() { - Set result = new HashSet(); + Set result = new HashSet<>(); for (BlastAlignmentParameterEnum parameter : param.keySet()) { result.add(parameter.name()); } @@ -102,7 +102,7 @@ public void removeAlignmentOption(BlastAlignmentParameterEnum key) { */ public BlastProgramEnum getBlastProgram() { BlastProgramEnum program = BlastProgramEnum.valueOf(getAlignmentOption(PROGRAM)); - boolean isMegablast = BlastProgramEnum.blastn == program && getAlignmentOption(MEGABLAST).equals("on"); + boolean isMegablast = BlastProgramEnum.blastn == program && "on".equals(getAlignmentOption(MEGABLAST)); return !isMegablast ? program : BlastProgramEnum.megablast; } @@ -137,11 +137,9 @@ public String getBlastDatabase() { /** * Sets the database to be used with blastall *

      - * A list of available databases can be acquired by calling {@link NCBIQBlastService#printRemoteBlastInfo()} - *

      * Blastall equivalent: -d * - * @param db : a valid name to a NCBI blastable database + * @param database a valid name to a NCBI blastable database */ public void setBlastDatabase(String database) { setAlignmentOption(DATABASE, database); diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastOutputProperties.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastOutputProperties.java index 8efc91908b..6c4b92eb87 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastOutputProperties.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastOutputProperties.java @@ -41,7 +41,7 @@ public class NCBIQBlastOutputProperties implements RemotePairwiseAlignmentOutputProperties { private static final long serialVersionUID = -9202060390925345163L; - private Map param = new HashMap(); + private Map param = new HashMap<>(); /** * This constructor builds the parameters for the output of the GET command sent to the QBlast service with default @@ -96,7 +96,7 @@ public void setOutputOption(BlastOutputParameterEnum key, String value) { */ @Override public Set getOutputOptions() { - Set result = new HashSet(); + Set result = new HashSet<>(); for (BlastOutputParameterEnum parameter : param.keySet()) { result.add(parameter.name()); } @@ -119,7 +119,7 @@ public String getOutputFormat() { /** * Sets the stream output format to get from the QBlast service - *

      + *

      * If {@code HTML} format is selected, also adds the following parameters (which are removed if another output * format is chosen): * diff --git a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java index c63a4b7eb9..5826949426 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java @@ -72,7 +72,7 @@ public class NCBIQBlastService implements RemotePairwiseAlignmentService { private String email = DEFAULT_EMAIL; private String tool = DEFAULT_TOOL; - private Map jobs = new HashMap(); + private Map jobs = new HashMap<>(); /** Constructs a service object that targets the public NCBI BLAST network * service. @@ -164,7 +164,7 @@ public String sendAlignmentRequest(int gid, RemotePairwiseAlignmentProperties rp */ @Override public String sendAlignmentRequest(String query, RemotePairwiseAlignmentProperties alignmentProperties) throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); for (String key : alignmentProperties.getAlignmentOptions()) { params.put(key, alignmentProperties.getAlignmentOption(key)); } @@ -248,7 +248,7 @@ public boolean isReady(String id) throws Exception { /** * Checks for completion of request. - *

      + *

      * If expected execution time (RTOE) is available for request, this method will always return false until that time * passes. This is done to prevent sending unnecessary requests to the server. * @@ -307,7 +307,7 @@ public boolean isReady(String id, long present) throws Exception { /** * Extracts the actual Blast report for given request id according to options provided in {@code outputProperties} * argument. - *

      + *

      * If the results are not ready yet, sleeps until they are available. If sleeping is not desired, call this method * after {@code isReady} returns true * @@ -318,7 +318,7 @@ public boolean isReady(String id, long present) throws Exception { */ @Override public InputStream getAlignmentResults(String id, RemotePairwiseAlignmentOutputProperties outputProperties) throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); for (String key : outputProperties.getOutputOptions()) { params.put(key, outputProperties.getOutputOption(key)); } 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/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java b/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java index 2083db63aa..2c8e494971 100644 --- a/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java +++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java @@ -134,7 +134,7 @@ public SortedSet scan(ProteinSequence sequence, URL serviceLocation // process the response and build up a container for the data. - SortedSet results = new TreeSet(); + SortedSet results = new TreeSet<>(); try { JSONObject json = JSONObject.fromObject(result.toString()); @@ -170,7 +170,7 @@ public SortedSet scan(ProteinSequence sequence, URL serviceLocation JSONArray hmmdomains = hit.getJSONArray("domains"); - SortedSet domains = new TreeSet(); + SortedSet domains = new TreeSet<>(); for ( int j= 0 ; j < hmmdomains.size() ; j++){ JSONObject d = hmmdomains.getJSONObject(j); Integer is_included = getInteger(d.get("is_included")); diff --git a/pom.xml b/pom.xml index c897c9238a..e9f246202b 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.biojava biojava pom - 7.0.3-SNAPSHOT + 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 @@ -40,11 +40,11 @@ UTF-8 512M 1.0.11 - 1.7.30 - 2.17.2 - 5.7.2 + 2.0.12 + 2.23.1 + 5.10.1 ciftools-java - 5.0.1 + 7.0.1 scm:git:git://github.com/biojava/biojava.git @@ -171,11 +171,11 @@ maven-clean-plugin - 3.1.0 + 3.4.0 maven-compiler-plugin - 3.8.1 + 3.13.0 ${jdk.version} ${jdk.version} @@ -183,19 +183,19 @@ maven-dependency-plugin - 3.1.2 + 3.8.1 maven-jar-plugin - 3.2.0 + 3.4.2 maven-scm-plugin - 1.11.2 + 2.1.0 maven-source-plugin - 3.2.1 + 3.3.1 maven-failsafe-plugin @@ -214,7 +214,7 @@ org.apache.maven.plugins maven-release-plugin - 3.0.0-M1 + 3.1.1 true clean install @@ -229,7 +229,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.1 + 3.11.2 -Xdoclint:none @@ -247,16 +247,21 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M5 + 3.5.2 org.apache.maven.plugins maven-shade-plugin 3.2.4 + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.8.0 + maven-assembly-plugin - 3.3.0 + 3.7.1 src/main/assembly/assembly.xml @@ -275,11 +280,6 @@ - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.5 - org.codehaus.mojo @@ -300,8 +300,9 @@ + org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M3 + 3.5.0 enforce-java @@ -321,19 +322,25 @@ org.apache.maven.plugins maven-install-plugin - 3.0.0-M1 + 3.1.3 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.11.2 org.apache.maven.plugins maven-site-plugin - 3.9.1 + 3.21.0 org.apache.maven.plugins maven-deploy-plugin - 3.0.0-M1 + 3.1.3 @@ -375,10 +382,6 @@ - - org.codehaus.mojo - findbugs-maven-plugin - org.apache.maven.plugins maven-checkstyle-plugin @@ -389,6 +392,14 @@ + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + @@ -436,7 +447,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl ${log4j.version} runtime @@ -462,16 +473,21 @@ 1.039 - javax.xml.bind - jaxb-api - 2.3.1 + jakarta.xml.bind + jakarta.xml.bind-api + 4.0.0 org.glassfish.jaxb jaxb-runtime - 2.3.5 + 4.0.3 runtime + + com.google.guava + guava + 33.4.0-jre + @@ -479,6 +495,18 @@ maven-javadoc-plugin + + + + aggregate + + aggregate + + + + javadoc:aggregate true @@ -490,8 +518,8 @@ + org.apache.maven.plugins maven-project-info-reports-plugin - 2.9 @@ -507,10 +535,6 @@ - - org.codehaus.mojo - findbugs-maven-plugin - org.apache.maven.plugins @@ -536,6 +560,15 @@ ossrh https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + biojava.org + The biojava.org site + + + https://biojava.org/docs/site + @@ -547,17 +580,20 @@ release - - + - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 true - ossrh - https://oss.sonatype.org/ - true + + central + + + true + + published @@ -588,7 +624,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.0 + 3.3.1 attach-sources @@ -603,7 +639,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.11.2 attach-javadocs @@ -614,6 +650,22 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + + org.apache.maven.plugins + maven-site-plugin + 3.21.0 + + + true + + +

  • section fieldpreferred location
    #=GF <feature> <Generic per-File annotation, free text>Above the alignment
    #=GC <feature> <Generic per-Column annotation, exactly 1 char per column>Below the alignment
    #=GS <seqname> <feature> <Generic per-Sequence annotation, free text>Above the alignment or just below the corresponding sequence
    #=GR <seqname> <feature> <Generic per-Residue annotation, exactly 1 char per residue>Just below the corresponding sequence