Clover icon

Coverage Report

  1. Project Clover database Fri Nov 15 2024 13:56:46 GMT
  2. Package jalview.gui.structurechooser

File ThreeDBStructureChooserQuerySource.java

 

Coverage histogram

../../../img/srcFileCovDistChart6.png
36% of files have more coverage

Code metrics

100
229
21
1
683
509
84
0.37
10.9
21
4

Classes

Class Line # Actions
ThreeDBStructureChooserQuerySource 57 229 84
0.534285753.4%
 

Contributing tests

This file is covered by 42 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  70 toggle public ThreeDBStructureChooserQuerySource()
76    {
77  70 defaultFilters = new LinkedHashSet<String>();
78  70 defaultFilters.add(FILTER_TDBEACONS_COVERAGE);
79  70 defaultFilters.add(FILTER_FIRST_BEST_COVERAGE);
80   
81  70 tdbRestClient = TDBeaconsFTSRestClient.getInstance();
82  70 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  83 toggle public static int checkUniprotRefs(List<DBRefEntry> refs)
116    {
117  83 boolean hasUniprot = false;
118  83 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  60 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  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 pdbEntry.setTempFacType(tempfacType);
497  0 if (modelConf != null) {
498  0 pdbEntry.setModelConfidence(modelConf);
499    }
500  0 if (modelConfType != null) {
501  0 pdbEntry.setModelConfidenceType(modelConfType);
502    }
503  0 if (modelConfVer != null) {
504  0 pdbEntry.setModelConfidenceVersion(modelConfVer);
505    }
506   
507  0 selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
508    }
509  0 pdbEntriesToView[count++] = pdbEntry;
510    }
511  0 return pdbEntriesToView;
512    }
513   
 
514  97 toggle @Override
515    protected FTSRestRequest getLastFTSRequest()
516    {
517  97 return lastTdbRequest;
518    }
519   
520    /**
521    * generate a query for PDBFTS to retrieve structure metadata
522    *
523    * @param ftsRestRequest
524    * @param upResponse
525    * @return
526    */
527   
 
528  22 toggle public List<String> buildPDBFTSQueryFor(FTSRestResponse upResponse)
529    {
530  22 List<String> ftsQueries = new ArrayList<String>();
531  22 Set<String> pdbIds = new HashSet<String>();
532  22 int idx_modelId = getLastFTSRequest().getFieldIndex("Model id");
533  22 int idx_provider = getLastFTSRequest().getFieldIndex("Provider");
534  22 for (FTSData row : upResponse.getSearchSummary())
535    {
536  9934 String id = (String) row.getSummaryData()[idx_modelId];
537  9934 String provider = (String) row.getSummaryData()[idx_provider];
538  9934 if ("PDBe".equalsIgnoreCase(provider))
539    {
540  9468 pdbIds.add(id);
541    }
542    }
543  22 StringBuilder sb = new StringBuilder();
544  22 for (String pdbId : pdbIds)
545    {
546  7556 if (sb.length() > 2500)
547    {
548  20 ftsQueries.add(sb.toString());
549  20 sb.setLength(0);
550    }
551  7556 if (sb.length() > 0)
552    {
553  7514 sb.append(" OR ");
554    }
555  7556 sb.append(pdbId);
556    }
557  22 if (sb.length() > 0)
558    {
559  22 ftsQueries.add(sb.toString());
560    }
561  22 return ftsQueries;
562    }
563   
564    /**
565    * query PDBe for structure metadata
566    *
567    * @param pdbquery
568    * @param upResponse
569    * @return FTSRestResponse via PDBStructureChooserQuerySource
570    */
 
