<commit_before># BioInterchange converts non-RDF data formats into RDF.
#
# Convert TSV, XML, GFF3, GVF and other files into RDF triples using
# BioInterchange's command-line tool, its web-services or make use
# of it as a gem in your own Ruby implementation.
module BioInterchange

  ### Global behaviour settings, which can be altered programmatically or via the CLI:

  # If true, then RDF::Graph's "insert" function will be overwritten so that it
  # immediately outputs N-Triples. This reduces memory requirements (since no RDF
  # graph is kept in memory) and performance (since no looping through an RDF graph
  # is necessary).
  @@skip_rdf_graph = true
  def self.skip_rdf_graph
    @@skip_rdf_graph
  end

  # Custom Exceptions and Errors
  require 'biointerchange/exceptions'

  # Ontologies (besides the ones from the 'rdf' gem)
  require 'biointerchange/cdao'
  require 'biointerchange/faldo'
  require 'biointerchange/gff3o'
  require 'biointerchange/goxref'
  require 'biointerchange/gvf1o'
  require 'biointerchange/sio'
  require 'biointerchange/so'
  require 'biointerchange/sofa'

  # Registry for reader/writer management:
  require 'biointerchange/registry'

  # Reader/writer interfaces
  require 'biointerchange/reader'
  require 'biointerchange/model'
  require 'biointerchange/writer'

  #
  # TEXT MINING
  #

  # Text mining readers
  require 'biointerchange/textmining/text_mining_reader'
  require 'biointerchange/textmining/pubannos_json_reader'
  require 'biointerchange/textmining/pdfx_xml_reader'

  # Text mining model
  require 'biointerchange/textmining/document'
  require 'biointerchange/textmining/content'
  require 'biointerchange/textmining/content_connection'
  require 'biointerchange/textmining/process'
  
  # Text mining writers
  require 'biointerchange/textmining/text_mining_rdf_ntriples'
  
  #
  # GENOMICS
  #

  ### GFF3 ###

  # Reader
  require 'biointerchange/genomics/gff3_reader'

  # Feature base model
  require 'biointerchange/genomics/gff3_pragmas'
  require 'biointerchange/genomics/gff3_feature_set'
  require 'biointerchange/genomics/gff3_feature'

  # Writer
  require 'biointerchange/genomics/gff3_rdf_ntriples'
  
  ### GVF ###

  # Reader
  require 'biointerchange/genomics/gvf_reader'

  # Feature base model
  require 'biointerchange/genomics/gvf_pragmas'
  require 'biointerchange/genomics/gvf_feature_set'
  require 'biointerchange/genomics/gvf_feature'

  # Writer
  # ...same GFF3 writer

  #
  # PHYLOGENETICS
  #

  # Reader
  require 'biointerchange/phylogenetics/newick_reader'

  # Model
  require 'biointerchange/phylogenetics/tree_set'

  # Writer
  require 'biointerchange/phylogenetics/cdao_rdf_ntriples'

  #
  # ACTUAL COMMAND LINE IMPLEMENTATION
  #

  # Option parsing 
  require 'getopt/long'

  def self.cli
    begin
      opts = [
        ["--help", "-h", Getopt::BOOLEAN],
        ["--debug", "-d", Getopt::BOOLEAN],                     # set debug mode => print stack traces
        ["--no_rdf_graph_optimization", "-n", Getopt::BOOLEAN], # set self.skip_rdf_graph to false
        ["--batchsize", "-b", Getopt::OPTIONAL],                # batchsize for readers/writers that support +postpone?+
        ["--input", "-i", Getopt::REQUIRED],                    # input file format
        ["--rdf", "-r", Getopt::REQUIRED],                      # output file format
        ["--file", "-f", Getopt::OPTIONAL],                     # file to read, will read from STDIN if not supplied
        ["--out", "-o", Getopt::OPTIONAL],                      # output file, will out to STDOUT if not supplied
        ["--version", "-v", Getopt::BOOLEAN]                    # output the version number of the gem and exit
      ]
      reader_writer_pairs = Registry.reader_writer_pairs
      reader_writer_pairs.each_index { |reader_writer_pair_index|
        reader_id, writer_id = reader_writer_pairs[reader_writer_pair_index]
        Registry.options_help(reader_id).each { |option_description|
          option, description = option_description
          opts |= [ [ "--annotate_#{option.sub(/\s.*$/, '')}", Getopt::OPTIONAL ] ]
        }
      }
      puts "#{opts}"
      opt = Getopt::Long.getopts(*opts)
      
      if opt['help'] or not (opt['input'] and opt['rdf'] or opt['version']) then
        puts "Usage: ruby #{$0} -i <format> -r <format> [options]"
        puts ''
        puts 'Supported input formats (--input <format>/-i <format>):'
        Registry.reader_descriptions.each_pair { |reader_id, description|
          puts "  #{reader_id}#{' ' * (34 - reader_id.length)} : #{description}"
        }
        puts ''
        puts 'Supported output formats (--rdf <format>/-r <format>)'<commit_msg>Bugfix. Forgot to remove debug "puts". Removed now.<commit_after># BioInterchange converts non-RDF data formats into RDF.
