forked from ultimatesource/denovogear
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue ultimatesource#45 - Multiple familes in ped file
- Merge family ID and individual ID in `ped.h` to make id unique. Use an "unique/unusual/obscure" delimiter, `_F@I_`, to concatenate these two IDs, then everything will be unique in `table_`. The `id()` function take care of the rest. - A simple delimiter (`_`, `@` ...etc) is avoid to prevent the case that family name is something like `*f1@` or `*f1_`. - Update related unittests.
- Loading branch information
Showing
5 changed files
with
36 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
/* | ||
* Copyright (c) 2014-2015 Reed A. Cartwright | ||
* Copyright (c) 2016 Steven H. Wu | ||
* Authors: Reed A. Cartwright <[email protected]> | ||
* Steven H. Wu <[email protected]> | ||
* | ||
* This file is part of DeNovoGear. | ||
* | ||
|
@@ -40,6 +42,8 @@ namespace dng { | |
namespace io { | ||
|
||
class Pedigree { | ||
const std::string FAM_IND_DELIM = "_F@I_"; | ||
|
||
public: | ||
typedef boost::multi_index_container<std::string, | ||
boost::multi_index::indexed_by< | ||
|
@@ -127,6 +131,9 @@ class Pedigree { | |
map<string, size_t> child_names; | ||
child_names.emplace("", 0); | ||
for(k = 1; k < string_table.size(); ++k) { | ||
string_table[k][1] = string_table[k][0] + FAM_IND_DELIM + string_table[k][1]; | ||
string_table[k][2] = string_table[k][0] + FAM_IND_DELIM + string_table[k][2]; | ||
string_table[k][3] = string_table[k][0] + FAM_IND_DELIM + string_table[k][3]; | ||
bool success = child_names.emplace(string_table[k][1], k).second; | ||
// If child name is duplicate, erase it | ||
if(!success) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters