import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
import jalview.fts.api.FTSData;
+import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient;
+import jalview.fts.threedbeacons.TDBeaconsFTSRestClientTest;
import jalview.gui.structurechooser.PDBStructureChooserQuerySource;
import jalview.gui.structurechooser.StructureChooserQuerySource;
import jalview.gui.structurechooser.ThreeDBStructureChooserQuerySource;
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
- Sequence seq;
+ Sequence seq,upSeq;
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
pdbIds.add(dbRef);
seq.setPDBId(pdbIds);
+
+ // Uniprot sequence for 3D-Beacons mocks
+ upSeq = new Sequence("P38398",
+ "MDLSALRVEEVQNVINAMQKILECPICLELIKEPVSTKCDHIFCKFCMLKLLNQKKGPSQCPLCKNDITKRS\n"
+ + "LQESTRFSQLVEELLKIICAFQLDTGLEYANSYNFAKKENNSPEHLKDEVSIIQSMGYRNRAKRLLQSEPEN\n"
+ + "PSLQETSLSVQLSNLGTVRTLRTKQRIQPQKTSVYIELGSDSSEDTVNKATYCSVGDQELLQITPQGTRDEI\n"
+ + "SLDSAKKAACEFSETDVTNTEHHQPSNNDLNTTEKRAAERHPEKYQGSSVSNLHVEPCGTNTHASSLQHENS\n"
+ + "SLLLTKDRMNVEKAEFCNKSKQPGLARSQHNRWAGSKETCNDRRTPSTEKKVDLNADPLCERKEWNKQKLPC\n"
+ + "SENPRDTEDVPWITLNSSIQKVNEWFSRSDELLGSDDSHDGESESNAKVADVLDVLNEVDEYSGSSEKIDLL\n"
+ + "ASDPHEALICKSERVHSKSVESNIEDKIFGKTYRKKASLPNLSHVTENLIIGAFVTEPQIIQERPLTNKLKR\n"
+ + "KRRPTSGLHPEDFIKKADLAVQKTPEMINQGTNQTEQNGQVMNITNSGHENKTKGDSIQNEKNPNPIESLEK\n"
+ + "ESAFKTKAEPISSSISNMELELNIHNSKAPKKNRLRRKSSTRHIHALELVVSRNLSPP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AGYNAMEESVSREKPELTASTERVNKRMSMVVSG\n"
+ + "LTPEEFMLVYKFARKHHITLTNLITEETTHVVMKTDAEFVCERTLKYFLGIAGGKWVVSYFWVTQSIKERKM\n"
+ + "LNEHDFEVRGDVVNGRNHQGPKRARESQDRKIFRGLEICCYGPFTNMPTDQLEWMVQLCGASVVKELSSFTL\n"
+ + "GTGVHPIVVVQPDAWTEDNGFHAIGQMCEAPVVTREWVLDSVALYQCQELDTYLIPQIPHSHY\n"
+ + "", 1,
+1863);
+ upSeq.createDatasetSequence();
+ upSeq.setDescription("Breast cancer type 1 susceptibility protein");
+ upSeq.addDBRef(new DBRefEntry("UNIPROT","0","P38398",null,true));
}
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
seq = null;
+ upSeq=null;
}
@SuppressWarnings("deprecation")
query);
}
+ @SuppressWarnings("deprecation")
+ @Test(groups = { "Functional" })
+ public void buildThreeDBQueryTest()
+ {
+ System.out.println("seq >>>> " + upSeq);
+ TDBeaconsFTSRestClientTest.setMock();
+ StructureChooserQuerySource scquery = StructureChooserQuerySource.getQuerySourceFor(new SequenceI[] { upSeq});
+ assertTrue(scquery instanceof ThreeDBStructureChooserQuerySource);
+ String query = scquery.buildQuery(upSeq);
+ assertEquals("P38398", query);
+
+ // query shouldn't change regardless of additional entries
+ // because 3DBeacons requires canonical entries.
+ upSeq.getAllPDBEntries().clear();
+ query = scquery.buildQuery(upSeq);
+ assertEquals("P38398", query);
+ upSeq.setDBRefs(null);
+ query = scquery.buildQuery(upSeq);
+ /*
+ * legacy projects/datasets will not have canonical flags set for uniprot dbrefs
+ * graceful behaviour would be to
+ * - pick one ? not possible
+ * - iterate through all until a 200 is obtained ?
+ * ---> ideal but could be costly
+ * ---> better to do a direct retrieval from uniprot to work out which is the canonical identifier..
+ * ----> need a test to check that accessions can be promoted to canonical!
+ */
+ assertEquals(null, query);
+
+ // TODO:
+//
+// DBRefEntry uniprotDBRef = new DBRefEntry();
+// uniprotDBRef.setAccessionId("P12345");
+// uniprotDBRef.setSource(DBRefSource.UNIPROT);
+// upSeq.addDBRef(uniprotDBRef);
+//
+// DBRefEntry pdbDBRef = new DBRefEntry();
+// pdbDBRef.setAccessionId("1XYZ");
+// pdbDBRef.setSource(DBRefSource.PDB);
+// upSeq.addDBRef(pdbDBRef);
+//
+// for (int x = 1; x < 5; x++)
+// {
+// DBRefEntry dbRef = new DBRefEntry();
+// dbRef.setAccessionId("XYZ_" + x);
+// seq.addDBRef(dbRef);
+// }
+// System.out.println("");
+// System.out.println(seq.getDBRefs());
+// System.out.println(query);
+// query = scquery.buildQuery(seq);
+// assertEquals(
+// "uniprot_accession:P12345 OR uniprot_id:P12345 OR pdb_id:1xyz",
+// query);
+ }
+
+
@Test(groups = { "Functional" })
public void populateFilterComboBoxTest() throws InterruptedException
{