From: tcofoegbu Date: Fri, 7 Aug 2015 13:59:50 +0000 (+0100) Subject: JAL-1824 updated caching procedure for pdb entries. Also refactored getPDBEntry metho... X-Git-Tag: Release_2_10_0~548 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=06e3a52df5af8243cdb67c023c8ddd834711ad36;p=jalview.git JAL-1824 updated caching procedure for pdb entries. Also refactored getPDBEntry method in SequenceI to getAllPDBEntries as it returns a collection of all available PDBEntry --- diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index 7b7f4b0..58991f3 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -388,11 +388,11 @@ public class PDBfile extends jalview.io.AlignFile { if (sq.getDatasetSequence() != null) { - sq.getDatasetSequence().getPDBId().clear(); + sq.getDatasetSequence().getAllPDBEntries().clear(); } else { - sq.getPDBId().clear(); + sq.getAllPDBEntries().clear(); } } replaceAndUpdateChains(prot, al, AlignSeq.PEP, false); @@ -456,16 +456,16 @@ public class PDBfile extends jalview.io.AlignFile { if (sq.getDatasetSequence() != null) { - if (sq.getDatasetSequence().getPDBId() != null) + if (sq.getDatasetSequence().getAllPDBEntries() != null) { - sq.getDatasetSequence().getPDBId().clear(); + sq.getDatasetSequence().getAllPDBEntries().clear(); } } else { - if (sq.getPDBId() != null) + if (sq.getAllPDBEntries() != null) { - sq.getPDBId().clear(); + sq.getAllPDBEntries().clear(); } } } diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java index 2ede9ed..c23f03c 100755 --- a/src/jalview/analysis/SeqsetUtils.java +++ b/src/jalview/analysis/SeqsetUtils.java @@ -60,7 +60,7 @@ public class SeqsetUtils } } sqinfo.put("SeqFeatures", sfeat); - sqinfo.put("PdbId", (seq.getPDBId() != null) ? seq.getPDBId() + sqinfo.put("PdbId", (seq.getAllPDBEntries() != null) ? seq.getAllPDBEntries() : new Vector()); sqinfo.put("datasetSequence", (seq.getDatasetSequence() != null) ? seq.getDatasetSequence() diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index f16da84..0dd73ea 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -896,9 +896,9 @@ public class APopupMenu extends java.awt.PopupMenu implements void addPDB() { - if (seq.getPDBId() != null) + if (seq.getAllPDBEntries() != null) { - PDBEntry entry = seq.getPDBId().firstElement(); + PDBEntry entry = seq.getAllPDBEntries().firstElement(); if (ap.av.applet.jmolAvailable) { diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 0225dc7..688ea53 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -3950,7 +3950,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, boolean needtoadd = false; if (toaddpdb != null) { - Vector pdbe = toaddpdb.getPDBId(); + Vector pdbe = toaddpdb.getAllPDBEntries(); PDBEntry pdbentry = null; if (pdbe != null && pdbe.size() > 0) { diff --git a/src/jalview/appletgui/ExtJmol.java b/src/jalview/appletgui/ExtJmol.java index c1035bd..929a871 100644 --- a/src/jalview/appletgui/ExtJmol.java +++ b/src/jalview/appletgui/ExtJmol.java @@ -139,7 +139,7 @@ public class ExtJmol extends JalviewJmolBinding SequenceI[] sq = ap.av.getAlignment().getSequencesArray(); for (int s = 0; s < sq.length; s++) { - Vector pdbids = sq[s].getPDBId(); + Vector pdbids = sq[s].getAllPDBEntries(); if (pdbids != null) { for (int pe = 0, peSize = pdbids.size(); pe < peSize; pe++) diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java index db792e2..d0cef5d 100755 --- a/src/jalview/datamodel/PDBEntry.java +++ b/src/jalview/datamodel/PDBEntry.java @@ -167,4 +167,8 @@ public class PDBEntry this.chainCode = chainCode; } + public String toString() + { + return id; + } } diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 916d785..19ad30f 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -260,9 +260,9 @@ public class Sequence extends ASequence implements SequenceI } } } - if (seq.getPDBId() != null) + if (seq.getAllPDBEntries() != null) { - Vector ids = seq.getPDBId(); + Vector ids = seq.getAllPDBEntries(); Enumeration e = ids.elements(); while (e.hasMoreElements()) { @@ -410,7 +410,7 @@ public class Sequence extends ASequence implements SequenceI * @return DOCUMENT ME! */ @Override - public Vector getPDBId() + public Vector getAllPDBEntries() { return pdbIds; } @@ -1057,7 +1057,7 @@ public class Sequence extends ASequence implements SequenceI // move database references onto dataset sequence datasetSequence.setDBRef(getDBRef()); setDBRef(null); - datasetSequence.setPDBId(getPDBId()); + datasetSequence.setPDBId(getAllPDBEntries()); setPDBId(null); datasetSequence.updatePDBIds(); if (annotation != null) @@ -1221,9 +1221,9 @@ public class Sequence extends ASequence implements SequenceI } // transfer PDB entries - if (entry.getPDBId() != null) + if (entry.getAllPDBEntries() != null) { - Enumeration e = entry.getPDBId().elements(); + Enumeration e = entry.getAllPDBEntries().elements(); while (e.hasMoreElements()) { PDBEntry pdb = (PDBEntry) e.nextElement(); @@ -1307,4 +1307,23 @@ public class Sequence extends ASequence implements SequenceI return getDisplayId(false); } + @Override + public PDBEntry getPDBEntry(String pdbIdStr) + { + if (getDatasetSequence() == null + || getDatasetSequence().getAllPDBEntries() == null) + { + return null; + } + List entries = getDatasetSequence().getAllPDBEntries(); + for (PDBEntry entry : entries) + { + if (entry.getId().equalsIgnoreCase(pdbIdStr)) + { + return entry; + } + } + return null; + } + } diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index f69c8b6..2ff619b 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -274,7 +274,7 @@ public interface SequenceI extends ASequenceI * * @return DOCUMENT ME! */ - public Vector getPDBId(); + public Vector getAllPDBEntries(); /** * add entry to the vector of PDBIds, if it isn't in the list already @@ -420,4 +420,12 @@ public interface SequenceI extends ASequenceI */ public List getInsertions(); + /** + * Given a pdbId String, return the equivalent PDBEntry if available in the + * given sequence + * + * @param pdbId + * @return + */ + public PDBEntry getPDBEntry(String pdbId); } diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 29c4fde..9ed953f 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -669,7 +669,7 @@ public class AlignViewport extends AlignmentViewport implements for (SequenceI sq : alignment.getSequences()) { Vector pdbs = sq - .getDatasetSequence().getPDBId(); + .getDatasetSequence().getAllPDBEntries(); if (pdbs == null) { continue; diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index 7876346..bd1cc88 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -628,7 +628,7 @@ public class AppJmol extends StructureViewerBase { // just transfer the file name from the first sequence's first // PDBEntry - file = new File(pdbseq.getSequenceAt(0).getPDBId() + file = new File(pdbseq.getSequenceAt(0).getAllPDBEntries() .elementAt(0).getFile()).getAbsolutePath(); jmb.getPdbEntry(pi).setFile(file); diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index f644e95..1d60d6c 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -434,7 +434,7 @@ public class ChimeraViewFrame extends StructureViewerBase String chain = null; if (seq.getDatasetSequence() != null) { - Vector pdbrefs = seq.getDatasetSequence().getPDBId(); + Vector pdbrefs = seq.getDatasetSequence().getAllPDBEntries(); if (pdbrefs != null && pdbrefs.size() > 0) { chain = pdbrefs.get(0).getChainCode(); @@ -950,7 +950,7 @@ public class ChimeraViewFrame extends StructureViewerBase if (pdbseq != null && pdbseq.getHeight() > 0) { // just use the file name from the first sequence's first PDBEntry - filePath = new File(pdbseq.getSequenceAt(0).getPDBId() + filePath = new File(pdbseq.getSequenceAt(0).getAllPDBEntries() .elementAt(0).getFile()).getAbsolutePath(); processingEntry.setFile(filePath); } diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 3b90bf6..23b09de 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -776,9 +776,9 @@ public class Jalview2XML } } - if (jdatasq.getPDBId() != null) + if (jdatasq.getAllPDBEntries() != null) { - Enumeration en = jdatasq.getPDBId().elements(); + Enumeration en = jdatasq.getAllPDBEntries().elements(); while (en.hasMoreElements()) { Pdbids pdb = new Pdbids(); diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 5699d9e..45b5394 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -561,7 +561,7 @@ public class PopupMenu extends JPopupMenu SequenceI sqass = null; for (SequenceI sq : ap.av.getSequenceSelection()) { - Vector pes = sq.getDatasetSequence().getPDBId(); + Vector pes = sq.getDatasetSequence().getAllPDBEntries(); if (pes != null && pes.size() > 0) { reppdb.put(pes.get(0).getId(), pes.get(0)); diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 765c214..266690e 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -39,7 +39,6 @@ import java.awt.event.ItemEvent; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; -import java.util.Hashtable; import java.util.LinkedHashSet; import java.util.List; @@ -47,7 +46,7 @@ import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JOptionPane; -import javax.swing.table.DefaultTableModel; +import javax.swing.table.AbstractTableModel; /** * Provides the behaviors for the Structure chooser Panel @@ -76,7 +75,6 @@ public class StructureChooser extends GStructureChooser private boolean isValidPBDEntry; - private static Hashtable cachedEntryMap; public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq, AlignmentPanel ap) @@ -169,7 +167,6 @@ public class StructureChooser extends GStructureChooser && !resultList.getSearchSummary().isEmpty()) { discoveredStructuresSet.addAll(resultList.getSearchSummary()); - updateSequencePDBEntries(seq, resultList.getSearchSummary()); } } @@ -192,7 +189,6 @@ public class StructureChooser extends GStructureChooser if (errors.size() > 0) { StringBuilder errorMsg = new StringBuilder(); - // "Operation was unsuccessful due to the following: \n"); for (String error : errors) { errorMsg.append(error).append("\n"); @@ -205,70 +201,27 @@ public class StructureChooser extends GStructureChooser public void loadLocalCachedPDBEntries() { - DefaultTableModel tableModel = new DefaultTableModel() - { - @Override - public boolean isCellEditable(int row, int column) - { - return false; - } - }; - tableModel.addColumn("Ref Sequence"); - tableModel.addColumn("PDB Id"); - tableModel.addColumn("Chain"); - tableModel.addColumn("Type"); - tableModel.addColumn("File"); - cachedEntryMap = new Hashtable(); + ArrayList entries = new ArrayList(); for (SequenceI seq : selectedSequences) { if (seq.getDatasetSequence() != null - && seq.getDatasetSequence().getPDBId() != null) + && seq.getDatasetSequence().getAllPDBEntries() != null) { - for (PDBEntry pdbEntry : seq.getDatasetSequence().getPDBId()) + for (PDBEntry pdbEntry : seq.getDatasetSequence().getAllPDBEntries()) { - - String chain = pdbEntry.getChainCode() == null ? "_" : pdbEntry - .getChainCode(); - Object[] pdbEntryRowData = new Object[] - { seq, pdbEntry.getId(), chain, pdbEntry.getType(), - pdbEntry.getFile() }; if (pdbEntry.getFile() != null) { - tableModel.addRow(pdbEntryRowData); + entries.add(new CachedPDB(seq, pdbEntry)); } - cachedEntryMap.put(pdbEntry.getId().toLowerCase(), pdbEntry); } } } - tbl_local_pdb.setModel(tableModel); - } - /** - * Update the PDBEntry for a given sequence with values retrieved from - * PDBResponseSummary - * - * @param seq - * the Sequence to update its DBRef entry - * @param responseSummaries - * a collection of PDBResponseSummary - */ - public void updateSequencePDBEntries(SequenceI seq, - Collection responseSummaries) - { - for (PDBResponseSummary response : responseSummaries) - { - String pdbIdStr = response.getPdbId(); - PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase()); - if (pdbEntry == null) - { - pdbEntry = new PDBEntry(); - pdbEntry.setId(pdbIdStr); - pdbEntry.setType(PDBEntry.Type.PDB); - } - seq.getDatasetSequence().addPDBId(pdbEntry); - } + PDBEntryTableModel tableModelx = new PDBEntryTableModel(entries); + tbl_local_pdb.setModel(tableModelx); } + /** * Builds a query string for a given sequences using its DBRef entries * @@ -292,9 +245,9 @@ public class StructureChooser extends GStructureChooser } } - if (seq.getPDBId() != null) + if (seq.getAllPDBEntries() != null) { - for (PDBEntry entry : seq.getPDBId()) + for (PDBEntry entry : seq.getAllPDBEntries()) { if (isValidSeqName(entry.getId())) { @@ -685,19 +638,20 @@ public class StructureChooser extends GStructureChooser PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length]; int count = 0; ArrayList selectedSeqsToView = new ArrayList(); - for (int summaryRow : selectedRows) + for (int row : selectedRows) { - String pdbIdStr = tbl_summary.getValueAt(summaryRow, pdbIdColIndex) + String pdbIdStr = tbl_summary.getValueAt(row, pdbIdColIndex) .toString(); - SequenceI selectedSeq = (SequenceI) tbl_summary.getValueAt( - summaryRow, refSeqColIndex); + SequenceI selectedSeq = (SequenceI) tbl_summary.getValueAt(row, + refSeqColIndex); selectedSeqsToView.add(selectedSeq); - PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase()); + PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr); if (pdbEntry == null) { pdbEntry = new PDBEntry(); pdbEntry.setId(pdbIdStr); pdbEntry.setType(PDBEntry.Type.PDB); + selectedSeq.getDatasetSequence().addPDBId(pdbEntry); } pdbEntriesToView[count++] = pdbEntry; } @@ -718,13 +672,12 @@ public class StructureChooser extends GStructureChooser ArrayList selectedSeqsToView = new ArrayList(); for (int row : selectedRows) { - String entryKey = tbl_local_pdb.getValueAt(row, pdbIdColIndex) - .toString().toLowerCase(); - pdbEntriesToView[count++] = cachedEntryMap.get(entryKey); + PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row, + pdbIdColIndex); + pdbEntriesToView[count++] = pdbEntry; SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(row, refSeqColIndex); selectedSeqsToView.add(selectedSeq); - } SequenceI[] selectedSeqs = selectedSeqsToView .toArray(new SequenceI[selectedSeqsToView.size()]); @@ -741,15 +694,15 @@ public class StructureChooser extends GStructureChooser } String pdbIdStr = txt_search.getText(); - PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase()); + PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr); if (pdbEntry == null) { pdbEntry = new PDBEntry(); - pdbEntry.setId(txt_search.getText()); + pdbEntry.setId(pdbIdStr); pdbEntry.setType(PDBEntry.Type.PDB); + selectedSequence.getDatasetSequence().addPDBId(pdbEntry); } - selectedSequence.getDatasetSequence().addPDBId(pdbEntry); PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry }; launchStructureViewer(ap.getStructureSelectionManager(), @@ -796,9 +749,6 @@ public class StructureChooser extends GStructureChooser } SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]); sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel); - // sViewer.viewStructures(pdbEntriesToView, - // alignPanel.av.collateForPDB(pdbEntriesToView), - // alignPanel); } else { @@ -818,7 +768,6 @@ public class StructureChooser extends GStructureChooser cmb_assSeq.removeAllItems(); cmb_assSeq.addItem(new AssociateSeqOptions("-Select Associated Seq-", null)); - // cmb_assSeq.addItem(new AssociateSeqOptions("Auto Detect", null)); lbl_associateSeq.setVisible(false); if (selectedSequences.length > 1) { @@ -909,4 +858,103 @@ public class StructureChooser extends GStructureChooser } } + public class PDBEntryTableModel extends AbstractTableModel + { + String[] columns = + { "Ref Sequence", "PDB Id", "Chain", "Type", "File" }; + + private List pdbEntries; + + public PDBEntryTableModel(List pdbEntries) + { + this.pdbEntries = new ArrayList(pdbEntries); + } + + @Override + public String getColumnName(int columnIndex) + { + return columns[columnIndex]; + } + + @Override + public int getRowCount() + { + return pdbEntries.size(); + } + + @Override + public int getColumnCount() + { + return columns.length; + } + + @Override + public boolean isCellEditable(int row, int column) + { + return false; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) + { + Object value = "??"; + CachedPDB entry = pdbEntries.get(rowIndex); + switch (columnIndex) + { + case 0: + value = entry.getSequence(); + break; + case 1: + value = entry.getPdbEntry(); + break; + case 2: + value = entry.getPdbEntry().getChainCode() == null ? "_" : entry + .getPdbEntry().getChainCode(); + break; + case 3: + value = entry.getPdbEntry().getType(); + break; + case 4: + value = entry.getPdbEntry().getFile(); + break; + } + return value; + } + + @Override + public Class getColumnClass(int columnIndex) + { + return columnIndex == 0 ? SequenceI.class : PDBEntry.class; + } + + public CachedPDB getPDBEntryAt(int row) + { + return pdbEntries.get(row); + } + + } + + private class CachedPDB + { + private SequenceI sequence; + + private PDBEntry pdbEntry; + + public CachedPDB(SequenceI sequence, PDBEntry pdbEntry) + { + this.sequence = sequence; + this.pdbEntry = pdbEntry; + } + + public SequenceI getSequence() + { + return sequence; + } + + public PDBEntry getPdbEntry() + { + return pdbEntry; + } + + } } diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 0705422..65f2a57 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -346,9 +346,9 @@ public class FileLoader implements Runnable { sq = sq.getDatasetSequence(); } - if (sq.getPDBId() != null) + if (sq.getAllPDBEntries() != null) { - for (PDBEntry pdbe : sq.getPDBId()) + for (PDBEntry pdbe : sq.getAllPDBEntries()) { // register PDB entries with desktop's structure selection // manager diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index c75a36f..836e211 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -140,7 +140,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy { String chid = null; // Mapping map=null; - for (PDBEntry pid : pdbcs.getPDBId()) + for (PDBEntry pid : pdbcs.getAllPDBEntries()) { if (pid.getFile() == file) { diff --git a/test/MCview/PDBfileTest.java b/test/MCview/PDBfileTest.java index 1dfeba9..3e24f52 100644 --- a/test/MCview/PDBfileTest.java +++ b/test/MCview/PDBfileTest.java @@ -71,8 +71,8 @@ public class PDBfileTest assertTrue(chainA.sequence.getSequenceAsString().endsWith("WNVEVY")); assertEquals("3W5V|A", chainA.sequence.getName()); assertNull(chainA.sequence.getAnnotation()); - assertEquals(1, chainA.sequence.getPDBId().size()); - PDBEntry pdb = chainA.sequence.getPDBId().get(0); + assertEquals(1, chainA.sequence.getAllPDBEntries().size()); + PDBEntry pdb = chainA.sequence.getAllPDBEntries().get(0); assertEquals("A", pdb.getChainCode()); assertEquals("PDB", pdb.getType()); assertEquals("3W5V", pdb.getId()); @@ -107,8 +107,8 @@ public class PDBfileTest assertEquals("3W5V|B", seqs.get(1).getName()); assertEquals("3W5V|C", seqs.get(2).getName()); assertEquals("3W5V|D", seqs.get(3).getName()); - assertEquals(1, seqs.get(0).getPDBId().size()); - PDBEntry pdbe = seqs.get(0).getPDBId().get(0); + assertEquals(1, seqs.get(0).getAllPDBEntries().size()); + PDBEntry pdbe = seqs.get(0).getAllPDBEntries().get(0); assertEquals("A", pdbe.getChainCode()); assertEquals("3W5V", pdbe.getId()); assertEquals(PDBEntry.Type.PDB.toString(), pdbe.getType()); diff --git a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java index 0c5d7fa..4bfabb3 100644 --- a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java +++ b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java @@ -56,15 +56,15 @@ public class JalviewChimeraView { dsq = dsq.getDatasetSequence(); } - if (dsq.getPDBId() != null && dsq.getPDBId().size() > 0) + if (dsq.getAllPDBEntries() != null && dsq.getAllPDBEntries().size() > 0) { - for (int q = 0; q < dsq.getPDBId().size(); q++) + for (int q = 0; q < dsq.getAllPDBEntries().size(); q++) { final StructureViewer structureViewer = new StructureViewer(af .getViewport().getStructureSelectionManager()); structureViewer.setViewerType(ViewerType.JMOL); JalviewStructureDisplayI jmolViewer = structureViewer - .viewStructures(dsq.getPDBId().elementAt(q), + .viewStructures(dsq.getAllPDBEntries().elementAt(q), new SequenceI[] { sq }, af.getCurrentView().getAlignPanel()); /* @@ -100,15 +100,15 @@ public class JalviewChimeraView { dsq = dsq.getDatasetSequence(); } - if (dsq.getPDBId() != null && dsq.getPDBId().size() > 0) + if (dsq.getAllPDBEntries() != null && dsq.getAllPDBEntries().size() > 0) { - for (int q = 0; q < dsq.getPDBId().size(); q++) + for (int q = 0; q < dsq.getAllPDBEntries().size(); q++) { final StructureViewer structureViewer = new StructureViewer(af .getViewport().getStructureSelectionManager()); structureViewer.setViewerType(ViewerType.CHIMERA); JalviewStructureDisplayI chimeraViewer = structureViewer - .viewStructures(dsq.getPDBId().elementAt(q), + .viewStructures(dsq.getAllPDBEntries().elementAt(q), new SequenceI[] { sq }, af.getCurrentView().getAlignPanel()); /* diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index 31bfd9d..150ee59 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -43,7 +43,7 @@ public class AnnotatedPDBFileInputTest AlignFrame af = loader.LoadFileWaitTillLoaded(pdbStr, FormatAdapter.FILE); al = af.getViewport().getAlignment(); - pdbId = al.getSequenceAt(0).getDatasetSequence().getPDBId() + pdbId = al.getSequenceAt(0).getDatasetSequence().getAllPDBEntries() .get(0).getId(); } @@ -197,9 +197,9 @@ public class AnnotatedPDBFileInputTest { sq = sq.getDatasetSequence(); } - assertNotNull(sq.getPDBId()); - assertEquals("Expected only one PDB ID", sq.getPDBId().size(), 1); - for (PDBEntry pdbentry : sq.getPDBId()) + assertNotNull(sq.getAllPDBEntries()); + assertEquals("Expected only one PDB ID", sq.getAllPDBEntries().size(), 1); + for (PDBEntry pdbentry : sq.getAllPDBEntries()) { System.err.println("PDB Entry " + pdbentry.getId() + " " + pdbentry.getFile()); diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index 2537002..7ef5cc6 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -58,9 +58,9 @@ public class StockholmFileTest int numpdb = 0; for (SequenceI sq : al.getSequences()) { - if (sq.getPDBId() != null) + if (sq.getAllPDBEntries() != null) { - numpdb += sq.getPDBId().size(); + numpdb += sq.getAllPDBEntries().size(); } } assertTrue( diff --git a/test/jalview/util/DBRefUtilsTest.java b/test/jalview/util/DBRefUtilsTest.java index b06132b..af5fd1e 100644 --- a/test/jalview/util/DBRefUtilsTest.java +++ b/test/jalview/util/DBRefUtilsTest.java @@ -129,7 +129,7 @@ public class DBRefUtilsTest assertEquals("EMBL", ref.getSource()); assertEquals("1.2", ref.getVersion()); assertEquals("a7890", ref.getAccessionId()); - assertNull(seq.getPDBId()); + assertNull(seq.getAllPDBEntries()); } /** @@ -148,8 +148,8 @@ public class DBRefUtilsTest assertEquals("1.2", ref.getVersion()); // DBRef id is pdbId + chain code assertEquals("1WRIA", ref.getAccessionId()); - assertEquals(1, seq.getPDBId().size()); - PDBEntry pdbRef = seq.getPDBId().get(0); + assertEquals(1, seq.getAllPDBEntries().size()); + PDBEntry pdbRef = seq.getAllPDBEntries().get(0); assertEquals("1WRI", pdbRef.getId()); assertNull(pdbRef.getFile()); assertEquals("A", pdbRef.getChainCode()); diff --git a/test/jalview/ws/PDBSequenceFetcherTest.java b/test/jalview/ws/PDBSequenceFetcherTest.java index 2963ef2..86439fc 100644 --- a/test/jalview/ws/PDBSequenceFetcherTest.java +++ b/test/jalview/ws/PDBSequenceFetcherTest.java @@ -61,7 +61,7 @@ public class PDBSequenceFetcherTest { assertTrue("No annotation transfered to sequence.", sq.getAnnotation().length > 0); - assertTrue("No PDBEntry on sequence.", sq.getPDBId().size() > 0); + assertTrue("No PDBEntry on sequence.", sq.getAllPDBEntries().size() > 0); assertTrue("No RNA annotation on sequence.", sq.getRNA() != null); } }