[med-svn] [Git][med-team/vcfanno][upstream] New upstream version 0.3.3+ds

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Mon Nov 1 21:28:35 GMT 2021



Nilesh Patra pushed to branch upstream at Debian Med / vcfanno


Commits:
b0b43e9b by Nilesh Patra at 2021-11-02T02:48:33+05:30
New upstream version 0.3.3+ds
- - - - -


11 changed files:

- − .travis.yml
- README.md
- api/api.go
- docs/index.md
- + go.mod
- shared/shared.go
- tests/functional-test.sh
- + tests/missing_postanno/o.conf
- + tests/missing_postanno/o.lua
- + tests/missing_postanno/o.vcf
- vcfanno.go


Changes:

=====================================
.travis.yml deleted
=====================================
@@ -1,21 +0,0 @@
-language: go
-
-os:
-  - linux
-  - osx
-
-go:
-  - 1.7.x
-  - 1.8.x
-  - 1.9.x
-  - 1.10.x
-  - 1.11.x
-
-before_install:
-  - make
-  - go get github.com/axw/gocov/gocov
-  - go get github.com/mattn/goveralls
-  - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
-script:
-    - ./tests/functional-test.sh
-


=====================================
README.md
=====================================
@@ -7,7 +7,7 @@ build:
 -->
 
 
