#!/usr/bin/perl use warnings; use Inline CPP => Config => AUTO_INCLUDE => '#include "ssw_cpp.h"'; my $ref = "CAGCCTTTCTGACCCGGAAATCAAAATAGGCACAACAAA"; my $seq = "CTGAGCCGGTAAATC"; my $cigar = do_SSW($seq,$ref); print "$cigar\n"; __END__ __CPP__ static string do_SSW(const string query, const string ref) { StripedSmithWaterman::Aligner aligner; StripedSmithWaterman::Filter filter; StripedSmithWaterman::Alignment alignment; aligner.Align(query.c_str(), ref.c_str(), ref.size(), filter, &alignment); return alignment.cigar_string; }