Clover icon

Coverage Report

  1. Project Clover database Tue Mar 10 2026 14:58:44 GMT
  2. Package jalview.gui.structurechooser

File ThreeDBStructureChooserQuerySource.java

 

Coverage histogram

../../../img/srcFileCovDistChart0.png
0% 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.00%
 

Contributing tests

No tests hitting this source file were found.

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  0 toggle public ThreeDBStructureChooserQuerySource()
76    {
77  0 defaultFilters = new LinkedHashSet<String>();
78  0 defaultFilters.add(FILTER_TDBEACONS_COVERAGE);
79  0 defaultFilters.add(FILTER_FIRST_BEST_COVERAGE);
80   
81  0 tdbRestClient = TDBeaconsFTSRestClient.getInstance();
82  0 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  0 toggle @Override
97    public String buildQuery(SequenceI seq)
98    {
99  0 List<DBRefEntry> refs = seq.getDBRefs();
100  0 int ib = checkUniprotRefs(refs);
101  0 if (ib > -1)
102    {
103  0 return getDBRefId(refs.get(ib));
104    }
105  0 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  0 toggle public static int checkUniprotRefs(List<DBRefEntry> refs)
116    {
117  0 boolean hasUniprot = false;
118  0 if (refs != null && refs.size() != 0)
119    {
120  0 for (int ib = 0, nb = refs.size(); ib < nb; ib++)
121    {
122  0 DBRefEntry dbRef = refs.get(ib);
123  0 if (dbRef.getSource().equalsIgnoreCase(DBRefSource.UNIPROT))
124    {
125  0 hasUniprot = true;
126  0 if (dbRef.isCanonical())
127    {
128  0 return ib;
129    }
130    }
131    }
132    }
133  0 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  0 toggle static String getDBRefId(DBRefEntry dbRef)
166    {
167  0 String ref = dbRef.getAccessionId().replaceAll("GO:", "");
168  0 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  0 toggle @Override
187    public FTSRestResponse fetchStructuresMetaData(SequenceI seq,
188    Collection<FTSDataColumnI> wantedFields,
189    FilterOption selectedFilterOpt, boolean b) throws Exception
190    {
191  0 FTSRestResponse resultList;
192  0 if (selectedFilterOpt != null
193    && tdBeaconsFilter(selectedFilterOpt.getValue()))
194    {
195  0 FTSRestRequest tdbRequest = getTDBeaconsRequest(seq, wantedFields);
196  0 resultList = tdbRestClient.executeRequest(tdbRequest);
197   
198  0 lastTdbRequest = tdbRequest;
199  0 if (resultList != null)
200    { // Query the PDB and add additional metadata
201  0 List<FTSRestResponse> pdbResponse = fetchStructuresMetaDataFor(
202    getPDBQuerySource(), resultList);
203   
204  0 resultList = joinResponses(resultList, pdbResponse);
205    }
206  0 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  0 toggle private PDBStructureChooserQuerySource getPDBQuerySource()
221    {
222  0 if (pdbQuerySource == null)
223    {
224  0 pdbQuerySource = new PDBStructureChooserQuerySource();
225    }
226  0 return pdbQuerySource;
227    }
228   
 
229  0 toggle private FTSRestRequest getTDBeaconsRequest(SequenceI seq,
230    Collection<FTSDataColumnI> wantedFields)
231    {
232  0 FTSRestRequest pdbRequest = new FTSRestRequest();
233  0 pdbRequest.setAllowEmptySeq(false);
234  0 pdbRequest.setResponseSize(500);
235  0 pdbRequest.setWantedFields(wantedFields);
236  0 String query = buildQuery(seq);
237  0 if (query == null)
238    {
239  0 return null;
240    }
241  0 pdbRequest.setSearchTerm(query + ".json");
242  0 pdbRequest.setAssociatedSequence(seq);
243  0 return pdbRequest;
244    }
245   
 
246  0 toggle @Override
247    public List<FilterOption> getAvailableFilterOptions(String VIEWS_FILTER)
248    {
249  0 List<FilterOption> filters = getPDBQuerySource()
250    .getAvailableFilterOptions(VIEWS_FILTER);
251  0 tdBeaconsFilters = new LinkedHashSet<String>();
252  0 tdBeaconsFilters.addAll(defaultFilters);
253  0 filters.add(0, new FilterOption("Best 3D-Beacons Coverage",
254    FILTER_FIRST_BEST_COVERAGE, VIEWS_FILTER, false, this));
255  0 filters.add(1, new FilterOption("Multiple 3D-Beacons Coverage",
256    FILTER_TDBEACONS_COVERAGE, VIEWS_FILTER, true, this));
257   
258  0 return filters;
259    }
260   
 
261  0 toggle @Override
262    public void updateAvailableFilterOptions(String VIEWS_FILTER,
263    List<FilterOption> xtantOptions, Collection<FTSData> tdbEntries)
264    {
265  0 if (tdbEntries != null && lastTdbRequest != null)
266    {
267  0 boolean hasPDBe = false;
268  0 for (FTSData _row : tdbEntries)
269    {
270    // tdb returns custom object
271  0 TDB_FTSData row = (TDB_FTSData) _row;
272  0 String provider = row.getProvider();
273  0 FilterOption providerOpt = new FilterOption(
274    "3DB Provider - " + provider,
275    FILTER_SOURCE_PREFIX + provider, VIEWS_FILTER, false, this);
276  0 if (!xtantOptions.contains(providerOpt))
277    {
278  0 xtantOptions.add(1, providerOpt);
279  0 tdBeaconsFilters.add(FILTER_SOURCE_PREFIX + provider);
280  0 if ("PDBe".equalsIgnoreCase(provider))
281    {
282  0 hasPDBe = true;
283    }
284    }
285    }
286  0 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  0 toggle private boolean tdBeaconsFilter(String fieldToFilterBy)
309    {
310  0 return tdBeaconsFilters != null
311    && tdBeaconsFilters.contains(fieldToFilterBy);
312    }
313   
 
314  0 toggle protected String remove_prefix(String fieldToFilterBy)
315    {
316  0 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  0 return null;
325    }
326    }
327   
 
328  0 toggle @Override
329    public boolean needsRefetch(FilterOption selectedFilterOpt)
330    {
331  0 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  0 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  0 if (fieldToFilterBy != null && tdBeaconsFilter(fieldToFilterBy))
358    {
359  0 TDBResultAnalyser analyser = new TDBResultAnalyser(seq,
360    collectedResults, lastTdbRequest, fieldToFilterBy,
361    remove_prefix(fieldToFilterBy));
362   
363  0 FTSRestResponse resultList = new FTSRestResponse();
364   
365  0 List<FTSData> filteredResponse = analyser.getFilteredResponse();
366   
367  0 List<FTSData> selectedStructures = analyser
368    .selectStructures(filteredResponse);
369  0 resultList.setNumberOfItemsFound(selectedStructures.size());
370  0 resultList.setSearchSummary(selectedStructures);
371  0 return resultList;
372    }
373    // Fall back to PDBe rankings
374  0 return getPDBQuerySource().selectFirstRankedQuery(seq, collectedResults,
375    wantedFields, fieldToFilterBy, b);
376    }
377   
 
378  0 toggle @Override
379    public PDBEntry[] collectSelectedRows(JTable restable, int[] selectedRows,
380    List<SequenceI> selectedSeqsToView)
381    {
382  0 int refSeqColIndex = restable.getColumn("Ref Sequence").getModelIndex();
383   
384  0 PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
385  0 int count = 0;
386  0 int idColumnIndex = restable.getColumn("Model id").getModelIndex();
387  0 int urlColumnIndex = restable.getColumn("Url").getModelIndex();
388  0 int typeColumnIndex = restable.getColumn("Provider").getModelIndex();
389  0 int humanUrl = restable.getColumn("Page URL").getModelIndex();
390  0 int modelformat = restable.getColumn("Model Format").getModelIndex();
391  0 int idx_mcat = restable.getColumn("Model Category").getModelIndex();
392  0 int idx_mqual = restable.getColumn("Confidence").getModelIndex();
393  0 int idx_mqualtype = restable.getColumn("Confidence Score Type").getModelIndex();
394  0 int idx_mqualtypever = restable.getColumn("Confidence Score Version").getModelIndex();
395   
396   
397   
398  0 final int up_start_idx = restable.getColumn("Uniprot Start")
399    .getModelIndex();
400  0 final int up_end_idx = restable.getColumn("Uniprot End")
401    .getModelIndex();
402  0 int i = 0;
403   
404    // bleugh!
405  0 Integer[] sellist = new Integer[selectedRows.length];
406  0 for (Integer row : selectedRows)
407    {
408  0 sellist[i++] = row;
409    }
410    // Sort rows by coverage
411  0 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  0 for (int row : sellist)
425    {
426    // unique id - could be a horrible hash
427   
428  0 String pdbIdStr = restable.getValueAt(row, idColumnIndex).toString();
429  0 String urlStr = restable.getValueAt(row, urlColumnIndex).toString();
430  0 String typeColumn = restable.getValueAt(row, typeColumnIndex)
431    .toString();
432  0 String modelPage = humanUrl < 1 ? null
433    : (String) restable.getValueAt(row, humanUrl);
434   
435  0 String modelCategory = idx_mcat < 1 ? null
436    : (String) restable.getValueAt(row, idx_mcat);
437   
438   
439  0 Double modelConf = idx_mqual < 1 ? null
440    : (Double) restable.getValueAt(row, idx_mqual);
441   
442  0 String modelConfType = idx_mqualtype < 1 ? null
443    : (String) restable.getValueAt(row, idx_mqualtype);
444  0 String modelConfVer = idx_mqualtypever < 1 ? null
445    : (String) restable.getValueAt(row, idx_mqualtypever);
446   
447  0 String tftype = (modelConfType==null) ? null: modelConfType.toUpperCase(Locale.ROOT);
448  0 TFType tempfacType = (tftype==null) ? null : TFType.valueOf(tftype);
449  0 if (tftype==null || "".equals(tftype) || TFType.valueOf(tftype) == null )
450    {
451    // TODO maintain mappings between confidence types and tempfactypes
452  0 if (typeColumn.toLowerCase(Locale.ROOT).startsWith("alpha") || (tftype!=null && tftype.startsWith("ALPHAFOLD"))) {
453  0 tftype = TFType.PLDDT.toString();
454  0 modelConfVer = null;
455    }
456  0 if (!typeColumn.toLowerCase(Locale.ROOT).startsWith("pdbe")) {
457  0 tftype = TFType.QMEANDISCO.toString();
458    }
459    }
460   
461  0 String strucFormat = restable.getValueAt(row, modelformat).toString();
462   
463  0 SequenceI selectedSeq = (SequenceI) restable.getValueAt(row,
464    refSeqColIndex);
465  0 selectedSeqsToView.add(selectedSeq);
466  0 PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
467  0 if (pdbEntry == null)
468    {
469  0 pdbEntry = getFindEntry(pdbIdStr, selectedSeq.getAllPDBEntries());
470    }
471   
472  0 if (pdbEntry == null)
473    {
474  0 pdbEntry = new PDBEntry();
475  0 pdbEntry.setId(pdbIdStr);
476  0 pdbEntry.setAuthoritative(true);
477  0 try
478    {
479  0 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  0 if (!"PDBe".equalsIgnoreCase(typeColumn))
487    {
488  0 pdbEntry.setRetrievalUrl(urlStr);
489    }
490  0 pdbEntry.setProvider(typeColumn);
491  0 if (modelPage != null)
492    {
493  0 pdbEntry.setProviderPage(modelPage);
494    }
495  0 pdbEntry.setProviderCategory(modelCategory);
496  0 if (tempfacType != null) {
497  0 pdbEntry.setTempFacType(tempfacType);
498    }
499  0 if (modelConf != null) {
500  0 pdbEntry.setModelConfidence(modelConf);
501    }
502  0 if (modelConfType != null) {
503  0 pdbEntry.setModelConfidenceType(modelConfType);
504    }
505  0 if (modelConfVer != null) {
506  0 pdbEntry.setModelConfidenceVersion(modelConfVer);
507    }
508   
509  0 selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
510    }
511  0 pdbEntriesToView[count++] = pdbEntry;
512    }
513  0 return pdbEntriesToView;
514    }
515   
 
516  0 toggle @Override
517    protected FTSRestRequest getLastFTSRequest()
518    {
519  0 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  0 toggle public List<String> buildPDBFTSQueryFor(FTSRestResponse upResponse)
531    {
532  0 List<String> ftsQueries = new ArrayList<String>();
533  0 Set<String> pdbIds = new HashSet<String>();
534  0 int idx_modelId = getLastFTSRequest().getFieldIndex("Model id");
535  0 int idx_provider = getLastFTSRequest().getFieldIndex("Provider");
536  0 for (FTSData row : upResponse.getSearchSummary())
537    {
538  0 String id = (String) row.getSummaryData()[idx_modelId];
539  0 String provider = (String) row.getSummaryData()[idx_provider];
540  0 if ("PDBe".equalsIgnoreCase(provider))
541    {
542  0 pdbIds.add(id);
543    }
544    }
545  0 StringBuilder sb = new StringBuilder();
546  0 for (String pdbId : pdbIds)
547    {
548  0 if (sb.length() > 2500)
549    {
550  0 ftsQueries.add(sb.toString());
551  0 sb.setLength(0);
552    }
553  0 if (sb.length() > 0)
554    {
555  0 sb.append(" OR ");
556    }
557  0 sb.append(pdbId);
558    }
559  0 if (sb.length() > 0)
560    {
561  0 ftsQueries.add(sb.toString());
562    }
563  0 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  0 toggle public List<FTSRestResponse> fetchStructuresMetaDataFor(
574    PDBStructureChooserQuerySource pdbquery,
575    FTSRestResponse upResponse) throws Exception
576    {
577  0 List<String> pdb_Queries = buildPDBFTSQueryFor(upResponse);
578  0 if (pdb_Queries.size() == 0)
579    {
580  0 return null;
581    }
582  0 List<FTSRestResponse> results = new ArrayList<FTSRestResponse>();
583   
584  0 for (String pdb_Query : pdb_Queries)
585    {
586  0 FTSRestResponse resultList;
587  0 FTSRestRequest pdbRequest = new FTSRestRequest();
588  0 pdbRequest.setAllowEmptySeq(false);
589  0 pdbRequest.setResponseSize(500);
590  0 pdbRequest.setFieldToSearchBy("(");
591    // pdbRequest.setFieldToSortBy("pdb_id");
592  0 pdbRequest.setWantedFields(
593    pdbquery.getDocFieldPrefs().getStructureSummaryFields());
594  0 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  0 try
599    {
600  0 resultList = pdbquery.executePDBFTSRestRequest(pdbRequest);
601  0 if (resultList.getNumberOfItemsFound() == 0)
602    {
603  0 Console.info("Unexpectedly returned no results for pdbe query: "
604    + pdb_Query);
605    }
606  0 results.add(resultList);
607  0 lastPdbRequest = pdbRequest;
608    } catch (Exception ex)
609    {
610  0 Console.error("PDBFTSQuery failed", ex);
611    }
612   
613    }
614   
615  0 return results;
616    }
617   
 
618  0 toggle public FTSRestResponse joinResponses(FTSRestResponse upResponse,
619    List<FTSRestResponse> pdbResponses)
620    {
621  0 boolean hasPdbResp = lastPdbRequest != null;
622   
623  0 int idx_provider = getLastFTSRequest().getFieldIndex("Provider");
624    // join on
625  0 int idx_modelId = getLastFTSRequest().getFieldIndex("Model id");
626  0 int pdbIdx = hasPdbResp ? lastPdbRequest.getFieldIndex("PDB Id") : -1;
627  0 int pdbTitle_idx = hasPdbResp ? lastPdbRequest.getFieldIndex("Title")
628    : -1;
629  0 int tdbTitle_idx = getLastFTSRequest().getFieldIndex("Title");
630   
631  0 for (final FTSData row : upResponse.getSearchSummary())
632    {
633  0 String id = (String) row.getSummaryData()[idx_modelId];
634  0 String provider = (String) row.getSummaryData()[idx_provider];
635  0 if ("PDBe".equalsIgnoreCase(provider))
636    {
637  0 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  0 for (final FTSRestResponse pdbResponse : pdbResponses)
645    {
646  0 for (final FTSData pdbrow : pdbResponse.getSearchSummary())
647    {
648  0 String pdbid = (String) pdbrow.getSummaryData()[pdbIdx];
649  0 if (id.equalsIgnoreCase(pdbid))
650    {
651  0 row.getSummaryData()[tdbTitle_idx] = pdbrow
652    .getSummaryData()[pdbTitle_idx];
653    }
654    }
655    }
656    }
657   
658    }
659    else
660    {
661  0 row.getSummaryData()[tdbTitle_idx] = "Model from TDB";
662    }
663    }
664  0 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    }