<commit_before>#include "Variant.h"

using namespace std;
using namespace vcf;

int main(int argc, char** argv) {

    VariantCallFile variantFile;

    if (argc > 1) {
        string filename = argv[1];
        variantFile.open(filename);
    } else {
        variantFile.open(std::cin);
    }

    if (!variantFile.is_open()) {
        return 1;
    }
    // obtain all possible field names
    vector<string> infofields;
    vector<string> infoflags;

    for (map<string, string>::iterator i = variantFile.infoTypes.begin(); i != variantFile.infoTypes.end(); ++i) {
        if (i->second == "Flag") {
            infoflags.push_back(i->first);
        } else {
            infofields.push_back(i->first);
        }
    }

    // write header

    // defaults
    cout << "CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\t";
    
    // configurable info field
    for (vector<string>::iterator i = infofields.begin(); i != infofields.end(); ++i) {
        if (i != infofields.begin()) {
            cout << "\t";
        }
        cout << *i;
    }
    for (vector<string>::iterator i = infoflags.begin(); i != infoflags.end(); ++i) {
        cout << "\t" << *i;
    }
    cout << endl;

    Variant var(variantFile);
    while (variantFile.getNextVariant(var)) {

        cout << var.sequenceName << "\t"
             << var.position << "\t"
             << var.id << "\t"
             << var.ref << "\t";
        var.printAlt(cout);
        cout << "\t"
             << var.quality << "\t"
             << var.filter << "\t";

        for (vector<string>::iterator i = infofields.begin(); i != infofields.end(); ++i) {
            string value;
            string& name = *i;
            map<string, string>::iterator f = var.info.find(name);
            if (f != var.info.end()) {
                value = f->second;
            }
            cout << "\t" << value;
        }
<commit_msg>fixed tab problem in vcf2tsv<commit_after>#include "Variant.h"

using namespace std;
using namespace vcf;

int main(int argc, char** argv) {

    VariantCallFile variantFile;

    if (argc > 1) {
        string filename = argv[1];
        variantFile.open(filename);
    } else {
        variantFile.open(std::cin);
    }

    if (!variantFile.is_open()) {
        return 1;
    }
    // obtain all possible field names
    vector<string> infofields;
    vector<string> infoflags;

    for (map<string, string>::iterator i = variantFile.infoTypes.begin(); i != variantFile.infoTypes.end(); ++i) {
        if (i->second == "Flag") {
            infoflags.push_back(i->first);
        } else {
            infofields.push_back(i->first);
        }
    }

    // write header

    // defaults
    cout << "CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\t";
    
    // configurable info field
    for (vector<string>::iterator i = infofields.begin(); i != infofields.end(); ++i) {
        if (i != infofields.begin()) {
            cout << "\t";
        }
        cout << *i;
    }
    for (vector<string>::iterator i = infoflags.begin(); i != infoflags.end(); ++i) {
        cout << "\t" << *i;
    }
    cout << endl;

    Variant var(variantFile);
    while (variantFile.getNextVariant(var)) {

        cout << var.sequenceName << "\t"
             << var.position << "\t"
             << var.id << "\t"
             << var.ref << "\t";
        var.printAlt(cout);
        cout << "\t"
             << var.quality << "\t"
             << var.filter;

        for (vector<string>::iterator i = infofields.begin(); i != infofields.end(); ++i) {
            string value;
            string& name = *i;
            map<string, string>::iterator f = var.info.find(name);
            if (f != var.info.end()) {
                value = f->second;
            }
            cout << "\t" << value;
        }

{'fraction_non_alphanumeric': 0.16812284882181625, 'fraction_numerical': 0.0018533227429176596, 'mean_word_length': 1.8026706231454006, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 27, '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': '1486547', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1191, 'n_words': 261}