module Bio::EMBLDB::Common
Constants
- DELIMITER
- RS
- TAGSIZE
Public Class Methods
Source
# File lib/bio/db/embl/common.rb 87 def initialize(entry) 88 super(entry, TAGSIZE) 89 end
Public Instance Methods
Source
# File lib/bio/db/embl/common.rb 100 def ac 101 unless @data['AC'] 102 tmp = Array.new 103 field_fetch('AC').split(/ /).each do |e| 104 tmp.push(e.sub(/;/,'')) 105 end 106 @data['AC'] = tmp 107 end 108 @data['AC'] 109 end
returns a Array of accession numbers in the AC lines.
AC Line
"AC A12345; B23456;" AC [AC1;]+
Accession numbers format:
1 2 3 4 5 6 [O,P,Q] [0-9] [A-Z, 0-9] [A-Z, 0-9] [A-Z, 0-9] [0-9]
Source
# File lib/bio/db/embl/common.rb 114 def accession 115 ac[0] 116 end
returns the first accession number in the AC lines
Source
# File lib/bio/db/embl/common.rb 122 def de 123 unless @data['DE'] 124 @data['DE'] = fetch('DE') 125 end 126 @data['DE'] 127 end
returns a String int the DE line.
DE Line
Source
# File lib/bio/db/embl/common.rb 332 def dr 333 unless @data['DR'] 334 tmp = Hash.new 335 self.get('DR').split(/\n/).each do |db| 336 a = db.sub(/^DR /,'').sub(/.$/,'').strip.split(/;[ ]/) 337 dbname = a.shift 338 tmp[dbname] = Array.new unless tmp[dbname] 339 tmp[dbname].push(a) 340 end 341 @data['DR'] = tmp 342 end 343 if block_given? 344 @data['DR'].each do |k,v| 345 yield(k, v) 346 end 347 else 348 @data['DR'] 349 end 350 end
returns contents in the DR line.
-
Bio::EMBLDB::Common#dr
-> [ <Database cross-reference Hash>* ]
where <Database cross-reference Hash> is:
-
Bio::EMBLDB::Common#dr
{|k,v| }
DR Line; defabases cross-reference (>=0) a cross_ref pre one line
"DR database_identifier; primary_identifier; secondary_identifier."
Source
# File lib/bio/db/embl/common.rb 221 def kw 222 unless @data['KW'] 223 if get('KW').size > 0 224 tmp = fetch('KW').sub(/.$/,'') 225 @data['KW'] = tmp.split(/;/).map {|e| e.strip } 226 else 227 @data['KW'] = [] 228 end 229 end 230 @data['KW'] 231 end
returns keywords in the KW line.
-
Bio::EMBLDB::Common#kw
-> [ <keyword>* ]
KW Line; keyword (>=1)
KW [Keyword;]+
Source
# File lib/bio/db/embl/common.rb 204 def oc 205 unless @data['OC'] 206 begin 207 @data['OC'] = fetch('OC').sub(/.$/,'').split(/;/).map {|e| 208 e.strip 209 } 210 rescue NameError 211 nil 212 end 213 end 214 @data['OC'] 215 end
returns contents in the OC line.
-
Bio::EMBLDB::Common#oc
-> [ <organism class String>* ]
OC Line; organism classification (>=1)
OC Eukaryota; Alveolata; Apicomplexa; Piroplasmida; Theileriidae; OC Theileria.
Source
# File lib/bio/db/embl/common.rb 181 def og 182 unless @data['OG'] 183 og = Array.new 184 if get('OG').size > 0 185 ogstr = fetch('OG') 186 ogstr.sub!(/\.$/,'') 187 ogstr.sub!(/ and/,'') 188 ogstr.sub!(/;/, ',') 189 ogstr.split(',').each do |tmp| 190 og.push(tmp.strip) 191 end 192 end 193 @data['OG'] = og 194 end 195 @data['OG'] 196 end
returns contents in the OG line.
-
Bio::EMBLDB::Common#og
-> [ <ogranella String>* ]
OG Line; organella (0 or 1/entry)
OG Plastid; Chloroplast. OG Mitochondrion. OG Plasmid sym pNGR234a. OG Plastid; Cyanelle. OG Plasmid pSymA (megaplasmid 1). OG Plasmid pNRC100, Plasmid pNRC200, and Plasmid pHH1.
Source
# File lib/bio/db/embl/common.rb 149 def os(num = nil) 150 unless @data['OS'] 151 os = Array.new 152 fetch('OS').split(/, and|, /).each do |tmp| 153 if tmp =~ /([A-Z][a-z]* *[\w \:\'\+\-]+\w)/ 154 org = $1 155 tmp =~ /(\(.+\))/ 156 os.push({'name' => $1, 'os' => org}) 157 else 158 raise "Error: OS Line. #{$!}\n#{fetch('OS')}\n" 159 end 160 end 161 @data['OS'] = os 162 end 163 if num 164 # EX. "Trifolium repens (white clover)" 165 "#{@data['OS'][num]['os']} {#data['OS'][num]['name']" 166 end 167 @data['OS'] 168 end
returns contents in the OS line.
-
Bio::EMBLDB#os -> Array of <OS Hash>
where <OS Hash> is:
[{'name'=>'Human', 'os'=>'Homo sapiens'}, {'name'=>'Rat', 'os'=>'Rattus norveticus'}]
-
Bio::SPTR#os[‘name’] => “Human”
-
Bio::SPTR#os => {‘name’=>“Human”, ‘os’=>‘Homo sapiens’}
-
Bio::STPR#os(0) => “Homo sapiens (Human)”
OS Line; organism species (>=1)
"OS Trifolium repens (white clover)" OS Genus species (name). OS Genus species (name0) (name1). OS Genus species (name0) (name1). OS Genus species (name0), G s0 (name0), and G s (name1).
Source
# File lib/bio/db/embl/common.rb 243 def ref 244 unless @data['R'] 245 ary = Array.new 246 get('R').split(/\nRN /).each do |str| 247 raw = {'RN' => String.new, 'RC' => String.new, 248 'RP' => String.new, 'RX' => String.new, 249 'RA' => String.new, 'RT' => String.new, 250 'RL' => String.new, 'RG' => String.new} 251 str = 'RN ' + str unless /^RN / =~ str 252 str.split("\n").each do |line| 253 if /^(R[NPXARLCTG]) (.+)/ =~ line 254 raw[$1] += $2 + ' ' 255 else 256 raise "Invalid format in R lines, \n[#{line}]\n" 257 end 258 end 259 raw.each_value {|v| 260 v.strip! 261 v.sub!(/^"/,'') 262 v.sub!(/;$/,'') 263 v.sub!(/"$/,'') 264 } 265 ary.push(raw) 266 end 267 @data['R'] = ary 268 end 269 @data['R'] 270 end
returns contents in the R lines.
-
Bio::EMBLDB::Common#ref
-> [ <refernece information Hash>* ]
where <reference information Hash> is:
{'RN' => '', 'RC' => '', 'RP' => '', 'RX' => '', 'RA' => '', 'RT' => '', 'RL' => '', 'RG' => ''}
R Lines
-
RN RC RP RX RA RT RL RG
Source
# File lib/bio/db/embl/common.rb 274 def references 275 unless @data['references'] 276 ary = self.ref.map {|ent| 277 hash = Hash.new 278 ent.each {|key, value| 279 case key 280 when 'RN' 281 if /\[(\d+)\]/ =~ value.to_s 282 hash['embl_gb_record_number'] = $1.to_i 283 end 284 when 'RC' 285 unless value.to_s.strip.empty? 286 hash['comments'] ||= [] 287 hash['comments'].push value 288 end 289 when 'RP' 290 hash['sequence_position'] = value 291 when 'RA' 292 a = value.split(/\, /) 293 a.each do |x| 294 x.sub!(/( [^ ]+)\z/, ",\\1") 295 end 296 hash['authors'] = a 297 when 'RT' 298 hash['title'] = value 299 when 'RL' 300 if /(.*) (\d+) *(\(([^\)]+)\))?(\, |\:)([a-zA-Z\d]+\-[a-zA-Z\d]+) *\((\d+)\)\.?\z/ =~ value.to_s 301 hash['journal'] = $1.rstrip 302 hash['volume'] = $2 303 hash['issue'] = $4 304 hash['pages'] = $6 305 hash['year'] = $7 306 else 307 hash['journal'] = value 308 end 309 when 'RX' # PUBMED, DOI, (AGRICOLA) 310 value.split(/\. /).each {|item| 311 tag, xref = item.split(/\; /).map {|i| i.strip.sub(/\.\z/, '') } 312 hash[ tag.downcase ] = xref 313 } 314 end 315 } 316 Reference.new(hash) 317 } 318 @data['references'] = ary.extend(Bio::References::BackwardCompatibility) 319 end 320 @data['references'] 321 end
returns Bio::Reference
object from Bio::EMBLDB::Common#ref
.