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

Revision 686db1b2da0eb33a4dd5a1509a3e51129a43609f authored by Debabrata Deka on 02 December 2020, 10:17:21 UTC, committed by GitHub on 02 December 2020, 10:17:21 UTC
Add architecture ppc64le to travis build
1 parent 031e062
  • Files
  • Changes
  • fdbb28c
  • /
  • ragout
  • /
  • maf2synteny
  • /
  • maf2synteny.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.

  • revision
  • directory
  • content
revision badge
swh:1:rev:686db1b2da0eb33a4dd5a1509a3e51129a43609f
directory badge
swh:1:dir:420ae4e0c330f2090b6fe221c6737ae48495da54
content badge
swh:1:cnt:2a6b945fec0b88fe8bcb6a466fc6140954b9f4f9

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.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
maf2synteny.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 maf2synteny native binary
which recovers synteny blocks from multiple alignment
"""

from __future__ import absolute_import
from __future__ import division
import logging
import subprocess
import os

from ragout.shared.utils import which
from ragout.shared import config
from ragout.six.moves import map

logger = logging.getLogger()

M2S_EXEC = "ragout-maf2synteny"


def check_binary():
    """
    Checks if native binary is available and runnable
    """
    binary = which(M2S_EXEC)
    if not binary:
        logger.error("\"%s\" native module not found", M2S_EXEC)
        return False

    try:
        devnull = open(os.devnull, "w")
        subprocess.check_call([M2S_EXEC, "-h"], stderr=devnull)
    except subprocess.CalledProcessError as e:
        logger.error("Some error inside native module: %s", str(e))
        return False

    return True


def make_synteny(maf_file, out_dir, min_blocks_list):
    """
    Builds synteny blocks from MAF file
    """
    if not check_binary():
        return False

    params_file = os.path.join(out_dir, "simpl_params.txt")
    _make_params_file(config.vals["maf2synteny"], params_file)
    cmdline = [M2S_EXEC, maf_file, "-o", out_dir, "-s", params_file,
               "-b", ",".join(map(str, min_blocks_list))]

    logger.info("Running maf2synteny module")
    proc = subprocess.Popen(cmdline)
    #for line in iter(proc.stderr.readline, ""):
    #    logger.debug(line.strip())
    ret_code = proc.wait()
    if ret_code:
        logger.error("Non-zero return code: %d", ret_code)
        return False

    os.remove(params_file)

    return True

def _make_params_file(params, out_file):
    assert len(params)

    with open(out_file, "w") as f:
        for k, d in params:
            f.write("{0} {1}\n".format(k, d))
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

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