@@ -201,6 +201,24 @@ public void testGetSubRanges() throws StructureException {
201201 chain = substr .getChainByIndex (0 );
202202 assertEquals ("Did not find the expected number of residues in " +range , 1 , chain .getAtomLength () );
203203
204+
205+ // negative residues
206+ range = "A:-3" ;
207+ substr = StructureTools .getSubRanges (structure2 , range );
208+ assertEquals ("Wrong number of chains in " +range , 1 , substr .size ());
209+ chain = substr .getChainByIndex (0 );
210+ assertEquals ("Did not find the expected number of residues in " +range , 1 , chain .getAtomLength () );
211+ range = "A:-3--1" ;
212+ substr = StructureTools .getSubRanges (structure2 , range );
213+ assertEquals ("Wrong number of chains in " +range , 1 , substr .size ());
214+ chain = substr .getChainByIndex (0 );
215+ assertEquals ("Did not find the expected number of residues in " +range , 3 , chain .getAtomLength () );
216+ range = "A:-3-1" ;
217+ substr = StructureTools .getSubRanges (structure2 , range );
218+ assertEquals ("Wrong number of chains in " +range , 1 , substr .size ());
219+ chain = substr .getChainByIndex (0 );
220+ assertEquals ("Did not find the expected number of residues in " +range , 4 , chain .getAtomLength () );
221+
204222 // Special '-' case
205223 range = "-" ;
206224 substr = StructureTools .getSubRanges (structure2 , range );
0 commit comments