Clover icon

Coverage Report

  1. Project Clover database Wed Nov 12 2025 13:01:44 GMT
  2. Package jalview.gui.structurechooser

File ThreeDBStructureChooserQuerySource.java

 

Coverage histogram

../../../img/srcFileCovDistChart8.png
22% of files have more coverage

Code metrics

102
230
21
1
685
511
85
0.37
10.95
21
4.05

Classes

Class Line # Actions
ThreeDBStructureChooserQuerySource 57 230 85
0.781869778.2%
 

Contributing tests

This file is covered by 55 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.gui.structurechooser;
22   
23    import java.util.ArrayList;
24    import java.util.Arrays;
25    import java.util.Collection;
26    import java.util.Comparator;
27    import java.util.HashSet;
28    import java.util.LinkedHashSet;
29    import java.util.List;
30    import java.util.Locale;
31    import java.util.Set;
32   
33    import javax.swing.JTable;
34   
35    import jalview.bin.Console;
36    import jalview.datamodel.DBRefEntry;
37    import jalview.datamodel.DBRefSource;
38    import jalview.datamodel.PDBEntry;
39    import jalview.datamodel.SequenceI;
40    import jalview.fts.api.FTSData;
41    import jalview.fts.api.FTSDataColumnI;
42    import jalview.fts.api.FTSRestClientI;
43    import jalview.fts.core.FTSDataColumnPreferences;
44    import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
45    import jalview.fts.core.FTSRestRequest;
46    import jalview.fts.core.FTSRestResponse;
47    import jalview.fts.service.threedbeacons.TDB_FTSData;
48    import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient;
49    import jalview.jbgui.FilterOption;
50    import jalview.structure.StructureImportSettings.TFType;
51   
52    /**
53    * logic for querying the 3DBeacons API for structures of sequences
54    *
55    * @author jprocter
56    */
 
