Class: Bio::KEGG::GLYCAN

Inherits:
Bio::KEGGDB show all
Includes:
Common::DblinksAsHash, Common::OrthologsAsHash, Common::PathwaysAsHash
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.



36
37
38
# File 'lib/bio/db/kegg/glycan.rb', line 36

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

Instance Method Details

#commentObject

COMMENT



118
119
120
# File 'lib/bio/db/kegg/glycan.rb', line 118

def comment
  field_fetch('COMMENT')
end

#compositionObject

COMPOSITION



51
52
53
54
55
56
57
58
59
60
# File 'lib/bio/db/kegg/glycan.rb', line 51

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



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

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

Returns a Hash of the DB name and an Array of entry IDs in DBLINKS field.



23
# File 'lib/bio/db/kegg/glycan.rb', line 23

def dblinks_as_hash; super; end

DBLINKS



145
146
147
148
149
150
# File 'lib/bio/db/kegg/glycan.rb', line 145

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

#entry_idObject

ENTRY



41
42
43
# File 'lib/bio/db/kegg/glycan.rb', line 41

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

#enzymesObject

ENZYME



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/bio/db/kegg/glycan.rb', line 97

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



153
154
155
# File 'lib/bio/db/kegg/glycan.rb', line 153

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

#keggclassObject

CLASS



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

def keggclass
  field_fetch('CLASS') 
end

#massObject

MASS



63
64
65
66
67
68
# File 'lib/bio/db/kegg/glycan.rb', line 63

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

#nameObject

NAME



46
47
48
# File 'lib/bio/db/kegg/glycan.rb', line 46

def name
  field_fetch('NAME') 
end

#orthologs_as_hashObject Also known as: orthologs

Returns a Hash of the orthology ID and definition in ORTHOLOGY field.



33
# File 'lib/bio/db/kegg/glycan.rb', line 33

def orthologs_as_hash; super; end

#orthologs_as_stringsObject

ORTHOLOGY



110
111
112
113
114
115
# File 'lib/bio/db/kegg/glycan.rb', line 110

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

#pathways_as_hashObject Also known as: pathways

Returns a Hash of the pathway ID and name in PATHWAY field.



28
# File 'lib/bio/db/kegg/glycan.rb', line 28

def pathways_as_hash; super; end

#pathways_as_stringsObject

PATHWAY



92
93
94
# File 'lib/bio/db/kegg/glycan.rb', line 92

def pathways_as_strings
  lines_fetch('PATHWAY') 
end

#reactionsObject

REACTION



84
85
86
87
88
89
# File 'lib/bio/db/kegg/glycan.rb', line 84

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

#referencesObject

REFERENCE



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/bio/db/kegg/glycan.rb', line 128

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



123
124
125
# File 'lib/bio/db/kegg/glycan.rb', line 123

def remark
  field_fetch('REMARK')
end