Class: Bioroebe::ReverseComplement
- Inherits:
-
Sequence
show all
- Defined in:
- lib/bioroebe/sequence/reverse_complement.rb
Overview
Bioroebe::ReverseComplement
Constant Summary
collapse
- DEFAULT_INPUT =
'AAAACCCGGT'
Constants inherited
from Sequence
Sequence::REMOVE_INVALID_CHARACTERS, Sequence::SHALL_WE_UPCASE
Class Method Summary
collapse
-
.[](i) ⇒ Object
# === Bioroebe::ReverseComplement[] ========================================================================= #.
Instance Method Summary
collapse
Methods inherited from Sequence
#automatic_support_for_nucleotides, #description?, #index, #infer_type, #is_DNA?, #is_RNA?, #is_a_protein?, #is_a_protein_now, #map, #n_uracil?, #randomize, #remove_invalid_entries_from_the_dna_sequence, #remove_invalid_entries_from_the_dna_sequence!, #return_string_nucleotides_or_aminoacids, #sanitize_dataset, #sanitize_rna, #save_sequence_to_this_file, sequence_from_file, #set_description, #set_dna, #set_protein, #set_rna, #set_save_file, #set_sequence, #set_type, #shall_we_upcase?, #size?, #to_genbank, #to_regexp, #type?
Methods inherited from RawSequence
#+, #<<, #[]=, #calculate_levensthein_distance, #chars?, #complement, #composition?, #count, #delete, #delete!, #downcase, #each_char, #empty?, #find_substring_indices, #first_position=, #freeze, #gsub, #gsub!, #include?, #insert_at_this_position, #prepend, #remove_n_characters_from_the_left_side, #reverse, #reverse!, #reverse_complement, #scan, #set_raw_sequence, #shuffle, #size?, #split, #start_with?, #strip, #subseq, #to_s, #to_str, #tr!, #upcase!
Constructor Details
#initialize(i = DEFAULT_INPUT, run_already = true) ⇒ ReverseComplement
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/bioroebe/sequence/reverse_complement.rb', line 38
def initialize(
i = DEFAULT_INPUT,
run_already = true
)
reset
set_sequence(i)
if block_given?
yielded = yield
case yielded
when :be_quiet
@be_verbose = false
end
end
run if run_already
end
|
Class Method Details
.[](i) ⇒ Object
#
Bioroebe::ReverseComplement[]
#
121
122
123
124
|
# File 'lib/bioroebe/sequence/reverse_complement.rb', line 121
def self.[](i)
sequence = new(i) { :be_quiet }.complement_sequence?
return sequence
end
|
Instance Method Details
#complement? ⇒ Boolean
Also known as:
result?, complement_sequence?
74
75
76
|
# File 'lib/bioroebe/sequence/reverse_complement.rb', line 74
def complement?
@complement
end
|
#report ⇒ Object
82
83
84
|
# File 'lib/bioroebe/sequence/reverse_complement.rb', line 82
def report
e @complement if @be_verbose
end
|
#reset ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/bioroebe/sequence/reverse_complement.rb', line 63
def reset
super()
@be_verbose = true
end
|
#run ⇒ Object
89
90
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
|
# File 'lib/bioroebe/sequence/reverse_complement.rb', line 89
def run
_ = sequence?
_ = _.reverse
@complement = ''.dup
chars = _.chars
chars.each {|character|
case character
when 'A'
@complement << 'T'
when 'T','U'
@complement << 'A'
when 'C'
@complement << 'G'
when 'G'
@complement << 'C'
end
}
report if @be_verbose
end
|