Class: Bio::AAindex

Inherits:
KEGGDB show all
Defined in:
lib/bio/db/aaindex.rb

Overview

Description

Bio::AAindex is the super class of Bio::AAindex1 and Bio::AAindex2, parser classes for AAindex Amino Acid Index Database.

Except Bio::AAindex.auto, do not use this class directly. Methods of this super class is used from AAindex1 and AAindex2 classes.

Examples

# auto-detection of data format
aax1 = Bio::AAindex.auto("PRAM900102.aaindex1")
aax2 = Bio::AAindex.auto("DAYM780301.aaindex2")

# Example of Bio::AAindex1 class
aax1 = Bio::AAindex1.new("PRAM900102.aaindex1")
aax1.entry_id
aax1.index

# Example of Bio::AAindex2 class
aax2 = Bio::AAindex2.new("DAYM780301.aaindex2")
aax2.entry_id
aax2.matrix
aax2.matrix[2,2]
aax2.matrix('R', 'A')
aax2['R', 'A']

References

Direct Known Subclasses

AAindex1, AAindex2

Constant Summary collapse

DELIMITER =

Delimiter

"\n//\n"
RS =

Delimiter

DELIMITER
TAGSIZE =

Bio::DB API

2

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DB

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

Constructor Details

#initialize(entry) ⇒ AAindex

Returns a new instance of AAindex.



99
100
101
# File 'lib/bio/db/aaindex.rb', line 99

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

Class Method Details

.auto(str) ⇒ Object

Auto detecter for two AAindex formats. returns a Bio::AAindex1 object or a Bio::AAindex2 object.



87
88
89
90
91
92
93
94
95
96
# File 'lib/bio/db/aaindex.rb', line 87

def self.auto(str)
  case str
  when /^I /m 
    Bio::AAindex1.new(str)
  when /^M /m
    Bio::AAindex2.new(str)
  else
    raise
  end        
end

Instance Method Details

#authorObject

Returns authors in the A line.



132
133
134
135
136
137
138
# File 'lib/bio/db/aaindex.rb', line 132

def author
  if @data['author']
    @data['author']
  else
    @data['author'] = field_fetch('A')
  end
end

#commentObject

Returns comment (if any).



159
160
161
162
163
164
165
# File 'lib/bio/db/aaindex.rb', line 159

def comment
  if @data['comment']
    @data['comment']
  else
    @data['comment'] = field_fetch('*')
  end
end

Returns database links in the R line. cf.) [‘LIT:123456’, ‘PMID:12345678’]



123
124
125
126
127
128
129
# File 'lib/bio/db/aaindex.rb', line 123

def dblinks
  if @data['ref']
    @data['ref']
  else
    @data['ref'] = field_fetch('R').split(' ')
  end
end

#definitionObject

Returns definition in the D line.



113
114
115
116
117
118
119
# File 'lib/bio/db/aaindex.rb', line 113

def definition
  if @data['definition']
    @data['definition']
  else
    @data['definition'] = field_fetch('D')
  end
end

#entry_idObject

Returns entry_id in the H line.



104
105
106
107
108
109
110
# File 'lib/bio/db/aaindex.rb', line 104

def entry_id
  if @data['entry_id']
    @data['entry_id']
  else
    @data['entry_id'] = field_fetch('H')
  end
end

#journalObject

Returns journal name in the J line.



150
151
152
153
154
155
156
# File 'lib/bio/db/aaindex.rb', line 150

def journal
  if @data['journal']
    @data['journal']
  else
    @data['journal'] = field_fetch('J')
  end
end

#titleObject

Returns title in the T line.



141
142
143
144
145
146
147
# File 'lib/bio/db/aaindex.rb', line 141

def title
  if @data['title']
    @data['title']
  else
    @data['title'] = field_fetch('T')
  end
end