Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6c22796
Support for extended PDBID PDB_nnnnNXXX
aalhossary Jul 27, 2021
dc12461
Some deprecated functions removal
aalhossary Jul 31, 2021
7b08387
Fix typo
aalhossary Aug 3, 2021
c39632c
Targeted most of Spencer's comments
aalhossary Aug 4, 2021
7dd8528
Fixed a bug in PDBId.equals() method
aalhossary Aug 4, 2021
e8466b9
Changing PDBID in SCOP record to lower case
aalhossary Aug 4, 2021
12efad9
public static PDBId field XXXX
aalhossary Sep 22, 2021
d4dfc95
Behavior is now an enum
aalhossary Oct 1, 2021
22e9158
Expose Pattern objects instead of Strings
aalhossary Oct 1, 2021
5c6bcdc
ID stored internally in a reduced format (without initial "PDB_" prefix)
aalhossary Oct 1, 2021
76112f0
Enhancements and bug fix
aalhossary Oct 2, 2021
d95e561
Added BDBId Unit test
aalhossary Oct 2, 2021
f54dd7d
Merge branch 'master' into Support_Extended_PDBID
aalhossary Oct 2, 2021
727aff6
Added @Deprecated codeTag
aalhossary Oct 2, 2021
960a1e6
Adding more TODOs
aalhossary Oct 2, 2021
605c6f8
more replacement of deprecated methods
aalhossary Oct 2, 2021
ec53cee
Removed PDBIdException
aalhossary Oct 9, 2021
fd48eba
review and untouch regular expressions
aalhossary Oct 9, 2021
84d9654
Un-deprecate, copy javadoc, and remove @author on methods
aalhossary Oct 10, 2021
e900fe5
Remove NullPointerException
aalhossary Oct 10, 2021
711fb8a
Bug fix
aalhossary Oct 10, 2021
f92db27
clean commented out code
aalhossary Oct 10, 2021
d9e15e0
Update CHANGELOG
aalhossary Oct 10, 2021
b410f16
Fix unit test
aalhossary Oct 13, 2021
6c8d267
PdbPair does not accept null
aalhossary Oct 12, 2021
a03a657
Addressing reviewer's comments
aalhossary Oct 13, 2021
a55aa95
Change capitalization state
aalhossary Oct 14, 2021
732a2c2
Fix probable NPE + keep consistent PdbId method naming convention
aalhossary Oct 14, 2021
34cb49e
Addressed some of the reviewer's comments.
aalhossary Oct 14, 2021
40a55d2
Use JUnit 5
aalhossary Oct 14, 2021
141d667
PdbId class Documentation
aalhossary Oct 15, 2021
c91a4dc
JavaDoc style update
aalhossary Oct 15, 2021
9ce50fe
Minor updates
aalhossary Oct 15, 2021
0fb6742
Reverting a wrong optimization
aalhossary Oct 15, 2021
02bfee4
Merge branch 'biojavaorigin/master' into Support_Extended_PDBID
aalhossary Oct 16, 2021
0d96963
Adding BioJava development code
aalhossary Oct 16, 2021
87fbc10
Javadoc
aalhossary Oct 21, 2021
17f366e
XXXX PdbId objects are not equal unless they are the same object
aalhossary Oct 22, 2021
ef9cf3f
No more XXXX. ANY malformed PdbId gracefully set to null
aalhossary Oct 23, 2021
02974cd
Addressing Reviewer's comments
aalhossary Oct 26, 2021
108fe97
Removing TODOs
aalhossary Oct 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BioJava 6.0.0 (future release)
* Removed `org.biojava.nbio.structure.io.mmtf.MmtfUtils.setUpBioJava()`
* Removed from `org.biojava.nbio.structure.Chain` interface: `getParent()`, `setParent()`, `getAtomLigands()`, `getSwissprotId()`, `setSwissprotId()`, `getInternalChainID()`, `setInternalChainID()`, `getChainID()`, `setChainID()`
* Removed from `org.biojava.nbio.structure.Structure` interface: `findChain()`, `getId()`, `setId()`, `getChainByPDB()`, `getCompoundById()`, `getResidueRanges()`, `getRanges()`
* Removed from `org.biojava.nbio.structure.StructureTools` : `isNucleicAcid()`, `isProtein()`, `getPredominantGroupType()`, `isChainWaterOnly()`, `isChainPureNonPolymer()`
* Removed from `org.biojava.nbio.structure.StructureTools` : `isNucleicAcid()`, `isProtein()`, `getPredominantGroupType()`, `isChainWaterOnly()`, `isChainPureNonPolymer()`, `getReducedStructure()`
* Removed `org.biojava.nbio.structure.io.SandboxStyleStructureProvider`
* In `org.biojava.nbio.structure.align.xml.MultipleAlignmentXMLParser` made all methods private except `parseXMLfile`

