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 57143f63aeab74207adb32a5a696d1dba0f3108c authored by Mikhail Kolmogorov on 16 May 2015, 00:13:58 UTC, committed by Mikhail Kolmogorov on 16 May 2015, 00:13:58 UTC
back to iterative BG + working rearrangements projection
1 parent 681fbff
  • Files
  • Changes
  • 82edcbe
  • /
  • scripts
  • /
  • utils
  • /
  • nucmer_parser.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:57143f63aeab74207adb32a5a696d1dba0f3108c
directory badge
swh:1:dir:fdfbc8ce7f5ad712860694246e7cf5b3c069e96e
content badge
swh:1:cnt:508276ad66212ebdc1dce8b854825ea30d90c376

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
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
nucmer_parser.py
from collections import namedtuple, defaultdict

from .common import AlignmentRow, AlignmentColumn

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

"""
Some helper functions to parse/process nucmer output
"""

def parse_nucmer_coords(filename):
    chr_alias = {}
    chr_num = 1

    alignment = []
    for line in open(filename, "r"):
        line = line.strip()
        if not len(line) or not line[0].isdigit():
            continue

        vals = line.split(" | ")
        s_ref, e_ref = list(map(int, vals[0].split()))
        s_qry, e_qry = list(map(int, vals[1].split()))
        len_ref, len_qry = list(map(int, vals[2].split()))
        ref_id, qry_id = vals[4].split("\t")

        if e_ref > s_ref:
            ref_strand = 1
        else:
            ref_strand = -1
            s_ref, e_ref = e_ref, s_ref

        if e_qry > s_qry:
            qry_strand = 1
        else:
            qry_strand = -1
            s_qry, e_qry = e_qry, s_qry

        if ref_id not in chr_alias:
            chr_alias[ref_id] = "chr{0}".format(chr_num)
            chr_num += 1

        ref_row = AlignmentRow(s_ref, e_ref, ref_strand, None,
                                                chr_alias[ref_id])
        qry_row = AlignmentRow(s_qry, e_qry, qry_strand, None, qry_id)
        alignment.append(AlignmentColumn(ref_row, qry_row))

    return alignment
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–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