Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save paths for alts using plain variant ID (when possible) #4065

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ namespace vg {

// Name the variant and place it in the order that we'll
// actually construct nodes in (see utility.hpp)
string variant_name = make_variant_id(*variant);
string variant_name = sha1_variant_name ? make_variant_id(*variant) : get_or_make_variant_id(*variant);
if (variants_by_name.count(variant_name)) {
// Some VCFs may include multiple variants at the same
// position with the same ref and alt. We will only take the
Expand Down
1 change: 1 addition & 0 deletions src/constructor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class Constructor : public Progressive, public NameMapper {
// _alt_6079b4a76d0ddd6b4b44aeb14d738509e266961c_0 and
// _alt_6079b4a76d0ddd6b4b44aeb14d738509e266961c_1?
bool alt_paths = false;
bool sha1_variant_name = true;

// Should we handle structural variants in the VCF file,
// or at least the ones we know how to?
Expand Down
11 changes: 9 additions & 2 deletions src/subcommand/construct_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ void help_construct(char** argv) {
<< " -r, --reference FILE input FASTA reference (may repeat)" << endl
<< " -v, --vcf FILE input VCF (may repeat)" << endl
<< " -n, --rename V=F match contig V in the VCFs to contig F in the FASTAs (may repeat)" << endl
<< " -a, --alt-paths save paths for alts of variants by variant ID" << endl
<< " -a, --alt-paths save paths for alts of variants by SHA1 hash" << endl
<< " -A, --alt-paths-plain save paths for alts of variants by variant ID (if possible, otherwise SHA1)" << endl
<< " -R, --region REGION specify a VCF contig name or 1-based inclusive region (may repeat, if on different contigs)" << endl
<< " -C, --region-is-chrom don't attempt to parse the regions (use when the reference" << endl
<< " sequence name could be inadvertently parsed as a region)" << endl
Expand Down Expand Up @@ -87,6 +88,7 @@ int main_construct(int argc, char** argv) {
{"drop-msa-paths", no_argument, 0, 'd'},
{"rename", required_argument, 0, 'n'},
{"alt-paths", no_argument, 0, 'a'},
{"alt-paths-plain", no_argument, 0, 'A'},
{"handle-sv", no_argument, 0, 'S'},
{"insertions", required_argument, 0, 'I'},
{"progress", no_argument, 0, 'p'},
Expand All @@ -103,7 +105,7 @@ int main_construct(int argc, char** argv) {
};

int option_index = 0;
c = getopt_long (argc, argv, "v:r:n:ph?z:t:R:m:aCfl:SI:M:dF:iN",
c = getopt_long (argc, argv, "v:r:n:ph?z:t:R:m:aACfl:SI:M:dF:iN",
long_options, &option_index);

/* Detect the end of the options. */
Expand Down Expand Up @@ -170,6 +172,11 @@ int main_construct(int argc, char** argv) {
constructor.alt_paths = true;
break;

case 'A':
constructor.alt_paths = true;
constructor.sha1_variant_name = false;
break;

case 'p':
show_progress = true;
break;
Expand Down
Loading