/
CoordinateMapper.t
685 lines (580 loc) · 18.4 KB
/
CoordinateMapper.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
use strict;
BEGIN {
use Bio::Root::Test;
test_begin(-tests => 175);
use_ok('Bio::Location::Simple');
use_ok('Bio::Coordinate::Pair');
use_ok('Bio::Coordinate::Result::Match');
use_ok('Bio::Coordinate::Result::Gap');
use_ok('Bio::Coordinate::Chain');
use_ok('Bio::Coordinate::Collection');
}
my ($c, $value);
ok $c = Bio::Coordinate::Result::Match-> new;
ok $c = Bio::Coordinate::Result::Gap-> new;
# propepide
my $match1 = Bio::Location::Simple->new
(-seq_id => 'propeptide', -start => 21, -end => 40, -strand=>1 );
# peptide
my $match2 = Bio::Location::Simple->new
(-seq_id => 'peptide', -start => 1, -end => 20, -strand=>1 );
ok my $pair = Bio::Coordinate::Pair->new(-in => $match1,
-out => $match2,
-negative => 0, # false, default
);
ok $pair->test;
is $pair->strand(), 1; # = in->strand * out->strand
is $pair->in->seq_id(), 'propeptide';
my ($count, $pos, $pos2, $res, $match, $res2);
#
# match within
#
$pos = Bio::Location::Simple->new
(-start => 25, -end => 25, -strand=> -1 );
# results are in Bio::Coordinate::Result
# they can be Matches and Gaps; are Bio::LocationIs
ok $res = $pair->map($pos);
isa_ok $res, 'Bio::Coordinate::Result';
isa_ok $res, 'Bio::Location::SplitLocationI';
is $res->each_match, 1;
is $res->each_gap, 0;
is $res->each_Location, 1;
isa_ok $res->match, 'Bio::LocationI';
isa_ok $res->match, 'Bio::Coordinate::Result::Match';
is $res->match->start, 5;
is $res->match->end, 5;
is $res->match->strand, -1;
is $res->match->seq_id, 'peptide';
is $res->start, 5;
is $res->end, 5;
is $res->strand, -1;
#is $res->seq_id, 'peptide';
# lets do the reverse
$match = $res->match;
ok $pair->swap;
$res2 = $pair->map($match);
is $res2->match->start, $pos->start;
is $res2->match->end, $pos->end;
is $res2->match->strand, $pos->strand;
is $res2->match->seq_id, $pair->out->seq_id;
ok $pair->swap;
#
# match outside = Gap
#
$pos = Bio::Location::Simple->new (-start => 5, -end => 5 );
ok $res = $pair->map($pos);
#$res->verbose(2);
is $res->each_Location, 1;
is $res->each_gap, 1;
isa_ok $res->gap, 'Bio::Coordinate::Result::Gap';
isa_ok $res->gap, 'Bio::LocationI';
is $res->gap->strand, 1;
is $res->gap->start, 5;
is $res->gap->length, $pos->length;
is $res->gap->seq_id, 'propeptide';
#
# partial match = gap & match
#
$pos2 = Bio::Location::Simple->new
(-start => 20, -end => 22, -strand=> -1 );
ok $res = $pair->map($pos2);
is $res->each_match, 1;
is $res->each_gap, 1;
is $res->each_Location, 2;
is $res->match->length + $res->gap->length, $pos2->length;
is $res->match->start, 1;
is $res->match->end, 2;
is $res->match->seq_id, 'peptide';
is $res->match->strand, -1;
is $res->gap->start, 20;
is $res->gap->end, 20;
is $res->gap->seq_id, 'propeptide';
is $res->gap->strand, -1;
#
# partial match = match & gap
#
$pos2 = Bio::Location::Simple->new (-start => 40, -end => 41, -strand=> 1 );
ok $res = $pair->map($pos2);
is $res->match->length + $res->gap->length, $pos2->length;
#
#enveloping
#
$pos2 = Bio::Location::Simple->new (-start => 19, -end => 41, -strand=> 1 );
ok $res = $pair->map($pos2);
$count = 0; map {$count += $_->length} $res->each_Location;
is $count, $pos2->length;
#
# Testing insertions
#
#out
$pos = Bio::Location::Simple->new (-start => 5, -end => 6, -location_type=>'^');
$res = $pair->map($pos);
is $res->each_gap, 1;
is $res->each_Location, 1;
#in
$pos = Bio::Location::Simple->new (-start => 21, -end => 22, -location_type=>'^');
$res = $pair->map($pos);
is $res->each_match, 1;
is $res->each_Location, 1;
#just before
$pos = Bio::Location::Simple->new (-start => 20, -end => 21, -location_type=>'^');
$res = $pair->map($pos);
is $res->each_gap, 1;
is $res->each_Location, 1;
#just after
$pos = Bio::Location::Simple->new (-start => 40, -end => 41, -location_type=>'^');
$res = $pair->map($pos);
is $res->each_gap, 1;
is $res->each_Location, 1;
#
# strandness
#
# 11 6 4 2
# -|--------|-
# -|--------|-
# 2 7 9 11
#
# from
$match1 = Bio::Location::Simple->new
(-seq_id => 'from', -start => 2, -end => 11, -strand=>1 );
# to
$match2 = Bio::Location::Simple->new
(-seq_id => 'to', -start => 2, -end => 11, -strand=>-1 );
$pair = Bio::Coordinate::Pair->new(-in => $match1,
-out => $match2
);
#
# match within
#
ok $pair->test;
is $pair->strand(), -1;
$pos = Bio::Location::Simple->new
(-seq_id => 'from', -start => 7, -end => 9, -strand=>1 );
$res = $pair->map($pos);
is $res->match->start, 4;
is $res->match->end, 6;
is $res->match->strand, -1;
$pos = Bio::Location::Simple->new
(-seq_id => 'from', -start => 3, -end => 10, -strand=>-1 );
$res = $pair->map($pos);
is $res->match->start, 3;
is $res->match->end, 10;
is $res->match->strand, 1;
#
# match outside = Gap
#
$pos = Bio::Location::Simple->new
(-seq_id => 'from', -start => 1, -end => 1, -strand=>1 );
$res = $pair->map($pos);
is $res->gap->start, 1;
is $res->gap->end, 1;
is $res->gap->strand, 1;
$pos = Bio::Location::Simple->new
(-seq_id => 'from', -start => 12, -end => 12, -strand=>-1 );
$res = $pair->map($pos);
is $res->gap->start, 12;
is $res->gap->end, 12;
is $res->gap->strand, -1;
#
# partial match1 = gap & match
#
$pos = Bio::Location::Simple->new
(-seq_id => 'from', -start => 1, -end => 7, -strand=>-1 );
$res = $pair->map($pos);
is $res->gap->start, 1;
is $res->gap->end, 1;
is $res->gap->strand, -1;
is $res->match->start, 6;
is $res->match->end, 11;
is $res->match->strand, 1;
#
# partial match2 = match & gap
#
$pos = Bio::Location::Simple->new
(-seq_id => 'from', -start => 9, -end => 12, -strand=>-1 );
$res = $pair->map($pos);
is $res->match->start, 2;
is $res->match->end, 4;
is $res->match->strand, 1;
is $res->gap->start, 12;
is $res->gap->end, 12;
is $res->gap->strand, -1;
#
#enveloping
#
$pos = Bio::Location::Simple->new
(-seq_id => 'from', -start => 1, -end => 12, -strand=>-1 );
$res = $pair->map($pos);
is $res->match->start, 2;
is $res->match->end, 11;
is $res->match->strand, 1;
my ($gap1, $gap2) = $res->each_gap;
is $gap1->start, 1;
is $gap1->end, 1;
is $gap1->strand, -1;
is $gap2->start, 12;
is $gap2->end, 12;
is $gap2->strand, -1;
#
# Chain
#
# chain (two) mappers together
#
# propepide
$match1 = Bio::Location::Simple->new
(-seq_id => 'propeptide', -start => 5, -end => 40, -strand=>1 );
# peptide
$match2 = Bio::Location::Simple->new
(-seq_id => 'peptide', -start => 1, -end => 36, -strand=>1 );
ok $pair = Bio::Coordinate::Pair->new(-in => $match1,
-out => $match2
);
ok my $chain = Bio::Coordinate::Chain->new;
ok $chain->add_mapper($pair);
$chain->add_mapper($pair);
$pos = Bio::Location::Simple->new
(-seq_id => 'from', -start => 6, -end => 21, -strand=> 1 );
# 6 -> 2 -> 1
# 21 -> 17 -> 13
$match = $chain->map($pos);
isa_ok $match, 'Bio::Coordinate::Result::Match';
is $match->start, 1;
is $match->end, 13;
is $match->strand, 1;
#
# Collection
#
# 1 5 6 10
# |---| |---|
#-----|-----------------------
# 1 5 9 15 19
# pair1 pair2
# gene
$match1 = Bio::Location::Simple->new
(-seq_id => 'gene', -start => 5, -end => 9, -strand=>1 );
# exon2
$match2 = Bio::Location::Simple->new
(-seq_id => 'exon1', -start => 1, -end => 5, -strand=>1 );
ok my $pair1 = Bio::Coordinate::Pair->new(-in => $match1,
-out => $match2,
);
# gene
my $match3 = Bio::Location::Simple->new
(-seq_id => 'gene', -start => 15, -end => 19, -strand=>1 );
# exon
my $match4 = Bio::Location::Simple->new
(-seq_id => 'exon2', -start => 6, -end => 10, -strand=>1 );
ok my $pair2 = Bio::Coordinate::Pair->new(-in => $match3,
-out => $match4,
);
ok my $transcribe = Bio::Coordinate::Collection->new;
ok $transcribe->add_mapper($pair1);
ok $transcribe->add_mapper($pair2);
# simple match
$pos = Bio::Location::Simple->new (-start => 5, -end => 9 );
ok $res = $transcribe->map($pos);
is $res->match->start, 1;
is $res->match->end, 5;
is $res->match->seq_id, 'exon1';
# flank pre
$pos = Bio::Location::Simple->new (-start => 2, -end => 9 );
ok $res = $transcribe->map($pos);
is $res->each_gap, 1;
is $res->each_match, 1;
is $res->match->start, 1;
is $res->match->end, 5;
# flank post
$pos = Bio::Location::Simple->new (-start => 5, -end => 12 );
ok $res = $transcribe->map($pos);
is $res->each_gap, 1;
is $res->each_match, 1;
is $res->match->start, 1;
is $res->match->end, 5;
# match more than two
$pos = Bio::Location::Simple->new (-start => 5, -end => 19 );
ok $res = $transcribe->map($pos);
is $res->each_gap, 2;
is $res->each_match, 2;
# testing sorting
#
# 1 5 6 10 11 15
# |---| |---| |---|
#-----|-----------------------|---|--
# 1 5 9 15 19 25 29
# pair1 pair2 pair3
#
#
# create the third pair
# gene
my $match5 = Bio::Location::Simple->new
(-seq_id => 'gene', -start => 25, -end => 29, -strand=>1 );
# exon
my $match6 = Bio::Location::Simple->new
(-seq_id => 'exon3', -start => 11, -end => 15, -strand=>1 );
my $pair3 = Bio::Coordinate::Pair->new(-in => $match5,
-out => $match6
);
# create a new collection in wrong order
$transcribe = Bio::Coordinate::Collection->new;
$transcribe->add_mapper($pair3);
$transcribe->add_mapper($pair1);
$transcribe->add_mapper($pair2);
ok $transcribe->sort;
my @res;
map {push @res, $_->in->start } $transcribe->each_mapper;
ok compare_arrays ([5, 15, 25], \@res);
#
# Test using genomic data
#
my $mapper = Bio::Coordinate::Collection->new;
load_data($mapper, undef );
# transform a segment entirely within the first rawcontig
#test_transform ($mapper,
# [627012, 2, 5, -1, "rawcontig"],
# ["chr1", 2, 5, -1]);
$pos = Bio::Location::Simple->new (-start => 2, -end => 5, -strand => -1);
$res = $mapper->map($pos);
is $res->match->start, 2;
is $res->match->end, 5;
is $res->match->strand, -1;
is $res->match->seq_id, '627012';
## now a split coord
my @testres = (
[314696, 31917, 31937, -1],
[341, 126, 59773, -1],
[315843, 5332, 5963, +1]
);
$pos = Bio::Location::Simple->new (-start => 383700, -end => 444000, -strand => 1);
$res = $mapper->map($pos);
@res = $res->each_match;
compare (shift @res, shift @testres);
compare (shift @res, shift @testres);
compare (shift @res, shift @testres);
## now a simple gap
@testres = (
[627011, 7447, 7507, +1],
["chr1", 273762, 273781, 1]
);
$pos = Bio::Location::Simple->new (-start => 273701, -end => 273781, -strand => 1);
$res = $mapper->map($pos);
is $res->each_match, 1;
is $res->each_gap, 1;
@res = $res->each_Location;
compare (shift @res, shift @testres);
compare (shift @res, shift @testres);
ok $mapper->swap;
$pos = Bio::Location::Simple->new
(-start => 2, -end => 5, -strand => -1, -seq_id => '627012');
$res = $mapper->map($pos);
is $res->match->start, 2;
is $res->match->end, 5;
is $res->match->strand, -1;
is $res->match->seq_id, 'chr1';
#
# tests for split locations
#
# testing a simple pair
$match1 = Bio::Location::Simple->new
(-seq_id => 'a', -start => 5, -end => 17, -strand=>1 );
$match2 = Bio::Location::Simple->new
(-seq_id => 'b', -start => 1, -end => 13, -strand=>-1 );
$pair = Bio::Coordinate::Pair->new(-in => $match1,
-out => $match2,
);
# split location
ok my $split = Bio::Location::Split->new();
ok $split->add_sub_Location(Bio::Location::Simple->new(-start=>6,
-end=>8,
-strand=>1));
$split->add_sub_Location(Bio::Location::Simple->new(-start=>15,
-end=>16,
-strand=>1));
$res=$pair->map($split);
ok my @sublocs = $res->each_Location(1);
is @sublocs, 2;
#print Dumper \@sublocs;
is $sublocs[0]->start, 2;
is $sublocs[0]->end, 3;
is $sublocs[1]->start, 10;
is $sublocs[1]->end, 12;
#
# from Align
#
use Bio::Coordinate::Utils;
use Bio::LocatableSeq;
use Bio::SimpleAlign;
my $string;
#y $out = IO::String->new($string);
#AAA/3-10 --wtatgtng
#BBB/1-7 -aaaat-tt-
my $s1 = Bio::LocatableSeq->new(-id => 'AAA',
-seq => '--wtatgtng',
-start => 3,
-end => 10,
-alphabet => 'dna'
);
my $s2 = Bio::LocatableSeq->new(-id => 'BBB',
-seq => '-aaaat-tt-',
-start => 1,
-end => 7,
-alphabet => 'dna'
);
$a = Bio::SimpleAlign->new();
$a->add_seq($s1);
$a->add_seq($s2);
#use Data::Dumper;
ok my $uti = Bio::Coordinate::Utils->new;
$mapper = $uti->from_align($a);
#print Dumper $mapper;
is $mapper->return_match, 1;
is $mapper->return_match(1), 1;
$pos = Bio::Location::Simple->new
(-start => 4, -end => 8, -strand => 1);
$res = $mapper->map($pos);
#print Dumper $res;
exit; # end of tests
#
# subroutines only after this
#
sub compare_arrays {
my ($first, $second) = @_;
return 0 unless @$first == @$second;
for (my $i = 0; $i < @$first; $i++) {
return 0 if $first->[$i] ne $second->[$i];
}
return 1;
}
sub compare {
my ($match, $test) = @_;
is $match->seq_id eq $test->[0], 1,
"Match: |". $match->seq_id. "| Test: ". $test->[0]. "|";
is $match->start, $test->[1];
is $match->end, $test->[2];
is $match->strand, $test->[3];
}
sub load_data {
my ($map, $reverse) = @_;
#chr_name raw_id chr_start chr_end raw_start raw_end raw_ori
my @sgp_dump = split ( /\n/, qq {
chr1 627012 1 31276 1 31276 1
chr1 627010 31377 42949 72250 83822 -1
chr1 2768 42950 180950 251 138251 1
chr1 10423 180951 266154 1 85204 -1
chr1 627011 266255 273761 1 7507 1
chr1 314698 273862 283122 1 9261 -1
chr1 627009 283223 331394 251 48422 -1
chr1 314695 331395 352162 1 20768 -1
chr1 314697 352263 359444 1 7182 -1
chr1 314696 359545 383720 31917 56092 -1
chr1 341 383721 443368 126 59773 -1
chr1 315843 443369 444727 5332 6690 1
chr1 315844 444828 453463 1 8636 -1
chr1 315834 453564 456692 1 3129 1
chr1 315831 456793 458919 1 2127 1
chr1 315827 459020 468965 251 10196 -1
chr1 544782 468966 469955 1 990 -1
chr1 315837 470056 473446 186 3576 -1
chr1 544807 473447 474456 1 1010 -1
chr1 315832 474557 477289 1 2733 1
chr1 544806 477390 477601 1086 1297 -1
chr1 315840 477602 482655 21 5074 1
chr1 544802 482656 483460 1 805 -1
chr1 544811 483561 484162 6599 7200 -1
chr1 315829 484163 498439 15 14291 -1
chr1 544813 498440 500980 1 2541 -1
chr1 544773 501081 502190 1217 2326 -1
chr1 315828 502191 513296 72 11177 1
chr1 544815 513297 517276 2179 6158 1
chr1 315836 517277 517662 2958 3343 1
chr1 544805 517663 520643 299 3279 1
chr1 315835 520744 521682 2462 3400 -1
chr1 544784 521683 526369 54 4740 1
chr1 544796 526470 527698 1 1229 1
chr1 315833 527799 528303 2530 3034 -1
chr1 544803 528304 531476 1 3173 -1
chr1 544821 531577 532691 1 1115 1
chr1 544810 532792 533843 1 1052 1
chr1 544800 533944 535249 1 1306 1
chr1 544786 535350 536652 1 1303 1
chr1 544814 536753 538358 1 1606 1
chr1 544812 538459 540004 1 1546 1
chr1 544818 540105 541505 1 1401 1
chr1 544816 541606 542693 1 1088 1
chr1 544778 542794 544023 1 1230 1
chr1 544779 544124 545709 1 1586 1
chr1 544804 545810 547660 1 1851 1
chr1 544774 547761 550105 1 2345 1
chr1 544817 550206 552105 1 1900 1
chr1 544781 552206 553640 1 1435 1
chr1 315830 553741 555769 1 2029 -1
chr1 544819 555870 558904 1 3035 -1
chr1 544777 559005 560670 1 1666 1
chr1 544795 560771 563092 1 2322 1
chr1 544809 563193 565523 1 2331 1
chr1 544808 565624 568113 1 2490 1
chr1 544798 568214 570324 1 2111 1
chr1 544783 570425 574640 1 4216 1
chr1 544824 574741 578101 1 3361 1
chr1 544775 578202 580180 1 1979 -1
chr1 544825 580281 581858 1 1578 -1
chr1 544772 581959 585312 1 3354 1
chr1 544793 585413 588740 1 3328 1
chr1 544785 588841 591656 1 2816 -1
chr1 544791 591757 594687 1 2931 1
chr1 544820 594788 597671 1 2884 1
chr1 544790 597772 601587 1 3816 1
chr1 544794 601688 603324 1 1637 -1
chr1 544823 603425 607433 1 4009 1
chr1 544789 607534 610856 1 3323 1
chr1 544799 610957 614618 1 3662 1
chr1 544776 614719 618674 1 3956 -1
chr1 544797 618775 624522 1 5748 -1
chr1 544787 624623 629720 1 5098 -1
chr1 544792 629821 637065 1 7245 1
chr1 622020 837066 851064 1 13999 -1
chr1 622021 851165 854101 1 2937 -1
chr1 622016 854202 856489 1 2288 -1
chr1 625275 856590 888524 420 32354 -1
chr1 622015 888525 891483 1 2959 -1
chr1 622024 891584 896208 8871 13495 -1
chr1 625537 896209 952170 1 55962 -1
chr1 625538 952271 1051812 251 99792 -1
chr1 625277 1051813 1055193 1 3381 -1
chr1 625266 1055294 1062471 1 7178 -1
chr1 598266 1062572 1086504 11 23943 -1
chr1 625271 1086505 1096571 3943 14009 1
chr1 625265 1096572 1100161 2436 6025 -1
chr1 173125 1100162 1106067 3329 9234 -1
chr1 598265 1106068 1112101 286 6319 1
chr1 625360 1112102 1172572 251 60721 1
chr1 173111 1172573 1172716 1 144 -1
chr1 173103 1172817 1173945 1 1129 1
chr1 170531 1174046 1174188 8791 8933 -1
chr1 625363 1174189 1183590 67 9468 1
chr1 173120 1183591 1183929 153 491 -1
chr1 170509 1183930 1184112 864 1046 1
chr1 173119 1184213 1189703 1 5491 -1
chr1 625357 1189804 1213915 1 24112 1
chr1 625359 1214016 1216330 1 2315 1
} );
# test the auto-sorting feature
# @sgp_dump = reverse (@sgp_dump) if defined $reverse;
my $first = 1;
for my $line ( @sgp_dump ) {
if( $first ) { $first = 0; next; }
my ( $chr_name, $contig_id, $chr_start, $chr_end,
$contig_start, $contig_end, $contig_strand ) =
split ( /\t/, $line );
my $match1 = Bio::Location::Simple->new
(-seq_id => $chr_name, -start => $chr_start,
-end => $chr_end, -strand=>1 );
my $match2 = Bio::Location::Simple->new
(-seq_id => $contig_id, -start => $contig_start,
-end => $contig_end, -strand=>$contig_strand );
my $pair = Bio::Coordinate::Pair->new(-in => $match1,
-out => $match2,
);
$map->add_mapper($pair);
}
return $map;
}