Expand All @@ -32,14 +32,15 @@ BioJava 6.0.0 (future release)
* Moved all chem-comp model classes from `org.biojava.nbio.structure.io.mmcif.chem` to `org.biojava.nbio.structure.chem`
* Moved all chem-comp parsing classes from `org.biojava.nbio.structure.io.mmcif.chem` to `org.biojava.nbio.structure.io.cif`
* Moved classes in `org.biojava.nbio.structure.io.mmcif` to `org.biojava.nbio.structure.chem`
* Fixed `CRC64Checksum#public void update(byte[] b, int offset, int length)` to use
the `length` argument correctly as specified in `java.util.zip.Checksum` interface.
* Removed `DownloadChemCompProvider.useDefaultUrlLayout` with a more flexible system to provide templated URLs `DownloadChemCompProvider.setChemCompPathUrlTemplate()`
and `DownloadChemCompProvider.setServerBaseUrl()`
* Fixed `CRC64Checksum#public void update(byte[] b, int offset, int length)` to use the `length` argument correctly as specified in `java.util.zip.Checksum` interface.
* In `SubstructureIdentifier`, `StructureName`, `EcodDomain`, `ScopDomain` : `getPdbId()` returns `PdbId` object instead of `String`.
* Removed `DownloadChemCompProvider.useDefaultUrlLayout` with a more flexible system to provide templated URLs `DownloadChemCompProvider.setChemCompPathUrlTemplate()` and `DownloadChemCompProvider.setServerBaseUrl()`
* In `Structure` (and `StructureImple`), the accessor methods `String getPdbId()` and `setPdbId(String)` were previously depricated. They were revived in BioJava 6.0.0 but as `PdbId getPdbId()` and `setPdbId(PdbId)` instead.n

### Added
* New keywords fields in `PDBHeader` class, populated by PDB and mmCIF parsers #946
* New `keywords` field in `PDBHeader` class, populated by PDB and mmCIF parsers #946
* OBO parsing now supports multiple altids, #960
* New class `PdbId` that wrapps a PDB Identifier and handles conversion between current short PDBID format and upcoming extended PDBID format #930

