<commit_before>#pragma once

#include <sam.h> //from htslib

#include <math.h>
#include <stdint.h>
#include <string>

class Read {
    public:
        int32_t insert_size;
        std::string flowcell;
        int lane;
        int tile;
        int x;
        int y;

    Read(bam1_t const* record);
    Read()
        : insert_size(0)
        , flowcell()
        , lane(0)
        , tile(0)
        , x(0)
        , y(0)
    {}

    bool is_on_same_tile(Read const& read) const { 
        return
            flowcell == read.flowcell
            && lane == read.lane
            && tile == read.tile;
    }

    int distance(Read const& read) const {
        //FIXME it would be better to check the return value here for overflow
        return (int) hypot( (double) (x - read.x), (double) (y - read.y)) + 0.5;
    }

    private:

    bool _parse_queryname(bam1_t const* record);
};


<commit_msg>fix non-rounding in distance measurement<commit_after>#pragma once

#include <sam.h> //from htslib

#include <math.h>
#include <stdint.h>
#include <string>

class Read {
    public:
        int32_t insert_size;
        std::string flowcell;
        int lane;
        int tile;
        int x;
        int y;

    Read(bam1_t const* record);
    Read()
        : insert_size(0)
        , flowcell()
        , lane(0)
        , tile(0)
        , x(0)
        , y(0)
    {}

    bool is_on_same_tile(Read const& read) const { 
        return
            flowcell == read.flowcell
            && lane == read.lane
            && tile == read.tile;
    }

    int distance(Read const& read) const {
        //FIXME it would be better to check the return value here for overflow
        return (int) (hypot( (double) (x - read.x), (double) (y - read.y)) + 0.5);
    }

    private:

    bool _parse_queryname(bam1_t const* record);
};



{'fraction_non_alphanumeric': 0.12179137083560895, 'fraction_numerical': 0.012015292190060076, 'mean_word_length': 1.7926829268292683, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2338431', 'n_tokens_mistral': 630, 'n_tokens_neox': 610, 'n_words': 168}