Class: NpSearch::Sequence
- Inherits:
-
Object
- Object
- NpSearch::Sequence
- Defined in:
- lib/npsearch/sequence.rb
Overview
Adapted from GeneValidator’s Query Class.. A class to hold sequence data
Constant Summary collapse
- DI_NP_CLV =
'KR|KK|RR'.freeze
- MONO_NP_CLV =
'[KRH]..R|[KRH]....R|[KRH]......R'.freeze
Instance Attribute Summary collapse
-
#defline ⇒ Object
readonly
Returns the value of attribute defline.
-
#html_seq ⇒ Object
readonly
Returns the value of attribute html_seq.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#potential_cleaved_nps ⇒ Object
Returns the value of attribute potential_cleaved_nps.
-
#score ⇒ Object
Returns the value of attribute score.
-
#seq ⇒ Object
readonly
Returns the value of attribute seq.
-
#signalp ⇒ Object
readonly
Returns the value of attribute signalp.
-
#translated_frame ⇒ Object
readonly
Returns the value of attribute translated_frame.
Instance Method Summary collapse
- #format_seq_for_html ⇒ Object
-
#initialize(entry, sp, frame = nil) ⇒ Sequence
constructor
A new instance of Sequence.
Constructor Details
#initialize(entry, sp, frame = nil) ⇒ Sequence
Returns a new instance of Sequence.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/npsearch/sequence.rb', line 18 def initialize(entry, sp, frame = nil) @id = entry.entry_id @defline = entry.definition sp_cleavage_site_idx = sp[:ymax_pos].to_i - 1 @signalp = sp[:orf][0..(sp_cleavage_site_idx - 1)] @seq = sp[:orf][sp_cleavage_site_idx..-1] @html_seq = format_seq_for_html @translated_frame = frame @score = 0 @potential_cleaved_nps = nil end |
Instance Attribute Details
#defline ⇒ Object (readonly)
Returns the value of attribute defline.
10 11 12 |
# File 'lib/npsearch/sequence.rb', line 10 def defline @defline end |
#html_seq ⇒ Object (readonly)
Returns the value of attribute html_seq.
13 14 15 |
# File 'lib/npsearch/sequence.rb', line 13 def html_seq @html_seq end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/npsearch/sequence.rb', line 9 def id @id end |
#potential_cleaved_nps ⇒ Object
Returns the value of attribute potential_cleaved_nps.
16 17 18 |
# File 'lib/npsearch/sequence.rb', line 16 def potential_cleaved_nps @potential_cleaved_nps end |
#score ⇒ Object
Returns the value of attribute score.
15 16 17 |
# File 'lib/npsearch/sequence.rb', line 15 def score @score end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
12 13 14 |
# File 'lib/npsearch/sequence.rb', line 12 def seq @seq end |
#signalp ⇒ Object (readonly)
Returns the value of attribute signalp.
11 12 13 |
# File 'lib/npsearch/sequence.rb', line 11 def signalp @signalp end |
#translated_frame ⇒ Object (readonly)
Returns the value of attribute translated_frame.
14 15 16 |
# File 'lib/npsearch/sequence.rb', line 14 def translated_frame @translated_frame end |
Instance Method Details
#format_seq_for_html ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/npsearch/sequence.rb', line 30 def format_seq_for_html seq = @seq.gsub(/C/, '<span class=cysteine>C</span>') seq.gsub!(/#{DI_NP_CLV}/i, '<span class=np_clv>\0</span>') seq.gsub!(/#{MONO_NP_CLV}/i, '\0::NP_CLV::') # so that we can target 'R' seq.gsub!('R::NP_CLV::', '<span class=mono_np_clv>R</span>') seq.gsub!('G<span class=np_clv>', '<span class=glycine>G</span><span class=np_clv>') "<span class=signalp>#{@signalp}</span><span class=seq>#{seq}</span>" end |