<commit_before>
local Sequence = {}
local Sequence_mt = {}
local seq_mt = {}

Sequence_mt.__index = Sequence_mt
seq_mt.__index = seq_mt

Sequence_mt.__call = function(self, name, text, description)
    assert(type(name) == 'string')
    assert(type(text) == 'string')
    assert(type(description) == 'string' or
        type(description) == 'nil')
    local seq = {}
    seq._name = name
    seq._text = Sequence.to_atgcn(text)
    assert(#seq._text > 0)
    assert(#seq._name > 0)
    seq._description = description or ''
    return setmetatable(seq, seq_mt)
end

Sequence_mt.to_atgcn = function(text)
    assert(type(text) == 'string')
    return text:upper()
        :gsub('[RYMKWSBVHD]', 'N')
        :gsub('[^ATGCN]', '')
end

Sequence_mt.complement = function(text)
    return text:reverse():gsub('[ATGC]',
        {A='T', T='A', C='G', G='C'})
end

seq_mt.type = function()
    return 'Sequence'
end

seq_mt.name = function(self)
    return self._name
end

local function get_name_part(name, number)
    local split = require 'npge.util.split'
    local parts = split(name, '&')
    if #parts == 3 then
        return parts[number]
    end
end

seq_mt.genome = function(self)
    return get_name_part(self._name, 1)
end<commit_msg>remove second return value of  Sequence.to_atgcn<commit_after>
local Sequence = {}
local Sequence_mt = {}
local seq_mt = {}

Sequence_mt.__index = Sequence_mt
seq_mt.__index = seq_mt

Sequence_mt.__call = function(self, name, text, description)
    assert(type(name) == 'string')
    assert(type(text) == 'string')
    assert(type(description) == 'string' or
        type(description) == 'nil')
    local seq = {}
    seq._name = name
    seq._text = Sequence.to_atgcn(text)
    assert(#seq._text > 0)
    assert(#seq._name > 0)
    seq._description = description or ''
    return setmetatable(seq, seq_mt)
end

Sequence_mt.to_atgcn = function(text)
    assert(type(text) == 'string')
    text = text:upper()
        :gsub('[RYMKWSBVHD]', 'N')
        :gsub('[^ATGCN]', '')
    return text
end

Sequence_mt.complement = function(text)
    return text:reverse():gsub('[ATGC]',
        {A='T', T='A', C='G', G='C'})
end

seq_mt.type = function()
    return 'Sequence'
end

seq_mt.name = function(self)
    return self._name
end

local function get_name_part(name, number)
    local split = require 'npge.util.split'
    local parts = split(name, '&')
    if #parts == 3 then
        return parts[number]
    end
end

seq_mt.genome = function(self)
    return get_name_part(self._name, 1)
end
{'fraction_non_alphanumeric': 0.14879303521962803, 'fraction_numerical': 0.0031658092599920855, 'mean_word_length': 3.5062388591800357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6172475', 'n_tokens_mistral': 909, 'n_tokens_neox': 877, 'n_words': 198}