Class: Bio::Sequence::DBLink

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/sequence/dblink.rb

Overview

Bio::Sequence::DBLink stores IDs with the database name. Its main purpose is to store database cross-reference information for a sequence entry.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database, primary_id, *secondary_ids) ⇒ DBLink

creates a new DBLink object



19
20
21
22
23
# File 'lib/bio/sequence/dblink.rb', line 19

def initialize(database, primary_id, *secondary_ids)
  @database = database
  @id = primary_id
  @secondary_ids = secondary_ids
end

Instance Attribute Details

#databaseObject (readonly)

Database name, or namespace identifier (String).



26
27
28
# File 'lib/bio/sequence/dblink.rb', line 26

def database
  @database
end

#idObject (readonly)

Primary identifier (String)



29
30
31
# File 'lib/bio/sequence/dblink.rb', line 29

def id
  @id
end

#secondary_idsObject (readonly)

Secondary identifiers (Array of String)



32
33
34
# File 'lib/bio/sequence/dblink.rb', line 32

def secondary_ids
  @secondary_ids
end

Class Method Details

.parse_embl_DR_line(str) ⇒ Object

Parses DR line in EMBL entry, and returns a DBLink object.



39
40
41
42
43
# File 'lib/bio/sequence/dblink.rb', line 39

def self.parse_embl_DR_line(str)
  str = str.sub(/\.\s*\z/, '')
  str.sub!(/\ADR   /, '')
  self.new(*(str.split(/\s*\;\s*/, 3)))
end

.parse_uniprot_DR_line(str) ⇒ Object

Parses DR line in UniProt entry, and returns a DBLink object.



46
47
48
49
50
# File 'lib/bio/sequence/dblink.rb', line 46

def self.parse_uniprot_DR_line(str)
  str = str.sub(/\.\s*\z/, '')
  str.sub!(/\ADR   /, '')
  self.new(*(str.split(/\s*\;\s*/)))
end