Module: Wrnap::Global::Entrez
- Defined in:
- lib/wrnap/global/entrez.rb
Class Method Summary collapse
- .na_sequence_from_entrez(id, position, window, buffer_size = 0) ⇒ Object
- .rna_sequence_from_entrez(id, position, window, buffer_size = 0) ⇒ Object
- .sequence_from_entrez(id, position, window) ⇒ Object
- .simple_rna_sequence(id, from, to) ⇒ Object
Class Method Details
.na_sequence_from_entrez(id, position, window, buffer_size = 0) ⇒ Object
15 16 17 |
# File 'lib/wrnap/global/entrez.rb', line 15 def na_sequence_from_entrez(id, position, window, buffer_size = 0) Bio::Sequence::NA.new(sequence_from_entrez(id, position, Range.new(window.min - buffer_size, window.max + buffer_size)).seq) end |
.rna_sequence_from_entrez(id, position, window, buffer_size = 0) ⇒ Object
11 12 13 |
# File 'lib/wrnap/global/entrez.rb', line 11 def rna_sequence_from_entrez(id, position, window, buffer_size = 0) na_sequence_from_entrez(id, position, window, buffer_size).rna end |
.sequence_from_entrez(id, position, window) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/wrnap/global/entrez.rb', line 19 def sequence_from_entrez(id, position, window) Wrnap.debugger { "Retrieving sequence from Entrez: using nuccore DB (id: #{id}, seq_start: #{position + window.min}, seq_stop: #{position + window.max})" } Wrnap.debugger { "> True starting position: #{position} with window #{window.min} to #{window.max}" } fasta = ::Entrez.EFetch("nuccore", { id: id, seq_start: position + window.min, seq_stop: position + window.max, retmode: :fasta, rettype: :text }) Wrnap.debugger { fasta } Bio::FastaFormat.new(fasta.response.body) end |
.simple_rna_sequence(id, from, to) ⇒ Object
5 6 7 8 9 |
# File 'lib/wrnap/global/entrez.rb', line 5 def simple_rna_sequence(id, from, to) sequence = rna_sequence_from_entrez(id, [from, to].min, 0..((to - from).abs)) to < from ? sequence.complement : sequence end |