Skip to content

Commit

Permalink
changing type of int for check pos exists
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaceves committed Dec 13, 2023
1 parent b945eb4 commit af8c4b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/allele_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ void position::update_alleles(std::string nt, uint32_t count){
int check_position_exists(uint32_t p, std::vector<position> positions) {
for (uint32_t i=0; i < positions.size(); i++) {
if (p == positions[i].pos) {
return(i);
return((int)i);
}
}
return(0);
return(-1);
}

int find_ref_in_allele(std::vector<allele> ad, char ref) {
Expand Down
4 changes: 2 additions & 2 deletions src/interval_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ std::vector<allele> add_allele_vectors(std::vector<allele> new_alleles, std::vec
void IntervalTree::combine_haplotypes(ITNode *root){
if (root==NULL) return;
for(uint32_t i=0; i < root->amp_positions.size(); i++){
uint32_t exists = check_position_exists(root->amp_positions[i].pos, variants);
int exists = check_position_exists(root->amp_positions[i].pos, variants);
//does exist
if (exists){
if (exists != -1){
variants[exists].depth += root->amp_positions[i].depth;
std::vector<allele> new_alleles = add_allele_vectors(root->amp_positions[i].alleles, variants[exists].alleles);
variants[exists].alleles = new_alleles;
Expand Down

0 comments on commit af8c4b7

Please sign in to comment.