Python3 API to store succession relationships between DNA oriented fragments in an oriented graph#

Latest release PyPI version Coverage report Pylint score Mypy Pipeline status Documentation Status

revsymg is a Python3 API to store succession relationships between oriented fragments (in forward or reverse orientation) that have been sequenced from nucleotide sequence(s) in an oriented graph. For example, this API can be used for a genome assembly overlap-layout-consensus method.

Quick installation#

To install the revsymg package from the PyPI repository, run the pip command :

pip install revsymg

You can find more installation details in the installation page.

Quick usage example#

from revsymg.graphs import RevSymGraph
from revsymg.index_lib import FORWARD_INT, REVERSE_INT

#
# Create an empty graph
#
graph = RevSymGraph()
vertices = graph.vertices()
edges = graph.edges()

#
# Add two vertices v and w that represents e.g. DNA fragments
#
frag_1_index = vertices.add()  # = 0
frag_2_index = vertices.add()  # = 1

#
# Add to the graph the overlap v reverse overlaps w forward
#
frag_1_r = (frag_1_index, REVERSE_INT)
frag_2_f = (frag_2_index, FORWARD_INT)
overlap_index = edges.add(frag_1_r, frag_2_f)  # = 0

for u, v, edge_index in edges:
    print(
        f'Predecessor:\t{u}\n'
        f'Successor:\t{v}\n'
        f'Edge index:\t{edge_index}\n',
    )

# The for-loop print this:
#
#   Predecessor:    (1, 1)
#   Successor:      (0, 0)
#   Edge index:     0
#
#   Predecessor:    (0, 1)
#   Successor:      (1, 0)
#   Edge index:     0
#

Changelog#

You can refer to the changelog page for details.

What next?#

Find a list of ideas in the todo page.

Contributing#

  • If you find any errors, missing documentation or test, or you want to discuss features you would like to have, please post an issue (with the corresponding predefined template) here.

  • If you want to help me code, please post an issue or contact me. You can find coding convention in the contributing page.

References#

  • The implemented structure is described as DGF in this preprint:

    📰 Victor Epain, ‘Overlap Graph for Assembling and Scaffolding Algorithms: Paradigm Review and Implementation Proposals’, 2022, https://hal.inria.fr/hal-03815190

  • Inspired by graph-tool

Licence#

This work is licensed under a GNU-GPLv3 licence.