<commit_before>
//////////////////////////////////////////////////////////////////////////////
// This software module is developed by SCIDM team in 1999-2008.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
// For any questions please contact SciDM team by email at <EMAIL>
//////////////////////////////////////////////////////////////////////////////

#define __sequtil_cpp__

#include "sequtil.h"
#include <string.h>
#include <iomanip>
#include <ios>

void n_revert_seq (char* dest, const char* src, int len, int beg)
{
    for (int ii = 0; ii < len; ii ++)
        put_base (dest, len - ii - 1, ((~get_base (src, ii+beg)) & 0x3));
}

bool n_ascii2binary (char* dest, int destlen, const char* source, int start, int len)
{
    if (destlen < ((len + 3) >> 2))
        return false;

    for (int i = start; i < start + len; i ++)
        put_base (dest, i - start, char2base (source [i]));

    return true;
}

bool n_binary2ascii (char* dest, int destlen, const char* source, int start, int len)
{
    if (destlen < len)
        return false;

    for (int i = start; i < start + len; i ++)
        dest [i - start] = base2char (get_base (source, i));

    return true;
}

void n_countnucs (int& a, int& g, int& c, int& t, const char* src, int start, int len)
{
    a = g = t = c = 0;
    if (len == -1) len = strlen (src) - start;

    for (int i = start; i < start + len; i ++)
        switch (tolower (src [i]))
        {
        case 't':   t ++; break;
        case 'a':   a ++; break;
        case 'g':   g ++; break;<commit_msg>synced to egdev<commit_after>
//////////////////////////////////////////////////////////////////////////////
// This software module is developed by SCIDM team in 1999-2008.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
// For any questions please contact SciDM team by email at <EMAIL>
//////////////////////////////////////////////////////////////////////////////

#define __sequtil_cpp__

#include "sequtil.h"
#include <string.h>
#include <iomanip>
#include <ios>

void n_revert_seq (char* dest, const char* src, int len, int beg)
{
    for (int ii = 0; ii < len; ii ++)
        put_base (dest, len - ii - 1, ((~get_base (src, ii+beg)) & 0x3));
}

bool n_ascii2binary (char* dest, int destlen, const char* source, int start, int len)
{
    if (destlen < ((len + 3) >> 2))
        return false;

    for (int i = start; i < start + len; i ++)
        put_base (dest, i - start, char2base (source [i]));

    return true;
}

bool n_binary2ascii (char* dest, int destlen, const char* source, int start, int len)
{
    if (destlen < len)
        return false;

    for (int i = start; i < start + len; i ++)
        dest [i - start] = base2char (get_base (source, i));
    // only zero-terminate if there is enough space in dest
    if (destlen > len)
        dest [len] = 0;

    return true;
}

void n_countnucs (int& a, int& g, int& c, int& t, const char* src, int start, int len)
{
    a = g = t = c = 0;
    if (len == -1) len = strlen (src) - start;

    for (int i = start; i < start + len; i ++)
        switch (tolower (src [i]))
        {
        case 't':   t ++; break;
        case 'a':   a ++; break;
        case 'g':   g ++; break;
{'fraction_non_alphanumeric': 0.18233869191807972, 'fraction_numerical': 0.014314027747192249, 'mean_word_length': 2.136740331491713, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3781535', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1346, 'n_words': 610}