Skip to content

Commit

Permalink
no major update, troubleshooting variants errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaceves committed Dec 7, 2023
1 parent 184627e commit 839b0dd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/allele_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct allele {
class position {
public:
uint32_t pos;
uint32_t depth;
uint32_t depth=0;
std::vector<allele> alleles;
void update_alleles(std::string nt, uint32_t count);
bool flux;
Expand Down
25 changes: 19 additions & 6 deletions src/interval_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ void add_allele_vectors(std::vector<allele> new_alleles, std::vector<allele> ret
for(uint32_t j=0; j < return_alleles.size(); j++){
if (return_alleles[j].nuc == new_alleles[i].nuc){
if(use){
std::cerr << return_alleles[j].depth << " " << return_alleles[j].nuc << std::endl;
std::cerr<<"";
// std::cerr << "\nin found " << return_alleles[j].depth << " " << return_alleles[j].nuc << std::endl;
}
return_alleles[j].depth += new_alleles[i].depth;
found = true;
Expand Down Expand Up @@ -55,27 +56,34 @@ void IntervalTree::set_haplotypes(ITNode *root, primer prim){
// we found the matching amplion, now we add this cigarotype to the amplicon
std::vector<position> tmp_pos = prim.get_positions();
for (uint32_t i=0; i < tmp_pos.size(); i++){
if(tmp_pos[i].pos == 350){
std::cerr << "posssssss" << std::endl;
}
position add_pos = tmp_pos[i];
bool found = false;
// check if we already have a pos for this pos
for(uint32_t j=0; j < root->amp_positions.size(); j++){
position here_pos = root->amp_positions[j];
bool use = false;
if(add_pos.pos == 350 && here_pos.pos == add_pos.pos){
std::cerr << " " << std::endl;
/*
std::cerr << "\nthe original thing" << std::endl;
print_allele_depths(root->amp_positions[j].alleles);
std::cerr << root->data->low << " " << root->data->high << std::endl;
std::cerr << "amp " << here_pos.depth << " prim "<< add_pos.depth << std::endl;
std::cerr << "position depth " << root->amp_positions[j].depth << " prim depth "<< tmp_pos[i].depth << std::endl;
std::cerr << "thing being added" << std::endl;
print_allele_depths(add_pos.alleles);
*/
use = true;
}
if(here_pos.pos == add_pos.pos){
found = true;
root->amp_positions[j].depth += add_pos.depth;
add_allele_vectors(add_pos.alleles, root->amp_positions[j].alleles, use);
if(add_pos.pos == 350){
print_allele_depths(root->amp_positions[j].alleles);
}
//if(add_pos.pos == 350){
// std::cerr << "after being added " << std::endl;
// print_allele_depths(root->amp_positions[j].alleles);
//}
break;
}
}
Expand All @@ -85,6 +93,11 @@ void IntervalTree::set_haplotypes(ITNode *root, primer prim){
tmp.depth = add_pos.depth;
tmp.alleles = add_pos.alleles;
tmp.pos = add_pos.pos;
if(add_pos.pos == 350){
std::cerr << "initiate " << tmp.depth << " " << add_pos.depth << std::endl;
std::cerr << root->data->low << " " << root->data->high << std::endl;
print_allele_depths(tmp.alleles);
}
root->amp_positions.push_back(tmp);
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/primer_bed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,14 @@ void primer::transform_mutations() {
std::ostringstream convert;
convert << sequence[j];
std::string nuc = convert.str();
if (current_pos == 350 && nuc != "C"){
std::cerr << current_pos << " " << nuc << " " << ccount << std::endl;
}
if (exists) {
if (qname == test){
//std::cerr << qname << " " << nuc << std::endl;
std::cerr << current_pos << " j " << j << " nuc " << nuc << " del pos " << deletion_positions.size() << " insert pos " << ignore_sequence.size() << std::endl;
}
if(current_pos ==350){
std::cerr << "primer " << ccount << " " << nuc << std::endl;
}
positions[exists].update_alleles(nuc, ccount);
} else {
//add position to vector
Expand All @@ -476,6 +476,9 @@ void primer::transform_mutations() {
add_pos.pos = current_pos; //don't add a position
add_pos.update_alleles(nuc, ccount);
positions.push_back(add_pos);
if(current_pos ==350){
std::cerr << "primer " << ccount << " " << nuc << std::endl;
}
}
}
}
Expand Down

0 comments on commit 839b0dd

Please sign in to comment.