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

https://github.com/fenderglass/Ragout
22 June 2021, 01:27:41 UTC
  • Code
  • Branches (21)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/chr_map
    • refs/heads/devel
    • refs/heads/gh-pages
    • refs/heads/ismb_2014
    • refs/heads/master
    • refs/heads/path_cover
    • refs/heads/py3
    • refs/heads/rr_devel
    • refs/heads/tree_infer
    • refs/remotes/origin/devel
    • refs/tags/1.0
    • refs/tags/1.1
    • refs/tags/2.0
    • refs/tags/2.1
    • refs/tags/2.1.1
    • refs/tags/2.2
    • refs/tags/2.3
    • refs/tags/v0.1b
    • refs/tags/v0.2b
    • refs/tags/v0.3b
    • refs/tags/v1.2
    No releases to show
  • 540f4cf
  • /
  • scripts
  • /
  • run-tests.py
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

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
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:cb87805eea3a84f49295d045bd0e867aaff2c5b9
origin badgedirectory badge
swh:1:dir:ff6fe2e9513e448ac079280e1d7af4c35e3b790b
origin badgerevision badge
swh:1:rev:ef228bf2555646fee110ea533f0546d104fbf9fe
origin badgesnapshot badge
swh:1:snp:049c406b15a9a28e76d942bfc1fe2a04f4142f61

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
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: ef228bf2555646fee110ea533f0546d104fbf9fe authored by Mikhail Kolmogorov on 17 March 2020, 00:49:47 UTC
newick parser fix
Tip revision: ef228bf
run-tests.py
#!/usr/bin/env python

#(c) 2013-2014 by Authors
#This file is a part of Ragout program.
#Released under the BSD license (see LICENSE file)

"""
A script for automatic testing
"""

from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import subprocess
import shutil

TESTS = {"ecoli" : {"recipe" : "examples/E.Coli/ecoli.rcp",
                    "coords" : "examples/E.Coli/mg1655.coords",
                    "max_errors" : 0,
                    "max_errors_refine" : 0,
                    "min_contigs" : 78,
                    "min_contigs_refine" : 145,
                    "max_scaffolds" : 1,
                    "outdir" : "ecoli-test",
                    "scaf_pref" : "mg1655_scaffolds"},
         #"helicobacter" : {"recipe" : "examples/H.Pylori/helicobacter.rcp",
         #                  "coords" : "examples/H.Pylori/SJM180.coords",
         #                  "max_errors" : 0,
         #                  "max_errors_refine" : 0,
         #                  "min_contigs" : 45,
         #                  "min_contigs_refine" : 126,
         #                  "max_scaffolds" : 1,
         #                  "outdir" : "helicobacter-test"},
         "cholerae" : {"recipe" : "examples/V.Cholerae/cholerae.rcp",
                       "coords" : "examples/V.Cholerae/h1.coords",
                       "max_errors" : 0,
                       "max_errors_refine" : 16,
                       "min_contigs" : 169,
                       "min_contigs_refine" : 719,
                       "max_scaffolds" : 4,
                       "outdir" : "cholerae-test",
                       "scaf_pref" : "h1_scaffolds"},
         "aureus" : {"recipe" : "examples/S.Aureus/aureus.rcp",
                     "coords" : "examples/S.Aureus/usa300.coords",
                     "max_errors" : 0,
                     "max_errors_refine" : 2,
                     "min_contigs" : 89,
                     "min_contigs_refine" : 164,
                     "max_scaffolds" : 1,
                     "outdir" : "aureus-test",
                     "scaf_pref" : "usa_scaffolds"}}

TEST_DIR = "test-dir"
RAGOUT_EXEC = "bin/ragout"
VERIFY_EXEC = os.path.join("scripts", "verify-order.py")


def test_environment():
    if not os.path.isfile(RAGOUT_EXEC):
        raise RuntimeError("File \"{0}\" was not found".format(RAGOUT_EXEC))

    if not os.path.isfile(VERIFY_EXEC):
        raise RuntimeError("File \"{0}\" was not found".format(VERIFY_EXEC))


def run_test(parameters):
    outdir = os.path.join(TEST_DIR, parameters["outdir"])
    cmd = [sys.executable, RAGOUT_EXEC, parameters["recipe"],
           "--outdir", outdir, "--debug"]
    print("Running:", " ".join(cmd), "\n")
    subprocess.check_call(cmd)

    links_simple = os.path.join(outdir, parameters["scaf_pref"] + ".links")
    links_simple_out = links_simple  + "_verify"

    #checking before refinement
    cmd = [sys.executable, VERIFY_EXEC, parameters["coords"], links_simple]
    print("Running:", " ".join(cmd), "\n")
    subprocess.check_call(cmd, stdout=open(links_simple_out, "w"))

    with open(links_simple_out, "r") as f:
        for line in f:
            if line.startswith("Total miss-ordered: "):
                value = int(line.strip()[20:])
                print("Errors:", value)
                if value > parameters["max_errors"]:
                    raise RuntimeError("Too many miss-ordered contigs")

            if line.startswith("Total contigs: "):
                value = int(line.strip()[15:])
                print("Contigs:", value)
                if value < parameters["min_contigs"]:
                    raise RuntimeError("Too few contigs")

            if line.startswith("Total scaffolds: "):
                value = int(line.strip()[17:])
                print("Scaffolds:", value)
                if value > parameters["max_scaffolds"]:
                    raise RuntimeError("Too many scaffolds")

    #checking after refinement
    cmd = [sys.executable, RAGOUT_EXEC, parameters["recipe"],
           "--outdir", outdir, "--debug", "--refine"]
    print("Running:", " ".join(cmd), "\n")
    subprocess.check_call(cmd)

    cmd = [sys.executable, VERIFY_EXEC, parameters["coords"], links_simple]
    print("Running:", " ".join(cmd), "\n")
    subprocess.check_call(cmd, stdout=open(links_simple_out, "w"))

    with open(links_simple_out, "r") as f:
        for line in f:
            if line.startswith("Total miss-ordered: "):
                value = int(line.strip()[20:])
                print("Errors:", value)
                if value > parameters["max_errors_refine"]:
                    raise RuntimeError("Too many miss-ordered contigs")

            if line.startswith("Total contigs: "):
                value = int(line.strip()[15:])
                print("Contigs:", value)
                if value < parameters["min_contigs_refine"]:
                    raise RuntimeError("Too few contigs")

            if line.startswith("Total scaffolds: "):
                value = int(line.strip()[17:])
                print("Scaffolds:", value)
                if value > parameters["max_scaffolds"]:
                    raise RuntimeError("Too many scaffolds")


def main():
    test_environment()
    if os.path.isdir(TEST_DIR):
        shutil.rmtree(TEST_DIR)
    os.mkdir(TEST_DIR)

    for name, params in TESTS.items():
        print("\n********Running test:", name, "********\n")
        run_test(params)

    print("\n********All tests were succesfully completed********")
    #shutil.rmtree(TEST_DIR)


if __name__ == "__main__":
    main()

back to top

Software Heritage — Copyright (C) 2015–2026, 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