class Bio::Jaspar::Motif
A subclass of Bio::Motifs::Motif used to represent a JASPAR profile.
Additional metadata information are stored if available. The metadata availability depends on the source of the JASPAR motif (a ‘pfm’ format file, a ‘jaspar’ format file or a JASPAR database).
A direct import of Bio.motifs.jaspar module in Biopython
Attributes
acc[RW]
collection[RW]
comment[RW]
data_type[RW]
matrix_id[RW]
medline[RW]
pazar_id[RW]
species[RW]
tax_group[RW]
tf_class[RW]
tf_family[RW]
Public Class Methods
new(matrix_id, name, opts = {})
click to toggle source
Construct a JASPAR Motif
instance
Calls superclass method
# File lib/bio-jaspar/jaspar.rb, line 43 def initialize(matrix_id, name, opts = {}) opts = { :alphabet => DNA, :instances => nil, :counts => nil, :collection => nil, :tf_class => nil, :tf_family => nil, :species => nil, :tax_group => nil, :acc => nil, :data_type => nil, :medline => nil, :pazar_id => nil, :comment => nil }.merge(opts) super(opts[:alphabet], opts[:instances], opts[:counts]) @name = name @matrix_id = matrix_id @collection = opts[:collection] @tf_class = opts[:tf_class] @tf_family = opts[:tf_family] @species = opts[:species] @tax_group = opts[:tax_group] @acc = opts[:acc] @data_type = opts[:data_type] @medline = opts[:medline] @pazar_id = opts[:pazar_id] @comment = opts[:comment] end
Public Instance Methods
==(other)
click to toggle source
Compare two JASPAR motifs for equality. Two motifs are equal if their matrix_ids match
# File lib/bio-jaspar/jaspar.rb, line 150 def ==(other) return @matrix_id == other.matrix_id end
base_id()
click to toggle source
Return the JASPAR base matrix ID
# File lib/bio-jaspar/jaspar.rb, line 77 def base_id base_id, _ = Jaspar.split_jaspar_id(@matrix_id) return base_id end
hash()
click to toggle source
Return the hash key corresponding to the JASPAR profile
Note: We assume the unicity of matrix IDs
# File lib/bio-jaspar/jaspar.rb, line 144 def hash return @matrix_id.hash end
to_s()
click to toggle source
Return a string represention of the JASPAR profile.
We choose to provide only the filled metadata information.
# File lib/bio-jaspar/jaspar.rb, line 91 def to_s tf_name_str = "TF name\t#{@name}\n" matrix_id_str = "Matrix ID\t#{@matrix_id}\n" the_string = tf_name_str + matrix_id_str if @collection collection_str = "Collection\t#{@collection}\n" the_string += collection_str end if @tf_class tf_class_str = "TF class\t#{@tf_class}\n" the_string += tf_class_str end if @tf_family tf_family_str = "TF family\t#{@tf_family}\n" the_string += tf_family_str end if @species species_str = "Species\t#{@species.join(",")}\n" the_string += species_str end if @tax_group tax_group_str = "Taxonomic group\t#{@tax_group}\n" the_string += tax_group_str end if @acc acc_str = "Accession\t#{@acc}\n" the_string += acc_str end if @data_type data_type_str = "Data type used\t#{@data_type}\n" the_string += data_type_str end if @medline medline_str = "Medline\t#{@medline}\n" the_string += medline_str end if @pazar_id pazar_id_str = "PAZAR ID\t#{@pazar_id}\n" the_string += pazar_id_str end if @comment comment_str = "Comments\t#{@comment}\n" the_string += comment_str end matrix_str = "Matrix:\n#{counts}\n\n" the_string += matrix_str return the_string end
version()
click to toggle source
Return the JASPAR matrix version
# File lib/bio-jaspar/jaspar.rb, line 83 def version _, version = Jaspar.split_jaspar_id(@matrix_id) return version end