[BioRuby-cvs] bioruby/lib/bio/db/kegg brite.rb, 0.5, 0.6 cell.rb,
1.6, 1.7 compound.rb, 0.10, 0.11 enzyme.rb, 0.7, 0.8 genes.rb,
0.19, 0.20 genome.rb, 0.13, 0.14 glycan.rb, 1.1,
1.2 keggtab.rb, 1.5, 1.6 ko.rb, 1.4, 1.5 reaction.rb, 1.2, 1.3
Katayama Toshiaki
k at pub.open-bio.org
Wed Sep 7 21:22:13 EDT 2005
- Previous message: [BioRuby-cvs] bioruby/lib/bio/db aaindex.rb, 1.12, 1.13 fantom.rb,
1.9, 1.10 fasta.rb, 1.19, 1.20 gff.rb, 1.1, 1.2 go.rb, 1.6,
1.7 medline.rb, 1.11, 1.12 nbrf.rb, 1.2, 1.3 prosite.rb, 0.9,
0.10 transfac.rb, 1.8, 1.9
- Next message: [BioRuby-cvs] bioruby/lib/bio/db/pdb atom.rb, 1.1, 1.2 pdb.rb, 1.1,
1.2 utils.rb, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg
In directory pub.open-bio.org:/tmp/cvs-serv9021/lib/bio/db/kegg
Modified Files:
brite.rb cell.rb compound.rb enzyme.rb genes.rb genome.rb
glycan.rb keggtab.rb ko.rb reaction.rb
Log Message:
* expanded tab at the line head
Index: genes.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/genes.rb,v
retrieving revision 0.19
retrieving revision 0.20
diff -C2 -d -r0.19 -r0.20
*** genes.rb 9 Feb 2005 08:41:38 -0000 0.19
--- genes.rb 8 Sep 2005 01:22:11 -0000 0.20
***************
*** 33,85 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
def entry
! unless @data['ENTRY']
! hash = Hash.new('')
! if get('ENTRY').length > 30
! e = get('ENTRY')
! hash['id'] = e[12..29].strip
! hash['division'] = e[30..39].strip
! hash['organism'] = e[40..80].strip
! end
! @data['ENTRY'] = hash
! end
! @data['ENTRY']
end
def entry_id
! entry['id']
end
def division
! entry['division'] # CDS, tRNA etc.
end
def organism
! entry['organism'] # H.sapiens etc.
end
def name
! field_fetch('NAME')
end
def genes
! name.split(', ')
end
def gene
! genes.first
end
def definition
! field_fetch('DEFINITION')
end
def eclinks
# definition.scan(/\[EC:(.*?)\]/).flatten
! if /\[EC:(.*?)\]/.match(definition)
$1.split(/\s+/)
else
--- 33,85 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
def entry
! unless @data['ENTRY']
! hash = Hash.new('')
! if get('ENTRY').length > 30
! e = get('ENTRY')
! hash['id'] = e[12..29].strip
! hash['division'] = e[30..39].strip
! hash['organism'] = e[40..80].strip
! end
! @data['ENTRY'] = hash
! end
! @data['ENTRY']
end
def entry_id
! entry['id']
end
def division
! entry['division'] # CDS, tRNA etc.
end
def organism
! entry['organism'] # H.sapiens etc.
end
def name
! field_fetch('NAME')
end
def genes
! name.split(', ')
end
def gene
! genes.first
end
def definition
! field_fetch('DEFINITION')
end
def eclinks
# definition.scan(/\[EC:(.*?)\]/).flatten
! if /\[EC:(.*?)\]/.match(definition)
$1.split(/\s+/)
else
***************
*** 90,94 ****
def splinks
# definition.scan(/\[SP:(.*?)\]/).flatten
! if /\[SP:(.*?)\]/.match(definition)
$1.split(/\s+/)
else
--- 90,94 ----
def splinks
# definition.scan(/\[SP:(.*?)\]/).flatten
! if /\[SP:(.*?)\]/.match(definition)
$1.split(/\s+/)
else
***************
*** 98,102 ****
def keggclass
! field_fetch('CLASS')
end
--- 98,102 ----
def keggclass
! field_fetch('CLASS')
end
***************
*** 106,157 ****
def position
! unless @data['POSITION']
! @data['POSITION'] = fetch('POSITION').gsub(/\s/, '')
! end
! @data['POSITION']
end
def gbposition
! position.sub(/.*?:/, '')
end
def chromosome
! if position =~ /:/
! position.sub(/:.*/, '')
! else
! nil
! end
end
def dblinks
! unless @data['DBLINKS']
! hash = {}
! get('DBLINKS').scan(/(\S+):\s*(\S+)\n/).each do |k, v|
! hash[k] = v
! end
! @data['DBLINKS'] = hash
! end
! @data['DBLINKS'] # Hash of DB:ID in DBLINKS
end
def codon_usage(codon = nil)
! unless @data['CODON_USAGE']
! ary = []
! get('CODON_USAGE').sub(/.*/,'').each_line do |line| # cut 1st line
! line.chomp.sub(/^.{11}/, '').scan(/..../) do |cu|
! ary.push(cu.to_i)
! end
! end
! @data['CODON_USAGE'] = ary
! end
! if codon
! h = { 't' => 0, 'c' => 1, 'a' => 2, 'g' => 3 }
! x, y, z = codon.downcase.scan(/\w/)
! codon_num = h[x] * 16 + h[y] * 4 + h[z]
! @data['CODON_USAGE'][codon_num] # CODON_USAGE of the codon
! else
! return @data['CODON_USAGE'] # Array of CODON_USAGE (default)
! end
end
--- 106,157 ----
def position
! unless @data['POSITION']
! @data['POSITION'] = fetch('POSITION').gsub(/\s/, '')
! end
! @data['POSITION']
end
def gbposition
! position.sub(/.*?:/, '')
end
def chromosome
! if position =~ /:/
! position.sub(/:.*/, '')
! else
! nil
! end
end
def dblinks
! unless @data['DBLINKS']
! hash = {}
! get('DBLINKS').scan(/(\S+):\s*(\S+)\n/).each do |k, v|
! hash[k] = v
! end
! @data['DBLINKS'] = hash
! end
! @data['DBLINKS'] # Hash of DB:ID in DBLINKS
end
def codon_usage(codon = nil)
! unless @data['CODON_USAGE']
! ary = []
! get('CODON_USAGE').sub(/.*/,'').each_line do |line| # cut 1st line
! line.chomp.sub(/^.{11}/, '').scan(/..../) do |cu|
! ary.push(cu.to_i)
! end
! end
! @data['CODON_USAGE'] = ary
! end
! if codon
! h = { 't' => 0, 'c' => 1, 'a' => 2, 'g' => 3 }
! x, y, z = codon.downcase.scan(/\w/)
! codon_num = h[x] * 16 + h[y] * 4 + h[z]
! @data['CODON_USAGE'][codon_num] # CODON_USAGE of the codon
! else
! return @data['CODON_USAGE'] # Array of CODON_USAGE (default)
! end
end
***************
*** 171,194 ****
def aaseq
! unless @data['AASEQ']
! @data['AASEQ'] = Sequence::AA.new(fetch('AASEQ').gsub(/[\s\d\/]+/, ''))
! end
! @data['AASEQ']
end
def aalen
! @data['AALEN'] = aaseq.length
end
def ntseq
! unless @data['NTSEQ']
! @data['NTSEQ'] = Sequence::NA.new(fetch('NTSEQ').gsub(/[\s\d\/]+/, ''))
! end
! @data['NTSEQ']
end
alias naseq ntseq
def ntlen
! @data['NTLEN'] = ntseq.length
end
alias nalen ntlen
--- 171,194 ----
def aaseq
! unless @data['AASEQ']
! @data['AASEQ'] = Sequence::AA.new(fetch('AASEQ').gsub(/[\s\d\/]+/, ''))
! end
! @data['AASEQ']
end
def aalen
! @data['AALEN'] = aaseq.length
end
def ntseq
! unless @data['NTSEQ']
! @data['NTSEQ'] = Sequence::NA.new(fetch('NTSEQ').gsub(/[\s\d\/]+/, ''))
! end
! @data['NTSEQ']
end
alias naseq ntseq
def ntlen
! @data['NTLEN'] = ntseq.length
end
alias nalen ntlen
Index: reaction.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/reaction.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** reaction.rb 22 Oct 2004 10:16:05 -0000 1.2
--- reaction.rb 8 Sep 2005 01:22:11 -0000 1.3
***************
*** 33,42 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
# ENTRY
def entry_id
! field_fetch('ENTRY')
end
--- 33,42 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
# ENTRY
def entry_id
! field_fetch('ENTRY')
end
***************
*** 48,65 ****
# DEFINITION
def definition
! field_fetch('DEFINITION')
end
# EQUATION
def equation
! field_fetch('EQUATION')
end
# RPAIR
def rpairs
! unless @data['RPAIR']
! @data['RPAIR'] = fetch('RPAIR').split(/\s+/)
! end
! @data['RPAIR']
end
--- 48,65 ----
# DEFINITION
def definition
! field_fetch('DEFINITION')
end
# EQUATION
def equation
! field_fetch('EQUATION')
end
# RPAIR
def rpairs
! unless @data['RPAIR']
! @data['RPAIR'] = fetch('RPAIR').split(/\s+/)
! end
! @data['RPAIR']
end
***************
*** 71,78 ****
# ENZYME
def enzymes
! unless @data['ENZYME']
@data['ENZYME'] = fetch('ENZYME').scan(/\S+/)
! end
! @data['ENZYME']
end
--- 71,78 ----
# ENZYME
def enzymes
! unless @data['ENZYME']
@data['ENZYME'] = fetch('ENZYME').scan(/\S+/)
! end
! @data['ENZYME']
end
Index: brite.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/brite.rb,v
retrieving revision 0.5
retrieving revision 0.6
diff -C2 -d -r0.5 -r0.6
*** brite.rb 15 Dec 2001 02:50:35 -0000 0.5
--- brite.rb 8 Sep 2005 01:22:11 -0000 0.6
***************
*** 33,37 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
--- 33,37 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
Index: glycan.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/glycan.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** glycan.rb 25 Oct 2004 14:08:35 -0000 1.1
--- glycan.rb 8 Sep 2005 01:22:11 -0000 1.2
***************
*** 33,37 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
--- 33,37 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
***************
*** 97,112 ****
# COMPOUND
def compounds
! unless @data['COMPOUND']
! @data['COMPOUND'] = fetch('COMPOUND').split(/\s+/)
! end
! @data['COMPOUND']
end
# REACTION
def reactions
! unless @data['REACTION']
! @data['REACTION'] = fetch('REACTION').split(/\s+/)
! end
! @data['REACTION']
end
--- 97,112 ----
# COMPOUND
def compounds
! unless @data['COMPOUND']
! @data['COMPOUND'] = fetch('COMPOUND').split(/\s+/)
! end
! @data['COMPOUND']
end
# REACTION
def reactions
! unless @data['REACTION']
! @data['REACTION'] = fetch('REACTION').split(/\s+/)
! end
! @data['REACTION']
end
***************
*** 118,130 ****
# ENZYME
def enzymes
! unless @data['ENZYME']
! field = fetch('ENZYME')
! if /\(/.match(field) # old version
! @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
! else
! @data['ENZYME'] = field.scan(/\S+/)
! end
! end
! @data['ENZYME']
end
--- 118,130 ----
# ENZYME
def enzymes
! unless @data['ENZYME']
! field = fetch('ENZYME')
! if /\(/.match(field) # old version
! @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
! else
! @data['ENZYME'] = field.scan(/\S+/)
! end
! end
! @data['ENZYME']
end
Index: compound.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/compound.rb,v
retrieving revision 0.10
retrieving revision 0.11
diff -C2 -d -r0.10 -r0.11
*** compound.rb 7 Aug 2005 08:23:37 -0000 0.10
--- compound.rb 8 Sep 2005 01:22:11 -0000 0.11
***************
*** 33,37 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
--- 33,37 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
***************
*** 49,79 ****
end
def name
! names[0]
end
# FORMULA
def formula
! field_fetch('FORMULA')
end
# MASS
def mass
! field_fetch('MASS').to_f
end
# REACTION
def reactions
! unless @data['REACTION']
! @data['REACTION'] = fetch('REACTION').split(/\s+/)
! end
! @data['REACTION']
end
# RPAIR
def rpairs
! unless @data['RPAIR']
! @data['RPAIR'] = fetch('RPAIR').split(/\s+/)
! end
! @data['RPAIR']
end
--- 49,79 ----
end
def name
! names[0]
end
# FORMULA
def formula
! field_fetch('FORMULA')
end
# MASS
def mass
! field_fetch('MASS').to_f
end
# REACTION
def reactions
! unless @data['REACTION']
! @data['REACTION'] = fetch('REACTION').split(/\s+/)
! end
! @data['REACTION']
end
# RPAIR
def rpairs
! unless @data['RPAIR']
! @data['RPAIR'] = fetch('RPAIR').split(/\s+/)
! end
! @data['RPAIR']
end
***************
*** 85,97 ****
# ENZYME
def enzymes
! unless @data['ENZYME']
! field = fetch('ENZYME')
! if /\(/.match(field) # old version
! @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
! else
! @data['ENZYME'] = field.scan(/\S+/)
! end
! end
! @data['ENZYME']
end
--- 85,97 ----
# ENZYME
def enzymes
! unless @data['ENZYME']
! field = fetch('ENZYME')
! if /\(/.match(field) # old version
! @data['ENZYME'] = field.scan(/\S+ \(\S+\)/)
! else
! @data['ENZYME'] = field.scan(/\S+/)
! end
! end
! @data['ENZYME']
end
Index: cell.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/cell.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** cell.rb 15 Dec 2001 02:55:07 -0000 1.6
--- cell.rb 8 Sep 2005 01:22:11 -0000 1.7
***************
*** 33,82 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
def entry_id
! field_fetch('ENTRY')
end
def definition
! field_fetch('DEFINITION')
end
def org
! field_fetch('ORGANISM')
end
alias organism org
def mother
! field_fetch('MOTHER')
end
def daughter
! field_fetch('DAUGHTER').gsub(/ /, '').split(/,/)
end
def sister
! field_fetch('SISTER')
end
def fate
! field_fetch('CELL_FATE').gsub(/ /, '').split(/,/)
end
def contact
! field_fetch('CONTACT').gsub(/ /, '').split(/,/)
end
def expression
! field_fetch('EXPRESSION')
end
def fig
! field_fetch('FIGURE')
end
def ref
! field_fetch('REFERENCE')
end
--- 33,82 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
def entry_id
! field_fetch('ENTRY')
end
def definition
! field_fetch('DEFINITION')
end
def org
! field_fetch('ORGANISM')
end
alias organism org
def mother
! field_fetch('MOTHER')
end
def daughter
! field_fetch('DAUGHTER').gsub(/ /, '').split(/,/)
end
def sister
! field_fetch('SISTER')
end
def fate
! field_fetch('CELL_FATE').gsub(/ /, '').split(/,/)
end
def contact
! field_fetch('CONTACT').gsub(/ /, '').split(/,/)
end
def expression
! field_fetch('EXPRESSION')
end
def fig
! field_fetch('FIGURE')
end
def ref
! field_fetch('REFERENCE')
end
Index: enzyme.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/enzyme.rb,v
retrieving revision 0.7
retrieving revision 0.8
diff -C2 -d -r0.7 -r0.8
*** enzyme.rb 4 Feb 2004 14:00:58 -0000 0.7
--- enzyme.rb 8 Sep 2005 01:22:11 -0000 0.8
***************
*** 33,47 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
# ENTRY
def entry_id
! field_fetch('ENTRY')
end
# NAME
def names
! lines_fetch('NAME')
end
def name
--- 33,47 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
# ENTRY
def entry_id
! field_fetch('ENTRY')
end
# NAME
def names
! lines_fetch('NAME')
end
def name
***************
*** 51,119 ****
# CLASS
def classes
! lines_fetch('CLASS')
end
# SYSNAME
def sysname
! field_fetch('SYSNAME')
end
# REACTION ';'
def reaction
! field_fetch('REACTION')
end
# SUBSTRATE
def substrates
! lines_fetch('SUBSTRATE')
end
# PRODUCT
def products
! lines_fetch('PRODUCT')
end
# COFACTOR
def cofactors
! lines_fetch('COFACTOR')
end
# COMMENT
def comment
! field_fetch('COMMENT')
end
# PATHWAY
def pathways
! lines_fetch('PATHWAY')
end
# GENES
def genes
! lines_fetch('GENES')
end
# DISEASE
def diseases
! lines_fetch('DISEASE')
end
# MOTIF
def motifs
! lines_fetch('MOTIF')
end
# STRUCTURES
def structures
! unless @data['STRUCTURES']
! @data['STRUCTURES'] =
! fetch('STRUCTURES').sub(/(PDB: )*/,'').split(/\s+/)
! end
! @data['STRUCTURES']
end
# DBLINKS
def dblinks
! lines_fetch('DBLINKS')
end
--- 51,119 ----
# CLASS
def classes
! lines_fetch('CLASS')
end
# SYSNAME
def sysname
! field_fetch('SYSNAME')
end
# REACTION ';'
def reaction
! field_fetch('REACTION')
end
# SUBSTRATE
def substrates
! lines_fetch('SUBSTRATE')
end
# PRODUCT
def products
! lines_fetch('PRODUCT')
end
# COFACTOR
def cofactors
! lines_fetch('COFACTOR')
end
# COMMENT
def comment
! field_fetch('COMMENT')
end
# PATHWAY
def pathways
! lines_fetch('PATHWAY')
end
# GENES
def genes
! lines_fetch('GENES')
end
# DISEASE
def diseases
! lines_fetch('DISEASE')
end
# MOTIF
def motifs
! lines_fetch('MOTIF')
end
# STRUCTURES
def structures
! unless @data['STRUCTURES']
! @data['STRUCTURES'] =
! fetch('STRUCTURES').sub(/(PDB: )*/,'').split(/\s+/)
! end
! @data['STRUCTURES']
end
# DBLINKS
def dblinks
! lines_fetch('DBLINKS')
end
Index: ko.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/ko.rb,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ko.rb 23 Aug 2004 23:53:23 -0000 1.4
--- ko.rb 8 Sep 2005 01:22:11 -0000 1.5
***************
*** 34,99 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
def entry_id
! field_fetch('ENTRY')[/\S+/]
end
def name
! field_fetch('NAME')
end
def names
! name.split(', ')
end
def definition
! field_fetch('DEFINITION')
end
def keggclass
! field_fetch('CLASS')
end
def keggclasses
! keggclass.gsub(/ \[[^\]]+/, '').split(/\] ?/)
end
def pathways
! keggclass.scan(/\[PATH:(.*?)\]/).flatten
end
def dblinks
! unless @data['DBLINKS']
! hash = {}
! get('DBLINKS').scan(/(\S+):\s*(.*)\n/).each do |k, v|
! hash[k] = v.split(/\s+/)
! end
! @data['DBLINKS'] = hash
! end
! @data['DBLINKS'] # Hash of DB:ID in DBLINKS
end
def genes
! unless @data['GENES']
! hash = {}
! k = ''
! get('GENES').each_line do |line|
! line.chomp!
! line[0, @tagsize] = ''
! if line =~ /(\S+):/
! k = $1
! hash[k] = []
! end
! line[0, 5] = ''
! line.gsub(/\(\S+/, '').each(' ') do |u|
! hash[k] << u.strip
! end
! end
! @data['GENES'] = hash
end
! @data['GENES'] # Hash of DB:ID in DBLINKS
end
--- 34,99 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
def entry_id
! field_fetch('ENTRY')[/\S+/]
end
def name
! field_fetch('NAME')
end
def names
! name.split(', ')
end
def definition
! field_fetch('DEFINITION')
end
def keggclass
! field_fetch('CLASS')
end
def keggclasses
! keggclass.gsub(/ \[[^\]]+/, '').split(/\] ?/)
end
def pathways
! keggclass.scan(/\[PATH:(.*?)\]/).flatten
end
def dblinks
! unless @data['DBLINKS']
! hash = {}
! get('DBLINKS').scan(/(\S+):\s*(.*)\n/).each do |k, v|
! hash[k] = v.split(/\s+/)
! end
! @data['DBLINKS'] = hash
! end
! @data['DBLINKS'] # Hash of DB:ID in DBLINKS
end
def genes
! unless @data['GENES']
! hash = {}
! k = ''
! get('GENES').each_line do |line|
! line.chomp!
! line[0, @tagsize] = ''
! if line =~ /(\S+):/
! k = $1
! hash[k] = []
! end
! line[0, 5] = ''
! line.gsub(/\(\S+/, '').each(' ') do |u|
! hash[k] << u.strip
! end
! end
! @data['GENES'] = hash
end
! @data['GENES'] # Hash of DB:ID in DBLINKS
end
Index: genome.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/genome.rb,v
retrieving revision 0.13
retrieving revision 0.14
diff -C2 -d -r0.13 -r0.14
*** genome.rb 23 Aug 2004 23:53:23 -0000 0.13
--- genome.rb 8 Sep 2005 01:22:11 -0000 0.14
***************
*** 33,37 ****
def initialize(entry)
! super(entry, TAGSIZE)
end
--- 33,37 ----
def initialize(entry)
! super(entry, TAGSIZE)
end
***************
*** 39,53 ****
# ENTRY
def entry_id
! field_fetch('ENTRY')
end
# NAME
def name
! field_fetch('NAME')
end
# DEFINITION
def definition
! field_fetch('DEFINITION')
end
alias organism definition
--- 39,53 ----
# ENTRY
def entry_id
! field_fetch('ENTRY')
end
# NAME
def name
! field_fetch('NAME')
end
# DEFINITION
def definition
! field_fetch('DEFINITION')
end
alias organism definition
***************
*** 55,206 ****
# TAXONOMY
def taxonomy
! unless @data['TAXONOMY']
! taxid, lineage = subtag2array(get('TAXONOMY'))
! taxid = taxid ? truncate(tag_cut(taxid)) : ''
! lineage = lineage ? truncate(tag_cut(lineage)) : ''
! @data['TAXONOMY'] = {
! 'taxid' => taxid,
! 'lineage' => lineage,
! }
! @data['TAXONOMY'].default = ''
! end
! @data['TAXONOMY']
end
def taxid
! taxonomy['taxid']
end
def lineage
! taxonomy['lineage']
end
# COMMENT
def comment
! field_fetch('COMMENT')
end
# REFERENCE
def references
! unless @data['REFERENCE']
! ary = []
! toptag2array(get('REFERENCE')).each do |ref|
! hash = Hash.new('')
! subtag2array(ref).each do |field|
! case tag_get(field)
! when /AUTHORS/
! authors = truncate(tag_cut(field))
! authors = authors.split(', ')
! authors[-1] = authors[-1].split(/\s+and\s+/)
! authors = authors.flatten.map { |a| a.sub(',', ', ') }
! hash['authors'] = authors
! when /TITLE/
! hash['title'] = truncate(tag_cut(field))
! when /JOURNAL/
! journal = truncate(tag_cut(field))
! if journal =~ /(.*) (\d+):(\d+)-(\d+) \((\d+)\) \[UI:(\d+)\]$/
! hash['journal'] = $1
! hash['volume'] = $2
! hash['pages'] = $3
! hash['year'] = $5
! hash['medline'] = $6
! else
! hash['journal'] = journal
! end
! end
! end
! ary.push(Reference.new(hash))
! end
! @data['REFERENCE'] = References.new(ary)
! end
! @data['REFERENCE']
end
# CHROMOSOME
def chromosomes
! unless @data['CHROMOSOME']
! @data['CHROMOSOME'] = []
! toptag2array(get('CHROMOSOME')).each do |chr|
! hash = Hash.new('')
! subtag2array(chr).each do |field|
! hash[tag_get(field)] = truncate(tag_cut(field))
! end
! @data['CHROMOSOME'].push(hash)
! end
! end
! @data['CHROMOSOME']
end
# PLASMID
def plasmids
! unless @data['PLASMID']
! @data['PLASMID'] = []
! toptag2array(get('PLASMID')).each do |chr|
! hash = Hash.new('')
! subtag2array(chr).each do |field|
! hash[tag_get(field)] = truncate(tag_cut(field))
! end
! @data['PLASMID'].push(hash)
! end
! end
! @data['PLASMID']
end
# SCAFFOLD
def scaffolds
! unless @data['SCAFFOLD']
! @data['SCAFFOLD'] = []
! toptag2array(get('SCAFFOLD')).each do |chr|
! hash = Hash.new('')
! subtag2array(chr).each do |field|
! hash[tag_get(field)] = truncate(tag_cut(field))
! end
! @data['SCAFFOLD'].push(hash)
! end
! end
! @data['SCAFFOLD']
end
# STATISTICS
def statistics
! unless @data['STATISTICS']
! hash = Hash.new(0.0)
! get('STATISTICS').each_line do |line|
! case line
! when /nucleotides:\s+(\d+)/
! hash['nalen'] = $1.to_i
! when /protein genes:\s+(\d+)/
! hash['num_gene'] = $1.to_i
! when /RNA genes:\s+(\d+)/
! hash['num_rna'] = $1.to_i
! when /G\+C content:\s+(\d+.\d+)/
! hash['gc'] = $1.to_f
! end
! end
! @data['STATISTICS'] = hash
! end
! @data['STATISTICS']
end
def nalen
! statistics['nalen']
end
alias length nalen
def num_gene
! statistics['num_gene']
end
def num_rna
! statistics['num_rna']
end
def gc
! statistics['gc']
end
# GENOMEMAP
def genomemap
! field_fetch('GENOMEMAP')
end
--- 55,206 ----
# TAXONOMY
def taxonomy
! unless @data['TAXONOMY']
! taxid, lineage = subtag2array(get('TAXONOMY'))
! taxid = taxid ? truncate(tag_cut(taxid)) : ''
! lineage = lineage ? truncate(tag_cut(lineage)) : ''
! @data['TAXONOMY'] = {
! 'taxid' => taxid,
! 'lineage' => lineage,
! }
! @data['TAXONOMY'].default = ''
! end
! @data['TAXONOMY']
end
def taxid
! taxonomy['taxid']
end
def lineage
! taxonomy['lineage']
end
# COMMENT
def comment
! field_fetch('COMMENT')
end
# REFERENCE
def references
! unless @data['REFERENCE']
! ary = []
! toptag2array(get('REFERENCE')).each do |ref|
! hash = Hash.new('')
! subtag2array(ref).each do |field|
! case tag_get(field)
! when /AUTHORS/
! authors = truncate(tag_cut(field))
! authors = authors.split(', ')
! authors[-1] = authors[-1].split(/\s+and\s+/)
! authors = authors.flatten.map { |a| a.sub(',', ', ') }
! hash['authors'] = authors
! when /TITLE/
! hash['title'] = truncate(tag_cut(field))
! when /JOURNAL/
! journal = truncate(tag_cut(field))
! if journal =~ /(.*) (\d+):(\d+)-(\d+) \((\d+)\) \[UI:(\d+)\]$/
! hash['journal'] = $1
! hash['volume'] = $2
! hash['pages'] = $3
! hash['year'] = $5
! hash['medline'] = $6
! else
! hash['journal'] = journal
! end
! end
! end
! ary.push(Reference.new(hash))
! end
! @data['REFERENCE'] = References.new(ary)
! end
! @data['REFERENCE']
end
# CHROMOSOME
def chromosomes
! unless @data['CHROMOSOME']
! @data['CHROMOSOME'] = []
! toptag2array(get('CHROMOSOME')).each do |chr|
! hash = Hash.new('')
! subtag2array(chr).each do |field|
! hash[tag_get(field)] = truncate(tag_cut(field))
! end
! @data['CHROMOSOME'].push(hash)
! end
! end
! @data['CHROMOSOME']
end
# PLASMID
def plasmids
! unless @data['PLASMID']
! @data['PLASMID'] = []
! toptag2array(get('PLASMID')).each do |chr|
! hash = Hash.new('')
! subtag2array(chr).each do |field|
! hash[tag_get(field)] = truncate(tag_cut(field))
! end
! @data['PLASMID'].push(hash)
! end
! end
! @data['PLASMID']
end
# SCAFFOLD
def scaffolds
! unless @data['SCAFFOLD']
! @data['SCAFFOLD'] = []
! toptag2array(get('SCAFFOLD')).each do |chr|
! hash = Hash.new('')
! subtag2array(chr).each do |field|
! hash[tag_get(field)] = truncate(tag_cut(field))
! end
! @data['SCAFFOLD'].push(hash)
! end
! end
! @data['SCAFFOLD']
end
# STATISTICS
def statistics
! unless @data['STATISTICS']
! hash = Hash.new(0.0)
! get('STATISTICS').each_line do |line|
! case line
! when /nucleotides:\s+(\d+)/
! hash['nalen'] = $1.to_i
! when /protein genes:\s+(\d+)/
! hash['num_gene'] = $1.to_i
! when /RNA genes:\s+(\d+)/
! hash['num_rna'] = $1.to_i
! when /G\+C content:\s+(\d+.\d+)/
! hash['gc'] = $1.to_f
! end
! end
! @data['STATISTICS'] = hash
! end
! @data['STATISTICS']
end
def nalen
! statistics['nalen']
end
alias length nalen
def num_gene
! statistics['num_gene']
end
def num_rna
! statistics['num_rna']
end
def gc
! statistics['gc']
end
# GENOMEMAP
def genomemap
! field_fetch('GENOMEMAP')
end
***************
*** 244,248 ****
puts "### " + x.shift
x.each do |m|
! p genome.send(m)
end
end
--- 244,248 ----
puts "### " + x.shift
x.each do |m|
! p genome.send(m)
end
end
Index: keggtab.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/keggtab.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** keggtab.rb 23 Aug 2004 23:53:23 -0000 1.5
--- keggtab.rb 8 Sep 2005 01:22:11 -0000 1.6
***************
*** 28,36 ****
def initialize(file_path, bioroot = nil)
! @bioroot = ENV['BIOROOT'] || bioroot
! @db_names = Hash.new
! @database = Hash.new
! @taxonomy = Hash.new
! parse_keggtab(File.open(file_path).read)
end
attr_reader :bioroot, :db_names
--- 28,36 ----
def initialize(file_path, bioroot = nil)
! @bioroot = ENV['BIOROOT'] || bioroot
! @db_names = Hash.new
! @database = Hash.new
! @taxonomy = Hash.new
! parse_keggtab(File.open(file_path).read)
end
attr_reader :bioroot, :db_names
***************
*** 40,53 ****
class DB
! def initialize(db_name, db_type, db_path, db_abbrev)
! @name = db_name
! @type = db_type
! @path = db_path
! @abbrev = db_abbrev
! @aliases = Array.new
! end
! attr_reader :name, :type, :path, :abbrev, :aliases
! alias :korg :abbrev
! alias :keggorg :abbrev
end
--- 40,53 ----
class DB
! def initialize(db_name, db_type, db_path, db_abbrev)
! @name = db_name
! @type = db_type
! @path = db_path
! @abbrev = db_abbrev
! @aliases = Array.new
! end
! attr_reader :name, :type, :path, :abbrev, :aliases
! alias :korg :abbrev
! alias :keggorg :abbrev
end
***************
*** 56,118 ****
def database(db_abbrev = nil)
! if db_abbrev
! @database[db_abbrev]
! else
! @database
! end
end
def aliases(db_abbrev)
! if @database[db_abbrev]
! @database[db_abbrev].aliases
! end
end
def name(db_abbrev)
! if @database[db_abbrev]
! @database[db_abbrev].name
! end
end
def path(db_abbrev)
! if @database[db_abbrev]
! file = @database[db_abbrev].name
! if @bioroot
! "#{@database[db_abbrev].path.sub(/\$BIOROOT/, at bioroot)}/#{file}"
! else
! "#{@database[db_abbrev].path}/#{file}"
! end
! end
end
def alias_list(db_name)
! if @db_names[db_name]
! @db_names[db_name].aliases
! end
end
def db_path(db_name)
! if @bioroot
! "#{@db_names[db_name].path.sub(/\$BIOROOT/, at bioroot)}/#{db_name}"
! else
! "#{@db_names[db_name].path}/#{db_name}"
! end
end
def db_by_abbrev(db_abbrev)
! @db_names.each do |k, db|
! return db if db.abbrev == db_abbrev
! end
! return nil
end
def name_by_abbrev(db_abbrev)
! db_by_abbrev(db_abbrev).name
end
def db_path_by_abbrev(db_abbrev)
! db_name = name_by_abbrev(db_abbrev)
! db_path(db_name)
end
--- 56,118 ----
def database(db_abbrev = nil)
! if db_abbrev
! @database[db_abbrev]
! else
! @database
! end
end
def aliases(db_abbrev)
! if @database[db_abbrev]
! @database[db_abbrev].aliases
! end
end
def name(db_abbrev)
! if @database[db_abbrev]
! @database[db_abbrev].name
! end
end
def path(db_abbrev)
! if @database[db_abbrev]
! file = @database[db_abbrev].name
! if @bioroot
! "#{@database[db_abbrev].path.sub(/\$BIOROOT/, at bioroot)}/#{file}"
! else
! "#{@database[db_abbrev].path}/#{file}"
! end
! end
end
def alias_list(db_name)
! if @db_names[db_name]
! @db_names[db_name].aliases
! end
end
def db_path(db_name)
! if @bioroot
! "#{@db_names[db_name].path.sub(/\$BIOROOT/, at bioroot)}/#{db_name}"
! else
! "#{@db_names[db_name].path}/#{db_name}"
! end
end
def db_by_abbrev(db_abbrev)
! @db_names.each do |k, db|
! return db if db.abbrev == db_abbrev
! end
! return nil
end
def name_by_abbrev(db_abbrev)
! db_by_abbrev(db_abbrev).name
end
def db_path_by_abbrev(db_abbrev)
! db_name = name_by_abbrev(db_abbrev)
! db_path(db_name)
end
***************
*** 121,153 ****
def taxonomy(node = nil)
! if node
! @taxonomy[node]
! else
! @taxonomy
! end
end
def taxa_list
! @taxonomy.keys.sort
end
def child_nodes(node = 'genes')
! return @taxonomy[node]
end
def taxo2korgs(node = 'genes')
! if node.length == 3
! return node
! else
! if @taxonomy[node]
! tmp = Array.new
! @taxonomy[node].each do |x|
! tmp.push(taxo2korgs(x))
! end
! return tmp
! else
! return nil
! end
! end
end
alias :taxo2keggorgs :taxo2korgs
--- 121,153 ----
def taxonomy(node = nil)
! if node
! @taxonomy[node]
! else
! @taxonomy
! end
end
def taxa_list
! @taxonomy.keys.sort
end
def child_nodes(node = 'genes')
! return @taxonomy[node]
end
def taxo2korgs(node = 'genes')
! if node.length == 3
! return node
! else
! if @taxonomy[node]
! tmp = Array.new
! @taxonomy[node].each do |x|
! tmp.push(taxo2korgs(x))
! end
! return tmp
! else
! return nil
! end
! end
end
alias :taxo2keggorgs :taxo2korgs
***************
*** 156,171 ****
def korg2taxo(keggorg)
! tmp = Array.new
! traverse = Proc.new {|keggorg|
! @taxonomy.each do |k,v|
! if v.include?(keggorg)
! tmp.push(k)
! traverse.call(k)
! break
! end
! end
! }
! traverse.call(keggorg)
! return tmp
end
alias :keggorg2taxo :korg2taxo
--- 156,171 ----
def korg2taxo(keggorg)
! tmp = Array.new
! traverse = Proc.new {|keggorg|
! @taxonomy.each do |k,v|
! if v.include?(keggorg)
! tmp.push(k)
! traverse.call(k)
! break
! end
! end
! }
! traverse.call(keggorg)
! return tmp
end
alias :keggorg2taxo :korg2taxo
***************
*** 177,208 ****
def parse_keggtab(keggtab)
! in_taxonomy = nil
! keggtab.each do |line|
! case line
! when /^# Taxonomy/ # beginning of the taxonomy section
! in_taxonomy = true
! when /^#|^$/
! next
! when /(^\w\S+)\s+(\w+)\s+(\$\S+)\s+(\w+)/ # db
! db_name = $1
! db_type = $2
! db_path = $3
! db_abbrev = $4
! @db_names[db_name] =
! Bio::KEGG::Keggtab::DB.new(db_name, db_type, db_path, db_abbrev)
! when /(^\w\S+)\s+alias\s+(\w.+\w)/ # alias
! db_alias = $1
! db_name = $2#.downcase
! if in_taxonomy
! @taxonomy.update(db_alias => db_name.split('+'))
! elsif @db_names[db_name]
! @db_names[db_name].aliases.push(db_alias)
! end
! end
! end
! # convert keys-by-names hash @db_names to keys-by-abbrev hash @database
! @db_names.each do |k,v|
! @database[v.abbrev] = v
! end
end
--- 177,208 ----
def parse_keggtab(keggtab)
! in_taxonomy = nil
! keggtab.each do |line|
! case line
! when /^# Taxonomy/ # beginning of the taxonomy section
! in_taxonomy = true
! when /^#|^$/
! next
! when /(^\w\S+)\s+(\w+)\s+(\$\S+)\s+(\w+)/ # db
! db_name = $1
! db_type = $2
! db_path = $3
! db_abbrev = $4
! @db_names[db_name] =
! Bio::KEGG::Keggtab::DB.new(db_name, db_type, db_path, db_abbrev)
! when /(^\w\S+)\s+alias\s+(\w.+\w)/ # alias
! db_alias = $1
! db_name = $2#.downcase
! if in_taxonomy
! @taxonomy.update(db_alias => db_name.split('+'))
! elsif @db_names[db_name]
! @db_names[db_name].aliases.push(db_alias)
! end
! end
! end
! # convert keys-by-names hash @db_names to keys-by-abbrev hash @database
! @db_names.each do |k,v|
! @database[v.abbrev] = v
! end
end
- Previous message: [BioRuby-cvs] bioruby/lib/bio/db aaindex.rb, 1.12, 1.13 fantom.rb,
1.9, 1.10 fasta.rb, 1.19, 1.20 gff.rb, 1.1, 1.2 go.rb, 1.6,
1.7 medline.rb, 1.11, 1.12 nbrf.rb, 1.2, 1.3 prosite.rb, 0.9,
0.10 transfac.rb, 1.8, 1.9
- Next message: [BioRuby-cvs] bioruby/lib/bio/db/pdb atom.rb, 1.1, 1.2 pdb.rb, 1.1,
1.2 utils.rb, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the bioruby-cvs
mailing list