Class: PredictORF
- Inherits:
-
Object
- Object
- PredictORF
- Includes:
- Bio::Big::FrameCodonHelpers
- Defined in:
- lib/bigbio/sequence/predictorf.rb
Constant Summary
Constants included from Bio::Big::FrameCodonHelpers
Bio::Big::FrameCodonHelpers::START_CODONS, Bio::Big::FrameCodonHelpers::STOP_CODONS
Instance Method Summary collapse
-
#initialize(id, descr, seq, trn_table = nil) ⇒ PredictORF
constructor
A new instance of PredictORF.
-
#longest_startstop(minsize = 0) ⇒ Object
Return the longest ORF that has a START codon (see
startstop
) Returns nil if none is found. -
#startstop(minsize = 30) ⇒ Object
Return a list of predicted ORFs with :minsize AA’s.
-
#stopstop(minsize = 30) ⇒ Object
Return a list of predicted ORFs with :minsize AA’s.
Constructor Details
#initialize(id, descr, seq, trn_table = nil) ⇒ PredictORF
Returns a new instance of PredictORF.
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/bigbio/sequence/predictorf.rb', line 84 def initialize id, descr, seq, trn_table = nil @id = id @descr = descr @seq = seq.gsub(/\s/,'') @trn_table = trn_table @startcodons = # FIXME: this should be linked properly if trn_table == nil or trn_table == 0 START_CODONS else # prokaryote ['ATG','TTG','CTG','AUG','UUG','CUG'] end end |
Instance Method Details
#longest_startstop(minsize = 0) ⇒ Object
Return the longest ORF that has a START codon (see startstop
) Returns nil if none is found
136 137 138 |
# File 'lib/bigbio/sequence/predictorf.rb', line 136 def longest_startstop minsize=0 startstop(minsize).first end |
#startstop(minsize = 30) ⇒ Object
Return a list of predicted ORFs with :minsize AA’s. The ORF’s are between START and STOP codons (ATG, TTG, CTG and AUG, UUG and CUG for now, a later version should use the EMBOSS translation table).
127 128 129 130 131 132 |
# File 'lib/bigbio/sequence/predictorf.rb', line 127 def startstop minsize=30 stopstop(minsize).find_all { | orf | # p [orf.nt.seq[0..2].upcase,@startcodons.include?(orf.nt.seq[0..2].upcase)] @startcodons.include?(orf.nt.seq[0..2].upcase) } end |
#stopstop(minsize = 30) ⇒ Object
Return a list of predicted ORFs with :minsize AA’s. The ORF’s are between STOP codons (so sequences without a proper START codon are included)
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/bigbio/sequence/predictorf.rb', line 100 def stopstop minsize=30 type = "XX" orfs = [] translate = Nucleotide::Translate.new(@trn_table) aa_frames = translate.aa_6_frames(@seq) # p @seq # pp aa_frames num = 0 aa_frames.each do | aa_frame | frame = aa_frame[:frame] aa = aa_frame[:sequence] aa_start = 0 aa.split(/\*/).each do | candidate | if candidate.size >= minsize and candidate.size > 0 orf = ORF.new(num,type,@id,@descr,@seq,frame,aa_start*3,candidate) orfs.push orf num += 1 end aa_start += candidate.size + 1 end end orfs end |