Skip to content

Commit

Permalink
Fixes to SWIG bindings
Browse files Browse the repository at this point in the history
* Fix vector and namespace error in `nucmer.i`. Only seem to occur with
recent version of SWIG.`
  • Loading branch information
gmarcais committed Nov 22, 2024
1 parent e38f4c7 commit f355b84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions swig/nucmer.i
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
%{
#include <vector>
#include <string>
#include <sstream>
%}

%template(LongVector) ::std::vector<long>;
%include <std_vector.i>

%template(LongVector) std::vector<long>;

namespace mummer {

Expand All @@ -14,7 +18,7 @@ struct Alignment {
//-- An alignment object between two sequences A and B
signed char dirB; // the query sequence direction
long int sA, sB, eA, eB; // the start in A, B and the end in A, B
::std::vector<long> delta; // the delta values, with NO zero at the end
std::vector<long> delta; // the delta values, with NO zero at the end
long int deltaApos; // sum of abs(deltas) - #of negative deltas
long int Errors, SimErrors, NonAlphas; // errors, similarity errors, nonalphas
double identity() const;
Expand All @@ -29,9 +33,11 @@ struct Alignment {
}
}
};
%template(AlignmentVector) ::std::vector<mummer::postnuc::Alignment>;
} // namespace postnuc
} // namespace mummer
%template(AlignmentVector) ::std::vector<mummer::postnuc::Alignment>;

namespace mummer {
namespace nucmer {
struct Options {
mummer::nucmer::Options& mum();
Expand Down Expand Up @@ -77,9 +83,8 @@ struct Options {
};
%apply (const char* STRING, size_t LENGTH) { (const char* reference, size_t reference_len) };
%apply (const char* STRING, size_t LENGTH) { (const char* query, size_t query_len) };
::std::vector<mummer::postnuc::Alignment> align_sequences(const char* reference, size_t reference_len,
const char* query, size_t query_len,
mummer::nucmer::Options opts = mummer::nucmer::Options());
std::vector<mummer::postnuc::Alignment> align_sequences(const char* reference, size_t reference_len,
const char* query, size_t query_len,
mummer::nucmer::Options opts = mummer::nucmer::Options());
} // namespace nucmer
} // namespace mummer

2 changes: 1 addition & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ EXTRA_DIST += %D%/testsh.in
EXTRA_DIST += %D%/test_md5

# Build generate_sequences, used to generage pseudo-random sequences.
%C%_generate_sequences_SOURCES = %D%/generate_sequences.cc
%C%_generate_sequences_SOURCES = %D%/generate_sequences.cc %D%/gcc10_uniform_dist.hpp
%C%_generate_sequences_CPPFLAGS = $(CPPFLAGS) -I%D%
YAGGO_BUILT += %D%/generate_sequences_cmdline.hpp

Expand Down

0 comments on commit f355b84

Please sign in to comment.