resultList = tdbRestClient.executeRequest(tdbRequest);
lastTdbRequest = tdbRequest;
+
+ // Query the PDB and add additional metadata
+ FTSRestResponse pdbResponse = fetchStructuresMetaDataFor(getPDBQuerySource(), resultList);
+ FTSRestResponse joinedResp = joinResponses(resultList,
+ pdbResponse);
return resultList;
}
+ PDBStructureChooserQuerySource pdbQuerySource=null;
+ private PDBStructureChooserQuerySource getPDBQuerySource()
+ {
+ if (pdbQuerySource==null)
+ {
+ pdbQuerySource = new PDBStructureChooserQuerySource();
+ }
+ return pdbQuerySource;
+ }
+
private FTSRestRequest getTDBeaconsRequest(SequenceI seq,
Collection<FTSDataColumnI> wantedFields)
{
int idx_provider = getLastFTSRequest().getFieldIndex("Provider");
// join on
int idx_modelId = getLastFTSRequest().getFieldIndex("Model id");
- int pdbIdx = lastPdbRequest.getFieldIndex("pdb_id");
- for (FTSData row : upResponse.getSearchSummary())
+ int pdbIdx = lastPdbRequest.getFieldIndex("PDB Id");
+ int pdbTitle_idx = lastPdbRequest.getFieldIndex("Title");
+ int tdbTitle_idx = getLastFTSRequest().getFieldIndex("Title");
+
+ List<FTSData> joinedRows = new ArrayList<FTSData>();
+ for (final FTSData row : upResponse.getSearchSummary())
{
String id = (String) row.getSummaryData()[idx_modelId];
String provider = (String) row.getSummaryData()[idx_provider];
if ("PDBe".equalsIgnoreCase(provider))
{
- for (FTSData pdbrow : pdbResponse.getSearchSummary())
+ for (final FTSData pdbrow : pdbResponse.getSearchSummary())
{
String pdbid = (String) pdbrow.getSummaryData()[pdbIdx];
if (id.equalsIgnoreCase(pdbid))
{
- // often multiple entries per PDB ID so we bail after first
- // get wanted fields
- // append to FTSRestResponse array
+ row.getSummaryData()[tdbTitle_idx] = pdbrow
+ .getSummaryData()[pdbTitle_idx];
}
}
+ } else {
+ row.getSummaryData()[tdbTitle_idx] = "Model from TDB";
}
}
- // TODO Auto-generated method stub
- return null;
+ return upResponse;
}
}
\ No newline at end of file
{
System.out.println("seq >>>> " + upSeq);
TDBeaconsFTSRestClientTest.setMock();
+ PDBFTSRestClient.setMock();
StructureChooserQuerySource scquery = StructureChooserQuerySource.getQuerySourceFor(new SequenceI[] { upSeq});
+ // gets the lightweight proxy rather than the ThreeDBStructureChooserQuerySource
AssertJUnit.assertTrue(scquery instanceof ThreeDBStructureChooserQuerySource);
String query = scquery.buildQuery(upSeq);
AssertJUnit.assertEquals("P38398", query);
upResponse = tdbquery.fetchStructuresMetaData(upSeq, tdbquery.getDocFieldPrefs().getStructureSummaryFields(), null, false);
// test ranking without additional PDBe data
FTSRestResponse firstRanked = tdbquery.selectFirstRankedQuery(upSeq, upResponse.getSearchSummary(), tdbquery.getDocFieldPrefs().getStructureSummaryFields(), "", false);
- assertTrue(firstRanked.getNumberOfItemsFound()==upResponse.getNumberOfItemsFound());
+ assertTrue(firstRanked.getNumberOfItemsFound()<upResponse.getNumberOfItemsFound());
// NB Could have race condition here
String pdb_Query = tdbquery.buildPDBFTSQueryFor(upResponse);
assertTrue(pdb_Query.trim().length()>0);