my $is_paired = defined($opts{p});
# core loop
my @s1 = ();
my @s2 = ();
my ($s_last, $s_curr) = (\@s1, \@s2);
while (<>) {
my $is_paired = defined($opts{p});
# core loop
my @s1 = ();
my @s2 = ();
my ($s_last, $s_curr) = (\@s1, \@s2);
while (<>) {
next if (&soap2sam_aux($_, $s_curr, $is_paired) < 0);
if (@$s_last != 0 && $s_last->[0] eq $s_curr->[0]) {
&mating($s_last, $s_curr);
next if (&soap2sam_aux($_, $s_curr, $is_paired) < 0);
if (@$s_last != 0 && $s_last->[0] eq $s_curr->[0]) {
&mating($s_last, $s_curr);