2828import org .biojava .nbio .structure .xtal .CrystalBuilder ;
2929import org .junit .Test ;
3030
31+ import javax .vecmath .Matrix4d ;
3132import java .io .IOException ;
33+ import java .util .HashMap ;
34+ import java .util .Map ;
3235
3336import static org .junit .Assert .*;
3437
@@ -48,7 +51,7 @@ public void test1NMR() throws IOException, StructureException {
4851
4952 CrystalBuilder cb = new CrystalBuilder (s1 );
5053 StructureInterfaceList interfaces = cb .getUniqueInterfaces (5.5 );
51- assertTrue ( interfaces .size ()== 0 );
54+ assertEquals ( 0 , interfaces .size ());
5255
5356 }
5457
@@ -65,7 +68,7 @@ public void test1B8G() throws IOException, StructureException {
6568 Structure s1 = StructureIO .getStructure ("1B8G" );
6669 CrystalBuilder cb = new CrystalBuilder (s1 );
6770 StructureInterfaceList interfaces = cb .getUniqueInterfaces (5.5 );
68- assertTrue ( interfaces .size ()> 1 );
71+ assertEquals ( 8 , interfaces .size ());
6972
7073
7174 }
@@ -83,7 +86,7 @@ public void test2MFZ() throws IOException, StructureException {
8386 Structure s1 = StructureIO .getStructure ("2MFZ" );
8487 CrystalBuilder cb = new CrystalBuilder (s1 );
8588 StructureInterfaceList interfaces = cb .getUniqueInterfaces (5.5 );
86- assertTrue ( interfaces .size ()== 1 );
89+ assertEquals ( 1 , interfaces .size ());
8790
8891 }
8992
@@ -100,10 +103,55 @@ public void test4MF8() throws IOException, StructureException {
100103 Structure s1 = StructureIO .getStructure ("4MF8" );
101104 CrystalBuilder cb = new CrystalBuilder (s1 );
102105 StructureInterfaceList interfaces = cb .getUniqueInterfaces (5.5 );
103- assertTrue ( interfaces .size ()> 3 );
106+ assertEquals ( 17 , interfaces .size ());
104107
105108 }
106109
110+ @ Test
111+ public void test1AUY () throws IOException , StructureException {
112+ // a virus with NCS operators
113+ AtomCache cache = new AtomCache ();
114+ StructureIO .setAtomCache (cache );
115+ cache .setUseMmCif (true );
116+ Structure s1 = StructureIO .getStructure ("1AUY" );
117+
118+ Map <String ,Matrix4d > chainNcsOps = new HashMap <>();
119+ Map <String ,String > chainOrigNames = new HashMap <>();
120+
121+ CrystalBuilder .expandNcsOps (s1 ,chainOrigNames ,chainNcsOps );
122+
123+ CrystalBuilder cb = new CrystalBuilder (s1 ,chainOrigNames ,chainNcsOps );
124+ StructureInterfaceList interfaces = cb .getUniqueInterfaces (5.5 );
125+ assertEquals (186 ,interfaces .size ());
126+ assertEquals (24 ,interfaces .getClustersNcs ().size ());
127+
128+ // kill the cell info to simulate incorrect and/or missing
129+ s1 .getCrystallographicInfo ().setCrystalCell (null );
130+ cb = new CrystalBuilder (s1 ,chainOrigNames ,chainNcsOps );
131+ interfaces = cb .getUniqueInterfaces (5.5 );
132+ //only interfaces within AU
133+ assertEquals (132 ,interfaces .size ());
134+ assertEquals (12 ,interfaces .getClustersNcs ().size ());
135+ }
136+
137+ @ Test
138+ public void test1A37 () throws IOException , StructureException {
139+ // a smaller structure with NCS operators
140+ AtomCache cache = new AtomCache ();
141+ StructureIO .setAtomCache (cache );
142+ cache .setUseMmCif (true );
143+ Structure s1 = StructureIO .getStructure ("1A37" );
144+
145+ Map <String ,Matrix4d > chainNcsOps = new HashMap <>();
146+ Map <String ,String > chainOrigNames = new HashMap <>();
147+ CrystalBuilder .expandNcsOps (s1 ,chainOrigNames ,chainNcsOps );
148+
149+ CrystalBuilder cb = new CrystalBuilder (s1 ,chainOrigNames ,chainNcsOps );
150+ StructureInterfaceList interfaces = cb .getUniqueInterfaces (5.5 );
151+ assertEquals (17 ,interfaces .size ());
152+ assertEquals (14 ,interfaces .getClustersNcs ().size ());
153+ }
154+
107155 @ Test
108156 public void test2H2Z () throws IOException , StructureException {
109157
@@ -120,7 +168,7 @@ public void test2H2Z() throws IOException, StructureException {
120168 Structure s1 = StructureIO .getStructure ("2H2Z" );
121169 CrystalBuilder cb = new CrystalBuilder (s1 );
122170 StructureInterfaceList interfaces = cb .getUniqueInterfaces (5.5 );
123- assertTrue ( interfaces .size ()>= 3 );
171+ assertEquals ( 3 , interfaces .size ());
124172
125173 }
126174
0 commit comments