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

  • 80083ed
  • /
  • lxpipe.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
swh:1:cnt:92aa6e712f5e8808988d20a8e7331ca5f2337b1a
directory badge
swh:1:dir:80083ed979d565ea782f1254d8c6cf7582e62cd2

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
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
lxpipe.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#
# Copyright © 2013 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#

import argparse
import sys

import labxpipe_scripts.lxpipe_demultiplex
import labxpipe_scripts.lxpipe_extract
import labxpipe_scripts.lxpipe_generate
import labxpipe_scripts.lxpipe_merge_count
import labxpipe_scripts.lxpipe_profile
import labxpipe_scripts.lxpipe_run
import labxpipe_scripts.lxpipe_report
import labxpipe_scripts.lxpipe_trackhub

subcommands = {
    'run': labxpipe_scripts.lxpipe_run,
    'report': labxpipe_scripts.lxpipe_report,
    'extract': labxpipe_scripts.lxpipe_extract,
    'merge-count': labxpipe_scripts.lxpipe_merge_count,
    'generate': labxpipe_scripts.lxpipe_generate,
    'profile': labxpipe_scripts.lxpipe_profile,
    'trackhub': labxpipe_scripts.lxpipe_trackhub,
    'demultiplex': labxpipe_scripts.lxpipe_demultiplex
}

def generate_help(subcommands):
    helpmsg = ''
    for k, m in subcommands.items():
        doc = ''
        if m.__doc__ is not None:
            for l in m.__doc__.split('\n'):
                if len(l.strip()) > 0:
                    doc = l.strip()
                    break
        helpmsg += f'{k:<13}{doc}\n'
    return helpmsg

class _HelpAction(argparse._HelpAction):
    def __call__(self, parser, namespace, values, option_string=None):
        if 'command' in namespace and namespace.command in subcommands:
            subcommands[namespace.command].main([f'{parser.prog} {namespace.command}', '-h'])
        else:
            parser.print_help()
            parser.exit()

def main(argv=None):
    if argv is None:
        argv = sys.argv
    parser = argparse.ArgumentParser(description='LabxPipe', formatter_class=argparse.RawTextHelpFormatter, add_help=False)
    parser.add_argument('-h', '--help', action=_HelpAction, help='help for help if you need some help')
    parser.add_argument('command', metavar='command', action='store', choices=subcommands.keys(), help=generate_help(subcommands))
    # One command is required
    if len(argv) < 2:
        parser.print_help()
        return 1
    # Parse arguments
    args, rest = parser.parse_known_args(argv[1:])
    # Run
    subcommands[args.command].main(argv)

if __name__ == '__main__':
    sys.exit(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