Skip to content

uio-bmi/pygssw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pygssw

A simple Python wrapper around gssw, enabling sequence to graph alignment from Python. Only tested with Python 3.

Install

Pygssw can installed with pip:

pip3 install pygssw

Usage

from pygssw import align
nodes = [1, 2, 3] 
edges = [(1, 2), (2, 3)]
node_sequences = ["AAA", "CCC", "TTT"]  # Same order as nodes list
read = "AAACTCTTT"

alignment, score = align(nodes, node_sequences, edges, read)
print(alignment, score)

Note: It seems that GSSW only supports dense sorted nodes, and no edges going from a higher node id to a lower. Pygssw attempts to converting all node IDs before calling GSSW. After aligning, it converts the node IDs back.

Installing from source

This guide assumes linux.

  • Clone this repository
  • Install requirements:
apt install swig
apt install python3-dev
  • Install:
cd pygssw   # Folder pygssw inside the repo
swig -python gssw.i
gcc -fpic  -c -O3 -msse4 gssw.c gssw_wrap.c -I/usr/include/python3.6m
ld -shared gssw.o gssw_wrap.o -o _gssw.so
cd ..
pip3 install -e .

NOTE: Change /usr/include/python3.6m to python-dev executable (requires intallation of python-dev, i.e. apt-get install python3-dev)

About

Python wrapper around GSSW (Graph Striped Smith-Waterman)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published