diff --git a/Brewfile b/Brewfile index f730aae8bee..33431d1aa07 100644 --- a/Brewfile +++ b/Brewfile @@ -20,3 +20,4 @@ brew "autoconf" brew "cmake" brew "boost" brew "pybind11" +brew "pandoc" diff --git a/Dockerfile b/Dockerfile index cf4279d6045..c430c745eab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ RUN apt-get -qq -y update && apt-get -qq -y upgrade && apt-get -qq -y install \ samtools curl unzip redland-utils librdf-dev cmake pkg-config wget gtk-doc-tools \ raptor2-utils rasqal-utils bison flex gawk libgoogle-perftools-dev liblz4-dev liblzma-dev \ libcairo2-dev libpixman-1-dev libffi-dev libcairo-dev libprotobuf-dev libboost-all-dev \ - tabix bcftools libzstd-dev pybind11-dev python3-pybind11 + tabix bcftools libzstd-dev pybind11-dev python3-pybind11 pandoc ###DEPS_END### # Prepare to build submodule dependencies diff --git a/Makefile b/Makefile index b2f25faaffc..237c72a0c1d 100644 --- a/Makefile +++ b/Makefile @@ -544,10 +544,17 @@ docs: $(SRC_DIR)/*.cpp $(SRC_DIR)/*.hpp $(ALGORITHMS_SRC_DIR)/*.cpp $(ALGORITHMS doxygen echo "View documentation at: file://$(PWD)/doc/doxygen/index.html" -man: $(patsubst doc/asciidoc/man/%.adoc,doc/man/%.1,$(wildcard doc/asciidoc/man/*.adoc)) +man: doc/wiki/vg-manpage.md doc/man/vg.1 -doc/man/%.1: doc/asciidoc/man/%.adoc - asciidoctor -b manpage -d manpage -o $@ $< +#The manpage markdown has an extra line needed for the actual manpage format +doc/man/vg-manpage.md: $(BIN_DIR)/$(EXE) doc/vgmanmd.desc.md doc/vgmanmd.py + mkdir -p doc/man && ./doc/vgmanmd.py > $@.tmp && mv $@.tmp $@ + +doc/wiki/vg-manpage.md: doc/man/vg-manpage.md + sed 1d doc/man/vg-manpage.md > $@ + +doc/man/vg.1: doc/man/vg-manpage.md + pandoc --standalone --to man $< -o $@ # Hack to use gshuf or shuf as appropriate to the platform when testing $(BIN_DIR)/shuf: diff --git a/README.md b/README.md index 7675f18b2de..82ea7562dbf 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ # vg [![Join the chat at https://gitter.im/vgteam/vg](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/vgteam/vg?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Latest Release](https://img.shields.io/github/release/vgteam/vg.svg)](https://github.com/vgteam/vg/releases/latest) -[![Doxygen API Documentation](https://img.shields.io/badge/doxygen-docs-brightgreen.svg)](https://vgteam.github.io/vg/) +[![Doxygen API Documentation](https://img.shields.io/badge/doxygen-docs-firebrick.svg)](https://vgteam.github.io/vg/) +[![vg man page](https://img.shields.io/badge/manpage-seagreen.svg)](https://github.com/vgteam/vg/wiki/vg-manpage) ## variation graph data structures, interchange formats, alignment, genotyping, and variant calling methods @@ -501,6 +502,8 @@ Most commands allow the streaming of graphs into and out of `vg`. ### Command line interface +See the [man-page](https://github.com/vgteam/vg/wiki/vg-manpage) + A variety of commands are available: - *autoindex*: construct graphs and indexes for other tools from common interchange file formats diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 00000000000..c69e1c6e5de --- /dev/null +++ b/doc/README.md @@ -0,0 +1,25 @@ +# Automated markdown manpage + +Make a markdown document with the usage messages of (selected) `vg` subcommands. +Calls the `vg` command, so it will match the version available in the command line. + +```sh +python3 vgmanmd.py > wiki/vg-manpage.md +``` + +Then commit and push the changes to the wiki submodule, or copy the markdown content to the [wiki page](https://github.com/vgteam/vg/wiki/vg-manpage). + +## Edit descriptions + +See [`vgmanmd.desc.md`](vgmanmd.desc.md) file. +This file must be in the current directory. +Also, in the title `# `, `` should match name of the command. +The name `intro` is used for the introduction, to be placed after the table of content. +The names don't need to match a command, and not all commands have to be described: if available, a subcommand description will be added before its usage message. + +The goal of the description is to be vague enough that we don't need to change them often, but informative enough that new users can get a good feel of the commands, plus pointers to other resources (e.g. Wiki pages). + +## Change list of selected subcommands + +At the top of [`vgmanmd.py`](vgmanmd.py), change the *cmds* list. + diff --git a/doc/asciidoc/man/vg-giraffe.adoc b/doc/asciidoc/man/vg-giraffe.adoc deleted file mode 100644 index 05d538c3192..00000000000 --- a/doc/asciidoc/man/vg-giraffe.adoc +++ /dev/null @@ -1,203 +0,0 @@ -= vg-giraffe(1) -vgteam contributors -v1.20.0 -:doctype: manpage -:manmanual: vg -:mansource: vg -:man-linkstyle: pass:[blue R < >] - -== Name - -vg-giraffe - map unpaired short reads using minimizers and gapless extension - -== Synopsis - -*vg giraffe* [_OPTION_]... [_FASTA_ [_VCF_]] > output.gam - -== Arguments - -_FASTA_:: - Specify a FASTA file to build the graph from. Must have an extension *.fa*, *.fna*, or *.fasta*, with optional *.gz*. The name without extension is used as the _basename_ under which to look for index files with their own extensions, if *-x*/*--xg-name* is not specified. If omitted, *-x*/*--xg-name* is required. - -_VCF_:: - Variant Call Format file containing phased haplotypes, used to build the graph and haplotype database (GBWT) if those are not themselves provided. Must have a *.vcf.gz* extension, and an associated *.vcf.gz.tbi* index file. If omitted, a graph and GBWT must already exist and must be provided, either explicitly with *-x*/*--xg-name* and *-H*/*--gbwt-name*, or via the _FASTA_ or *-x*/*--xg-name* derived _basename_. - -_TAG_:: - Specify a collection of tests to run, via []-enclosed tag. Tag may need to be quoted to avoid being interpreted as a shell wildcard character class. - -== Options - -*-x*:: -*--xg-name*=_FILE_:: - Use this xg index or graph. The file name without extension is also used as the _basename_ for finding indexes, overriding any FASTA-derived _basename_. If omitted, _FASTA_ is required. If not specified, will load _basename.vg_ and create that file if not present. - -*-g*:: -*--graph-name*=_FILE_:: - Load this GBWTGraph. If not specified, will load _basename.gg_ and create that file if not present. - -*-H*:: -*--gbwt-name*=_FILE_:: - Use this GBWT index. If not specified, will load _basename.gbwt_ and create that file if not present. - -*-m*:: -*--minimizer-name*=_FILE_:: - Use this minimizer index. If not specified, will load _basename.min_ and create that file if not present. - -*-d*:: -*--dist-name*=_FILE_:: - Cluster using this distance index. If not specified, will load _basename.dist_ and create that file if not present. - -*-p*:: -*--progress*:: - Show progress - -*-G*:: -*--gam-in*=_FILE_:: - Read and realign GAM-format reads from FILE (may repeat) - -*-f*:: -*--fastq-in*=_FILE_:: - Read and align FASTQ-format reads from FILE (may repeat) - -*-i*:: -*--interleaved*:: - GAM/FASTQ input is interleaved pairs, for paired-end alignment - -*-M*:: -*--max-multimap*=_INT_:: - Produce up to INT alignments for each read [1] - -*-N*:: -*--sample*=_NAME_:: - Add this sample name - -*-R*:: -*--read-group*=_NAME_:: - Add this read group - -*-n*:: -*--discard*:: - Discard all output alignments (for profiling) - -*--output-basename*=_NAME_:: - Write output to a GAM file beginning with the given prefix for each setting combination - -*--report-name*=_NAME_:: - Write a TSV of output file and mapping speed to the given file - -*-c*:: -*--hit-cap*=_INT_:: - Use all minimizers with at most INT hits [10] - -*-C*:: -*--hard-hit-cap*=_INT_:: - Use all minimizers with at most INT hits [10] - -*-F*:: -*--score-fraction*=_FLOAT_:: - Select minimizers between hit caps until score is FLOAT of total [0.6] - -*-D*:: -*--distance-limit*=_INT_:: - Cluster using this distance limit [200] - -*-e*:: -*--max-extensions*=_INT_:: - Extend up to INT clusters [48] - -*-a*:: -*--max-alignments*=_INT_:: - Align up to INT clusters [8] - -*-s*:: -*--cluster-score*=_INT_:: - Only extend clusters if they are within INT of the best score [50] - -*-u*:: -*--cluster-coverage*=_FLOAT_:: - Only extend clusters if they are within INT of the best read coverage [0.4] - -*-v*:: -*--extension-score*=_INT_:: - Only align extensions if their score is within INT of the best score [1] - -*-w*:: -*--extension-set*=_INT_:: - Only align extension sets if their score is within extension-set of the best score [20] - -*-O*:: -*--no-dp*:: - Disable all gapped alignment - -*--track-provenance*:: - Track how internal intermediate alignment candidates were arrived at - -*--track-correctness*:: - Track if internal intermediate alignment candidates are correct (implies --track-provenance) - -*-t*:: -*--threads*=_INT_:: - Number of compute threads to use - - -== Description - -*vg gaffe* is a fast (experimental) algorithm to map reads to a graph. -It is specialized for low-error-rate short reads. -Giraffe uses minimizers of the graph's haplotypes and gapless extension to map the reads. -Because the graph is expected to contain a relatively complete inventory of a certain type of variation, gapless alignment is sufficient to align most reads and a more expensive gapped alignment step is required for only a minority of cases. - -*vg gaffe* requires four input files to define the reference: A graph or GBWTGraph, a GBWT index, a minimizer index, and a distance index. -Each can also be automatically produced by *vg gaffe*, given the requisite input files. -The graph and indexes can be produced automatically if _FASTA_ and _VCF_ are specified. -The _basename_ is a file path derived from the graph file (specified by *-x*/*--xg-name*), or from the _FASTA_ argument if no graph file is specified. It is combined with an extension for each index type to produce the filename from which that index will be loaded, or to which it will be saved if it is constructed. - -Because indexing is resource-intensive, the graph and indexes can be manually constructed in advance. -The graph can be built wiht *vg construct*. -Indexes can be manually built with *vg index* and *vg minimizer*, as well as *vg snarls* to provide the snarls file needed for the distance index. -If desired, the GBWTgraph can also be pre-generated with *vg gbwt*. - -When building the graph with *vg construct* for use with *vg gaffe*, it is important to provide the *-a* option in order to embed the variant information necessary to later build the GBWT. - -When building snarls with *vg snarls*, it is important to provide the *-T*/*--include-trivial* option to include trivial snarls, which are required when building the distance index. - -== Examples - -To map reads to an indexed graph and write the alignment to a gam file: - ----- -$ vg gaffe -x reference.xg -H reference.gbwt -m reference.min -d reference.dist -G reads.gam > mapped.gam ----- - -Same as above, but implicitly finding other indexes using the graph's filename: - ----- -$ vg gaffe -x reference.xg -G reads.gam > mapped.gam ----- - -To map reads building all indexes dynamically, if not found, from a FASTA and indexed VCF: - ----- -$ vg gaffe reference.fa phased_haplotypes.vcf.gz -G reads.gam > mapped.gam ----- - -Same as above, but manually pre-building the graph and all indexes, and providing the graph to define _basename_: - ----- -$ vg construct -a -r reference.fa -v phased_haplotypes.vcf.gz >reference.vg -$ vg index -G reference.gbwt -v phased_haplotypes.vcf.gz reference.vg -$ vg snarls --include-trivial reference.vg > reference.snarls -$ vg index -s reference.snarls -j reference.dist reference.vg -$ vg minimizer -k 29 -w 11 -g reference.gbwt -i reference.min reference.vg -$ vg gbwt -g reference.gg -x reference.vg reference.gbwt -$ vg gaffe -x reference.vg -G reads.gam > mapped.gam ----- - -== See Also -*vg*(1) - -== Copyright - -Copyright (C) 2020 {author}. - -Free use of this documentation is granted under the terms of the MIT License. diff --git a/doc/asciidoc/man/vg-test.adoc b/doc/asciidoc/man/vg-test.adoc deleted file mode 100644 index 1c6a6d6a05b..00000000000 --- a/doc/asciidoc/man/vg-test.adoc +++ /dev/null @@ -1,154 +0,0 @@ -= vg-test(1) -vgteam contributors -v1.20.0 -:doctype: manpage -:manmanual: vg -:mansource: vg -:man-linkstyle: pass:[blue R < >] - -== Name - -vg-test - run internal vg unit tests - -== Synopsis - -*vg test* [_TESTNAME_ | _PATTERN_ | _TAG_]... [_OPTION_]... - -== Arguments - -_TESTNAME_:: - Specify a test to run, by full name. - -_PATTERN_:: - Specify a collection of tests to run, via regular expression match. - -_TAG_:: - Specify a collection of tests to run, via []-enclosed tag. Tag may need to be quoted to avoid being interpreted as a shell wildcard character class. - -== Options - -*-?*:: -*-h*:: -*--help*:: - display usage information - -*-l*:: -*--list-tests*:: - list all/matching test cases - -*-t*:: -*--list-tags*:: - list all/matching tags - -*-s*:: -*--success*:: - include successful tests in output - -*-b*:: -*--break*:: - break into debugger on failure - -*-e*:: -*--nothrow*:: - skip exception tests - -*-i*:: -*--invisibles*:: - show invisibles (tabs, newlines) - -*-o*:: -*--out*=_FILENAME_:: - output filename - -*-r*:: -*--reporter*=_NAME_:: - reporter to use (defaults to console) - -*-n*:: -*--name*=_NAME_:: - suite name - -*-a*:: -*--abort*:: - abort at first failure - -*-x*:: -*--abortx*=_NUM_:: - abort after _NUM_ failures - -*-w*:: -*--warn*=_NAME_:: - enable warnings - -*-d*:: -*--durations*=[_yes_|_no_]:: - show test durations - -*-f*:: -*--input-file*=_FILE_:: - load test names to run from a file - -*-#*:: -*--filenames-as-tags*:: - adds a tag for the filename - -*-c*:: -*--section*=_NAME_:: - specify section to run - -*--list-test-names-only*:: - list all/matching test cases names only - -*--list-reporters*:: - list all reporters - -*--order*=[_decl_|_lex_|_rand_]:: - test case order (defaults to _decl_) - -*--rng-seed*=[_time_|_NUM_]:: - set a specific seed for random numbers - -*--force-colour*:: - force colourised output (deprecated) - -*--use-colour*=[_yes_|_no_]:: - should output be colourised - -== Description - -When run without options or arguments, *vg test* runs all unit tests compiled into the *vg* binary. - -Particular tests can be selected by name, by pattern match on name, or by tag (between _[_ and _]_), by specifying the selectors as arguments. If multiple selectors are specified, only tests matching all of the selectors will be run. - -The tool supports all options provided by the Catch 1.x testing framework. - -See https://github.com/catchorg/Catch2/blob/Catch1.x/docs/command-line.md for more information on Catch's available options. - -== Examples - -To run all tests: - ----- -vg test ----- - -To see all available test tags: - ----- -vg test --list-tags ----- - -To run only tests tagged with _[a-star]_: - ----- -vg test [a-star] ----- - -== See Also -*vg*(1) - -== Copyright - -Copyright (C) 2020 {author}. - -Free use of this documentation is granted under the terms of the MIT License. diff --git a/doc/asciidoc/man/vg-version.adoc b/doc/asciidoc/man/vg-version.adoc deleted file mode 100644 index 50032b2406a..00000000000 --- a/doc/asciidoc/man/vg-version.adoc +++ /dev/null @@ -1,67 +0,0 @@ -= vg-version(1) -vgteam contributors -v1.20.0 -:doctype: manpage -:manmanual: vg -:mansource: vg -:man-linkstyle: pass:[blue R < >] - -== Name - -vg-version - get version and build information about vg - -== Synopsis - -*vg version* [_OPTION_]... - -== Options - -*-s*:: -*--slug*:: - Print only the one-line, whitespace-free version string (e.g. _v1.20.0-70-g472e24c9c_), for use in scripts. - -*-h*:: -*--help*:: - Print help about the *vg version* command and its supported options. - -== Description - -When run without options, *vg version* outputs information about the version of *vg* that is running, including: - -* The most recent released version on which your *vg* is based -* The number of commits since that version (if not itself a released version) -* The Git commit hash (if not itself a released version) -* The compiler that was used to build *vg* -* The OS that was used to build *vg* -* The C++ standard library that *vg* was linked against -* The user name and host name that built *vg* - -When run with the *-s* option, *vg version* prints just the release and Git commit information. - -== Examples - -To print all version information (human-readable): - ----- -$ vg version -vg version v1.20.0-70-g472e24c9c "Ginestra" -Compiled with g++ (GCC) 8.1.0 on Linux -Linked against libstd++ 20180502 -Built by anovak@courtyard ----- - -To print just the short "`version slug`": - ----- -$ vg version -s -v1.20.0-70-g472e24c9c ----- - -== See Also -*vg*(1), *git*(1) - -== Copyright - -Copyright (C) 2019 {author}. - -Free use of this documentation is granted under the terms of the MIT License. diff --git a/doc/vgmanmd.desc.md b/doc/vgmanmd.desc.md new file mode 100644 index 00000000000..7f0383844fb --- /dev/null +++ b/doc/vgmanmd.desc.md @@ -0,0 +1,102 @@ +# file-info + +This file contains extra text that will be added to the man pages generated with doc/vgmanmd.py +The `# description` section is added to the top of the page, and each `# subcommand` section will be added to given subcommand +When adding a new subcommand, add it to the appropriate section(s) in the description + +# description + +vg is a toolkit for variation graph data structures, interchange formats, alignment, genotyping, and variant calling methods. + +For more in-depth explanations of tools and workflows, see the [vg wiki page](https://github.com/vgteam/vg/wiki) + +# synopsis +This is an incomplete list of vg subcommands. For a complete list, run `vg help`. + +- **Graph construction and indexing** + See the [wiki page](https://github.com/vgteam/vg/wiki/Index-Types) for an overview of vg indexes. + - [`vg autoindex`](#autoindex): automatically construct a graph and indexes for a specific workflow (e.g. giraffe, rpvg). [wiki page](https://github.com/vgteam/vg/wiki/Automatic-indexing-for-read-mapping-and-downstream-inference) + - [`vg construct`](#construct): manually construct a graph from a reference and variants. [wiki page](https://github.com/vgteam/vg/wiki/Construction) + - [`vg index`](#index): manually build individual indexes (xg, distance, GCSA, etc). [wiki page](https://github.com/vgteam/vg/wiki/Index-Construction) + - [`vg gbwt`](#gbwt): manually build and manipulate GBWTs and indexes (GBWTgraph, GBZ, r-index). [wiki page](https://github.com/vgteam/vg/wiki/VG-GBWT-Subcommand) + - [`vg minimizer`](#minimizer): manually build a minimizer index for mapping. + - [`vg haplotypes`](#haplotypes): haplotype sample a graph. Recommended for mapping with giraffe. [wiki page](https://github.com/vgteam/vg/wiki/Haplotype-Sampling) +- **Read mapping** + - [`vg giraffe`](#giraffe): fast haplotype-aware short read alignment. [wiki page](https://github.com/vgteam/vg/wiki/Mapping-short-reads-with-Giraffe) + - [`vg mpmap`](#mpmap): splice-aware multipath alignment of short reads. [wiki page](https://github.com/vgteam/vg/wiki/Multipath-alignments-and-vg-mpmap) + - [`vg map`](#map): MEM-based read alignment. [wiki page](https://github.com/vgteam/vg/wiki/Working-with-a-whole-genome-variation-graph) +- **Downstream analyses** + - [`vg pack`](#pack): convert alignments to a compact coverage index. Used with [vg call](#call) + - [`vg call`](#call): call or genotype VCF variants. Uses [vg pack](#pack). [wiki page](https://github.com/vgteam/vg/wiki/SV-Genotyping-and-variant-calling) + - [`vg rna`](#rna): construct splicing graphs and pantranscriptomes. [wiki page](https://github.com/vgteam/vg/wiki/Transcriptomic-analyses). Also see [rpvg](https://github.com/jonassibbesen/rpvg) + - [`vg deconstruct`](#deconstruct): create a VCF from variation in the graph. [wiki page](https://github.com/vgteam/vg/wiki/VCF-export-with-vg-deconstruct) +- **Working with read alignments** + - [`vg gamsort`](#gamsort): sort a GAM/GAF file or index a sorted GAM file. + - [`vg filter`](#filter): filter alignments by properties. + - [`vg surject`](#surject): project alignments on a graph onto a linear reference (gam/gaf->bam/sam/cram). + - [`vg inject`](#inject): project alignments on a linear reference onto a graph (bam/sam/cram->gam/gaf). + - [`vg sim`](#sim): simulate reads from a graph. [wiki page](https://github.com/vgteam/vg/wiki/Simulating-reads-with-vg-sim) +- **Graph and read statistics** + - [`vg stats`](#stats): get stats about the graph. + - [`vg paths`](#paths): get stats about the paths. [wiki page](https://github.com/vgteam/vg/wiki/Path-Metadata-Model) + - [`vg gbwt`](#gbwt): get stats about a GBWT. + - [`vg filter`](#filter): get stats about alignments (use `--tsv-out`). +- **Manipulating a graph** + - [`vg mod`](#mod): filter, transform, and edit the graph. + - [`vg prune`](#prune): prune the graph for GCSA2 indexing. + - [`vg ids`](#ids): manipulate graph node ids. + - [`vg paths`](#paths): manipulate paths in a graph. + - [`vg gbwt`](#gbwt): manipulate GBWTs and associated indexes. [wiki page](https://github.com/vgteam/vg/wiki/VG-GBWT-Subcommand) + - [`vg annotate`](#annotate): annotate a graph or alignments. +- **Conversion between formats** + - [`vg convert`](#convert): convert between handle graph formats and GFA, and between alignment formats. + - [`vg view`](#view): convert between non-handle graph formats and alignment formats (dot, json, turtle...). + - [`vg surject`](#surject): project alignments on a graph onto a linear reference (gam/gaf->bam/sam/cram). + - [`vg inject`](#inject): project alignments on a linear reference onto a graph (bam/sam/cram->gam/gaf). + - [`vg paths`](#paths): extract a fasta from a graph. [wiki page](https://github.com/vgteam/vg/wiki/Extracting-a-FASTA-from-a-Graph) +- **Subgraph extraction** + - [`vg chunk`](#chunk): split a graph and/or alignment into smaller chunks. + - [`vg find`](#find): use an index to find nodes, edges, kmers, paths, or positions. + +# annotate + +Annotate alignments with graphs and graphs with alignments. + +# autoindex + +Mapping tool-oriented index construction from interchange formats. + +# convert + +Convert graphs between handle-graph compliant formats as well as GFA. + +# find + +Use an index to find nodes, edges, kmers, paths, or positions. + +# ids + +Manipulate node ids. + +# pack + +Convert alignments to a compact coverage index. + +# paths + +Traverse paths in the graph. + +# view + +format conversions for graphs and alignments + +# filter + +Filter alignments by properties. + +# bugs + +Bugs can be reported at: https://github.com/vgteam/vg/issues + +For technical support, please visit: https://www.biostars.org/tag/vg/ + diff --git a/doc/vgmanmd.py b/doc/vgmanmd.py new file mode 100755 index 00000000000..1db0aa4ecd2 --- /dev/null +++ b/doc/vgmanmd.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +import subprocess + + +# commands to include +######### If you add to this, also add it to the intro section of vgmandmd.desc.md +cmds = ['index', 'view', 'autoindex', 'pack', 'giraffe', 'map', 'call', + 'mpmap', 'rna', 'chunk', 'stats', 'gbwt', 'paths', 'find', 'filter', + 'construct', 'minimizer', 'haplotypes', 'deconstruct', 'convert', + 'gamsort', 'inject', 'surject', 'mod', 'prune', 'ids', 'sim', 'annotate'] +cmds.sort() + + +# parse short descriptions +desc_inf = open('./doc/vgmanmd.desc.md', 'rt') +desc = {} +cur_desc = '' +cur_header = '' +for line in desc_inf: + if line[0] == '#': + # new header + if cur_header != '': + desc[cur_header] = cur_desc + cur_header = line.rstrip().replace('# ', '') + cur_desc = '' + else: + cur_desc += line +desc[cur_header] = cur_desc +desc_inf.close() + +# start page +#print('# vg manpage') + +# get vg version +ret = subprocess.run(['vg', 'version'], capture_output=True) +vg_v = ret.stdout.decode().split('\n')[0] + +#Metadata +print("% vg(1) | Variation Graph Toolkit\n\n") + +#Start with the name +print("NAME") +print("====") +print('vg - variation graph tool, ' + vg_v + '.\n\n') + +if 'description' in desc: + print("DESCRIPTION") + print("====") + print(desc['description']) + print('\n\n') + +if 'synopsis' in desc: + print("SYNOPSIS") + print("====") + print(desc['synopsis']) + print('\n\n') + +# table of contents +#for cmd in cmds: +# print(' - [vg {cmd}](#{cmd})'.format(cmd=cmd)) +# +#print('\n\n') + +print("COMMANDS") +print("====") + +# help for each cmd +for cmd in cmds: + print('## {cmd}\n\n'.format(cmd=cmd)) + # run subcommand without -h because not everything has -h + ret = subprocess.run(['vg', cmd], capture_output=True) + print('```') + if cmd in desc: + print(desc[cmd]) + print('\n\n') + print(ret.stderr.decode()) + print('```\n\n') + +if 'bugs' in desc: + print("BUGS") + print("====") + print(desc['bugs']) + print('\n\n') diff --git a/doc/wiki b/doc/wiki index cf68c8b824d..0e573e62851 160000 --- a/doc/wiki +++ b/doc/wiki @@ -1 +1 @@ -Subproject commit cf68c8b824d366c5da7c3456e28b47e5503f21b4 +Subproject commit 0e573e6285197cbb2d0a119fc067b2c15e056783