3131import org .biojava .nbio .structure .io .PDBFileParser ;
3232import org .junit .Test ;
3333
34- public class TestCompoundResIndexMapping {
34+ /**
35+ * Various tests for functionality in {@link EntityInfo} and {@link org.biojava.nbio.structure.io.EntityFinder}
36+ * @author Jose Duarte
37+ */
38+ public class TestEntityResIndexMapping {
3539
3640 private static final String PATH_TO_TEST_FILES = "/org/biojava/nbio/structure/io/" ;
3741
@@ -67,7 +71,6 @@ public void test1SMT() throws IOException, StructureException {
6771 params .setAlignSeqRes (true );
6872 cache .setFileParsingParams (params );
6973
70-
7174 StructureIO .setAtomCache (cache );
7275
7376 cache .setUseMmCif (false );
@@ -78,7 +81,11 @@ public void test1SMT() throws IOException, StructureException {
7881 assertEquals ("First residue in 1smtA " +chainA .getAtomGroup (0 ).toString ()+" should map to 24 in SEQRES" ,24 ,i );
7982 Chain chainB = s .getPolyChainByPDB ("B" );
8083 i = chainB .getEntityInfo ().getAlignedResIndex (chainB .getAtomGroup (0 ),chainB );
81- assertEquals ("First residue in 1smtB " +chainA .getAtomGroup (0 ).toString ()+" should map to 20 in SEQRES" ,20 ,i );
84+ assertEquals ("First residue in 1smtB " +chainB .getAtomGroup (0 ).toString ()+" should map to 20 in SEQRES" ,20 ,i );
85+
86+ // group with seqres index 19 is observed in chain B but not in chain A, we should still get the index back from getAlignedResIndex
87+ i = chainA .getEntityInfo ().getAlignedResIndex (chainA .getSeqResGroup (19 ),chainA );
88+ assertEquals ("Seqres residue 20 in 1smtA " +chainA .getSeqResGroup (19 ).toString ()+" should map to 20 in SEQRES" ,20 ,i );
8289
8390 checkAllResidues (s );
8491 }
@@ -97,7 +104,7 @@ private void checkAllResidues(Structure s) {
97104 }
98105
99106 // This doesn't work yet, since for raw files without a SEQRES, the seqres groups are not populated. Instead
100- // in that case Compound .getAlignedResIndex() returns residue numbers as given (without insertion codes) and
107+ // in that case EntityInfo .getAlignedResIndex() returns residue numbers as given (without insertion codes) and
101108 // thus in general residues will not be correctly aligned between different chains of same entity. This breaks
102109 // cases like 3ddo (with no SEQRES records) where residue numbering is different in every chain of the one entity.
103110 // see https://github.com/eppic-team/eppic/issues/39
@@ -134,7 +141,7 @@ public void test3ddoRawNoSeqres() throws IOException, StructureException {
134141
135142
136143
137- // this should work either with or without setAlignSeqRes, since the mapping happens in CompoundFinder
144+ // this should work either with or without setAlignSeqRes, since the mapping happens in EntityFinder
138145 s = getStructure ("3ddo_raw_noseqres.pdb.gz" , false );
139146
140147 assertEquals (1 ,s .getEntityInfos ().size ());
0 commit comments