Sha256: 4d160b473fd20374635ca2a04130913b0c02ed3b94169785727f88c13d14b5aa

Contents?: true

Size: 1.73 KB

Versions: 35

Compression:

Stored size: 1.73 KB

Contents

#!/usr/bin/env ruby
#
# genes2tab.rb - convert KEGG/GENES into tab delimited data for MySQL
#
#  Usage:
#
#    % genes2tab.rb /bio/db/kegg/genes/e.coli > genes_eco.tab
#
#   Copyright (C) 2001 KATAYAMA Toshiaki <k@bioruby.org>
#
#  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.
#
#  $Id: genes2tab.rb,v 0.5 2002/06/23 20:21:56 k Exp $
#

require 'bio/db/kegg/genes'

include Bio

while entry = gets(KEGG::GENES::DELIMITER)

  genes = KEGG::GENES.new(entry)

  db = genes.dblinks.inspect

  if genes.codon_usage.length == 64
    cu = genes.codon_usage.join(' ')
  else
    cu = '\N'
  end

  ary = [
    genes.entry_id,
    genes.division,
    genes.organism,
    genes.name,
    genes.definition,
    genes.keggclass,
    genes.position,
    db,
    cu,
    genes.aalen,
    genes.aaseq,
    genes.nalen,
    genes.naseq
  ]

  puts ary.join("\t")

end

=begin

CREATE DATABASE IF NOT EXISTS db_name;
CREATE TABLE IF NOT EXISTS db_name.genes (
	id		varchar(30)	not NULL,	# ENTRY ID
	division	varchar(30),			# CDS, tRNA etc.
	organism	varchar(255),
	gene		varchar(255),
	definition	varchar(255),
	keggclass	varchar(255),
	position	varchar(255),
	dblinks		varchar(255),
	codon_usage	text,
	aalen		integer,
	aaseq		text,
	nalen		integer,
	naseq		text
);
LOAD DATA LOCAL INFILE 'genes.tab' INTO TABLE db_name.genes;

=end

Version data entries

35 entries across 35 versions & 4 rubygems

Version Path
bio-2.0.5 sample/genes2tab.rb
bio-2.0.4 sample/genes2tab.rb
bio-2.0.3 sample/genes2tab.rb
bio-2.0.2 sample/genes2tab.rb
bio-2.0.1 sample/genes2tab.rb
bio-2.0.0 sample/genes2tab.rb
bio-1.6.0.pre.20181210 sample/genes2tab.rb
bio-1.5.2 sample/genes2tab.rb
bio-1.5.1 sample/genes2tab.rb
bio-1.5.0 sample/genes2tab.rb
bioruby-bio-1.2.9.9001 sample/genes2tab.rb
bioruby-bio-1.2.9.9501 sample/genes2tab.rb
bioruby-bio-1.3.0.5000 sample/genes2tab.rb
bioruby-bio-1.3.0.9901 sample/genes2tab.rb
bioruby-bio-1.3.0 sample/genes2tab.rb
bioruby-bio-1.3.1.5000 sample/genes2tab.rb
jandot-bio-1.2.1 sample/genes2tab.rb
ngoto-bio-1.2.9.9001 sample/genes2tab.rb
ngoto-bio-1.2.9.9501 sample/genes2tab.rb
ngoto-bio-1.3.0.5000 sample/genes2tab.rb