#
# Convert TSV, XML, GFF3, GVF and other files into RDF triples using
# BioInterchange's command-line tool, its web-services or make use
# of it as a gem in your own Ruby implementation.
module BioInterchange

  ### Global behaviour settings, which can be altered programmatically or via the CLI:

  # If true, then RDF::Graph's "insert" function will be overwritten so that it
  # immediately outputs N-Triples. This reduces memory requirements (since no RDF
  # graph is kept in memory) and performance (since no looping through an RDF graph
  # is necessary).
  @@skip_rdf_graph = true
  def self.skip_rdf_graph
    @@skip_rdf_graph
  end

  # Custom Exceptions and Errors
  require 'biointerchange/exceptions'

  # Ontologies (besides the ones from the 'rdf' gem)
  require 'biointerchange/cdao'
  require 'biointerchange/faldo'
  require 'biointerchange/gff3o'
  require 'biointerchange/goxref'
  require 'biointerchange/gvf1o'
  require 'biointerchange/sio'
  require 'biointerchange/so'
  require 'biointerchange/sofa'

  # Registry for reader/writer management:
  require 'biointerchange/registry'

  # Reader/writer interfaces
  require 'biointerchange/reader'
  require 'biointerchange/model'
  require 'biointerchange/writer'

  #
  # TEXT MINING
  #

  # Text mining readers
  require 'biointerchange/textmining/text_mining_reader'
  require 'biointerchange/textmining/pubannos_json_reader'
  require 'biointerchange/textmining/pdfx_xml_reader'

  # Text mining model
  require 'biointerchange/textmining/document'
  require 'biointerchange/textmining/content'
  require 'biointerchange/textmining/content_connection'
  require 'biointerchange/textmining/process'
  
  # Text mining writers
  require 'biointerchange/textmining/text_mining_rdf_ntriples'
  
  #
  # GENOMICS
  #

  ### GFF3 ###

  # Reader
  require 'biointerchange/genomics/gff3_reader'

  # Feature base model
  require 'biointerchange/genomics/gff3_pragmas'
  require 'biointerchange/genomics/gff3_feature_set'
  require 'biointerchange/genomics/gff3_feature'

  # Writer
  require 'biointerchange/genomics/gff3_rdf_ntriples'
  
  ### GVF ###

  # Reader
  require 'biointerchange/genomics/gvf_reader'

  # Feature base model
  require 'biointerchange/genomics/gvf_pragmas'
  require 'biointerchange/genomics/gvf_feature_set'
  require 'biointerchange/genomics/gvf_feature'

  # Writer
  # ...same GFF3 writer

  #
  # PHYLOGENETICS
  #

  # Reader
  require 'biointerchange/phylogenetics/newick_reader'

  # Model
  require 'biointerchange/phylogenetics/tree_set'

  # Writer
  require 'biointerchange/phylogenetics/cdao_rdf_ntriples'

  #
  # ACTUAL COMMAND LINE IMPLEMENTATION
  #

  # Option parsing 
  require 'getopt/long'

  def self.cli
    begin
      opts = [
        ["--help", "-h", Getopt::BOOLEAN],
        ["--debug", "-d", Getopt::BOOLEAN],                     # set debug mode => print stack traces
        ["--no_rdf_graph_optimization", "-n", Getopt::BOOLEAN], # set self.skip_rdf_graph to false
        ["--batchsize", "-b", Getopt::OPTIONAL],                # batchsize for readers/writers that support +postpone?+
        ["--input", "-i", Getopt::REQUIRED],                    # input file format
        ["--rdf", "-r", Getopt::REQUIRED],                      # output file format
        ["--file", "-f", Getopt::OPTIONAL],                     # file to read, will read from STDIN if not supplied
        ["--out", "-o", Getopt::OPTIONAL],                      # output file, will out to STDOUT if not supplied
        ["--version", "-v", Getopt::BOOLEAN]                    # output the version number of the gem and exit
      ]
      reader_writer_pairs = Registry.reader_writer_pairs
      reader_writer_pairs.each_index { |reader_writer_pair_index|
        reader_id, writer_id = reader_writer_pairs[reader_writer_pair_index]
        Registry.options_help(reader_id).each { |option_description|
          option, description = option_description
          opts |= [ [ "--annotate_#{option.sub(/\s.*$/, '')}", Getopt::OPTIONAL ] ]
        }
      }
      opt = Getopt::Long.getopts(*opts)
      
      if opt['help'] or not (opt['input'] and opt['rdf'] or opt['version']) then
        puts "Usage: ruby #{$0} -i <format> -r <format> [options]"
        puts ''
        puts 'Supported input formats (--input <format>/-i <format>):'
        Registry.reader_descriptions.each_pair { |reader_id, description|
          puts "  #{reader_id}#{' ' * (34 - reader_id.length)} : #{description}"
        }
        puts ''
        puts 'Supported output formats (--rdf <format>/-r <format>)'
{'fraction_non_alphanumeric': 0.10946965671165905, 'fraction_numerical': 0.002763311722818578, 'mean_word_length': 3.16555998229305, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '90079', 'n_tokens_mistral': 3055, 'n_tokens_neox': 2944, 'n_words': 728}