Skip to content

Commit

Permalink
Keep haplotype phase number when converting to reference path
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnovak committed Oct 4, 2023
1 parent 6ade88c commit 9016d97
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/subcommand/convert_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,16 +609,9 @@ void graph_to_xg_adjusting_paths(const PathHandleGraph* input, xg::XG* output, c
// Compose the new reference-ified metadata
std::string sample = input->get_sample_name(path);
std::string locus = input->get_locus_name(path);
int64_t haplotype;
if (sample_to_haplotypes[sample].size() > 1) {
// We should preserve the haplotype because we have multiple
// haplotype phases of this sample.
haplotype = input->get_haplotype(path);
} else {
// We should drop the haplotype number because this sample has only
// one haplotype phase.
haplotype = PathMetadata::NO_HAPLOTYPE;
}
// We should always preserve the haplotype phase number; we
// will need it if we ever want to go back to haplotype sense.
int64_t haplotype = input->get_haplotype(path);
auto subrange = input->get_subrange(path);

// Make a new name with reference-ified metadata.
Expand Down

0 comments on commit 9016d97

Please sign in to comment.