Skip to content

Commit

Permalink
Add an operator<< for the SequenceDistanceGraphPath
Browse files Browse the repository at this point in the history
And disable size modification on the interface for the vector of sdgp
  • Loading branch information
ljyanesm committed Aug 8, 2019
1 parent d50790b commit abcb596
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions interfaces/SequenceDistanceGraph.i.in
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ __commit__ = "@GIT_COMMIT_HASH@"

%template(vectorNode) std::vector<Node>;

%ignore std::vector<SequenceDistanceGraphPath>::vector(size_type);
%ignore std::vector<SequenceDistanceGraphPath>::resize;
%template(vectorSequenceDistanceGraphPath) std::vector<SequenceDistanceGraphPath>;
%extend std::vector<SequenceDistanceGraphPath> {
const std::string __repr__() {
Expand Down
5 changes: 5 additions & 0 deletions src/sdglib/graph/SequenceDistanceGraphPath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,8 @@ bool SequenceDistanceGraphPath::is_unitig() {
}
return true;
}

std::ostream &operator<<(std::ostream &os, const SequenceDistanceGraphPath &sdgp) {
os << "SequenceDistanceGraphPath (" << sdgp.sg.name << "): " << sdgp.nodes.size() << " nodes";
return os;
}
2 changes: 2 additions & 0 deletions src/sdglib/graph/SequenceDistanceGraphPath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class SequenceDistanceGraphPath {

SequenceDistanceGraphPath& operator=(const SequenceDistanceGraphPath &other);

friend std::ostream& operator<<(std::ostream &os, const SequenceDistanceGraphPath &sdgp);

std::string get_fasta_header(bool use_oldnames = false) const;
std::string sequence() const;
size_t get_sequence_size_fast() const;
Expand Down

0 comments on commit abcb596

Please sign in to comment.