<commit_before>#include "ResultData.h"
#include "TryCatch.h"

using namespace std;



vcf::Variant& Results::vcf(
        vcf::Variant& var, // variant to update
        long double pHom,
        long double bestComboOddsRatio,
        //long double alleleSamplingProb,
        Samples& samples,
        string refbase,
        vector<Allele>& altAllelesIncludingNulls,
        map<string, int> repeats,
        vector<string>& sampleNames,
        int coverage,
        GenotypeCombo& genotypeCombo,
        bool bestOverallComboIsHet,
        map<string, vector<Allele*> >& alleleGroups,
        map<int, vector<Genotype> >& genotypesByPloidy,
        vector<string>& sequencingTechnologies,
        AlleleParser* parser) {

    Parameters& parameters = parser->parameters;

    GenotypeComboMap comboMap;
    genotypeCombo2Map(genotypeCombo, comboMap);

    // set up the reported reference allele
    long int referencePosition = (long int) parser->currentPosition; // 0-based

    // remove alt alleles
    vector<Allele> altAlleles;
    for (vector<Allele>::iterator aa = altAllelesIncludingNulls.begin(); aa != altAllelesIncludingNulls.end(); ++aa) {
        if (!aa->isNull()) {
            altAlleles.push_back(*aa);
        }
    }

    // adjust reference position, reference sequence, and alt alleles by
    // stripping invariant bases off the beginning and end of the alt alleles
    // first we find the minimum start and end matches
    vector<Allele> adjustedAltAlleles;
    int minStartMatch = 0;
    int minEndMatch = 0;
    for (vector<Allele>::iterator aa = altAlleles.begin(); aa != altAlleles.end(); ++aa) {
        vector<pair<int, string> > cigar = splitCigar(aa->cigar);
        int startmatch = 0;
        int endmatch = 0;
        if (cigar.front().second == "M") {
            startmatch = cigar.front().first;
        }
        if (cigar.back().second == "M") {
            endmatch = cigar.back().first;
        }
        if (cigar.size() > 1 && (cigar.at(1).second == "D" || cigar.at(1).second == "I")) {
            if (startmatch == 1) { // require at least one base flanking deletions
                startmatch = 0;
            }
        }
        if (aa == altAlleles.begin()) {<commit_msg>retain a flanking base when reporting adjusted biallelic indels<commit_after>#include "ResultData.h"
#include "TryCatch.h"

using namespace std;



vcf::Variant& Results::vcf(
        vcf::Variant& var, // variant to update
        long double pHom,
        long double bestComboOddsRatio,
        //long double alleleSamplingProb,
        Samples& samples,
        string refbase,
        vector<Allele>& altAllelesIncludingNulls,
        map<string, int> repeats,
        vector<string>& sampleNames,
        int coverage,
        GenotypeCombo& genotypeCombo,
        bool bestOverallComboIsHet,
        map<string, vector<Allele*> >& alleleGroups,
        map<int, vector<Genotype> >& genotypesByPloidy,
        vector<string>& sequencingTechnologies,
        AlleleParser* parser) {

    Parameters& parameters = parser->parameters;

    GenotypeComboMap comboMap;
    genotypeCombo2Map(genotypeCombo, comboMap);

    // set up the reported reference allele
    long int referencePosition = (long int) parser->currentPosition; // 0-based

    // remove alt alleles
    vector<Allele> altAlleles;
    for (vector<Allele>::iterator aa = altAllelesIncludingNulls.begin(); aa != altAllelesIncludingNulls.end(); ++aa) {
        if (!aa->isNull()) {
            altAlleles.push_back(*aa);
        }
    }

    // adjust reference position, reference sequence, and alt alleles by
    // stripping invariant bases off the beginning and end of the alt alleles
    // first we find the minimum start and end matches
    vector<Allele> adjustedAltAlleles;
    int minStartMatch = 0;
    int minEndMatch = 0;
    for (vector<Allele>::iterator aa = altAlleles.begin(); aa != altAlleles.end(); ++aa) {
        vector<pair<int, string> > cigar = splitCigar(aa->cigar);
        int startmatch = 0;
        int endmatch = 0;
        if (cigar.front().second == "M") {
            startmatch = cigar.front().first;
        }
        if (cigar.back().second == "M") {
            endmatch = cigar.back().first;
        }
        if (cigar.size() > 1 && (cigar.at(1).second == "D" || cigar.at(1).second == "I")) {
            startmatch -= 1; // require at least one base flanking deletions
        }
        if (aa == altAlleles.begin()) {
{'fraction_non_alphanumeric': 0.1179245283018868, 'fraction_numerical': 0.0047169811320754715, 'mean_word_length': 2.5624, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5130379', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1314, 'n_words': 349}