+ private List<TestRetrieveObject> toRetrieve = Arrays.asList(
+ new TestRetrieveObject("1QIP", 4),
+ new TestRetrieveObject("4IM2", 1));
+
+ private void testRetrieveProteinSeqFromPDB() throws Exception
+ {
+ List<DbSourceProxy> sps = sf.getSourceProxy("PDB");
+ StringBuilder errors = new StringBuilder();
+ for (TestRetrieveObject str : toRetrieve)
+ {
+ AlignmentI response = sps.get(0).getSequenceRecords(str.id);
+ assertTrue("No aligment for " + str.id, response != null);
+ assertEquals(response.getHeight(), str.expectedHeight,
+ "Number of chains for " + str.id);
+ for (SequenceI sq : response.getSequences())
+ {
+ assertTrue("No annotation transfered to sequence " + sq.getName(),
+ sq.getAnnotation().length > 0);
+ assertTrue("No PDBEntry on sequence " + sq.getName(),
+ sq.getAllPDBEntries().size() > 0);
+ // FIXME: should test that all residues extracted as sequences from
+ // chains in structure have a mapping to data in the structure
+ List<SequenceFeature> prev = null;
+ int lastp = -1;
+ for (int col = 1; col <= sq.getLength(); col++)
+ {
+ List<SequenceFeature> sf = sq.findFeatures(col, col, "RESNUM");
+ if (sf.size() != 1)
+ {
+ errors.append(str.id + ": "
+ + "Expected one feature at column (position): "
+ + (col - 1) + " (" + sq.findPosition(col - 1) + ")"
+ + ": saw " + sf.size());
+ errors.append("\n");
+ if (prev != null)
+ {
+ errors.append("Last Feature was at position " + lastp + ": "
+ + prev.get(0).toString());
+ errors.append("\n");
+ }
+ }
+ else
+ {
+ prev = sf;
+ lastp = sq.findPosition(col - 1);
+ }
+ }
+ }
+ }
+ if (errors.length() > 0)
+ {
+ Assert.fail(errors.toString());
+ }
+ }