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