+ /**
+ * test to demonstrate JAL-1142 - compare sequences in RNAML returned from
+ * Annotate3d vs those extracted by Jalview from the originl PDB file
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testPDBfileVsRNAML() throws Exception
+ {
+ PDBfile pdbf = new PDBfile("examples/2GIS.pdb", FormatAdapter.FILE);
+ Assert.assertTrue(pdbf.isValid());
+ StringBuffer sb = new StringBuffer();
+ // Comment - should add new FileParse constructor like new FileParse(Reader
+ // ..). for direct reading
+ BufferedReader br = new BufferedReader(
+ Annotate3D.getRNAMLForPDBFileAsString(FileUtil
+ .readFileToString(new File("examples/2GIS.pdb"))));
+ String line;
+ while ((line = br.readLine()) != null)
+ {
+ sb.append(line + "\n");
+ }
+ assertTrue("No data returned by Annotate3D", sb.length() > 0);
+ AlignmentI al = new FormatAdapter().readFile(sb.toString(),
+ FormatAdapter.PASTE, "RNAML");
+
+ assertTrue("No alignment returned.", al != null);
+ assertTrue("No sequences in returned alignment.", al.getHeight() > 0);
+ for (SequenceI sq : al.getSequences())
+ {
+ {
+ SequenceI struseq = null;
+ String sq_ = new String(sq.getSequence()).toLowerCase();
+ for (SequenceI _struseq : pdbf.getSeqsAsArray())
+ {
+ if (new String(_struseq.getSequence()).toLowerCase().equals(sq_))
+ {
+ struseq = _struseq;
+ break;
+ }
+ }
+ if (struseq == null)
+ {
+ Assert.fail("Couldn't find this sequence in original input:\n"
+ + new FastaFile().print(new SequenceI[]
+ { sq }) + "\n\nOriginal input:\n"
+ + new FastaFile().print(pdbf.getSeqsAsArray()) + "\n");
+ }
+ }
+ }
+ }