### Fixed
* Correct chain assignment to entities when parsing PDB/mmCIF without entity information (in cases with more than 3 chains per entity) #931
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public void setUp() throws Exception {


@Test
public void test1a4wPDBFile() throws IOException
{
public void test1a4wPDBFile() throws IOException {

// structure = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
package org.biojava.nbio.structure.test.cath;

import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.cath.CathDomain;
import org.biojava.nbio.structure.cath.CathFactory;
import org.junit.Test;
Expand All @@ -33,9 +34,9 @@
*/
public class CathDomainTest {
@Test
public void test() {
public void test() throws StructureException {
String id = "1qvrC03";
CathDomain domain = CathFactory.getCathDatabase().getDomainByCathId(id);
assertEquals("1qvr.C_332-400,C_514-540", domain.toCanonical().getIdentifier());
assertEquals("1QVR.C_332-400,C_514-540", domain.toCanonical().getIdentifier());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private static int testVersion(String ecodVersion) throws IOException {
Atom[] ca1;
Structure struct;
try {
struct = cache.getStructure(d.getPdbId());
struct = cache.getStructure(d.getPdbId().getId());
ca1 = StructureTools.getRepresentativeAtomArray(struct);
} catch (IOException e) {
logger.error("Error getting structure for "+d.getDomainId(),e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.io.IOException;
import java.util.ArrayList;

import javax.swing.Box;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

import org.biojava.nbio.structure.PdbId;
import org.biojava.nbio.structure.ResidueRange;
import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.StructureException;
Expand Down Expand Up @@ -106,30 +108,32 @@ public SelectPDBPanel(boolean show2PDBs) {
}

public StructureIdentifier getName1() {
String pdbId = f1.getText().trim();
String id = f1.getText().trim();
String chainId = c1.getText().trim();
String range = r1.getText().trim();


PdbId pdbId = new PdbId(id);
// Prefer range over chain
if( ! range.isEmpty() ) {
return new SubstructureIdentifier(pdbId, ResidueRange.parseMultiple(range));
} else if ( ! chainId.isEmpty() ){
return new SubstructureIdentifier(pdbId, ResidueRange.parseMultiple(chainId));
}
return new SubstructureIdentifier(pdbId);
return new SubstructureIdentifier(pdbId, new ArrayList<ResidueRange>());
}
public StructureIdentifier getName2() {
String pdbId = f2.getText().trim();
String id = f2.getText().trim();
String chainId = c2.getText().trim();
String range = r2.getText().trim();


PdbId pdbId = new PdbId(id);
// Prefer range over chain
if( ! range.isEmpty() ) {
return new SubstructureIdentifier(pdbId, ResidueRange.parseMultiple(range));
} else if ( ! chainId.isEmpty() ){
return new SubstructureIdentifier(pdbId, ResidueRange.parseMultiple(chainId));
}
return new SubstructureIdentifier(pdbId);
return new SubstructureIdentifier(pdbId, new ArrayList<ResidueRange>());
}
@Override
public Structure getStructure1() throws StructureException, IOException{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package org.biojava.nbio.structure.gui.util;

import org.biojava.nbio.structure.Chain;
import org.biojava.nbio.structure.PdbId;
import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.StructureImpl;
Expand Down Expand Up @@ -97,17 +98,17 @@ public PDBDirPanel() {


private Structure fromPDB(JTextField f, JTextField c) throws StructureException{
String pdb = f.getText();
String pdbIdString = f.getText();


if ( pdb.length() < 4) {
if ( pdbIdString.length() < 4) {
f.setText("!!!");
return null;
}

String chain = c.getText();
if ( debug )
System.out.println("file :" + pdb + " " + chain);
System.out.println("file :" + pdbIdString + " " + chain);
/// prepare structures

// load them from the file system
Expand All @@ -123,19 +124,18 @@ private Structure fromPDB(JTextField f, JTextField c) throws StructureException{
Structure tmp1 = new StructureImpl();

try {
Structure structure1 = reader.getStructureById(pdb);
Structure structure1 = reader.getStructureById(new PdbId(pdbIdString));

// no chain has been specified
// return whole structure
if (( chain == null) || (chain.length()==0)){
return structure1;
}
if ( debug)
System.out.println("using chain " + chain + " for structure " + structure1.getPDBCode());
System.out.println("using chain " + chain + " for structure " + structure1.getPdbId().getId());
Chain c1 = structure1.getPolyChainByPDB(chain);
tmp1.setPDBCode(structure1.getPDBCode());
tmp1.setPDBHeader(structure1.getPDBHeader());
tmp1.setPDBCode(structure1.getPDBCode());
tmp1.setPdbId(structure1.getPdbId());
tmp1.addChain(c1);
System.out.println("ok");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.biojava.nbio.structure.gui.util;

import org.biojava.nbio.structure.Chain;
import org.biojava.nbio.structure.PdbId;
import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.StructureImpl;
Expand Down Expand Up @@ -86,17 +87,17 @@ public PDBServerPanel() {


private Structure fromPDB(JTextField f, JTextField c) throws StructureException{
String pdb = f.getText();
String pdbIdString = f.getText();


if ( pdb.length() < 4) {
if ( pdbIdString.length() < 4) {
f.setText("!!!");
return null;
}

String chain = c.getText();
if ( debug )
System.out.println("file :" + pdb + " " + chain);
System.out.println("file :" + pdbIdString + " " + chain);
/// prepare structures

// load them from the file system
Expand All @@ -108,19 +109,18 @@ private Structure fromPDB(JTextField f, JTextField c) throws StructureException{
Structure tmp1 = new StructureImpl();

try {
Structure structure1 = reader.getStructureById(pdb);
Structure structure1 = reader.getStructureById(new PdbId(pdbIdString));

// no chain has been specified
// return whole structure
if (( chain == null) || (chain.length()==0)){
return structure1;
}
if ( debug)
System.out.println("using chain " + chain + " for structure " + structure1.getPDBCode());
System.out.println("using chain " + chain + " for structure " + structure1.getPdbId().getId());
Chain c1 = structure1.getPolyChainByPDB(chain);
tmp1.setPDBCode(structure1.getPDBCode());
tmp1.setPDBHeader(structure1.getPDBHeader());
tmp1.setPDBCode(structure1.getPDBCode());
tmp1.setPdbId(structure1.getPdbId());
tmp1.addChain(c1);
System.out.println("ok");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,34 @@
package org.biojava.nbio.structure.gui.util;


import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import org.biojava.nbio.structure.ResidueRange;
import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.StructureTools;
import org.biojava.nbio.structure.SubstructureIdentifier;
import org.biojava.nbio.structure.align.util.UserConfiguration;
import org.biojava.nbio.structure.io.CifFileReader;
import org.biojava.nbio.structure.io.PDBFileReader;
import org.biojava.nbio.structure.io.StructureIOFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.net.URL;

/** A JPanel to upload 2 custom PDB files.
*
* @author Andreas Prlic
Expand All @@ -59,16 +70,16 @@ public class PDBUploadPanel



private JComboBox fileType ;
private JComboBox<String> fileType ;

JTextField filePath1;
JTextField filePath2;
JTextField chain1;
JTextField chain2;

public static JComboBox getFileFormatSelect(){
JComboBox fileType = new JComboBox();
fileType = new JComboBox(new String[] {UserConfiguration.PDB_FORMAT,UserConfiguration.MMCIF_FORMAT});
public static JComboBox<String> getFileFormatSelect(){
JComboBox<String> fileType = new JComboBox<>();
fileType = new JComboBox<String>(new String[] {UserConfiguration.PDB_FORMAT,UserConfiguration.MMCIF_FORMAT});
fileType.setSelectedIndex(0);
fileType.setMaximumSize(new Dimension(10,50));

Expand Down Expand Up @@ -150,7 +161,10 @@ private Structure getStructure(JTextField filePath,JTextField chainId) throws St
throw new StructureException(e);
}

Structure reduced = StructureTools.getReducedStructure(s, chainId.getText());
// Structure reduced = StructureTools.getReducedStructure(s, chainId.getText());
// Structure reduced = new SubstructureIdentifier(s.getPdbId().getId()+"."+ chainId.getText()).reduce(s); //TODO double check this
Structure reduced = new SubstructureIdentifier(s.getPdbId(),
Arrays.asList(new ResidueRange(chainId.getText(), (String) null, null))).reduce(s);

String fileURL = "";
try {
Expand All @@ -169,7 +183,7 @@ private Structure getStructure(JTextField filePath,JTextField chainId) throws St
e.printStackTrace();
}

reduced.setPDBCode(fileURL);
reduced.setPDBCode(fileURL); //TODO FIXME This usage seems wrong and should be changed.
reduced.setName(fileURL);
return reduced;

Expand Down
14 changes: 13 additions & 1 deletion biojava-structure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
<artifactId>log4j-core</artifactId>
</dependency>
<!-- Testing related dependencies -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -117,6 +116,19 @@
<version>1.6</version>
<scope>test</scope>
</dependency>
<!-- Junit5 dependencies, defined in parent pom. -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>

</dependencies>

Expand Down
Loading