@@ -160,69 +160,54 @@ public void testLocationJoins() throws Exception {
160160
161161 assertEquals ("join1, getType()" , "CDS" , join1 .getType ());
162162 assertEquals ("join1, getLocations().getStrand()" , "POSITIVE" , join1 .getLocations ().getStrand ().toString ());
163- assertEquals ("join1, getLocations().getSubLocations().size()" , 8 , join1SubLocs .size ());
163+ assertEquals ("join1, getLocations().getSubLocations().size()" , 6 , join1SubLocs .size ());
164164
165- assertEquals ("join1, SubLocation 1)" , 3356 , join1SubLocs .get (0 ).getStart ().getPosition ().intValue ());
166- assertEquals ("join1, SubLocation 1)" , 3356 , join1SubLocs .get (0 ).getEnd ().getPosition ().intValue ());
165+ assertEquals ("join1, SubLocation 1)" , 1 , join1SubLocs .get (0 ).getStart ().getPosition ().intValue ());
166+ assertEquals ("join1, SubLocation 1)" , 1 , join1SubLocs .get (0 ).getEnd ().getPosition ().intValue ());
167167
168- assertEquals ("join1, SubLocation 2)" , 3500 , join1SubLocs .get (1 ).getStart ().getPosition ().intValue ());
169- assertEquals ("join1, SubLocation 2)" , 3792 , join1SubLocs .get (1 ).getEnd ().getPosition ().intValue ());
168+ assertEquals ("join1, SubLocation 2)" , 10 , join1SubLocs .get (1 ).getStart ().getPosition ().intValue ());
169+ assertEquals ("join1, SubLocation 2)" , 12 , join1SubLocs .get (1 ).getEnd ().getPosition ().intValue ());
170170
171- assertEquals ("join1, SubLocation 3)" , 3793 , join1SubLocs .get (2 ).getStart ().getPosition ().intValue ());
172- assertEquals ("join1, SubLocation 3)" , 3793 , join1SubLocs .get (2 ).getEnd ().getPosition ().intValue ());
171+ assertEquals ("join1, SubLocation 3)" , 30 , join1SubLocs .get (2 ).getStart ().getPosition ().intValue ());
172+ assertEquals ("join1, SubLocation 3)" , 30 , join1SubLocs .get (2 ).getEnd ().getPosition ().intValue ());
173173
174- assertEquals ("join1, SubLocation 4 )" , 4185 , join1SubLocs .get (3 ).getStart ().getPosition ().intValue ());
175- assertEquals ("join1, SubLocation 4 )" , 4228 , join1SubLocs .get (3 ).getEnd ().getPosition ().intValue ());
174+ assertEquals ("join1, SubLocation 3 )" , 35 , join1SubLocs .get (3 ).getStart ().getPosition ().intValue ());
175+ assertEquals ("join1, SubLocation 3 )" , 38 , join1SubLocs .get (3 ).getEnd ().getPosition ().intValue ());
176176
177- assertEquals ("join1, SubLocation 5)" , 4229 , join1SubLocs .get (4 ).getStart ().getPosition ().intValue ());
178- assertEquals ("join1, SubLocation 5)" , 4229 , join1SubLocs .get (4 ).getEnd ().getPosition ().intValue ());
177+ assertEquals ("join1, SubLocation 5)" , 43 , join1SubLocs .get (4 ).getStart ().getPosition ().intValue ());
178+ assertEquals ("join1, SubLocation 5)" , 46 , join1SubLocs .get (4 ).getEnd ().getPosition ().intValue ());
179179
180- assertEquals ("join1, SubLocation 6)" , 4348 , join1SubLocs .get (5 ).getStart ().getPosition ().intValue ());
181- assertEquals ("join1, SubLocation 6)" , 4676 , join1SubLocs .get (5 ).getEnd ().getPosition ().intValue ());
182-
183- assertEquals ("join1, SubLocation 7)" , 4677 , join1SubLocs .get (6 ).getStart ().getPosition ().intValue ());
184- assertEquals ("join1, SubLocation 7)" , 4677 , join1SubLocs .get (6 ).getEnd ().getPosition ().intValue ());
185-
186- assertEquals ("join1, SubLocation 8)" , 4775 , join1SubLocs .get (7 ).getStart ().getPosition ().intValue ());
187- assertEquals ("join1, SubLocation 8)" , 5094 , join1SubLocs .get (7 ).getEnd ().getPosition ().intValue ());
180+ assertEquals ("join1, SubLocation 6)" , 47 , join1SubLocs .get (5 ).getStart ().getPosition ().intValue ());
181+ assertEquals ("join1, SubLocation 6)" , 50 , join1SubLocs .get (5 ).getEnd ().getPosition ().intValue ());
188182
189183 //qualifiers
190184 assertEquals ("join1, getType()" , "Joined feature" , join1 .getQualifiers ().get ("standard_name" ).get (0 ).getValue ());
191185
192186 //Join 2
193187 FeatureInterface <AbstractSequence <NucleotideCompound >, NucleotideCompound > join2 = features .get (1 );
194- List <Location > join2SubLocs = join1 .getLocations ().getSubLocations ();
195-
196- assertEquals ("join1, getType()" , "CDS" , join2 .getType ());
197- assertEquals ("join1, getLocations().getStrand()" , "NEGATIVE" , join2 .getLocations ().getStrand ().toString ());
198- assertEquals ("join1, getLocations().getSubLocations().size()" , 8 , join2SubLocs .size ());
188+ List <Location > join2SubLocs = join2 .getLocations ().getSubLocations ();
199189
200- assertEquals ("join2, SubLocation 1)" , 3356 , join2SubLocs .get (0 ).getStart ().getPosition ().intValue ());
201- assertEquals ("join2, SubLocation 1)" , 3356 , join2SubLocs .get (0 ).getEnd ().getPosition ().intValue ());
190+ assertEquals ("join2, getType()" , "CDS" , join2 .getType ());
191+ assertEquals ("join2, getLocations().getStrand()" , "NEGATIVE" , join2 .getLocations ().getStrand ().toString ());
192+ assertEquals ("join2, getLocations().getSubLocations().size()" , 5 , join2SubLocs .size ());
202193
203- assertEquals ("join2, SubLocation 2 )" , 3500 , join2SubLocs .get (1 ).getStart ().getPosition ().intValue ());
204- assertEquals ("join2, SubLocation 2 )" , 3792 , join2SubLocs .get (1 ).getEnd ().getPosition ().intValue ());
194+ assertEquals ("join2, SubLocation 1 )" , 33 , join2SubLocs .get (0 ).getStart ().getPosition ().intValue ());
195+ assertEquals ("join2, SubLocation 1 )" , 33 , join2SubLocs .get (0 ).getEnd ().getPosition ().intValue ());
205196
206- assertEquals ("join2, SubLocation 3 )" , 3793 , join2SubLocs .get (2 ).getStart ().getPosition ().intValue ());
207- assertEquals ("join2, SubLocation 3 )" , 3793 , join2SubLocs .get (2 ).getEnd ().getPosition ().intValue ());
197+ assertEquals ("join2, SubLocation 2 )" , 35 , join2SubLocs .get (1 ).getStart ().getPosition ().intValue ());
198+ assertEquals ("join2, SubLocation 2 )" , 37 , join2SubLocs .get (1 ).getEnd ().getPosition ().intValue ());
208199
209- assertEquals ("join2, SubLocation 4 )" , 4185 , join2SubLocs .get (3 ).getStart ().getPosition ().intValue ());
210- assertEquals ("join2, SubLocation 4 )" , 4228 , join2SubLocs .get (3 ).getEnd ().getPosition ().intValue ());
200+ assertEquals ("join2, SubLocation 3 )" , 41 , join2SubLocs .get (2 ).getStart ().getPosition ().intValue ());
201+ assertEquals ("join2, SubLocation 3 )" , 43 , join2SubLocs .get (2 ).getEnd ().getPosition ().intValue ());
211202
212- assertEquals ("join2, SubLocation 5)" , 4229 , join2SubLocs .get (4 ).getStart ().getPosition ().intValue ());
213- assertEquals ("join2, SubLocation 5)" , 4229 , join2SubLocs .get (4 ).getEnd ().getPosition ().intValue ());
214-
215- assertEquals ("join2, SubLocation 6)" , 4348 , join2SubLocs .get (5 ).getStart ().getPosition ().intValue ());
216- assertEquals ("join2, SubLocation 6)" , 4676 , join2SubLocs .get (5 ).getEnd ().getPosition ().intValue ());
217-
218- assertEquals ("join2, SubLocation 7)" , 4677 , join2SubLocs .get (6 ).getStart ().getPosition ().intValue ());
219- assertEquals ("join2, SubLocation 7)" , 4677 , join2SubLocs .get (6 ).getEnd ().getPosition ().intValue ());
203+ assertEquals ("join2, SubLocation 4)" , 44 , join2SubLocs .get (3 ).getStart ().getPosition ().intValue ());
204+ assertEquals ("join2, SubLocation 4)" , 46 , join2SubLocs .get (3 ).getEnd ().getPosition ().intValue ());
220205
221- assertEquals ("join2, SubLocation 8 )" , 4775 , join2SubLocs .get (7 ).getStart ().getPosition ().intValue ());
222- assertEquals ("join2, SubLocation 8 )" , 5094 , join2SubLocs .get (7 ).getEnd ().getPosition ().intValue ());
206+ assertEquals ("join2, SubLocation 5 )" , 47 , join2SubLocs .get (4 ).getStart ().getPosition ().intValue ());
207+ assertEquals ("join2, SubLocation 5 )" , 50 , join2SubLocs .get (4 ).getEnd ().getPosition ().intValue ());
223208
224209 //qualifiers
225- assertEquals ("join1 , getType()" , "Joined feature on complement" , join2 .getQualifiers ().get ("standard_name" ).get (0 ).getValue ());
210+ assertEquals ("join2 , getType()" , "Joined feature on complement" , join2 .getQualifiers ().get ("standard_name" ).get (0 ).getValue ());
226211
227212 // Now write the joins back to a file using the GenbankWriterHelper
228213 ByteArrayOutputStream fragwriter = new ByteArrayOutputStream ();
@@ -231,7 +216,7 @@ public void testLocationJoins() throws Exception {
231216 Arrays .asList (sequence ));
232217 fragwriter .close ();
233218
234- // System.out.println(fragwriter.toString().replaceAll("\r\n", "\n"));
219+ System .out .println (fragwriter .toString ().replaceAll ("\r \n " , "\n " ));
235220
236221 // Read the output file and test that no information is lost
237222 InputStream readerInputStream = new ByteArrayInputStream (fragwriter .toByteArray ());
@@ -242,17 +227,17 @@ public void testLocationJoins() throws Exception {
242227 // Check the output matches the original sequence feature
243228 for (int i =0 ; i < features .size (); i ++ ) {
244229 assertEquals ("getFeatures(), getType()" , features .get (i ).getType (), newFeatures .get (i ).getType ());
245- assertEquals ("getFeatures(), getLocations()" , features .get (i ).getLocations (), newFeatures .get (i ).getLocations ());
230+ assertEquals ("getFeatures(), getStart()" , features .get (i ).getLocations ().getStart (), newFeatures .get (i ).getLocations ().getStart ());
231+ assertEquals ("getFeatures(), getEnd()" , features .get (i ).getLocations ().getEnd (), newFeatures .get (i ).getLocations ().getEnd ());
246232 assertEquals ("getFeatures(), getStrand()" , features .get (i ).getLocations ().getStrand (), newFeatures .get (i ).getLocations ().getStrand ());
247233
248234 List <Location > subLocations = features .get (i ).getLocations ().getSubLocations ();
249235 List <Location > newSubLocations = newFeatures .get (i ).getLocations ().getSubLocations ();
250236 assertEquals ("getSubLocations()" , subLocations .size (), newSubLocations .size ());
251-
252- assertEquals ("getSubLocations()" , subLocations , newSubLocations );
253-
254- for (int j =0 ; j < subLocations .size (); j ++ ) {
255- assertEquals ("getSubLocations()" , subLocations .get (j ).toString (), newSubLocations .get (j ).toString ());
237+ for (int j =0 ; j < subLocations .size (); j ++ ) {
238+ assertEquals ("getSubLocations(), getStart()" , subLocations .get (j ).getStart (), newSubLocations .get (j ).getStart ());
239+ assertEquals ("getSubLocations(), getEnd()" , subLocations .get (j ).getEnd (), newSubLocations .get (j ).getEnd ());
240+ assertEquals ("getSubLocations(), getStrand()" , subLocations .get (j ).getStrand (), newSubLocations .get (j ).getStrand ());
256241 }
257242
258243 Map <String , List <Qualifier >> qualifiers = features .get (i ).getQualifiers ();
0 commit comments