Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 15:05:32 GMT
  2. Package jalview.fts.service.pdb

File PDBFTSRestClientTest.java

 

Code metrics

12
147
12
1
844
761
29
0.2
12.25
12
2.42

Classes

Class Line # Actions
PDBFTSRestClientTest 57 147 29
0.3333333433.3%
 

Contributing tests

This file is covered by 12 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.fts.service.pdb;
22   
23    import static org.testng.AssertJUnit.assertEquals;
24    import static org.testng.AssertJUnit.assertTrue;
25   
26    import java.io.BufferedReader;
27    import java.io.FileReader;
28    import java.io.IOException;
29    import java.util.ArrayList;
30    import java.util.Iterator;
31    import java.util.List;
32   
33    import javax.ws.rs.core.MediaType;
34   
35    import org.json.simple.JSONArray;
36    import org.json.simple.JSONObject;
37    import org.json.simple.parser.JSONParser;
38    import org.json.simple.parser.ParseException;
39    import org.testng.Assert;
40    import org.testng.annotations.AfterMethod;
41    import org.testng.annotations.BeforeClass;
42    import org.testng.annotations.BeforeMethod;
43    import org.testng.annotations.Test;
44   
45    import com.sun.jersey.api.client.Client;
46    import com.sun.jersey.api.client.ClientResponse;
47    import com.sun.jersey.api.client.WebResource;
48    import com.sun.jersey.api.client.config.ClientConfig;
49    import com.sun.jersey.api.client.config.DefaultClientConfig;
50   
51    import jalview.fts.api.FTSDataColumnI;
52    import jalview.fts.core.FTSRestClient;
53    import jalview.fts.core.FTSRestRequest;
54    import jalview.fts.core.FTSRestResponse;
55    import jalview.gui.JvOptionPane;
56   
 
