Skip to content

Commit

Permalink
auto-update to UShER commit 771ecb71a02fd208b1b395438d9c3501896637c7
Browse files Browse the repository at this point in the history
  • Loading branch information
amkram committed Aug 27, 2021
1 parent d950ea3 commit dfd5c3c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](LICENSE)
[![Integration Tests](https://github.com/amkram/shusher/actions/workflows/build_and_test.yml/badge.svg)](https://github.com/amkram/shusher/actions/workflows/build_and_test.yml)<!---BEGIN_USHER_BADGE-->
<a target="_blank" href="https://github.com/yatisht/usher/tree/0555be77c91ce3b798ae59b4ba2bd3d42a02cf11"><img src="https://img.shields.io/badge/UShER%20Version-commit%200555be77-%235e0000"/></a>
<a target="_blank" href="https://github.com/yatisht/usher/tree/771ecb71a02fd208b1b395438d9c3501896637c7"><img src="https://img.shields.io/badge/UShER%20Version-commit%20771ecb71-%235e0000"/></a>
<!---END_USHER_BADGE-->

| :computer_mouse: Access ShUShER <a target="_blank" href="https://shusher.gi.ucsc.edu">here</a>! |
Expand Down
27 changes: 13 additions & 14 deletions usher-port/src/mutation_annotated_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <google/protobuf/io/coded_stream.h>
#include <iomanip>
#include <iostream>
#include <random>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
Expand Down Expand Up @@ -1513,7 +1514,7 @@ void Mutation_Annotated_Tree::get_random_sample_subtrees (Mutation_Annotated_Tre
//size_t random_subtree_size = print_subtrees_size/2;
//size_t nearest_subtree_size = print_subtrees_size - random_subtree_size;

size_t random_subtree_size = 0;
size_t random_subtree_size = subtree_size/5;
size_t nearest_subtree_size = subtree_size - random_subtree_size;

//Set a constant random seed
Expand Down Expand Up @@ -1606,22 +1607,20 @@ void Mutation_Annotated_Tree::get_random_sample_subtrees (Mutation_Annotated_Tre
}
leaves_to_keep.emplace_back(n.node->identifier);
}
} else {
for (auto l: T->get_leaves(anc->identifier)) {
leaves_to_keep.emplace_back(l->identifier);
}
}

// Add non-overlapping random subtree samples
for (auto l: random_ordered_leaves) {
if (leaves_to_keep.size() < subtree_size) {
if (std::find(leaves_to_keep.begin(), leaves_to_keep.end(), l->identifier) == leaves_to_keep.end()) {
leaves_to_keep.emplace_back(l->identifier);
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(node_distances.begin()+nearest_subtree_size, node_distances.end(), g);

for (auto n = node_distances.begin()+nearest_subtree_size; n != node_distances.end(); n++) {
if (leaves_to_keep.size() == subtree_size) {
break;
}
leaves_to_keep.emplace_back(n->node->identifier);
}

if (leaves_to_keep.size() >= subtree_size) {
break;
} else {
for (auto l: T->get_leaves(anc->identifier)) {
leaves_to_keep.emplace_back(l->identifier);
}
}

Expand Down
2 changes: 1 addition & 1 deletion usher_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0555be77c91ce3b798ae59b4ba2bd3d42a02cf11
771ecb71a02fd208b1b395438d9c3501896637c7

0 comments on commit dfd5c3c

Please sign in to comment.