diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index afeb0ea524..cbd01ec54b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -195,6 +195,9 @@ build-job: - docker buildx build --cache-from type=local,src=${HOME}/docker-cache/base --cache-from type=local,src=${HOME}/docker-cache/build --cache-from type=local,src=${HOME}/docker-cache/run --cache-to type=inline --platform="${PLATFORMS}" --build-arg THREADS=${THREADS} --target run -t ${CI_REPO}:${DOCKER_TAG} -f Dockerfile --push . variables: GIT_SUBMODULE_STRATEGY: recursive + # Work around + # See + GIT_STRATEGY: clone # The arm container build takes like 90 minutes, so we don't want to run it # before the main test phase where the other long tests live. @@ -243,6 +246,9 @@ production-build-job: # manage to hit a 6 hour timeout on our extremely slow emulators. variables: GIT_SUBMODULE_STRATEGY: recursive + # Work around + # See + GIT_STRATEGY: clone # We also run the toil-vg/pytest-based tests # Note that WE ONLY RUN TESTS LISTED IN vgci/test-list.txt diff --git a/.gitmodules b/.gitmodules index 3892786a00..a3e2908554 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "vcflib"] path = deps/vcflib - url = https://github.com/vcflib/vcflib.git + url = https://github.com/vgteam/vcflib.git [submodule "gssw"] path = deps/gssw url = https://github.com/vgteam/gssw.git diff --git a/deps/vcflib b/deps/vcflib index 7ca5c2036d..81624a203e 160000 --- a/deps/vcflib +++ b/deps/vcflib @@ -1 +1 @@ -Subproject commit 7ca5c2036da5952ff1f262dedd26daafa2a1aeaf +Subproject commit 81624a203ec372703c4731424995e246a504b0fe diff --git a/src/constructor.cpp b/src/constructor.cpp index bd8cd34deb..bbd2a08cff 100644 --- a/src/constructor.cpp +++ b/src/constructor.cpp @@ -2444,6 +2444,11 @@ namespace vg { exit(1); } for (auto& kv : *(reference->index)) { + if (reference_for.count(kv.first)) { + #pragma omp critical (cerr) + cerr << "error:[vg::Constructor] Contig " << kv.first << " appears multiple times" << endl; + exit(1); + } // For every sequence name and index entry, point to this reference reference_for[kv.first] = reference; #ifdef debug diff --git a/test/t/02_vg_construct.t b/test/t/02_vg_construct.t index f82628e775..b7583c8a98 100644 --- a/test/t/02_vg_construct.t +++ b/test/t/02_vg_construct.t @@ -7,7 +7,7 @@ PATH=../bin:$PATH # for vg export LC_ALL="C" # force a consistent sort order -plan tests 30 +plan tests 33 is $(vg construct -m 1000 -r small/x.fa -v small/x.vcf.gz | vg stats -z - | grep nodes | cut -f 2) 210 "construction produces the right number of nodes" @@ -120,3 +120,16 @@ is $? 0 "Reference with ambiguity codes has them coerced to Ns" is "$(vg view -j tiny.vg | jq -r '.node[].sequence' | tr -d 'ACGT\n' | wc -c)" "10" "Expected number of Ns are created" rm -f tiny.vg +vg construct -r small/x.fa -r small/x.fa > /dev/null +is $? 1 "Names may not be duplicated across files" +sed "s/y/x/" small/xy.fa > xx.fa +samtools faidx xx.fa +# Samtools drops duplicate entries so we need to manually make an index with duplicates. +cat xx.fa.fai xx.fa.fai >xx.fa.fai2 +mv xx.fa.fai2 xx.fa.fai +vg construct -r xx.fa > /dev/null +is $? 1 "Names may not be duplicated within an index" +rm -f xx.fa.fai +vg construct -r xx.fa > /dev/null +is $? 1 "Names may not be duplicated within an unindexed file" +rm -f xx.fa xx.fa.fai