57    public class PDBFTSRestClientTest
58    {
59   
 
60  1 toggle @BeforeClass(alwaysRun = true)
61    public void setUpJvOptionPane()
62    {
63  1 JvOptionPane.setInteractiveMode(false);
64  1 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
65    }
66   
 
67  2 toggle @BeforeMethod(alwaysRun = true)
68    public void setUp() throws Exception
69    {
70    }
71   
 
72  2 toggle @AfterMethod(alwaysRun = true)
73    public void tearDown() throws Exception
74    {
75    }
76   
 
77  0 toggle @Test(groups = { "External", "Network" })
78    public void executeRequestTest()
79    {
80  0 List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
81  0 try
82    {
83  0 wantedFields.add(PDBFTSRestClient.getInstance()
84    .getDataColumnByNameOrCode("molecule_type"));
85  0 wantedFields.add(PDBFTSRestClient.getInstance()
86    .getDataColumnByNameOrCode("pdb_id"));
87  0 wantedFields.add(PDBFTSRestClient.getInstance()
88    .getDataColumnByNameOrCode("genus"));
89  0 wantedFields.add(PDBFTSRestClient.getInstance()
90    .getDataColumnByNameOrCode("gene_name"));
91  0 wantedFields.add(PDBFTSRestClient.getInstance()
92    .getDataColumnByNameOrCode("title"));
93    } catch (Exception e1)
94    {
95  0 e1.printStackTrace();
96    }
97  0 System.out.println("wantedFields >>" + wantedFields);
98   
99  0 FTSRestRequest request = new FTSRestRequest();
100  0 request.setAllowEmptySeq(false);
101  0 request.setResponseSize(100);
102  0 request.setFieldToSearchBy("text:");
103  0 request.setSearchTerm("abc");
104  0 request.setWantedFields(wantedFields);
105   
106  0 FTSRestResponse response;
107  0 try
108    {
109  0 response = PDBFTSRestClient.getInstance().executeRequest(request);
110    } catch (Exception e)
111    {
112  0 e.printStackTrace();
113  0 Assert.fail("Couldn't execute webservice call!");
114  0 return;
115    }
116  0 assertTrue(response.getNumberOfItemsFound() > 99);
117  0 assertTrue(response.getSearchSummary() != null);
118  0 assertTrue(response.getSearchSummary().size() > 99);
119    }
120   
 
121  1 toggle @Test(groups = { "Functional" })
122    public void getPDBDocFieldsAsCommaDelimitedStringTest()
123    {
124  1 List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
125  1 try
126    {
127  1 wantedFields.add(PDBFTSRestClient.getInstance()
128    .getDataColumnByNameOrCode("molecule_type"));
129  1 wantedFields.add(PDBFTSRestClient.getInstance()
130    .getDataColumnByNameOrCode("pdb_id"));
131  1 wantedFields.add(PDBFTSRestClient.getInstance()
132    .getDataColumnByNameOrCode("genus"));
133  1 wantedFields.add(PDBFTSRestClient.getInstance()
134    .getDataColumnByNameOrCode("gene_name"));
135  1 wantedFields.add(PDBFTSRestClient.getInstance()
136    .getDataColumnByNameOrCode("title"));
137    } catch (Exception e)
138    {
139  0 e.printStackTrace();
140    }
141   
142  1 String expectedResult = "molecule_type,pdb_id,genus,gene_name,title";
143  1 String actualResult = PDBFTSRestClient.getInstance()
144    .getDataColumnsFieldsAsCommaDelimitedString(wantedFields);
145   
146  1 assertEquals("", expectedResult, actualResult);
147    }
148   
 
149  0 toggle @Test(groups = { "External, Network" })
150    public void parsePDBJsonExceptionStringTest()
151    {
152  0 List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
153  0 try
154    {
155  0 wantedFields.add(PDBFTSRestClient.getInstance()
156    .getDataColumnByNameOrCode("molecule_type"));
157  0 wantedFields.add(PDBFTSRestClient.getInstance()
158    .getDataColumnByNameOrCode("pdb_id"));
159  0 wantedFields.add(PDBFTSRestClient.getInstance()
160    .getDataColumnByNameOrCode("genus"));
161  0 wantedFields.add(PDBFTSRestClient.getInstance()
162    .getDataColumnByNameOrCode("gene_name"));
163  0 wantedFields.add(PDBFTSRestClient.getInstance()
164    .getDataColumnByNameOrCode("title"));
165    } catch (Exception e1)
166    {
167  0 e1.printStackTrace();
168    }
169   
170  0 FTSRestRequest request = new FTSRestRequest();
171  0 request.setAllowEmptySeq(false);
172  0 request.setResponseSize(100);
173  0 request.setFieldToSearchBy("text:");
174  0 request.setSearchTerm("abc");
175  0 request.setWantedFields(wantedFields);
176   
177  0 String jsonErrorResponse = "";
178  0 try
179    {
180  0 jsonErrorResponse = readJsonStringFromFile(
181    "test/jalview/io/pdb_request_json_error.txt");
182    } catch (IOException e)
183    {
184  0 e.printStackTrace();
185    }
186   
187  0 String parsedErrorResponse = PDBFTSRestClient
188    .parseJsonExceptionString(jsonErrorResponse);
189   
190  0 String expectedErrorMsg = "\n============= PDB Rest Client RunTime error =============\n"
191    + "Status: 400\n"
192    + "Message: org.apache.solr.search.SyntaxError: Cannot parse 'text:abc OR text:go:abc AND molecule_sequence:['' TO *]': Encountered \" \":\" \": \"\" at line 1, column 19.\n"
193    + "query: text:abc OR text:go:abc AND molecule_sequence:['' TO *]\n"
194    + "fl: pdb_id\n";
195   
196  0 assertEquals(expectedErrorMsg, parsedErrorResponse);
197    }
198   
 
199  0 toggle @Test(
200    groups =
201    { "External" },
202    enabled = false,
203    expectedExceptions = Exception.class)
204    public void testForExpectedRuntimeException() throws Exception
205    {
206    // FIXME JBPNote: looks like this test fails for no good reason - what
207    // exception was supposed to be raised ?
208  0 List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
209  0 wantedFields.add(PDBFTSRestClient.getInstance()
210    .getDataColumnByNameOrCode("pdb_id"));
211   
212  0 FTSRestRequest request = new FTSRestRequest();
213  0 request.setFieldToSearchBy("text:");
214  0 request.setSearchTerm("abc OR text:go:abc");
215  0 request.setWantedFields(wantedFields);
216  0 PDBFTSRestClient.getInstance().executeRequest(request);
217    }
218   
219    // JBP: Is this actually external ? Looks like it is mocked
220    // JBP looks like the mock is not up to date for this test
 
221  0 toggle @Test(groups = { "External" })
222    public void parsePDBJsonResponseTest()
223    {
224  0 List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
225  0 try
226    {
227  0 wantedFields.add(PDBFTSRestClient.getInstance()
228    .getDataColumnByNameOrCode("molecule_type"));
229  0 wantedFields.add(PDBFTSRestClient.getInstance()
230    .getDataColumnByNameOrCode("pdb_id"));
231  0 wantedFields.add(PDBFTSRestClient.getInstance()
232    .getDataColumnByNameOrCode("genus"));
233  0 wantedFields.add(PDBFTSRestClient.getInstance()
234    .getDataColumnByNameOrCode("gene_name"));
235  0 wantedFields.add(PDBFTSRestClient.getInstance()
236    .getDataColumnByNameOrCode("title"));
237    } catch (Exception e1)
238    {
239  0 e1.printStackTrace();
240    }
241   
242  0 FTSRestRequest request = new FTSRestRequest();
243  0 request.setAllowEmptySeq(false);
244  0 request.setWantedFields(wantedFields);
245   
246  0 String jsonString = "";
247  0 try
248    {
249  0 jsonString = readJsonStringFromFile(
250    "test/jalview/io/pdb_response_json.txt");
251    } catch (IOException e)
252    {
253  0 e.printStackTrace();
254    }
255  0 FTSRestResponse response = PDBFTSRestClient
256    .parsePDBJsonResponse(jsonString, request);
257  0 assertTrue(response.getSearchSummary() != null);
258  0 assertTrue(response.getNumberOfItemsFound() == 931);
259  0 assertTrue(response.getSearchSummary().size() == 14);
260  0 System.out.println("Search summary : " + response.getSearchSummary());
261    }
262   
 
263  1 toggle @Test(groups = { "Functional" })
264    public void getPDBIdColumIndexTest()
265    {
266  1 List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
267  1 try
268    {
269  1 wantedFields.add(PDBFTSRestClient.getInstance()
270    .getDataColumnByNameOrCode("molecule_type"));
271  1 wantedFields.add(PDBFTSRestClient.getInstance()
272    .getDataColumnByNameOrCode("genus"));
273  1 wantedFields.add(PDBFTSRestClient.getInstance()
274    .getDataColumnByNameOrCode("gene_name"));
275  1 wantedFields.add(PDBFTSRestClient.getInstance()
276    .getDataColumnByNameOrCode("title"));
277  1 wantedFields.add(PDBFTSRestClient.getInstance()
278    .getDataColumnByNameOrCode("pdb_id"));
279    } catch (Exception e)
280    {
281  0 e.printStackTrace();
282    }
283  1 try
284    {
285  1 assertEquals(5, PDBFTSRestClient.getInstance()
286    .getPrimaryKeyColumIndex(wantedFields, true));
287  1 assertEquals(4, PDBFTSRestClient.getInstance()
288    .getPrimaryKeyColumIndex(wantedFields, false));
289    } catch (Exception e)
290    {
291    // TODO Auto-generated catch block
292  0 e.printStackTrace();
293    }
294    }
295   
 
296  0 toggle @Test(groups = { "External" })
297    public void externalServiceIntegrationTest()
298    {
299  0 ClientConfig clientConfig = new DefaultClientConfig();
300  0 Client client = Client.create(clientConfig);
301   
302    // Build request parameters for the REST Request
303  0 WebResource webResource = client
304    .resource(PDBFTSRestClient.PDB_SEARCH_ENDPOINT)
305    .queryParam("wt", "json").queryParam("rows", String.valueOf(1))
306    .queryParam("q", "text:abc AND molecule_sequence:['' TO *]");
307   
308    // Execute the REST request
309  0 ClientResponse clientResponse = webResource
310    .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
311   
312    // Get the JSON string from the response object
313  0 String pdbJsonResponseString = clientResponse.getEntity(String.class);
314   
315    // Check the response status and report exception if one occurs
316  0 if (clientResponse.getStatus() != 200)
317    {
318  0 Assert.fail("Webservice call failed!!!");
319    }
320    else
321    {
322  0 try
323    {
324  0 JSONParser jsonParser = new JSONParser();
325  0 JSONObject jsonObj = (JSONObject) jsonParser
326    .parse(pdbJsonResponseString);
327  0 JSONObject pdbResponse = (JSONObject) jsonObj.get("response");
328  0 String queryTime = ((JSONObject) jsonObj.get("responseHeader"))
329    .get("QTime").toString();
330  0 String numFound = pdbResponse.get("numFound").toString();
331  0 JSONArray docs = (JSONArray) pdbResponse.get("docs");
332  0 Iterator<JSONObject> docIter = docs.iterator();
333   
334  0 assertTrue("Couldn't Retrieve 'response' object",
335    pdbResponse != null);
336  0 assertTrue("Couldn't Retrieve 'QTime' value", queryTime != null);
337  0 assertTrue("Couldn't Retrieve 'numFound' value", numFound != null);
338  0 assertTrue("Couldn't Retrieve 'docs' object",
339    docs != null || !docIter.hasNext());
340   
341  0 JSONObject pdbJsonDoc = docIter.next();
342   
343  0 for (FTSDataColumnI field : PDBFTSRestClient.getInstance()
344    .getAllFTSDataColumns())
345    {
346  0 if (field.getName().equalsIgnoreCase("ALL"))
347    {
348  0 continue;
349    }
350  0 if (pdbJsonDoc.get(field.getCode()) == null)
351    {
352    // System.out.println(">>>\t" + field.getCode());
353  0 assertTrue(
354    field.getCode()
355    + " has been removed from PDB doc Entity",
356    !pdbJsonResponseString.contains(field.getCode()));
357    }
358    }
359    } catch (ParseException e)
360    {
361  0 Assert.fail(
362    ">>> Test failed due to exception while parsing pdb response json !!!");
363  0 e.printStackTrace();
364    }
365    }
366    }
367   
368    /**
369    * reads any string from filePath
370    *
371    * @param filePath
372    * @return
373    * @throws IOException
374    */
 
375  185 toggle public static String readJsonStringFromFile(String filePath)
376    throws IOException
377    {
378  185 String fileContent;
379  185 BufferedReader br = new BufferedReader(new FileReader(filePath));
380  185 try
381    {
382  185 StringBuilder sb = new StringBuilder();
383  185 String line = br.readLine();
384   
385  118378 while (line != null)
386    {
387  118193 sb.append(line);
388  118193 sb.append(System.lineSeparator());
389  118193 line = br.readLine();
390    }
391  185 fileContent = sb.toString();
392    } finally
393    {
394  185 br.close();
395    }
396  185 return fileContent;
397    }
398   
 
399  9 toggle public static void setMock()
400    {
401  9 List<String[]> mocks = new ArrayList<String[]>();
402  9 mocks.add(
403    new String[]
404    { "https://www.ebi.ac.uk/pdbe/search/pdb/select?wt=json&fl=pdb_id,title,experimental_method,resolution&rows=500&start=0&q=(4igk+OR+7lyb+OR+3k0h+OR+3k0k+OR+1t15+OR+3pxc+OR+3pxd+OR+3pxe+OR+1jm7+OR+7jzv+OR+3pxa+OR+3pxb+OR+1y98+OR+1n5o+OR+4ifi+OR+4y2g+OR+3k15+OR+3k16+OR+4jlu+OR+2ing+OR+4ofb+OR+6g2i+OR+3coj+OR+1jnx+OR+4y18+OR+4u4a+OR+1oqa+OR+1t29+OR+1t2u+OR+1t2v)+AND+molecule_sequence:%5B''+TO+*%5D+AND+status:REL&sort=",
405    "{\n" + " \"responseHeader\":{\n" + " \"status\":0,\n"
406    + " \"QTime\":0,\n" + " \"params\":{\n"
407    + " \"q\":\"(4igk OR 7lyb OR 3k0h OR 3k0k OR 1t15 OR 3pxc OR 3pxd OR 3pxe OR 1jm7 OR 7jzv OR 3pxa OR 3pxb OR 1y98 OR 1n5o OR 4ifi OR 4y2g OR 3k15 OR 3k16 OR 4jlu OR 2ing OR 4ofb OR 6g2i OR 3coj OR 1jnx OR 4y18 OR 4u4a OR 1oqa OR 1t29 OR 1t2u OR 1t2v) AND molecule_sequence:['' TO *] AND status:REL\",\n"
408    + " \"fl\":\"pdb_id,title,experimental_method,resolution\",\n"
409    + " \"start\":\"0\",\n"
410    + " \"sort\":\"\",\n"
411    + " \"rows\":\"500\",\n"
412    + " \"wt\":\"json\"}},\n"
413    + " \"response\":{\"numFound\":64,\"start\":0,\"docs\":[\n"
414    + " {\n"
415    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
416    + " \"pdb_id\":\"4ofb\",\n"
417    + " \"resolution\":3.05,\n"
418    + " \"title\":\"Crystal structure of human BRCA1 BRCT in complex with nonphosphopeptide inhibitor\"},\n"
419    + " {\n"
420    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
421    + " \"pdb_id\":\"3pxe\",\n"
422    + " \"resolution\":2.85,\n"
423    + " \"title\":\"Impact of BRCA1 BRCT domain missense substitutions on phospho-peptide recognition: E1836K\"},\n"
424    + " {\n"
425    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
426    + " \"pdb_id\":\"4jlu\",\n"
427    + " \"resolution\":3.5,\n"
428    + " \"title\":\"Crystal structure of BRCA1 BRCT with doubly phosphorylated Abraxas\"},\n"
429    + " {\n"
430    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
431    + " \"pdb_id\":\"4y2g\",\n"
432    + " \"resolution\":2.5,\n"
433    + " \"title\":\"Structure of BRCA1 BRCT domains in complex with Abraxas single phosphorylated peptide\"},\n"
434    + " {\n"
435    + " \"experimental_method\":[\"Solution NMR\"],\n"
436    + " \"pdb_id\":\"1oqa\",\n"
437    + " \"title\":\"Solution structure of the BRCT-c domain from human BRCA1\"},\n"
438    + " {\n"
439    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
440    + " \"pdb_id\":\"4u4a\",\n"
441    + " \"resolution\":3.51,\n"
442    + " \"title\":\"Complex Structure of BRCA1 BRCT with singly phospho Abraxas\"},\n"
443    + " {\n"
444    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
445    + " \"pdb_id\":\"3k16\",\n"
446    + " \"resolution\":3.0,\n"
447    + " \"title\":\"Crystal Structure of BRCA1 BRCT D1840T in complex with a minimal recognition tetrapeptide with a free carboxy C-terminus\"},\n"
448    + " {\n"
449    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
450    + " \"pdb_id\":\"1t15\",\n"
451    + " \"resolution\":1.85,\n"
452    + " \"title\":\"Crystal Structure of the Brca1 BRCT Domains in Complex with the Phosphorylated Interacting Region from Bach1 Helicase\"},\n"
453    + " {\n"
454    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
455    + " \"pdb_id\":\"3k15\",\n"
456    + " \"resolution\":2.8,\n"
457    + " \"title\":\"Crystal Structure of BRCA1 BRCT D1840T in complex with a minimal recognition tetrapeptide with an amidated C-terminus\"},\n"
458    + " {\n"
459    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
460    + " \"pdb_id\":\"1t2v\",\n"
461    + " \"resolution\":3.3,\n"
462    + " \"title\":\"Structural basis of phospho-peptide recognition by the BRCT domain of BRCA1, structure with phosphopeptide\"},\n"
463    + " {\n"
464    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
465    + " \"pdb_id\":\"1y98\",\n"
466    + " \"resolution\":2.5,\n"
467    + " \"title\":\"Structure of the BRCT repeats of BRCA1 bound to a CtIP phosphopeptide.\"},\n"
468    + " {\n"
469    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
470    + " \"pdb_id\":\"1t29\",\n"
471    + " \"resolution\":2.3,\n"
472    + " \"title\":\"Crystal structure of the BRCA1 BRCT repeats bound to a phosphorylated BACH1 peptide\"},\n"
473    + " {\n"
474    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
475    + " \"pdb_id\":\"3k0k\",\n"
476    + " \"resolution\":2.7,\n"
477    + " \"title\":\"Crystal Structure of BRCA1 BRCT in complex with a minimal recognition tetrapeptide with a free carboxy C-terminus.\"},\n"
478    + " {\n"
479    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
480    + " \"pdb_id\":\"3k0h\",\n"
481    + " \"resolution\":2.7,\n"
482    + " \"title\":\"The crystal structure of BRCA1 BRCT in complex with a minimal recognition tetrapeptide with an amidated C-terminus\"},\n"
483    + " {\n"
484    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
485    + " \"pdb_id\":\"4ifi\",\n"
486    + " \"resolution\":2.2,\n"
487    + " \"title\":\"Structure of human BRCA1 BRCT in complex with BAAT peptide\"},\n"
488    + " {\n"
489    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
490    + " \"pdb_id\":\"3pxd\",\n"
491    + " \"resolution\":2.8,\n"
492    + " \"title\":\"Impact of BRCA1 BRCT domain missense substitutions on phospho-peptide recognition: R1835P\"},\n"
493    + " {\n"
494    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
495    + " \"pdb_id\":\"3pxc\",\n"
496    + " \"resolution\":2.8,\n"
497    + " \"title\":\"Impact of BRCA1 BRCT domain missense substitutions on phospho-peptide recognition: R1699Q\"},\n"
498    + " {\n"
499    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
500    + " \"pdb_id\":\"1jnx\",\n"
501    + " \"resolution\":2.5,\n"
502    + " \"title\":\"Crystal structure of the BRCT repeat region from the breast cancer associated protein, BRCA1\"},\n"
503    + " {\n"
504    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
505    + " \"pdb_id\":\"3pxa\",\n"
506    + " \"resolution\":2.55,\n"
507    + " \"title\":\"Impact of BRCA1 BRCT domain missense substitutions on phospho-peptide recognition: G1656D\"},\n"
508    + " {\n"
509    + " \"experimental_method\":[\"Solution NMR\"],\n"
510    + " \"pdb_id\":\"1jm7\",\n"
511    + " \"title\":\"Solution structure of the BRCA1/BARD1 RING-domain heterodimer\"},\n"
512    + " {\n"
513    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
514    + " \"pdb_id\":\"4igk\",\n"
515    + " \"resolution\":1.75,\n"
516    + " \"title\":\"Structure of human BRCA1 BRCT in complex with ATRIP peptide\"},\n"
517    + " {\n"
518    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
519    + " \"pdb_id\":\"1t2u\",\n"
520    + " \"resolution\":2.8,\n"
521    + " \"title\":\"Structural basis of phosphopeptide recognition by the BRCT domain of BRCA1: structure of BRCA1 missense variant V1809F\"},\n"
522    + " {\n"
523    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
524    + " \"pdb_id\":\"3pxb\",\n"
525    + " \"resolution\":2.5,\n"
526    + " \"title\":\"Impact of BRCA1 BRCT domain missense substitutions on phospho-peptide recognition: T1700A\"},\n"
527    + " {\n"
528    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
529    + " \"pdb_id\":\"1n5o\",\n"
530    + " \"resolution\":2.8,\n"
531    + " \"title\":\"Structural consequences of a cancer-causing BRCA1-BRCT missense mutation\"},\n"
532    + " {\n"
533    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
534    + " \"pdb_id\":\"3coj\",\n"
535    + " \"resolution\":3.21,\n"
536    + " \"title\":\"Crystal Structure of the BRCT Domains of Human BRCA1 in Complex with a Phosphorylated Peptide from Human Acetyl-CoA Carboxylase 1\"},\n"
537    + " {\n"
538    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
539    + " \"pdb_id\":\"6g2i\",\n"
540    + " \"resolution\":5.9,\n"
541    + " \"title\":\"Filament of acetyl-CoA carboxylase and BRCT domains of BRCA1 (ACC-BRCT) at 5.9 A resolution\"},\n"
542    + " {\n"
543    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
544    + " \"pdb_id\":\"4jlu\",\n"
545    + " \"resolution\":3.5,\n"
546    + " \"title\":\"Crystal structure of BRCA1 BRCT with doubly phosphorylated Abraxas\"},\n"
547    + " {\n"
548    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
549    + " \"pdb_id\":\"4ofb\",\n"
550    + " \"resolution\":3.05,\n"
551    + " \"title\":\"Crystal structure of human BRCA1 BRCT in complex with nonphosphopeptide inhibitor\"},\n"
552    + " {\n"
553    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
554    + " \"pdb_id\":\"3pxe\",\n"
555    + " \"resolution\":2.85,\n"
556    + " \"title\":\"Impact of BRCA1 BRCT domain missense substitutions on phospho-peptide recognition: E1836K\"},\n"
557    + " {\n"
558    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
559    + " \"pdb_id\":\"4u4a\",\n"
560    + " \"resolution\":3.51,\n"
561    + " \"title\":\"Complex Structure of BRCA1 BRCT with singly phospho Abraxas\"},\n"
562    + " {\n"
563    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
564    + " \"pdb_id\":\"4y2g\",\n"
565    + " \"resolution\":2.5,\n"
566    + " \"title\":\"Structure of BRCA1 BRCT domains in complex with Abraxas single phosphorylated peptide\"},\n"
567    + " {\n"
568    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
569    + " \"pdb_id\":\"4y18\",\n"
570    + " \"resolution\":3.5,\n"
571    + " \"title\":\"Structure of BRCA1 BRCT domains in complex with Abraxas double phosphorylated peptide\"},\n"
572    + " {\n"
573    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
574    + " \"pdb_id\":\"2ing\",\n"
575    + " \"resolution\":3.6,\n"
576    + " \"title\":\"X-ray Structure of the BRCA1 BRCT mutant M1775K\"},\n"
577    + " {\n"
578    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
579    + " \"pdb_id\":\"1t15\",\n"
580    + " \"resolution\":1.85,\n"
581    + " \"title\":\"Crystal Structure of the Brca1 BRCT Domains in Complex with the Phosphorylated Interacting Region from Bach1 Helicase\"},\n"
582    + " {\n"
583    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
584    + " \"pdb_id\":\"1t29\",\n"
585    + " \"resolution\":2.3,\n"
586    + " \"title\":\"Crystal structure of the BRCA1 BRCT repeats bound to a phosphorylated BACH1 peptide\"},\n"
587    + " {\n"
588    + " \"experimental_method\":[\"Solution NMR\"],\n"
589    + " \"pdb_id\":\"1jm7\",\n"
590    + " \"title\":\"Solution structure of the BRCA1/BARD1 RING-domain heterodimer\"},\n"
591    + " {\n"
592    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
593    + " \"pdb_id\":\"1t2v\",\n"
594    + " \"resolution\":3.3,\n"
595    + " \"title\":\"Structural basis of phospho-peptide recognition by the BRCT domain of BRCA1, structure with phosphopeptide\"},\n"
596    + " {\n"
597    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
598    + " \"pdb_id\":\"4ifi\",\n"
599    + " \"resolution\":2.2,\n"
600    + " \"title\":\"Structure of human BRCA1 BRCT in complex with BAAT peptide\"},\n"
601    + " {\n"
602    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
603    + " \"pdb_id\":\"4igk\",\n"
604    + " \"resolution\":1.75,\n"
605    + " \"title\":\"Structure of human BRCA1 BRCT in complex with ATRIP peptide\"},\n"
606    + " {\n"
607    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
608    + " \"pdb_id\":\"3k0k\",\n"
609    + " \"resolution\":2.7,\n"
610    + " \"title\":\"Crystal Structure of BRCA1 BRCT in complex with a minimal recognition tetrapeptide with a free carboxy C-terminus.\"},\n"
611    + " {\n"
612    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
613    + " \"pdb_id\":\"3k16\",\n"
614    + " \"resolution\":3.0,\n"
615    + " \"title\":\"Crystal Structure of BRCA1 BRCT D1840T in complex with a minimal recognition tetrapeptide with a free carboxy C-terminus\"},\n"
616    + " {\n"
617    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
618    + " \"pdb_id\":\"3k15\",\n"
619    + " \"resolution\":2.8,\n"
620    + " \"title\":\"Crystal Structure of BRCA1 BRCT D1840T in complex with a minimal recognition tetrapeptide with an amidated C-terminus\"},\n"
621    + " {\n"
622    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
623    + " \"pdb_id\":\"3k0h\",\n"
624    + " \"resolution\":2.7,\n"
625    + " \"title\":\"The crystal structure of BRCA1 BRCT in complex with a minimal recognition tetrapeptide with an amidated C-terminus\"},\n"
626    + " {\n"
627    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
628    + " \"pdb_id\":\"1y98\",\n"
629    + " \"resolution\":2.5,\n"
630    + " \"title\":\"Structure of the BRCT repeats of BRCA1 bound to a CtIP phosphopeptide.\"},\n"
631    + " {\n"
632    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
633    + " \"pdb_id\":\"3coj\",\n"
634    + " \"resolution\":3.21,\n"
635    + " \"title\":\"Crystal Structure of the BRCT Domains of Human BRCA1 in Complex with a Phosphorylated Peptide from Human Acetyl-CoA Carboxylase 1\"},\n"
636    + " {\n"
637    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
638    + " \"pdb_id\":\"4y18\",\n"
639    + " \"resolution\":3.5,\n"
640    + " \"title\":\"Structure of BRCA1 BRCT domains in complex with Abraxas double phosphorylated peptide\"},\n"
641    + " {\n"
642    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
643    + " \"pdb_id\":\"7jzv\",\n"
644    + " \"resolution\":3.9,\n"
645    + " \"title\":\"Cryo-EM structure of the BRCA1-UbcH5c/BARD1 E3-E2 module bound to a nucleosome\"},\n"
646    + " {\n"
647    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
648    + " \"pdb_id\":\"7jzv\",\n"
649    + " \"resolution\":3.9,\n"
650    + " \"title\":\"Cryo-EM structure of the BRCA1-UbcH5c/BARD1 E3-E2 module bound to a nucleosome\"},\n"
651    + " {\n"
652    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
653    + " \"pdb_id\":\"7lyb\",\n"
654    + " \"resolution\":3.28,\n"
655    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
656    + " {\n"
657    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
658    + " \"pdb_id\":\"7lyb\",\n"
659    + " \"resolution\":3.28,\n"
660    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
661    + " {\n"
662    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
663    + " \"pdb_id\":\"7lyb\",\n"
664    + " \"resolution\":3.28,\n"
665    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
666    + " {\n"
667    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
668    + " \"pdb_id\":\"7jzv\",\n"
669    + " \"resolution\":3.9,\n"
670    + " \"title\":\"Cryo-EM structure of the BRCA1-UbcH5c/BARD1 E3-E2 module bound to a nucleosome\"},\n"
671    + " {\n"
672    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
673    + " \"pdb_id\":\"7lyb\",\n"
674    + " \"resolution\":3.28,\n"
675    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
676    + " {\n"
677    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
678    + " \"pdb_id\":\"7jzv\",\n"
679    + " \"resolution\":3.9,\n"
680    + " \"title\":\"Cryo-EM structure of the BRCA1-UbcH5c/BARD1 E3-E2 module bound to a nucleosome\"},\n"
681    + " {\n"
682    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
683    + " \"pdb_id\":\"7lyb\",\n"
684    + " \"resolution\":3.28,\n"
685    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
686    + " {\n"
687    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
688    + " \"pdb_id\":\"7jzv\",\n"
689    + " \"resolution\":3.9,\n"
690    + " \"title\":\"Cryo-EM structure of the BRCA1-UbcH5c/BARD1 E3-E2 module bound to a nucleosome\"},\n"
691    + " {\n"
692    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
693    + " \"pdb_id\":\"7lyb\",\n"
694    + " \"resolution\":3.28,\n"
695    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
696    + " {\n"
697    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
698    + " \"pdb_id\":\"7lyb\",\n"
699    + " \"resolution\":3.28,\n"
700    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
701    + " {\n"
702    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
703    + " \"pdb_id\":\"7lyb\",\n"
704    + " \"resolution\":3.28,\n"
705    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
706    + " {\n"
707    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
708    + " \"pdb_id\":\"7jzv\",\n"
709    + " \"resolution\":3.9,\n"
710    + " \"title\":\"Cryo-EM structure of the BRCA1-UbcH5c/BARD1 E3-E2 module bound to a nucleosome\"},\n"
711    + " {\n"
712    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
713    + " \"pdb_id\":\"6g2i\",\n"
714    + " \"resolution\":5.9,\n"
715    + " \"title\":\"Filament of acetyl-CoA carboxylase and BRCT domains of BRCA1 (ACC-BRCT) at 5.9 A resolution\"},\n"
716    + " {\n"
717    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
718    + " \"pdb_id\":\"7jzv\",\n"
719    + " \"resolution\":3.9,\n"
720    + " \"title\":\"Cryo-EM structure of the BRCA1-UbcH5c/BARD1 E3-E2 module bound to a nucleosome\"},\n"
721    + " {\n"
722    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
723    + " \"pdb_id\":\"7lyb\",\n"
724    + " \"resolution\":3.28,\n"
725    + " \"title\":\"Cryo-EM structure of the human nucleosome core particle in complex with BRCA1-BARD1-UbcH5c\"},\n"
726    + " {\n"
727    + " \"experimental_method\":[\"Electron Microscopy\"],\n"
728    + " \"pdb_id\":\"7jzv\",\n"
729    + " \"resolution\":3.9,\n"
730    + " \"title\":\"Cryo-EM structure of the BRCA1-UbcH5c/BARD1 E3-E2 module bound to a nucleosome\"}]\n"
731    + " }}" });
732   
733  9 try
734    {
735  27 for (int i = 1; i < 3; i++)
736    {
737  18 mocks.add(
738    new String[]
739    { readJsonStringFromFile(
740    "test/jalview/fts/threedbeacons/p01308_pdbfts_query_pt"
741    + i + ".txt").trim(),
742    readJsonStringFromFile(
743    "test/jalview/fts/threedbeacons/p01308_pdbfts_query_pt"
744    + i + "_resp.txt").trim() });
745    }
746  54 for (int i = 1; i < 6; i++)
747    {
748  45 mocks.add(
749   
750    new String[]
751    { readJsonStringFromFile(
752    "test/jalview/fts/threedbeacons/p0dtd1_pdbfts_fts_query_pt"
753    + i + ".txt").trim(),
754    readJsonStringFromFile(
755    "test/jalview/fts/threedbeacons/p0dtd1_pdbfts_fts_query_pt"
756    + i + "_resp.txt").trim() });
757    }
758    // maize
759  9 mocks.add(
760    new String[]
761    { "https://www.ebi.ac.uk/pdbe/search/pdb/select?wt=json&fl=pdb_id,title,experimental_method,resolution&rows=500&start=0&q=(1gaq+OR+5h92+OR+3b2f+OR+3w5u+OR+5h8y+OR+3w5v)+AND+molecule_sequence:%5B''+TO+*%5D+AND+status:REL&sort=",
762    "{\n" + " \"responseHeader\":{\n" + " \"status\":0,\n"
763    + " \"QTime\":0,\n" + " \"params\":{\n"
764    + " \"q\":\"(1gaq OR 5h92 OR 3b2f OR 3w5u OR 5h8y OR 3w5v) AND molecule_sequence:['' TO *] AND status:REL\",\n"
765    + " \"fl\":\"pdb_id,title,experimental_method,resolution\",\n"
766    + " \"start\":\"0\",\n"
767    + " \"sort\":\"\",\n"
768    + " \"rows\":\"500\",\n"
769    + " \"wt\":\"json\"}},\n"
770    + " \"response\":{\"numFound\":11,\"start\":0,\"docs\":[\n"
771    + " {\n"
772    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
773    + " \"pdb_id\":\"3b2f\",\n"
774    + " \"resolution\":1.7,\n"
775    + " \"title\":\"Maize Ferredoxin 1\"},\n"
776    + " {\n"
777    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
778    + " \"pdb_id\":\"5h92\",\n"
779    + " \"resolution\":2.08,\n"
780    + " \"title\":\"Crystal structure of the complex between maize Sulfite Reductase and ferredoxin in the form-3 crystal\"},\n"
781    + " {\n"
782    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
783    + " \"pdb_id\":\"5h8y\",\n"
784    + " \"resolution\":2.2,\n"
785    + " \"title\":\"Crystal structure of the complex between maize sulfite reductase and ferredoxin in the form-2 crystal\"},\n"
786    + " {\n"
787    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
788    + " \"pdb_id\":\"1gaq\",\n"
789    + " \"resolution\":2.59,\n"
790    + " \"title\":\"CRYSTAL STRUCTURE OF THE COMPLEX BETWEEN FERREDOXIN AND FERREDOXIN-NADP+ REDUCTASE\"},\n"
791    + " {\n"
792    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
793    + " \"pdb_id\":\"3w5u\",\n"
794    + " \"resolution\":2.7,\n"
795    + " \"title\":\"Cross-linked complex between Ferredoxin and Ferredoxin-NADP+ reductase\"},\n"
796    + " {\n"
797    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
798    + " \"pdb_id\":\"3w5v\",\n"
799    + " \"resolution\":3.81,\n"
800    + " \"title\":\"Cross-linked complex between Ferredoxin and Ferredoxin-NADP+ reductase\"},\n"
801    + " {\n"
802    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
803    + " \"pdb_id\":\"3w5u\",\n"
804    + " \"resolution\":2.7,\n"
805    + " \"title\":\"Cross-linked complex between Ferredoxin and Ferredoxin-NADP+ reductase\"},\n"
806    + " {\n"
807    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
808    + " \"pdb_id\":\"3w5v\",\n"
809    + " \"resolution\":3.81,\n"
810    + " \"title\":\"Cross-linked complex between Ferredoxin and Ferredoxin-NADP+ reductase\"},\n"
811    + " {\n"
812    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
813    + " \"pdb_id\":\"1gaq\",\n"
814    + " \"resolution\":2.59,\n"
815    + " \"title\":\"CRYSTAL STRUCTURE OF THE COMPLEX BETWEEN FERREDOXIN AND FERREDOXIN-NADP+ REDUCTASE\"},\n"
816    + " {\n"
817    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
818    + " \"pdb_id\":\"5h92\",\n"
819    + " \"resolution\":2.08,\n"
820    + " \"title\":\"Crystal structure of the complex between maize Sulfite Reductase and ferredoxin in the form-3 crystal\"},\n"
821    + " {\n"
822    + " \"experimental_method\":[\"X-ray diffraction\"],\n"
823    + " \"pdb_id\":\"5h8y\",\n"
824    + " \"resolution\":2.2,\n"
825    + " \"title\":\"Crystal structure of the complex between maize sulfite reductase and ferredoxin in the form-2 crystal\"}]\n"
826    + " }}" });
827  9 mocks.add(
828    new String[]
829    { "https://www.ebi.ac.uk/pdbe/search/pdb/select?wt=json&fl=pdb_id,title,experimental_method,resolution&rows=500&start=0&q=(4gs9+OR+6bvb+OR+8ck8+OR+8ck3+OR+6x3d+OR+8ck4+OR+6x28+OR+6i7r+OR+3h82+OR+6i7q+OR+6x21+OR+4xt2+OR+5kiz+OR+7q5v+OR+6x2h+OR+7q5x+OR+3f1n+OR+3f1o+OR+2a24+OR+3f1p+OR+1p97+OR+4ghi+OR+3h7w+OR+6d09+OR+6czw+OR+7ujv+OR+5tbm+OR+5ufp+OR+4pky+OR+6d0b+OR+6d0c+OR+6x37)+AND+molecule_sequence:%5B''+TO+*%5D+AND+status:REL&sort=",
830    readJsonStringFromFile(
831    "test/jalview/fts/threedbeacons/q99814_tdb_pdbfts_query_resp.txt") });
832    } catch (Throwable e)
833    {
834  0 Assert.fail("Couldn't read mock data.", e);
835    }
836    /*
837    * updating mocks for p0dtd1 require very long URLs to be queried
838    for i in test/jalview/fts/threedbeacons/p0dtd1_pdbfts_fts_query_pt?.txt; do wget -i $i -O ${i/.txt/_resp.txt}; done
839    */
840  9 FTSRestClient.createMockFTSRestClient(
841    (FTSRestClient) PDBFTSRestClient.getInstance(),
842    mocks.toArray(new String[0][2]));
843    }
844    }