Class: Bio::SiRNA

Inherits:
Object show all
Defined in:
lib/bio/util/sirna.rb

Overview

Bio::SiRNA

Designing siRNA.

This class implements the selection rules described by Kumiko Ui-Tei et al. (2004) and Reynolds et al. (2004).

Defined Under Namespace

Classes: Pair, ShRNA

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(seq, antisense_size = 21, max_gc_percent = 60.0, min_gc_percent = 40.0) ⇒ SiRNA

Input is a Bio::Sequence::NA object (the target sequence). Output is a list of Bio::SiRNA::Pair object.



64
65
66
67
68
69
70
# File 'lib/bio/util/sirna.rb', line 64

def initialize(seq, antisense_size = 21, max_gc_percent = 60.0, min_gc_percent = 40.0)
  @seq = seq.rna!
  @pairs = Array.new
  @antisense_size = antisense_size
  @max_gc_percent = max_gc_percent
  @min_gc_percent = min_gc_percent
end

Instance Attribute Details

#antisense_sizeObject

A parameter of size of antisense.



54
55
56
# File 'lib/bio/util/sirna.rb', line 54

def antisense_size
  @antisense_size
end

#max_gc_percentObject

A parameter of maximal %GC.



57
58
59
# File 'lib/bio/util/sirna.rb', line 57

def max_gc_percent
  @max_gc_percent
end

#min_gc_percentObject

A parameter of minimum %GC.



60
61
62
# File 'lib/bio/util/sirna.rb', line 60

def min_gc_percent
  @min_gc_percent
end

Instance Method Details

#design(rule = 'uitei') ⇒ Object

rule can be one of ‘uitei’ (default) and ‘reynolds’.



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
# File 'lib/bio/util/sirna.rb', line 105

def design(rule = 'uitei')
  @target_size = @antisense_size + 2

  target_start = 0
  @seq.window_search(@target_size) do |target|
    antisense = target.subseq(1, @target_size - 2).complement.rna
    sense     = target.subseq(3, @target_size)

    target_start += 1
    target_stop  = target_start + @target_size

    antisense_gc_percent = antisense.gc_percent
    next if antisense_gc_percent > @max_gc_percent
    next if antisense_gc_percent < @min_gc_percent
    
    case rule
    when 'uitei'
      next unless uitei?(target)
    when 'reynolds'
      next unless reynolds?(target)
    else
      raise NotImplementedError
    end

    pair = Bio::SiRNA::Pair.new(target, sense, antisense, target_start, target_stop, rule, antisense_gc_percent)
    @pairs.push(pair)
  end
  return @pairs
end

#reynoldsObject

same as design(‘reynolds’).



100
101
102
# File 'lib/bio/util/sirna.rb', line 100

def reynolds
  design('reynolds')
end

#reynolds?(target) ⇒ Boolean

Reynolds’ rule.

Returns:

  • (Boolean)


88
89
90
91
92
# File 'lib/bio/util/sirna.rb', line 88

def reynolds?(target)
  return false if /[GC]{9}/i =~ target
  return false unless /^.{4}A.{6}U.{2}[AUC].{5}[AU].{2}$/i =~ target
  return true
end

#uiteiObject

same as design(‘uitei’).



95
96
97
# File 'lib/bio/util/sirna.rb', line 95

def uitei
  design('uitei')
end

#uitei?(target) ⇒ Boolean

Ui-Tei’s rule.

Returns:

  • (Boolean)


73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/bio/util/sirna.rb', line 73

def uitei?(target)
  return false unless /^.{2}[GC]/i =~ target
  return false unless /[AU].{2}$/i =~ target
  return false if     /[GC]{9}/i   =~ target

  one_third  = target.size * 1 / 3
  start_pos  = @target_size - one_third - 1
  remain_seq = target.subseq(start_pos, @target_size - 2)
  au_number  = remain_seq.scan(/[AU]/i).size
  return false if au_number < 5
  
  return true
end