From df5a5a4e6faea39e470ec8bc629c152248e41219 Mon Sep 17 00:00:00 2001 From: Glenn Hickey Date: Wed, 2 Aug 2023 13:44:34 -0400 Subject: [PATCH 1/2] always set haplotype for refsense -- vg 1.50.0 requires it --- hal2vg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal2vg.cpp b/hal2vg.cpp index 0e9e623..6910add 100644 --- a/hal2vg.cpp +++ b/hal2vg.cpp @@ -653,7 +653,7 @@ void pinch_to_handle(const Genome* genome, subrange_t subpath = resolve_subpath_naming(parsed_name); string parsed_genome_name = genome->getName(); size_t haplotype = resolve_haplotype_naming(parsed_genome_name); - if (sense == PathSense::HAPLOTYPE && haplotype == PathMetadata::NO_HAPLOTYPE) { + if (haplotype == PathMetadata::NO_HAPLOTYPE) { haplotype = 0; } // create the path From 4d177ac7fc02faae5e718fe71c6bd12161ecfc70 Mon Sep 17 00:00:00 2001 From: Glenn Hickey Date: Wed, 2 Aug 2023 14:41:33 -0400 Subject: [PATCH 2/2] fix tests --- tests/small/truth.json | 6 +++--- tests/t/chop.t | 3 +-- tests/t/merge.t | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/small/truth.json b/tests/small/truth.json index 52e8e81..aa298a9 100644 --- a/tests/small/truth.json +++ b/tests/small/truth.json @@ -173,7 +173,7 @@ "rank": "6" } ], - "name": "cat#3" + "name": "cat#0#3" }, { "mapping": [ @@ -264,7 +264,7 @@ "rank": "7" } ], - "name": "chimp#2" + "name": "chimp#0#2" }, { "mapping": [ @@ -368,7 +368,7 @@ "rank": "8" } ], - "name": "human#1" + "name": "human#0#1" } ] } diff --git a/tests/t/chop.t b/tests/t/chop.t index 2e13bf5..bf527f9 100644 --- a/tests/t/chop.t +++ b/tests/t/chop.t @@ -8,8 +8,7 @@ PATH=../deps/hal:$PATH plan tests 18 -#vg convert -g chop/tiny-flat.gfa -p > tiny-flat.vg -vg convert -g chop/tiny-flat.gfa -o > tiny-flat.vg +vg convert -g chop/tiny-flat.gfa -p > tiny-flat.vg printf "x\t0\t100\n" > all.bed clip-vg tiny-flat.vg -b all.bed | vg view - | grep -v ^H > chopped-all.gfa is "$(cat chopped-all.gfa | wc -l)" 0 "chopping everything clears out the graph" diff --git a/tests/t/merge.t b/tests/t/merge.t index 0ef503d..86622b9 100644 --- a/tests/t/merge.t +++ b/tests/t/merge.t @@ -27,8 +27,8 @@ hal2vg small2.hal | vg mod -O - | vg ids -s - > small2.vg hal2vg merged1.hal | vg mod -O - | vg ids -s - > merged1.vg vg view small.vg | sort > small.gfa vg view small2.vg | sort > small2.gfa -vg find -x merged1.vg -p cat#3:1 -c 1000 | vg ids -s - | vg view - | sort | sed -e 's/_0//g' | sed -e 's/_1//g' | sed -e "s/cat human chimp/human chimp cat/g" > merged1.comp1.gfa -vg find -x merged1.vg -p cow#3:1 -c 1000 | vg ids -s - | vg view - | sort | sed -e 's/_0//g' | sed -e 's/_1//g' | sed -e "s/human chimp cow/cow human chimp/g" > merged1.comp2.gfa +vg find -x merged1.vg -p cat#0#3:1 -c 1000 | vg ids -s - | vg view - | sort | sed -e 's/_0//g' | sed -e 's/_1//g' | sed -e "s/human chimp cat/chimp human cat/g" > merged1.comp1.gfa +vg find -x merged1.vg -p cow#0#3:1 -c 1000 | vg ids -s - | vg view - | sort | sed -e 's/_0//g' | sed -e 's/_1//g' | sed -e "s/human cow chimp/chimp human cow/g" > merged1.comp2.gfa diff small.gfa merged1.comp1.gfa is $? 0 "First component of merged graph identical to first input graph" diff small2.gfa merged1.comp2.gfa @@ -60,8 +60,8 @@ hal2vg small2.hal | vg mod -O - | vg ids -s - > small2.vg hal2vg merged1.hal | vg mod -O - | vg ids -s - > merged1.vg vg view small.vg | sort > small.gfa vg view small2.vg | sort > small2.gfa -vg find -x merged1.vg -p cat#3:1 -c 1000 | vg ids -s - | vg view - | sort | sed -e 's/_0//g' | sed -e 's/_1//g' | sed -e "s/cat human chimp/human chimp cat/g" > merged1.comp1.gfa -vg find -x merged1.vg -p cow#3:1 -c 1000 | vg ids -s - | vg view - | sort | sed -e 's/_0//g' | sed -e 's/_1//g' | sed -e "s/human chimp cow/cow human chimp/g" > merged1.comp2.gfa +vg find -x merged1.vg -p cat#0#3:1 -c 1000 | vg ids -s - | vg view - | sort | sed -e 's/_0//g' | sed -e 's/_1//g' | sed -e "s/human chimp cat/chimp human cat/g" > merged1.comp1.gfa +vg find -x merged1.vg -p cow#0#3:1 -c 1000 | vg ids -s - | vg view - | sort | sed -e 's/_0//g' | sed -e 's/_1//g' | sed -e "s/human cow chimp/chimp human cow/g" > merged1.comp2.gfa diff small.gfa merged1.comp1.gfa is $? 0 "First component of merged graph identical to first input graph" diff small2.gfa merged1.comp2.gfa