Sha256: 7b7700570bfd70021b052ab7b62c95ff2313c1c39a181387d101f56e31446c58

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

#
# = bio/sequence/dblink.rb - sequence ID with database name
#
# Copyright::  Copyright (C) 2008
#              Naohisa Goto <ng@bioruby.org>
# License::    The Ruby License
#

module Bio

require 'bio/sequence' unless const_defined?(:Sequence)

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

  # creates a new DBLink object
  def initialize(database, primary_id, *secondary_ids)
    @database = database
    @id = primary_id
    @secondary_ids = secondary_ids
  end

  # Database name, or namespace identifier (String).
  attr_reader :database

  # Primary identifier (String)
  attr_reader :id

  # Secondary identifiers (Array of String)
  attr_reader :secondary_ids

  #--
  # class methods
  #++

  # Parses DR line in EMBL entry, and returns a DBLink object.
  def self.parse_embl_DR_line(str)
    str = str.sub(/\.\s*\z/, '')
    str.sub!(/\ADR   /, '')
    self.new(*(str.split(/\s*\;\s*/, 3)))
  end

  # Parses DR line in UniProt entry, and returns a DBLink object.
  def self.parse_uniprot_DR_line(str)
    str = str.sub(/\.\s*\z/, '')
    str.sub!(/\ADR   /, '')
    self.new(*(str.split(/\s*\;\s*/)))
  end

end #class Sequence::DBLink

end #module Bio

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bio-2.0.5 lib/bio/sequence/dblink.rb
bio-2.0.4 lib/bio/sequence/dblink.rb
bio-2.0.3 lib/bio/sequence/dblink.rb
bio-2.0.2 lib/bio/sequence/dblink.rb
bio-2.0.1 lib/bio/sequence/dblink.rb
bio-2.0.0 lib/bio/sequence/dblink.rb
bio-1.6.0.pre.20181210 lib/bio/sequence/dblink.rb
bio-1.5.2 lib/bio/sequence/dblink.rb
bio-1.5.1 lib/bio/sequence/dblink.rb
bio-1.5.0 lib/bio/sequence/dblink.rb
bio-1.4.3.0001 lib/bio/sequence/dblink.rb
bio-1.4.3 lib/bio/sequence/dblink.rb