-[![Build Status](https://travis-ci.org/brentp/vcfanno.svg)](https://travis-ci.org/brentp/vcfanno)
+[![Build Status](https://travis-ci.com/brentp/vcfanno.svg)](https://travis-ci.com/brentp/vcfanno)
 [![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://brentp.github.io/vcfanno/)
 
 If you use vcfanno, please cite [the paper](https://genomebiology.biomedcentral.com/articles/10.1186/s13059-016-0973-5)


=====================================
api/api.go
=====================================
@@ -105,7 +105,7 @@ type PostAnnotation struct {
 	Vms [8]*goluaez.State
 }
 
-// NewAnnotator returns an Annotator with the sources, seeded with some javascript.
+// NewAnnotator returns an Annotator with the sources, seeded with some lua.
 // If ends is true, it will annotate the 1 base ends of the interval as well as the
 // interval itself. If strict is true, when overlapping variants, they must share
 // the ref allele and at least 1 alt allele.
@@ -638,7 +638,7 @@ func (a *Annotator) PostAnnotate(chrom string, start int, end int, info interfac
 				}
 			}
 			// we need to try even if it didn't get all values.
-			if len(vals) == 0 && len(post.Fields) > 0 {
+			if len(vals) == 0 && len(post.Fields) == 0 {
 				continue
 			}
 


=====================================
docs/index.md
=====================================
@@ -257,9 +257,8 @@ the VCF  header is A (Number=A)
 For example this table lists Alt columns query and annotation (assuming the REFs and position match) along with the values from
 the annotation and shows how the query INFO will be filled:
 
-| query  | anno | anno vals  |         |
-| ALTS   | ALTS | from INFO  | result  |
-| ------ | ---- | ---------- | ------- |
+| query ALTS | anno ALTS | anno vals from INFO | result | note |
+| ------ | ---- | ---------- | ------- | ---- |
 | C,G    | C,G  | 22,23      | 22,23   |
 | C,G    | C,T  | 22,23      | 22,.    |
 | C,G    | T,G  | 22,23      | .,23    |


=====================================
go.mod
=====================================
@@ -0,0 +1,18 @@
+module github.com/brentp/vcfanno
+
+go 1.16
+
+require (
+	github.com/BurntSushi/toml v0.3.1
+	github.com/biogo/hts v1.4.2
+	github.com/brentp/bix v0.0.0-20190718140914-00aa7a7f205d
+	github.com/brentp/goluaez v0.0.0-20160116211227-dd35d08e32e7
+	github.com/brentp/irelate v0.0.1
+	github.com/brentp/vcfgo v0.0.0-20190824021612-654ed2e5945d
+	github.com/brentp/xopen v0.0.0-20181116180855-111b45cadc7d
+	github.com/pkg/errors v0.9.1 // indirect
+	github.com/yuin/gluare v0.0.0-20170607022532-d7c94f1a80ed // indirect
+	github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 // indirect
+	golang.org/x/tools v0.1.5 // indirect
+	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
+)


=====================================
shared/shared.go
=====================================
@@ -30,7 +30,7 @@ type Annotation struct {
 // Flatten turns an annotation into a slice of Sources. Pass in the index of the file.
 // having it as a Source makes the code cleaner, but it's simpler for the user to
 // specify multiple ops per file in the toml config.
-func (a *Annotation) Flatten(index int, basepath string) ([]*Source, error) {
+func (a *Annotation) Flatten(index int) ([]*Source, error) {
 	if len(a.Ops) == 0 {
 		if !strings.HasSuffix(a.File, ".bam") {
 			return nil, fmt.Errorf("no ops specified for %s\n", a.File)
@@ -54,12 +54,7 @@ func (a *Annotation) Flatten(index int, basepath string) ([]*Source, error) {
 		}
 	}
 	if !(xopen.Exists(a.File) || a.File == "-") {
-		if basepath != "" {
-			a.File = basepath + "/" + a.File
-		}
-		if !(xopen.Exists(a.File) || a.File == "-") {
-			return nil, fmt.Errorf("[Flatten] unable to open file: %s in %s\n", a.File, basepath)
-		}
+		return nil, fmt.Errorf("[Flatten] unable to open file: %s\n", a.File)
 	}
 
 	n := len(a.Ops)
@@ -103,7 +98,7 @@ func (c Config) Sources() ([]*Source, error) {
 	}
 	var s []*Source
 	for i, a := range annos {
-		flats, err := a.Flatten(i, c.Base)
+		flats, err := a.Flatten(i)
 		if err != nil {
 			return nil, err
 		}


=====================================
tests/functional-test.sh
=====================================
@@ -7,12 +7,15 @@ test -e ssshtest || wget -q https://raw.githubusercontent.com/ryanlayer/ssshtest
 set -o nounset
 
 
-go install -race -a
+go install -race -a github.com/brentp/vcfanno
 
 run check_self_number vcfanno -base-path tests/data/ -lua example/custom.lua tests/data/number.conf tests/data/number-input.vcf
 assert_equal 0 $(grep -c "lua error in postannotation" $STDERR_FILE)
 cat $STDERR_FILE
 
+run check_empty_args_gives_non_zero_exit vcfanno
+assert_exit_code 2
+
 run check_example vcfanno -lua example/custom.lua example/conf.toml example/query.vcf.gz
 assert_equal $(zgrep -cv ^# example/query.vcf.gz) $(grep -cv ^# $STDOUT_FILE)
 assert_equal 6 $(grep ^# $STDOUT_FILE | grep -c lua)
@@ -194,3 +197,8 @@ assert_exit_code 0
 assert_equal $(tail -1 $STDOUT_FILE | cut -f 8) "AF=1.56250e-02;AQ=1328;CADD_RAW=0.591814"
 go install -a
 
+
+run check_missing_postanno vcfanno -lua tests/missing_postanno/o.lua tests/missing_postanno/o.conf tests/missing_postanno/o.vcf
+assert_exit_code 0
+assert_in_stdout "exome_af=-1"
+


=====================================
tests/missing_postanno/o.conf
=====================================
@@ -0,0 +1,5 @@
+[[postannotation]]
+fields=["exome_af"]
+op="lua:checkaf(exome_af)"
+name="exome_af"
+type="Float"


=====================================
tests/missing_postanno/o.lua
=====================================
@@ -0,0 +1,5 @@
+function checkaf(v)
+  local output = v
+  if (v == nil) then output = -1 end
+  return output
+end


=====================================
tests/missing_postanno/o.vcf
=====================================
@@ -0,0 +1,4 @@
+##fileformat=VCFv4.1
+##INFO=<ID=exome_af,Number=1,Type=Float,Description="xxx">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+chr1	123456	.	G	T	.	PASS	.


=====================================
vcfanno.go
=====================================
@@ -6,6 +6,7 @@ import (
 	"fmt"
 	"io"
 	"log"
+
 	//_ "net/http/pprof"
 	"os"
 	"runtime"
@@ -25,7 +26,7 @@ import (
 	"github.com/brentp/xopen"
 )
 
-var VERSION = "0.3.2"
+var VERSION = "0.3.3"
 
 func envGet(name string, vdefault int) int {
 	sval := os.Getenv(name)
@@ -57,7 +58,7 @@ see: https://github.com/brentp/vcfanno
 	ends := flag.Bool("ends", false, "annotate the start and end as well as the interval itself.")
 	notstrict := flag.Bool("permissive-overlap", false, "annotate with an overlapping variant even it doesn't"+
 		" share the same ref and alt alleles. Default is to require exact match between variants.")
-	lua := flag.String("lua", "", "optional path to a file containing custom javascript functions to be used as ops")
+	lua := flag.String("lua", "", "optional path to a file containing custom lua functions to be used as ops")
 	base := flag.String("base-path", "", "optional base-path to prepend to annotation files in the config")
 	procs := flag.Int("p", 2, "number of processes to use.")
 	flag.Parse()
@@ -68,7 +69,7 @@ see: https://github.com/brentp/vcfanno
 
 `, os.Args[0])
 		flag.PrintDefaults()
-		return
+		os.Exit(2)
 	}
 	queryFile := inFiles[1]
 	if !(xopen.Exists(queryFile) || queryFile == "") {
@@ -211,6 +212,7 @@ see: https://github.com/brentp/vcfanno
 	maxChunk := envGet("IRELATE_MAX_CHUNK", 8000)
 
 	// make a new writer from the string header.
+	query.Header.Extras = append(query.Header.Extras, fmt.Sprintf("##vcfanno=%s", VERSION))
 	out, err = vcfgo.NewWriter(out, query.Header)
 
 	stream := irelate.PIRelate(maxChunk, maxGap, qstream, *ends, fn, queryables...)



View it on GitLab: https://salsa.debian.org/med-team/vcfanno/-/commit/b0b43e9b23c10241b0a396d19c1f39c464f51d12

-- 
View it on GitLab: https://salsa.debian.org/med-team/vcfanno/-/commit/b0b43e9b23c10241b0a396d19c1f39c464f51d12
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20211101/c569c28a/attachment-0001.htm>


More information about the debian-med-commit mailing list