Class: Bio::KEGG::GLYCAN

Inherits:
Bio::KEGGDB show all
Defined in:
lib/bio/db/kegg/glycan.rb

Constant Summary collapse

DELIMITER =
RS = "\n///\n"
TAGSIZE =
12

Instance Method Summary collapse

Methods inherited from DB

#exists?, #fetch, #get, open, #tags

Constructor Details

#initialize(entry) ⇒ GLYCAN

Returns a new instance of GLYCAN.



20
21
22
# File 'lib/bio/db/kegg/glycan.rb', line 20

def initialize(entry)
  super(entry, TAGSIZE)
end

Instance Method Details

#commentObject

COMMENT



102
103
104
# File 'lib/bio/db/kegg/glycan.rb', line 102

def comment
  field_fetch('COMMENT')
end

#compositionObject

COMPOSITION



35
36
37
38
39
40
41
42
43
44
# File 'lib/bio/db/kegg/glycan.rb', line 35

def composition
  unless @data['COMPOSITION']
    hash = Hash.new(0)
    fetch('COMPOSITION').scan(/\((\S+)\)(\d+)/).each do |key, val|
      hash[key] = val.to_i
    end
    @data['COMPOSITION'] = hash
  end
  @data['COMPOSITION']
end

#compoundsObject

COMPOUND



60
61
62
63
64
65
# File 'lib/bio/db/kegg/glycan.rb', line 60

def compounds
  unless @data['COMPOUND']
    @data['COMPOUND'] = fetch('COMPOUND').split(/\s+/)
  end
  @data['COMPOUND']
end

DBLINKS



129
130
131
132
133
134
# File 'lib/bio/db/kegg/glycan.rb', line 129

def dblinks
  unless @data['DBLINKS']
    @data['DBLINKS'] = lines_fetch('DBLINKS')
  end
  @data['DBLINKS']
end

#entry_idObject

ENTRY



25
26
27
# File 'lib/bio/db/kegg/glycan.rb', line 25

def entry_id
  field_fetch('ENTRY')[/\S+/]
end

#enzymesObject

ENZYME



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/bio/db/kegg/glycan.rb', line 81

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

#kcfObject

ATOM, BOND



137
138
139
# File 'lib/bio/db/kegg/glycan.rb', line 137

def kcf
  return "#{get('NODE')}#{get('EDGE')}"
end

#keggclassObject

CLASS



55
56
57
# File 'lib/bio/db/kegg/glycan.rb', line 55

def keggclass
  field_fetch('CLASS') 
end

#massObject

MASS



47
48
49
50
51
52
# File 'lib/bio/db/kegg/glycan.rb', line 47

def mass
  unless @data['MASS']
    @data['MASS'] = field_fetch('MASS')[/[\d\.]+/].to_f
  end
  @data['MASS']
end

#nameObject

NAME



30
31
32
# File 'lib/bio/db/kegg/glycan.rb', line 30

def name
  field_fetch('NAME') 
end

#orthologsObject

ORTHOLOGY



94
95
96
97
98
99
# File 'lib/bio/db/kegg/glycan.rb', line 94

def orthologs
  unless @data['ORTHOLOGY']
    @data['ORTHOLOGY'] = lines_fetch('ORTHOLOGY')
  end
  @data['ORTHOLOGY']
end

#pathwaysObject

PATHWAY



76
77
78
# File 'lib/bio/db/kegg/glycan.rb', line 76

def pathways
  lines_fetch('PATHWAY') 
end

#reactionsObject

REACTION



68
69
70
71
72
73
# File 'lib/bio/db/kegg/glycan.rb', line 68

def reactions
  unless @data['REACTION']
    @data['REACTION'] = fetch('REACTION').split(/\s+/)
  end
  @data['REACTION']
end

#referencesObject

REFERENCE



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/bio/db/kegg/glycan.rb', line 112

def references
  unless @data['REFERENCE']
    ary = Array.new
    lines = lines_fetch('REFERENCE')
    lines.each do |line|
      if /^\d+\s+\[PMID/.match(line)
        ary << line
      else
        ary.last << " #{line.strip}"
      end
    end
    @data['REFERENCE'] = ary
  end
  @data['REFERENCE']
end

#remarkObject

REMARK



107
108
109
# File 'lib/bio/db/kegg/glycan.rb', line 107

def remark
  field_fetch('REMARK')
end