Class: Bio::Jaspar::Motif
- Inherits:
-
Motifs::Motif
- Object
- Motifs::Motif
- Bio::Jaspar::Motif
- Defined in:
- lib/bio-jaspar/jaspar.rb
Overview
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
Instance Attribute Summary collapse
-
#acc ⇒ Object
Returns the value of attribute acc.
-
#collection ⇒ Object
Returns the value of attribute collection.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#data_type ⇒ Object
Returns the value of attribute data_type.
-
#matrix_id ⇒ Object
Returns the value of attribute matrix_id.
-
#medline ⇒ Object
Returns the value of attribute medline.
-
#pazar_id ⇒ Object
Returns the value of attribute pazar_id.
-
#species ⇒ Object
Returns the value of attribute species.
-
#tax_group ⇒ Object
Returns the value of attribute tax_group.
-
#tf_class ⇒ Object
Returns the value of attribute tf_class.
-
#tf_family ⇒ Object
Returns the value of attribute tf_family.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Compare two JASPAR motifs for equality.
-
#base_id ⇒ Object
Return the JASPAR base matrix ID.
-
#hash ⇒ Object
Note: We assume the unicity of matrix IDs.
-
#initialize(matrix_id, name, opts = {}) ⇒ Motif
constructor
Construct a JASPAR Motif instance.
-
#to_s ⇒ Object
We choose to provide only the filled metadata information.
-
#version ⇒ Object
Return the JASPAR matrix version.
Constructor Details
#initialize(matrix_id, name, opts = {}) ⇒ Motif
Construct a JASPAR Motif instance
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# 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 |
Instance Attribute Details
#acc ⇒ Object
Returns the value of attribute acc.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def acc @acc end |
#collection ⇒ Object
Returns the value of attribute collection.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def collection @collection end |
#comment ⇒ Object
Returns the value of attribute comment.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def comment @comment end |
#data_type ⇒ Object
Returns the value of attribute data_type.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def data_type @data_type end |
#matrix_id ⇒ Object
Returns the value of attribute matrix_id.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def matrix_id @matrix_id end |
#medline ⇒ Object
Returns the value of attribute medline.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def medline @medline end |
#pazar_id ⇒ Object
Returns the value of attribute pazar_id.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def pazar_id @pazar_id end |
#species ⇒ Object
Returns the value of attribute species.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def species @species end |
#tax_group ⇒ Object
Returns the value of attribute tax_group.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def tax_group @tax_group end |
#tf_class ⇒ Object
Returns the value of attribute tf_class.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def tf_class @tf_class end |
#tf_family ⇒ Object
Returns the value of attribute tf_family.
38 39 40 |
# File 'lib/bio-jaspar/jaspar.rb', line 38 def tf_family @tf_family end |
Instance Method Details
#==(other) ⇒ Object
Compare two JASPAR motifs for equality. Two motifs are equal if their matrix_ids match
150 151 152 |
# File 'lib/bio-jaspar/jaspar.rb', line 150 def ==(other) return @matrix_id == other.matrix_id end |
#base_id ⇒ Object
Return the JASPAR base matrix ID
77 78 79 80 |
# File 'lib/bio-jaspar/jaspar.rb', line 77 def base_id base_id, _ = Jaspar.split_jaspar_id(@matrix_id) return base_id end |
#hash ⇒ Object
Note: We assume the unicity of matrix IDs
144 145 146 |
# File 'lib/bio-jaspar/jaspar.rb', line 144 def hash return @matrix_id.hash end |
#to_s ⇒ Object
We choose to provide only the filled metadata information.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# 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 ⇒ Object
Return the JASPAR matrix version
83 84 85 86 |
# File 'lib/bio-jaspar/jaspar.rb', line 83 def version _, version = Jaspar.split_jaspar_id(@matrix_id) return version end |