<commit_before>require 'rbbt/workflow'
require 'rbbt/entity'
require 'rbbt/entity/genomic_mutation'

module Genotype
  extend Workflow

  if self.respond_to? :extended
    class << self
      alias prev_genotype_extended extended
    end
  end

  def self.extended(base)
    prev_genotype_extended(base) if self.respond_to? :prev_genotype_extended
    base.helper :genotype do
      base
    end
  end

  module Cohort
    extend Workflow

    if self.respond_to? :extended
      class << self
        alias prev_genotype_cohort_extended extended
      end
    end

    def self.extended(base)
      prev_genotype_cohort_extended(base) if self.respond_to? :prev_genotype_cohort_extended

      class << base
        attr_accessor :metagenotype

        def jobname
          if @jobname.nil?
            @jobname ||= "Meta-genotype: " + self.collect{|g| g.jobname} * ", "
            @jobname[100..-1] = " (etc; #{self.length} genotypes)" if @jobname.length > 100
          end
          @jobname
        end

        def metagenotype
          if @metagenotype.nil?
            @metagenotype = GenomicMutation.setup(self.dup.flatten, jobname, self[0].organism, self[0].watson)
            @metagenotype.extend Genotype unless Genotype === @metagenotype
          end
          @metagenotype
        end
      end unless base.respond_to? :metagenotype

      base.helper :metagenotype do
        base.metagenotype
      end

      base.helper :samples do
        base
      end
    end

    returns "Ensembl Gene ID"
    task :all_affected_genes => :array do
      set_info :organism, metagenotype.organism<commit_msg>NamedArray for cohort samples and extend samples with Genotype<commit_after>require 'rbbt/workflow'
require 'rbbt/entity'
require 'rbbt/entity/genomic_mutation'

module Genotype
  extend Workflow

  if self.respond_to? :extended
    class << self
      alias prev_genotype_extended extended
    end
  end

  def self.extended(base)
    prev_genotype_extended(base) if self.respond_to? :prev_genotype_extended
    base.helper :genotype do
      base
    end
  end

  module Cohort
    extend Workflow

    if self.respond_to? :extended
      class << self
        alias prev_genotype_cohort_extended extended
      end
    end

    def self.extended(base)
      prev_genotype_cohort_extended(base) if self.respond_to? :prev_genotype_cohort_extended

      class << base
        attr_accessor :metagenotype

        def jobname
          if @jobname.nil?
            @jobname ||= "Meta-genotype: " + self.collect{|g| g.jobname} * ", "
            @jobname[100..-1] = " (etc; #{self.length} genotypes)" if @jobname.length > 100
          end
          @jobname
        end

        def metagenotype
          if @metagenotype.nil?
            @metagenotype = GenomicMutation.setup(self.dup.flatten, jobname, self[0].organism, self[0].watson)
            @metagenotype.extend Genotype unless Genotype === @metagenotype
          end
          @metagenotype
        end
      end unless base.respond_to? :metagenotype

      base.each do |genotype| genotype.extend Genotype unless Genotype === genotype end

      base.helper :metagenotype do
        base.metagenotype
      end

      base.helper :samples do
        base
      end

      NamedArray.setup(base, base.collect{|base| base.jobname})
    end

    returns "Ensembl Gene ID"
    task :all_affected_genes => :array do
      set_info :organism, metagenotype.organism
{'fraction_non_alphanumeric': 0.0799651061355045, 'fraction_numerical': 0.005234079674323932, 'mean_word_length': 2.4434434434434436, 'pattern_counts': {'":': 0, '<': 15, '<?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': '6583639', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1027, 'n_words': 253}