From 881b5166dd9549c3f75b5e19363e9c60d006c193 Mon Sep 17 00:00:00 2001 From: AndreaGuarracino Date: Thu, 28 Jul 2022 09:27:38 +0200 Subject: [PATCH 1/2] add `--version` flag --- pggb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pggb b/pggb index a872aef..344c8d4 100755 --- a/pggb +++ b/pggb @@ -45,6 +45,7 @@ keep_intermediate_files=false compress=false normalize=true vcf_spec=false +show_version=false if [ $# -eq 0 ]; then show_help=true @@ -52,7 +53,7 @@ fi # read the options cmd=$0" "$@ -TEMP=`getopt -o i:o:D:a:p:n:s:l:K:F:k:x:f:B:H:j:P:O:Me:t:T:vhASY:G:Q:d:I:R:NbrmZzV: --long input-fasta:,output-dir:,temp-dir:,input-paf:,map-pct-id:,n-mappings:,segment-length:,block-length-min:,mash-kmer:,mash-kmer-thres:,min-match-length:,sparse-map:,sparse-factor:,transclose-batch:,n-haps:,path-jump-max:,subpath-min:,edge-jump-max:,threads:,poa-threads:,skip-viz,do-layout,help,no-merge-segments,do-stats,exclude-delim:,poa-length-target:,poa-params:,poa-padding:,run-abpoa,global-poa,write-maf,consensus-spec:,consensus-prefix:,pad-max-depth:,block-id-min:,block-ratio-min:,no-splits,resume,keep-temp-files,multiqc,compress,vcf-spec: -n 'pggb' -- "$@"` +TEMP=`getopt -o i:o:D:a:p:n:s:l:K:F:k:x:f:B:H:j:P:O:Me:t:T:vhASY:G:Q:d:I:R:NbrmZzV: --long input-fasta:,output-dir:,temp-dir:,input-paf:,map-pct-id:,n-mappings:,segment-length:,block-length-min:,mash-kmer:,mash-kmer-thres:,min-match-length:,sparse-map:,sparse-factor:,transclose-batch:,n-haps:,path-jump-max:,subpath-min:,edge-jump-max:,threads:,poa-threads:,skip-viz,do-layout,help,no-merge-segments,do-stats,exclude-delim:,poa-length-target:,poa-params:,poa-padding:,run-abpoa,global-poa,write-maf,consensus-spec:,consensus-prefix:,pad-max-depth:,block-id-min:,block-ratio-min:,no-splits,resume,keep-temp-files,multiqc,compress,vcf-spec:,version -n 'pggb' -- "$@"` eval set -- "$TEMP" # extract options and their arguments into variables. @@ -96,11 +97,21 @@ while true ; do -Z|--compress) compress=true ; shift ;; -V|--vcf-spec) vcf_spec=$2 ; shift 2 ;; -h|--help) show_help=true ; shift ;; + --version) show_version=true ; shift ;; --) shift ; break ;; *) echo "$2" "Internal error!" ; exit 1 ;; esac done +if [ $show_version == true ]; then + SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + cd "$SCRIPT_DIR" + GIT_VERSION=$(git describe --always --tags) + echo "pggb $GIT_VERSION" + cd - &> /dev/null + exit +fi + # if a PAF is given as input, we set the segment_length by to an arbitrary number, since we will skip the wfmash alignment process if [[ $input_paf != false ]]; then if [[ $segment_length == false ]]; then From 58b36e353b1c1590e91cee0c7a3c2402e47d653b Mon Sep 17 00:00:00 2001 From: AndreaGuarracino Date: Thu, 28 Jul 2022 09:31:58 +0200 Subject: [PATCH 2/2] mention `--version` in the description --- pggb | 1 + 1 file changed, 1 insertion(+) diff --git a/pggb b/pggb index 344c8d4..37ccf3e 100755 --- a/pggb +++ b/pggb @@ -250,6 +250,7 @@ if [ $show_help ]; then echo " -A, --keep-temp-files keep intermediate graphs" echo " -Z, --compress compress alignment (.paf), graph (.gfa, .og), and MSA (.maf) outputs with pigz," echo " and variant (.vcf) outputs with bgzip" + echo " --version display the version of pggb" echo " -h, --help this text" echo echo "Use wfmash, seqwish, smoothxg, odgi, gfaffix, and vg to build, project and display a pangenome graph."