src/matOptimize/condense.cpp
//find mutated alleles shared by both of the input
find mutated alleles shared by both of the input
find mutated alleles shared by both of the input
static void intersect_allele(const Mutation_Annotated_Tree::Mutations_Collection& in1, const Mutation_Annotated_Tree::Mutations_Collection& in2, Mutation_Annotated_Tree::Mutations_Collection& out) {
    if (in1.empty()||in2.empty()) {
        return;
    }
    auto in1_iter=in1.begin();
    auto in1_end=in1.end();
    for(const auto& mut:in2) {
        while (in1_iter!=in1_end&&in1_iter->get_position()<mut.get_position()) {
            in1_iter++;
        }
        if (in1_iter!=in1_end&&in1_iter->get_position()==mut.get_position()) {
            nuc_one_hot common=in1_iter->get_all_major_allele()&mut.get_all_major_allele();
            if (common!=mut.get_par_one_hot()) {
                out.push_back(mut);
                out.back().set_auxillary(common, 0xf&(~common));
            }
            in1_iter++;
        }
    }
}
static void intersect_allele ( const Mutation_Annotated_Tree :: Mutations_Collection & in1 , const Mutation_Annotated_Tree :: Mutations_Collection & in2 , Mutation_Annotated_Tree :: Mutations_Collection & out ) { if ( in1 . empty ( ) || in2 . empty ( ) ) { return ; } auto in1_iter = in1 . begin ( ) ; auto in1_end = in1 . end ( ) ; for ( const auto & mut : in2 ) { while ( in1_iter != in1_end && in1_iter -> get_position ( ) < mut . get_position ( ) ) { in1_iter ++ ; } if ( in1_iter != in1_end && in1_iter -> get_position ( ) == mut . get_position ( ) ) { nuc_one_hot common = in1_iter -> get_all_major_allele ( ) & mut . get_all_major_allele ( ) ; if ( common != mut . get_par_one_hot ( ) ) { out . push_back ( mut ) ; out . back ( ) . set_auxillary ( common , 0xf & ( ~ common ) ) ; } in1_iter ++ ; } } }
find mutated alleles shared by both of the input
find mutated alleles shared by both of the input
//skip all muts present in only one of the inout //output common major allele