X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2FMCview%2FPDBfileTest.java;h=54576c6757d5cce0cb63ab784d68bcd2ada416f7;hb=ee198b3ca3687f18a2ee186f4e7c7330f4ea30f0;hp=9d7009ff35151db08940a9bfbb03a8e699510092;hpb=52288466dd1e71946a06fd1e6ea15fa8e652c693;p=jalview.git diff --git a/test/MCview/PDBfileTest.java b/test/MCview/PDBfileTest.java index 9d7009f..54576c6 100644 --- a/test/MCview/PDBfileTest.java +++ b/test/MCview/PDBfileTest.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package MCview; import static org.testng.AssertJUnit.assertEquals; @@ -12,7 +32,7 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.PDBEntry; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; import java.io.IOException; import java.util.List; @@ -50,19 +70,21 @@ public class PDBfileTest * Constructor with file path performs parse() */ PDBfile pf = new PDBfile(false, false, false, "examples/3W5V.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); - assertEquals("3W5V", pf.id); + assertEquals("3W5V", pf.getId()); // verify no alignment annotations created assertNull(getAlignmentAnnotations(pf)); - assertEquals(4, pf.chains.size()); - assertEquals("A", pf.chains.get(0).id); - assertEquals("B", pf.chains.get(1).id); - assertEquals("C", pf.chains.get(2).id); - assertEquals("D", pf.chains.get(3).id); + assertEquals(4, pf.getChains().size()); + assertEquals("A", pf.getChains().get(0).id); + assertEquals("B", pf.getChains().get(1).id); + assertEquals("C", pf.getChains().get(2).id); + assertEquals("D", pf.getChains().get(3).id); + + PDBChain chainA = pf.getChains().get(0); + SequenceI seqA = pf.getSeqs().get(0); - PDBChain chainA = pf.chains.get(0); assertEquals(0, chainA.seqstart); // not set assertEquals(0, chainA.seqend); // not set assertEquals(18, chainA.sequence.getStart()); @@ -71,27 +93,27 @@ public class PDBfileTest assertTrue(chainA.sequence.getSequenceAsString().endsWith("WNVEVY")); assertEquals("3W5V|A", chainA.sequence.getName()); assertNull(chainA.sequence.getAnnotation()); - assertEquals(1, chainA.sequence.getAllPDBEntries().size()); - PDBEntry pdb = chainA.sequence.getAllPDBEntries().get(0); + assertEquals(1, seqA.getAllPDBEntries().size()); + PDBEntry pdb = seqA.getAllPDBEntries().get(0); assertEquals("A", pdb.getChainCode()); assertEquals("PDB", pdb.getType()); assertEquals("3W5V", pdb.getId()); - PDBChain chainB = pf.chains.get(1); + PDBChain chainB = pf.getChains().get(1); assertEquals(1, chainB.sequence.getStart()); assertEquals(96, chainB.sequence.getEnd()); assertTrue(chainB.sequence.getSequenceAsString().startsWith("ATYNVK")); assertTrue(chainB.sequence.getSequenceAsString().endsWith("KEEELT")); assertEquals("3W5V|B", chainB.sequence.getName()); - PDBChain chainC = pf.chains.get(2); + PDBChain chainC = pf.getChains().get(2); assertEquals(18, chainC.sequence.getStart()); assertEquals(314, chainC.sequence.getEnd()); assertTrue(chainC.sequence.getSequenceAsString().startsWith("KCSKKQEE")); assertTrue(chainC.sequence.getSequenceAsString().endsWith("WNVEVY")); assertEquals("3W5V|C", chainC.sequence.getName()); - PDBChain chainD = pf.chains.get(3); + PDBChain chainD = pf.getChains().get(3); assertEquals(1, chainD.sequence.getStart()); assertEquals(96, chainD.sequence.getEnd()); assertTrue(chainD.sequence.getSequenceAsString().startsWith("ATYNVK")); @@ -124,7 +146,7 @@ public class PDBfileTest public void testParse_withAnnotations_noSS() throws IOException { PDBfile pf = new PDBfile(true, false, false, "examples/3W5V.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); AlignmentAnnotation[] anns = getAlignmentAnnotations(pf); assertEquals(4, anns.length); @@ -182,7 +204,7 @@ public class PDBfileTest public void testParse_withJmol_noAnnotations() throws IOException { PDBfile pf = new PDBfile(false, true, false, "examples/3W5V.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); /* * alignment annotations _are_ created anyway (in @@ -195,7 +217,7 @@ public class PDBfileTest * no sequence annotations created - tempFactor annotation is not added * unless the flag to 'addAlignmentAnnotations' is set true */ - for (PDBChain c : pf.chains) + for (PDBChain c : pf.getChains()) { assertNull(c.sequence.getAnnotation()); } @@ -212,7 +234,7 @@ public class PDBfileTest throws IOException { PDBfile pf = new PDBfile(true, true, false, "examples/3W5V.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); /* * Alignment annotations for TempFactor, SecStruct, per sequence (chain) @@ -231,10 +253,10 @@ public class PDBfileTest /* * PDBFileWithJmol (unlike PDBChain!) leaves PDB id upper case */ - assertEquals("Secondary Structure for 3W5VA", anns[0].description); - assertEquals("Secondary Structure for 3W5VB", anns[2].description); - assertEquals("Secondary Structure for 3W5VC", anns[4].description); - assertEquals("Secondary Structure for 3W5VD", anns[6].description); + assertEquals("Secondary Structure for 3w5vA", anns[0].description); + assertEquals("Secondary Structure for 3w5vB", anns[2].description); + assertEquals("Secondary Structure for 3w5vC", anns[4].description); + assertEquals("Secondary Structure for 3w5vD", anns[6].description); /* * Verify SS annotations are linked to respective sequences (chains) @@ -270,7 +292,7 @@ public class PDBfileTest // TODO requires a mock for Annotate3D processing // and/or run as an integration test PDBfile pf = new PDBfile(true, true, true, "examples/2GIS.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); } /**