EDLIB_TASK_PATH/;
our %EXPORT_TAGS =
- (all => [ @constants, qw/align distance/ ], constants => \@constants);
+ (all => [ @constants, qw/align distance to_cigar/ ], constants => \@constants);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = ( @{ $EXPORT_TAGS{'constants'} } );
our $VERSION = '0.001';
}
sub distance {
- my ($q, $t, $k) = @_;
- align($q, $t, $k)->{editDistance}
+ my ($q, $t, $k, $mode) = @_;
+ align($q, $t, $k, $mode, EDLIB_TASK_DISTANCE())->{editDistance}
+}
+
+sub to_cigar {
+ my ($align, $format) = @_;
+ $align = pack 'C*', @$align;
+ $format //= EDLIB_CIGAR_STANDARD();
+ edlibAlignmentToCigar($align, $format);
}
1;
say "Start locations are: @{$align->{startLocations}}";
say "End locations are: @{$align->{endLocations}}";
say "Alignment path is: @{$align->{alignment}}";
-
+ say "Alignment path (in CIGAR format): ", to_cigar $align->{alignment};
+ say "Alignment path (in extended CIGAR format): ",
+ to_cigar $align->{alignment}, EDLIB_CIGAR_EXTENDED;
=head1 DESCRIPTION
=over
-=item B<distance>(I<$query>, I<$target>, [I<$max_distance>])
+=item B<distance>(I<$query>, I<$target>, [I<$max_distance>, [I<$mode>]])
This is the basic interface to the library. It is compatible with the
function of the same name in L<Text::Levenshtein::XS>.
It returns the edit distance between the two given strings. If the
third argument is specified, and the edit distance is greater than the
value of the third argument, then the function finishes the
-computation early and returns undef.
+computation early and returns undef. See below for the meaning of the
+optional I<$mode> argument.
=item B<align>(I<$query>, I<$target>, [I<$max_distance>, [I<$mode>, [I<$task>]]])
=head1 SEE ALSO
-L<https://github.com/Martinsos/edlib/>
+L<https://github.com/Martinsos/edlib/>, L<http://martinsosic.com/edlib/edlib_8h.html>
=head1 AUTHOR