Skip to content

Commit

Permalink
Merge pull request #4186 from vgteam/diploid-giraffe
Browse files Browse the repository at this point in the history
Diploid sampling in Giraffe
  • Loading branch information
jltsiren authored Dec 8, 2023
2 parents 25b02cc + f066fc8 commit 710f00c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/subcommand/gbwt_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1829,4 +1829,4 @@ void print_metadata(std::ostream& out, const GBWTHandler& gbwts) {
//----------------------------------------------------------------------------

// Register subcommand
static vg::subcommand::Subcommand vg_gbwt("gbwt", "build and manipulate GBWTs", vg::subcommand::TOOLKIT, main_gbwt);
static vg::subcommand::Subcommand vg_gbwt("gbwt", "build and manipulate GBWT and GBZ files", vg::subcommand::TOOLKIT, main_gbwt);
2 changes: 2 additions & 0 deletions src/subcommand/giraffe_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,8 @@ string sample_haplotypes(const vector<pair<string, string>>& indexes, string& ba
Haplotypes::Verbosity verbosity = (progress ? Haplotypes::verbosity_basic : Haplotypes::verbosity_silent);
Recombinator recombinator(gbz, verbosity);
Recombinator::Parameters parameters;
parameters.num_haplotypes = Recombinator::NUM_CANDIDATES;
parameters.diploid_sampling = true;
parameters.include_reference = true;
gbwt::GBWT sampled_gbwt;
try {
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/haplotypes_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ int main_haplotypes(int argc, char** argv) {
return 0;
}

static vg::subcommand::Subcommand vg_haplotypes("haplotypes", "haplotype sampling based on kmer counts", vg::subcommand::DEVELOPMENT, main_haplotypes);
static vg::subcommand::Subcommand vg_haplotypes("haplotypes", "haplotype sampling based on kmer counts", vg::subcommand::TOOLKIT, main_haplotypes);

//----------------------------------------------------------------------------

Expand Down
18 changes: 9 additions & 9 deletions test/t/54_vg_haplotypes.t
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,18 @@ is $(vg gbwt -S -Z no_ref.gbz) 1 "1 sample"
is $(vg gbwt -C -Z no_ref.gbz) 2 "2 contigs"
is $(vg gbwt -H -Z no_ref.gbz) 4 "4 haplotypes"

# Diploid sampling
vg haplotypes --validate -i full.hapl -k haplotype-sampling/HG003.kff --include-reference --diploid-sampling -g diploid.gbz full.gbz
is $? 0 "diploid sampling"
is $(vg gbwt -S -Z diploid.gbz) 3 "1 generated + 2 reference samples"
is $(vg gbwt -C -Z diploid.gbz) 2 "2 contigs"
is $(vg gbwt -H -Z diploid.gbz) 4 "2 generated + 2 reference haplotypes"

# Giraffe integration, guessed output name
vg giraffe -Z full.gbz --haplotype-name full.hapl --kff-name haplotype-sampling/HG003.kff \
-f haplotype-sampling/HG003.fq.gz > default.gam 2> /dev/null
is $? 0 "Giraffe integration with a guessed output name"
cmp indirect.gbz full.HG003.gbz
cmp diploid.gbz full.HG003.gbz
is $? 0 "the sampled graph is identical to a manually sampled one"

# Giraffe integration, specified output name
Expand All @@ -53,16 +60,9 @@ is $? 0 "Giraffe integration with a specified output name"
cmp full.HG003.gbz sampled.003HG.gbz
is $? 0 "the sampled graphs are identical"

# Diploid sampling
vg haplotypes --validate -i full.hapl -k haplotype-sampling/HG003.kff --include-reference --diploid-sampling --num-haplotypes 8 -g diploid.gbz full.gbz
is $? 0 "diploid sampling"
is $(vg gbwt -S -Z diploid.gbz) 3 "1 generated + 2 reference samples"
is $(vg gbwt -C -Z diploid.gbz) 2 "2 contigs"
is $(vg gbwt -H -Z diploid.gbz) 4 "2 generated + 2 reference haplotypes"

# Cleanup
rm -r full.gbz full.ri full.dist full.hapl
rm -f indirect.gbz direct.gbz no_ref.gbz
rm -f diploid.gbz
rm -f full.HG003.gbz full.HG003.dist full.HG003.min default.gam
rm -f sampled.003HG.gbz sampled.003HG.dist sampled.003HG.min specified.gam
rm -f diploid.gbz

1 comment on commit 710f00c

@adamnovak
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vg CI tests complete for merge to master. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 17812 seconds

Please sign in to comment.