Skip to content

Commit

Permalink
S4 (#3)
Browse files Browse the repository at this point in the history
* Update spoa to 4.0.0 and build for portability
  • Loading branch information
cjw85 authored Oct 2, 2020
1 parent 5c5f4bb commit 5439edc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

build:
cmake --version
mkdir -p src/build
cd src/build && cmake -DCMAKE_BUILD_TYPE=Release -D CMAKE_CXX_FLAGS="-fPIC" .. && make
cd src/build && cmake -D optimize_for_portability=ON -DCMAKE_BUILD_TYPE=Release -D CMAKE_CXX_FLAGS="-I ../vendor/cereal/include/ -fPIC" .. && make
python3 setup.py develop

test: build
Expand Down
26 changes: 11 additions & 15 deletions pyspoa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,25 @@
#include <pybind11/stl.h>
#include <pybind11/pybind11.h>

using namespace std;
using namespace spoa;
using namespace pybind11;
using namespace pybind11::literals;
using namespace pybind11::literals; // for _a in pybind def


auto poa(vector<string> sequences, int algorithm, bool genmsa,
auto poa(std::vector<std::string> sequences, int algorithm, bool genmsa,
int m, int n, int g, int e, int q, int c) -> pybind11::tuple
{
auto alignment_engine = createAlignmentEngine(
static_cast<AlignmentType>(algorithm), m, n, g, e, q, c
);
auto alignment_engine = spoa::AlignmentEngine::Create(
spoa::AlignmentType::kSW, m, n, g, e, q, c);

auto graph = createGraph();
spoa::Graph graph{};

for (const auto& it: sequences) {
auto alignment = alignment_engine->align(it, graph);
graph->add_alignment(alignment, it);
auto alignment = alignment_engine->Align(it, graph);
graph.AddAlignment(alignment, it);
}

string consensus = graph->generate_consensus();
vector<string> msa;
if (genmsa) graph->generate_multiple_sequence_alignment(msa);
auto consensus = graph.GenerateConsensus();
std::vector<std::string> msa;
if (genmsa)
msa = graph.GenerateMultipleSequenceAlignment();
return pybind11::make_tuple(consensus, msa);
}

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def build_extensions(self):
['pyspoa.cpp'],
include_dirs=[
'src/include/spoa',
'src/vendor/cereal/include',
get_pybind_include(),
get_pybind_include(user=True),
],
Expand All @@ -108,7 +109,7 @@ def build_extensions(self):

setup(
name='pyspoa',
version='0.0.2',
version='0.0.3',
author='Oxford Nanoporetech Technologies, Ltd.',
author_email='[email protected]',
url='https://github.com/nanoporetech/pyspoa',
Expand Down

0 comments on commit 5439edc

Please sign in to comment.