From: Jim Procter Date: Fri, 5 Nov 2021 16:51:37 +0000 (+0000) Subject: JAL-3829 format and tidy up unused code X-Git-Tag: Release_2_11_2_0~24^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=37762f10a4836b6f80bf2b31b77b431dd38da68e;p=jalview.git JAL-3829 format and tidy up unused code --- diff --git a/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java b/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java index ffc6c66..2890a01 100644 --- a/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java +++ b/src/jalview/gui/structurechooser/ThreeDBStructureChooserQuerySource.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; -import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; @@ -12,6 +11,7 @@ import java.util.Set; import javax.swing.JTable; +import jalview.bin.Cache; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; import jalview.datamodel.PDBEntry; @@ -44,8 +44,6 @@ public class ThreeDBStructureChooserQuerySource private static final String FILTER_SOURCE_PREFIX = "only_"; - private static int MAX_QLENGTH = 7820; - protected FTSRestRequest lastTdbRequest; protected FTSRestClientI tdbRestClient; @@ -75,19 +73,9 @@ public class ThreeDBStructureChooserQuerySource public String buildQuery(SequenceI seq) { - boolean isPDBRefsFound = false; - boolean isUniProtRefsFound = false; - StringBuilder queryBuilder = new StringBuilder(); - Set seqRefs = new LinkedHashSet<>(); - - /* - * note PDBs as DBRefEntry so they are not duplicated in query - */ - Set pdbids = new HashSet<>(); - List refs = seq.getDBRefs(); int ib = checkUniprotRefs(refs); - if (ib>-1) + if (ib > -1) { return getDBRefId(refs.get(ib)); } @@ -96,8 +84,10 @@ public class ThreeDBStructureChooserQuerySource /** * Searches DBRefEntry for uniprot refs + * * @param seq - * @return -2 if no uniprot refs, -1 if no canonical ref., otherwise index of Uniprot canonical DBRefEntry + * @return -2 if no uniprot refs, -1 if no canonical ref., otherwise index of + * Uniprot canonical DBRefEntry */ public static int checkUniprotRefs(List refs) { @@ -129,7 +119,6 @@ public class ThreeDBStructureChooserQuerySource */ static boolean isValidSeqName(String seqName) { - // System.out.println("seqName : " + seqName); String ignoreList = "pdb,uniprot,swiss-prot"; if (seqName.length() < 3) { @@ -181,13 +170,14 @@ public class ThreeDBStructureChooserQuerySource { FTSRestRequest tdbRequest = getTDBeaconsRequest(seq, wantedFields); resultList = tdbRestClient.executeRequest(tdbRequest); - + lastTdbRequest = tdbRequest; - if (resultList!=null) + if (resultList != null) { // Query the PDB and add additional metadata FTSRestResponse pdbResponse = fetchStructuresMetaDataFor( getPDBQuerySource(), resultList); - FTSRestResponse joinedResp = joinResponses(resultList, pdbResponse); + + resultList = joinResponses(resultList, pdbResponse); } return resultList; } @@ -250,8 +240,7 @@ public class ThreeDBStructureChooserQuerySource { if (tdbEntries != null && lastTdbRequest != null) { - int prov_idx = lastTdbRequest.getFieldIndex("Provider"); - boolean hasPDBe=false; + boolean hasPDBe = false; for (FTSData _row : tdbEntries) { // tdb returns custom object @@ -266,21 +255,24 @@ public class ThreeDBStructureChooserQuerySource tdBeaconsFilters.add(FILTER_SOURCE_PREFIX + provider); if ("PDBe".equalsIgnoreCase(provider)) { - hasPDBe=true; + hasPDBe = true; } } } if (!hasPDBe) { // remove the PDBe options from the available filters - int op=0; - while (op joinedRows = new ArrayList(); for (final FTSData row : upResponse.getSearchSummary()) { String id = (String) row.getSummaryData()[idx_modelId]; @@ -561,13 +550,15 @@ public class ThreeDBStructureChooserQuerySource Collection discoveredStructuresSet) { int idColumnIndex = restable.getColumn("Model id").getModelIndex(); - - String modelId = (String) restable.getValueAt(selectedRow, idColumnIndex); - for (FTSData row:discoveredStructuresSet) + + String modelId = (String) restable.getValueAt(selectedRow, + idColumnIndex); + for (FTSData row : discoveredStructuresSet) { - if (row instanceof TDB_FTSData && ((TDB_FTSData)row).getModelId().equals(modelId)) + if (row instanceof TDB_FTSData + && ((TDB_FTSData) row).getModelId().equals(modelId)) { - return ((TDB_FTSData)row); + return ((TDB_FTSData) row); } } return null;