57    public class ThreeDBStructureChooserQuerySource
58    extends StructureChooserQuerySource
59    {
60   
61    private Set<String> tdBeaconsFilters = null, defaultFilters = null;
62   
63    public static final String FILTER_TDBEACONS_COVERAGE = "3d_beacons_coverage";
64   
65    public static final String FILTER_FIRST_BEST_COVERAGE = "3d_beacons_first_best_coverage";
66   
67    private static final String FILTER_SOURCE_PREFIX = "only_";
68   
69    protected FTSRestRequest lastTdbRequest;
70   
71    protected FTSRestClientI tdbRestClient;
72   
73    private FTSRestRequest lastPdbRequest;
74   
 
75  90 toggle public ThreeDBStructureChooserQuerySource()
76    {
77  90 defaultFilters = new LinkedHashSet<String>();
78  90 defaultFilters.add(FILTER_TDBEACONS_COVERAGE);
79  90 defaultFilters.add(FILTER_FIRST_BEST_COVERAGE);
80   
81  90 tdbRestClient = TDBeaconsFTSRestClient.getInstance();
82  90 docFieldPrefs = new FTSDataColumnPreferences(
83    PreferenceSource.STRUCTURE_CHOOSER,
84    TDBeaconsFTSRestClient.getInstance());
85    }
86   
87    /**
88    * Builds a query string for a given sequences using its DBRef entries 3d
89    * Beacons is only useful for uniprot IDs
90    *
91    * @param seq
92    * the sequences to build a query for
93    * @return the built query string
94    */
95   
 
96  15 toggle @Override
97    public String buildQuery(SequenceI seq)
98    {
99  15 List<DBRefEntry> refs = seq.getDBRefs();
100  15 int ib = checkUniprotRefs(refs);
101  15 if (ib > -1)
102    {
103  14 return getDBRefId(refs.get(ib));
104    }
105  1 return null;
106    }
107   
108    /**
109    * Searches DBRefEntry for uniprot refs
110    *
111    * @param seq
112    * @return -2 if no uniprot refs, -1 if no canonical ref., otherwise index of
113    * Uniprot canonical DBRefEntry
114    */
 
115  110 toggle public static int checkUniprotRefs(List<DBRefEntry> refs)
116    {
117  110 boolean hasUniprot = false;
118  110 if (refs != null && refs.size() != 0)
119    {
120  57 for (int ib = 0, nb = refs.size(); ib < nb; ib++)
121    {
122  46 DBRefEntry dbRef = refs.get(ib);
123  46 if (dbRef.getSource().equalsIgnoreCase(DBRefSource.UNIPROT))
124    {
125  26 hasUniprot = true;
126  26 if (dbRef.isCanonical())
127    {
128  23 return ib;
129    }
130    }
131    }
132    }
133  87 return hasUniprot ? -1 : -2;
134    }
135   
136    /**
137    * Ensures sequence ref names are not less than 3 characters and does not
138    * contain a database name
139    *
140    * @param seqName
141    * @return
142    */
 
143  0 toggle static boolean isValidSeqName(String seqName)
144    {
145  0 String ignoreList = "pdb,uniprot,swiss-prot";
146  0 if (seqName.length() < 3)
147    {
148  0 return false;
149    }
150  0 if (seqName.contains(":"))
151    {
152  0 return false;
153    }
154  0 seqName = seqName.toLowerCase(Locale.ROOT);
155  0 for (String ignoredEntry : ignoreList.split(","))
156    {
157  0 if (seqName.contains(ignoredEntry))
158    {
159  0 return false;
160    }
161    }
162  0 return true;
163    }
164   
 
165  14 toggle static String getDBRefId(DBRefEntry dbRef)
166    {
167  14 String ref = dbRef.getAccessionId().replaceAll("GO:", "");
168  14 return ref;
169    }
170   
171    /**
172    * FTSRestClient specific query builder to recover associated structure data
173    * records for a sequence
174    *
175    * @param seq
176    * - seq to generate a query for
177    * @param wantedFields
178    * - fields to retrieve
179    * @param selectedFilterOpt
180    * - criterion for ranking results (e.g. resolution)
181    * @param b
182    * - sort ascending or descending
183    * @return
184    * @throws Exception
185    */
 
186  12 toggle @Override
187    public FTSRestResponse fetchStructuresMetaData(SequenceI seq,
188    Collection<FTSDataColumnI> wantedFields,
189    FilterOption selectedFilterOpt, boolean b) throws Exception
190    {
191  12 FTSRestResponse resultList;
192  12 if (selectedFilterOpt != null
193    && tdBeaconsFilter(selectedFilterOpt.getValue()))
194    {
195  12 FTSRestRequest tdbRequest = getTDBeaconsRequest(seq, wantedFields);
196  12 resultList = tdbRestClient.executeRequest(tdbRequest);
197   
198  12 lastTdbRequest = tdbRequest;
199  12 if (resultList != null)
200    { // Query the PDB and add additional metadata
201  12 List<FTSRestResponse> pdbResponse = fetchStructuresMetaDataFor(
202    getPDBQuerySource(), resultList);
203   
204  12 resultList = joinResponses(resultList, pdbResponse);
205    }
206  12 return resultList;
207    }
208    // use the PDBFTS directly
209  0 resultList = getPDBQuerySource().fetchStructuresMetaData(seq,
210    wantedFields, selectedFilterOpt, b);
211  0 lastTdbRequest = getPDBQuerySource().lastPdbRequest;
212  0 lastPdbRequest = lastTdbRequest; // both queries the same - indicates we
213    // rank using PDBe
214  0 return resultList;
215   
216    }
217   
218    PDBStructureChooserQuerySource pdbQuerySource = null;
219   
 
220  19 toggle private PDBStructureChooserQuerySource getPDBQuerySource()
221    {
222  19 if (pdbQuerySource == null)
223    {
224  6 pdbQuerySource = new PDBStructureChooserQuerySource();
225    }
226  19 return pdbQuerySource;
227    }
228   
 
229  12 toggle private FTSRestRequest getTDBeaconsRequest(SequenceI seq,
230    Collection<FTSDataColumnI> wantedFields)
231    {
232  12 FTSRestRequest pdbRequest = new FTSRestRequest();
233  12 pdbRequest.setAllowEmptySeq(false);
234  12 pdbRequest.setResponseSize(500);
235  12 pdbRequest.setWantedFields(wantedFields);
236  12 String query = buildQuery(seq);
237  12 if (query == null)
238    {
239  0 return null;
240    }
241  12 pdbRequest.setSearchTerm(query + ".json");
242  12 pdbRequest.setAssociatedSequence(seq);
243  12 return pdbRequest;
244    }
245   
 
246  7 toggle @Override
247    public List<FilterOption> getAvailableFilterOptions(String VIEWS_FILTER)
248    {
249  7 List<FilterOption> filters = getPDBQuerySource()
250    .getAvailableFilterOptions(VIEWS_FILTER);
251  7 tdBeaconsFilters = new LinkedHashSet<String>();
252  7 tdBeaconsFilters.addAll(defaultFilters);
253  7 filters.add(0, new FilterOption("Best 3D-Beacons Coverage",
254    FILTER_FIRST_BEST_COVERAGE, VIEWS_FILTER, false, this));
255  7 filters.add(1, new FilterOption("Multiple 3D-Beacons Coverage",
256    FILTER_TDBEACONS_COVERAGE, VIEWS_FILTER, true, this));
257   
258  7 return filters;
259    }
260   
 
261  7 toggle @Override
262    public void updateAvailableFilterOptions(String VIEWS_FILTER,
263    List<FilterOption> xtantOptions, Collection<FTSData> tdbEntries)
264    {
265  7 if (tdbEntries != null && lastTdbRequest != null)
266    {
267  6 boolean hasPDBe = false;
268  6 for (FTSData _row : tdbEntries)
269    {
270    // tdb returns custom object
271  2515 TDB_FTSData row = (TDB_FTSData) _row;
272  2515 String provider = row.getProvider();
273  2515 FilterOption providerOpt = new FilterOption(
274    "3DB Provider - " + provider,
275    FILTER_SOURCE_PREFIX + provider, VIEWS_FILTER, false, this);
276  2515 if (!xtantOptions.contains(providerOpt))
277    {
278  27 xtantOptions.add(1, providerOpt);
279  27 tdBeaconsFilters.add(FILTER_SOURCE_PREFIX + provider);
280  27 if ("PDBe".equalsIgnoreCase(provider))
281    {
282  6 hasPDBe = true;
283    }
284    }
285    }
286  6 if (!hasPDBe)
287    {
288    // remove the PDBe options from the available filters
289  0 int op = 0;
290  0 while (op < xtantOptions.size())
291    {
292  0 FilterOption filter = xtantOptions.get(op);
293  0 if (filter
294    .getQuerySource() instanceof PDBStructureChooserQuerySource)
295    {
296  0 xtantOptions.remove(op);
297    }
298    else
299    {
300  0 op++;
301    }
302    }
303    }
304    }
305   
306    }
307   
 
308  19 toggle private boolean tdBeaconsFilter(String fieldToFilterBy)
309    {
310  19 return tdBeaconsFilters != null
311    && tdBeaconsFilters.contains(fieldToFilterBy);
312    }
313   
 
314  7 toggle protected String remove_prefix(String fieldToFilterBy)
315    {
316  7 if (tdBeaconsFilters != null
317    && tdBeaconsFilters.contains(fieldToFilterBy)
318    && !defaultFilters.contains(fieldToFilterBy))
319    {
320  0 return fieldToFilterBy.substring(FILTER_SOURCE_PREFIX.length());
321    }
322    else
323    {
324  7 return null;
325    }
326    }
327   
 
328  1 toggle @Override
329    public boolean needsRefetch(FilterOption selectedFilterOpt)
330    {
331  1 return selectedFilterOpt == null
332    || !tdBeaconsFilter(selectedFilterOpt.getValue())
333    && lastPdbRequest != lastTdbRequest;
334    }
335   
336    /**
337    * FTSRestClient specific query builder to pick top ranked entry from a
338    * fetchStructuresMetaData query
339    *
340    * @param seq
341    * - seq to generate a query for
342    * @param wantedFields
343    * - fields to retrieve
344    * @param selectedFilterOpt
345    * - criterion for ranking results (e.g. resolution)
346    * @param b
347    * - sort ascending or descending
348    * @return
349    * @throws Exception
350    */
 
351  6 toggle @Override
352    public FTSRestResponse selectFirstRankedQuery(SequenceI seq,
353    Collection<FTSData> collectedResults,
354    Collection<FTSDataColumnI> wantedFields, String fieldToFilterBy,
355    boolean b) throws Exception
356    {
357  6 if (fieldToFilterBy != null && tdBeaconsFilter(fieldToFilterBy))
358    {
359  6 TDBResultAnalyser analyser = new TDBResultAnalyser(seq,
360    collectedResults, lastTdbRequest, fieldToFilterBy,
361    remove_prefix(fieldToFilterBy));
362   
363  6 FTSRestResponse resultList = new FTSRestResponse();
364   
365  6 List<FTSData> filteredResponse = analyser.getFilteredResponse();
366   
367  6 List<FTSData> selectedStructures = analyser
368    .selectStructures(filteredResponse);
369  6 resultList.setNumberOfItemsFound(selectedStructures.size());
370  6 resultList.setSearchSummary(selectedStructures);
371  6 return resultList;
372    }
373    // Fall back to PDBe rankings
374  0 return getPDBQuerySource().selectFirstRankedQuery(seq, collectedResults,
375    wantedFields, fieldToFilterBy, b);
376    }
377   
 
378  3 toggle @Override
379    public PDBEntry[] collectSelectedRows(JTable restable, int[] selectedRows,
380    List<SequenceI> selectedSeqsToView)
381    {
382  3 int refSeqColIndex = restable.getColumn("Ref Sequence").getModelIndex();
383   
384  3 PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
385  3 int count = 0;
386  3 int idColumnIndex = restable.getColumn("Model id").getModelIndex();
387  3 int urlColumnIndex = restable.getColumn("Url").getModelIndex();
388  3 int typeColumnIndex = restable.getColumn("Provider").getModelIndex();
389  3 int humanUrl = restable.getColumn("Page URL").getModelIndex();
390  3 int modelformat = restable.getColumn("Model Format").getModelIndex();
391  3 int idx_mcat = restable.getColumn("Model Category").getModelIndex();
392  3 int idx_mqual = restable.getColumn("Confidence").getModelIndex();
393  3 int idx_mqualtype = restable.getColumn("Confidence Score Type").getModelIndex();
394  3 int idx_mqualtypever = restable.getColumn("Confidence Score Version").getModelIndex();
395   
396   
397   
398  3 final int up_start_idx = restable.getColumn("Uniprot Start")
399    .getModelIndex();
400  3 final int up_end_idx = restable.getColumn("Uniprot End")
401    .getModelIndex();
402  3 int i = 0;
403   
404    // bleugh!
405  3 Integer[] sellist = new Integer[selectedRows.length];
406  3 for (Integer row : selectedRows)
407    {
408  3 sellist[i++] = row;
409    }
410    // Sort rows by coverage
411  3 Arrays.sort(sellist, new Comparator<Integer>()
412    {
 
413  0 toggle @Override
414    public int compare(Integer o1, Integer o2)
415    {
416  0 int o1_xt = ((Integer) restable.getValueAt(o1, up_end_idx))
417    - (Integer) restable.getValueAt(o1, up_start_idx);
418  0 int o2_xt = ((Integer) restable.getValueAt(o2, up_end_idx))
419    - (Integer) restable.getValueAt(o2, up_start_idx);
420  0 return o2_xt - o1_xt;
421    }
422    });
423   
424  3 for (int row : sellist)
425    {
426    // unique id - could be a horrible hash
427   
428  3 String pdbIdStr = restable.getValueAt(row, idColumnIndex).toString();
429  3 String urlStr = restable.getValueAt(row, urlColumnIndex).toString();
430  3 String typeColumn = restable.getValueAt(row, typeColumnIndex)
431    .toString();
432  3 String modelPage = humanUrl < 1 ? null
433    : (String) restable.getValueAt(row, humanUrl);
434   
435  3 String modelCategory = idx_mcat < 1 ? null
436    : (String) restable.getValueAt(row, idx_mcat);
437   
438   
439  3 Double modelConf = idx_mqual < 1 ? null
440    : (Double) restable.getValueAt(row, idx_mqual);
441   
442  3 String modelConfType = idx_mqualtype < 1 ? null
443    : (String) restable.getValueAt(row, idx_mqualtype);
444  3 String modelConfVer = idx_mqualtypever < 1 ? null
445    : (String) restable.getValueAt(row, idx_mqualtypever);
446   
447  3 String tftype = (modelConfType==null) ? null: modelConfType.toUpperCase(Locale.ROOT);
448  3 TFType tempfacType = (tftype==null) ? null : TFType.valueOf(tftype);
449  3 if (tftype==null || "".equals(tftype) || TFType.valueOf(tftype) == null )
450    {
451    // TODO maintain mappings between confidence types and tempfactypes
452  1 if (typeColumn.toLowerCase(Locale.ROOT).startsWith("alpha") || (tftype!=null && tftype.startsWith("ALPHAFOLD"))) {
453  0 tftype = TFType.PLDDT.toString();
454  0 modelConfVer = null;
455    }
456  1 if (!typeColumn.toLowerCase(Locale.ROOT).startsWith("pdbe")) {
457  0 tftype = TFType.QMEANDISCO.toString();
458    }
459    }
460   
461  3 String strucFormat = restable.getValueAt(row, modelformat).toString();
462   
463  3 SequenceI selectedSeq = (SequenceI) restable.getValueAt(row,
464    refSeqColIndex);
465  3 selectedSeqsToView.add(selectedSeq);
466  3 PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
467  3 if (pdbEntry == null)
468    {
469  3 pdbEntry = getFindEntry(pdbIdStr, selectedSeq.getAllPDBEntries());
470    }
471   
472  3 if (pdbEntry == null)
473    {
474  3 pdbEntry = new PDBEntry();
475  3 pdbEntry.setId(pdbIdStr);
476  3 pdbEntry.setAuthoritative(true);
477  3 try
478    {
479  3 pdbEntry.setType(PDBEntry.Type.valueOf(strucFormat));
480    } catch (Exception q)
481    {
482  0 Console.warn("Unknown filetype for 3D Beacons Model from: "
483    + strucFormat + " - " + pdbIdStr + " - " + modelPage);
484    }
485   
486  3 if (!"PDBe".equalsIgnoreCase(typeColumn))
487    {
488  2 pdbEntry.setRetrievalUrl(urlStr);
489    }
490  3 pdbEntry.setProvider(typeColumn);
491  3 if (modelPage != null)
492    {
493  3 pdbEntry.setProviderPage(modelPage);
494    }
495  3 pdbEntry.setProviderCategory(modelCategory);
496  3 if (tempfacType != null) {
497  2 pdbEntry.setTempFacType(tempfacType);
498    }
499  3 if (modelConf != null) {
500  2 pdbEntry.setModelConfidence(modelConf);
501    }
502  3 if (modelConfType != null) {
503  2 pdbEntry.setModelConfidenceType(modelConfType);
504    }
505  3 if (modelConfVer != null) {
506  1 pdbEntry.setModelConfidenceVersion(modelConfVer);
507    }
508   
509  3 selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
510    }
511  3 pdbEntriesToView[count++] = pdbEntry;
512    }
513  3 return pdbEntriesToView;
514    }
515   
 
516  98 toggle @Override
517    protected FTSRestRequest getLastFTSRequest()
518    {
519  98 return lastTdbRequest;
520    }
521   
522    /**
523    * generate a query for PDBFTS to retrieve structure metadata
524    *
525    * @param ftsRestRequest
526    * @param upResponse
527    * @return
528    */
529   
 
530  22 toggle public List<String> buildPDBFTSQueryFor(FTSRestResponse upResponse)
531    {
532  22 List<String> ftsQueries = new ArrayList<String>();
533  22 Set<String> pdbIds = new HashSet<String>();
534  22 int idx_modelId = getLastFTSRequest().getFieldIndex("Model id");
535  22 int idx_provider = getLastFTSRequest().getFieldIndex("Provider");
536  22 for (FTSData row : upResponse.getSearchSummary())
537    {
538  9934 String id = (String) row.getSummaryData()[idx_modelId];
539  9934 String provider = (String) row.getSummaryData()[idx_provider];
540  9934 if ("PDBe".equalsIgnoreCase(provider))
541    {
542  9468 pdbIds.add(id);
543    }
544    }
545  22 StringBuilder sb = new StringBuilder();
546  22 for (String pdbId : pdbIds)
547    {
548  7556 if (sb.length() > 2500)
549    {
550  20 ftsQueries.add(sb.toString());
551  20 sb.setLength(0);
552    }
553  7556 if (sb.length() > 0)
554    {
555  7514 sb.append(" OR ");
556    }
557  7556 sb.append(pdbId);
558    }
559  22 if (sb.length() > 0)
560    {
561  22 ftsQueries.add(sb.toString());
562    }
563  22 return ftsQueries;
564    }
565   
566    /**
567    * query PDBe for structure metadata
568    *
569    * @param pdbquery
570    * @param upResponse
571    * @return FTSRestResponse via PDBStructureChooserQuerySource
572    */
 
573  17 toggle public List<FTSRestResponse> fetchStructuresMetaDataFor(
574    PDBStructureChooserQuerySource pdbquery,
575    FTSRestResponse upResponse) throws Exception
576    {
577  17 List<String> pdb_Queries = buildPDBFTSQueryFor(upResponse);
578  17 if (pdb_Queries.size() == 0)
579    {
580  0 return null;
581    }
582  17 List<FTSRestResponse> results = new ArrayList<FTSRestResponse>();
583   
584  17 for (String pdb_Query : pdb_Queries)
585    {
586  32 FTSRestResponse resultList;
587  32 FTSRestRequest pdbRequest = new FTSRestRequest();
588  32 pdbRequest.setAllowEmptySeq(false);
589  32 pdbRequest.setResponseSize(500);
590  32 pdbRequest.setFieldToSearchBy("(");
591    // pdbRequest.setFieldToSortBy("pdb_id");
592  32 pdbRequest.setWantedFields(
593    pdbquery.getDocFieldPrefs().getStructureSummaryFields());
594  32 pdbRequest.setSearchTerm(pdb_Query + ")");
595   
596    // handle exceptions like server errors here - means the threedbeacons
597    // discovery isn't broken by issues to do with the PDBe SOLR api
598  32 try
599    {
600  32 resultList = pdbquery.executePDBFTSRestRequest(pdbRequest);
601  32 if (resultList.getNumberOfItemsFound() == 0)
602    {
603  0 Console.info("Unexpectedly returned no results for pdbe query: "
604    + pdb_Query);
605    }
606  32 results.add(resultList);
607  32 lastPdbRequest = pdbRequest;
608    } catch (Exception ex)
609    {
610  0 Console.error("PDBFTSQuery failed", ex);
611    }
612   
613    }
614   
615  17 return results;
616    }
617   
 
618  17 toggle public FTSRestResponse joinResponses(FTSRestResponse upResponse,
619    List<FTSRestResponse> pdbResponses)
620    {
621  17 boolean hasPdbResp = lastPdbRequest != null;
622   
623  17 int idx_provider = getLastFTSRequest().getFieldIndex("Provider");
624    // join on
625  17 int idx_modelId = getLastFTSRequest().getFieldIndex("Model id");
626  17 int pdbIdx = hasPdbResp ? lastPdbRequest.getFieldIndex("PDB Id") : -1;
627  17 int pdbTitle_idx = hasPdbResp ? lastPdbRequest.getFieldIndex("Title")
628    : -1;
629  17 int tdbTitle_idx = getLastFTSRequest().getFieldIndex("Title");
630   
631  17 for (final FTSData row : upResponse.getSearchSummary())
632    {
633  7482 String id = (String) row.getSummaryData()[idx_modelId];
634  7482 String provider = (String) row.getSummaryData()[idx_provider];
635  7482 if ("PDBe".equalsIgnoreCase(provider))
636    {
637  7116 if (!hasPdbResp)
638    {
639  0 jalview.bin.Console.outPrintln(
640    "Warning: seems like we couldn't get to the PDBe search interface.");
641    }
642    else
643    {
644  7116 for (final FTSRestResponse pdbResponse : pdbResponses)
645    {
646  29043 for (final FTSData pdbrow : pdbResponse.getSearchSummary())
647    {
648  11189136 String pdbid = (String) pdbrow.getSummaryData()[pdbIdx];
649  11189136 if (id.equalsIgnoreCase(pdbid))
650    {
651  12527 row.getSummaryData()[tdbTitle_idx] = pdbrow
652    .getSummaryData()[pdbTitle_idx];
653    }
654    }
655    }
656    }
657   
658    }
659    else
660    {
661  366 row.getSummaryData()[tdbTitle_idx] = "Model from TDB";
662    }
663    }
664  17 return upResponse;
665    }
666   
 
667  0 toggle public TDB_FTSData getFTSDataFor(JTable restable, int selectedRow,
668    Collection<FTSData> discoveredStructuresSet)
669    {
670  0 int idColumnIndex = restable.getColumn("Model id").getModelIndex();
671   
672  0 String modelId = (String) restable.getValueAt(selectedRow,
673    idColumnIndex);
674  0 for (FTSData row : discoveredStructuresSet)
675    {
676  0 if (row instanceof TDB_FTSData
677    && ((TDB_FTSData) row).getModelId().equals(modelId))
678    {
679  0 return ((TDB_FTSData) row);
680    }
681    }
682  0 return null;
683    }
684   
685    }