Class: NpSearch::Sequence
- Inherits:
-
Object
- Object
- NpSearch::Sequence
- Defined in:
- lib/npsearch/sequence.rb
Overview
A class to hold sequence data
Constant Summary collapse
- DI_NP_CLV =
'KR|KK|RR'- MONO_NP_CLV =
'[KRH]..R|[KRH]....R|[KRH]......R'
Instance Attribute Summary collapse
-
#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.
-
#signalp_output ⇒ Object
readonly
Returns the value of attribute signalp_output.
-
#translated_frame ⇒ Object
readonly
Returns the value of attribute translated_frame.
Instance Method Summary collapse
- #format_seq_for_html ⇒ Object
-
#initialize(id, seq, signalp_output, frame = nil) ⇒ Sequence
constructor
A new instance of Sequence.
Constructor Details
#initialize(id, seq, signalp_output, frame = nil) ⇒ Sequence
Returns a new instance of Sequence.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/npsearch/sequence.rb', line 16 def initialize(id, seq, signalp_output, frame = nil) @id = id sp_cleavage_site_idx = signalp_output[:ymax_pos].to_i - 1 @signalp = seq[0..(sp_cleavage_site_idx - 1)] @seq = seq[sp_cleavage_site_idx..-1] @html_seq = format_seq_for_html @translated_frame = frame @score = 0 @potential_cleaved_nps = nil end |
Instance Attribute Details
#html_seq ⇒ Object (readonly)
Returns the value of attribute html_seq.
10 11 12 |
# File 'lib/npsearch/sequence.rb', line 10 def html_seq @html_seq end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/npsearch/sequence.rb', line 7 def id @id end |
#potential_cleaved_nps ⇒ Object
Returns the value of attribute potential_cleaved_nps.
14 15 16 |
# File 'lib/npsearch/sequence.rb', line 14 def potential_cleaved_nps @potential_cleaved_nps end |
#score ⇒ Object
Returns the value of attribute score.
13 14 15 |
# File 'lib/npsearch/sequence.rb', line 13 def score @score end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
9 10 11 |
# File 'lib/npsearch/sequence.rb', line 9 def seq @seq end |
#signalp ⇒ Object (readonly)
Returns the value of attribute signalp.
8 9 10 |
# File 'lib/npsearch/sequence.rb', line 8 def signalp @signalp end |
#signalp_output ⇒ Object (readonly)
Returns the value of attribute signalp_output.
11 12 13 |
# File 'lib/npsearch/sequence.rb', line 11 def signalp_output @signalp_output end |
#translated_frame ⇒ Object (readonly)
Returns the value of attribute translated_frame.
12 13 14 |
# File 'lib/npsearch/sequence.rb', line 12 def translated_frame @translated_frame end |
Instance Method Details
#format_seq_for_html ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/npsearch/sequence.rb', line 27 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 |