sub _parse_paired { my $this = shift; my $pkey = 1; my $c = { comments => '', left_instance => '', right_instance => '', match => '' }; ### build up each record and place in the collection ### $INPUT_RECORD_SEPARATOR = "\n\n\n"; while (my $record = $this->{handle}->getline()) { my ($lt, $rt, $lseq, $rseq) = (); my @rows = split /\n/, $record; for (my $i = 0; $i < $#rows; $i++) { if ($rows[$i] =~ m/^\n?$/) { next; } elsif ($rows[$i] =~ m/^#/) { $c->{$pkey}->{comments} .= "$rows[$i]\n"; } elsif ($rows[$i] =~ m/^\s+\d+/) { _load_stats($pkey, $rows[$i], $c); } elsif ($rows[$i] =~ m/^Sbjct/ && $rows[$i+1] =~ m/^Sbjct/) { (undef, $lt, undef) = split /\s+/, $rows[$i]; (undef, $rt, undef) = split /\s+/, $rows[$i+1]; $lseq .= $lt; $rseq .= $rt; } elsif ($rows[$i] =~ m/^Sbjct/ && $rows[$i+1] =~ m/!/) { (undef, $lt, undef) = split /\s+/, $rows[$i]; (undef, $rt, undef) = split /\s+/, $rows[$i+2]; $lseq .= $lt; $rseq .= $rt; } } $c->{$pkey}->{left_instance}->{sequence} = $lseq; $c->{$pkey}->{right_instance}->{sequence} = $rseq; ++$pkey; } return $c; }