Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • a943c0f
  • /
  • overlap.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:778c7ba2e75e9e12718a7e22971c60e2aabc814f
directory badge Iframe embedding
swh:1:dir:a943c0f6a78ccd373aa3dd252ac3577c079ff0ba

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
overlap.py
#(c) 2013-2014 by Authors
#This file is a part of Ragout program.
#Released under the BSD license (see LICENSE file)

"""
This module executes overlap native binary
which reconstructs overlap graph from contigs
"""

import os
import logging
import subprocess

from ragout.shared import config
from ragout.shared.utils import which

logger = logging.getLogger()

OVERLAP_EXEC = "ragout-overlap"

class OverlapException(Exception):
    pass

def check_binary():
    """
    Checks if the native binary is available and runnable
    """
    binary = which(OVERLAP_EXEC)
    if not binary:
        logger.error("\"{0}\" native module not found".format(OVERLAP_EXEC))
        return False

    try:
        devnull = open(os.devnull, "w")
        subprocess.check_call([OVERLAP_EXEC, "--help"], stderr=devnull)
    except subprocess.CalledProcessError as e:
        logger.error("Some error inside native {0} module: {1}"
                     .format(OVERLAP_EXEC, e))
        return False

    return True


def make_overlap_graph(contigs_file, dot_file):
    """
    Builds assembly graph and outputs it in "dot" format
    """
    cmdline = [OVERLAP_EXEC, contigs_file, dot_file,
               str(config.vals["overlap"]["min_overlap"]),
               str(config.vals["overlap"]["max_overlap"])]
    if config.vals["overlap"]["detect_kmer"]:
        cmdline.append("--detect-kmer")

    logger.info("Building assembly graph")
    proc = subprocess.Popen(cmdline, stderr=subprocess.PIPE)
    for line in iter(proc.stderr.readline, ""):
        logger.debug(line.strip())
    ret_code = proc.wait()
    if ret_code:
        raise OverlapException("Error building overlap graph: Non-zero return "
                               "code when calling {0} "
                               "module: {1}".format(OVERLAP_EXEC, ret_code))

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API