571  17 toggle public List<FTSRestResponse> fetchStructuresMetaDataFor(
572    PDBStructureChooserQuerySource pdbquery,
573    FTSRestResponse upResponse) throws Exception
574    {
575  17 List<String> pdb_Queries = buildPDBFTSQueryFor(upResponse);
576  17 if (pdb_Queries.size() == 0)
577    {
578  0 return null;
579    }
580  17 List<FTSRestResponse> results = new ArrayList<FTSRestResponse>();
581   
582  17 for (String pdb_Query : pdb_Queries)
583    {
584  32 FTSRestResponse resultList;
585  32 FTSRestRequest pdbRequest = new FTSRestRequest();
586  32 pdbRequest.setAllowEmptySeq(false);
587  32 pdbRequest.setResponseSize(500);
588  32 pdbRequest.setFieldToSearchBy("(");
589    // pdbRequest.setFieldToSortBy("pdb_id");
590  32 pdbRequest.setWantedFields(
591    pdbquery.getDocFieldPrefs().getStructureSummaryFields());
592  32 pdbRequest.setSearchTerm(pdb_Query + ")");
593   
594    // handle exceptions like server errors here - means the threedbeacons
595    // discovery isn't broken by issues to do with the PDBe SOLR api
596  32 try
597    {
598  32 resultList = pdbquery.executePDBFTSRestRequest(pdbRequest);
599  32 if (resultList.getNumberOfItemsFound() == 0)
600    {
601  0 Console.info("Unexpectedly returned no results for pdbe query: "
602    + pdb_Query);
603    }
604  32 results.add(resultList);
605  32 lastPdbRequest = pdbRequest;
606    } catch (Exception ex)
607    {
608  0 Console.error("PDBFTSQuery failed", ex);
609    }
610   
611    }
612   
613  17 return results;
614    }
615   
 
616  17 toggle public FTSRestResponse joinResponses(FTSRestResponse upResponse,
617    List<FTSRestResponse> pdbResponses)
618    {
619  17 boolean hasPdbResp = lastPdbRequest != null;
620   
621  17 int idx_provider = getLastFTSRequest().getFieldIndex("Provider");
622    // join on
623  17 int idx_modelId = getLastFTSRequest().getFieldIndex("Model id");
624  17 int pdbIdx = hasPdbResp ? lastPdbRequest.getFieldIndex("PDB Id") : -1;
625  17 int pdbTitle_idx = hasPdbResp ? lastPdbRequest.getFieldIndex("Title")
626    : -1;
627  17 int tdbTitle_idx = getLastFTSRequest().getFieldIndex("Title");
628   
629  17 for (final FTSData row : upResponse.getSearchSummary())
630    {
631  7482 String id = (String) row.getSummaryData()[idx_modelId];
632  7482 String provider = (String) row.getSummaryData()[idx_provider];
633  7482 if ("PDBe".equalsIgnoreCase(provider))
634    {
635  7116 if (!hasPdbResp)
636    {
637  0 jalview.bin.Console.outPrintln(
638    "Warning: seems like we couldn't get to the PDBe search interface.");
639    }
640    else
641    {
642  7116 for (final FTSRestResponse pdbResponse : pdbResponses)
643    {
644  29043 for (final FTSData pdbrow : pdbResponse.getSearchSummary())
645    {
646  11189136 String pdbid = (String) pdbrow.getSummaryData()[pdbIdx];
647  11189136 if (id.equalsIgnoreCase(pdbid))
648    {
649  12527 row.getSummaryData()[tdbTitle_idx] = pdbrow
650    .getSummaryData()[pdbTitle_idx];
651    }
652    }
653    }
654    }
655   
656    }
657    else
658    {
659  366 row.getSummaryData()[tdbTitle_idx] = "Model from TDB";
660    }
661    }
662  17 return upResponse;
663    }
664   
 
665  0 toggle public TDB_FTSData getFTSDataFor(JTable restable, int selectedRow,
666    Collection<FTSData> discoveredStructuresSet)
667    {
668  0 int idColumnIndex = restable.getColumn("Model id").getModelIndex();
669   
670  0 String modelId = (String) restable.getValueAt(selectedRow,
671    idColumnIndex);
672  0 for (FTSData row : discoveredStructuresSet)
673    {
674  0 if (row instanceof TDB_FTSData
675    && ((TDB_FTSData) row).getModelId().equals(modelId))
676    {
677  0 return ((TDB_FTSData) row);
678    }
679    }
680  0 return null;
681    }
682   
683    }