Class: Bio::Ensembl
- Defined in:
- lib/bio/io/ensembl.rb,
lib/bio/io/ensembl.rb
Overview
Codes for backward-compatibility.
Defined Under Namespace
Constant Summary collapse
- ENSEMBL_URL =
'http://www.ensembl.org'
- EBIServerURI =
ENSEMBL_URL
Instance Attribute Summary collapse
-
#organism ⇒ Object
readonly
Organism name.
-
#server ⇒ Object
readonly
Server URL (ex. ‘www.ensembl.org’).
Class Method Summary collapse
Instance Method Summary collapse
-
#exportview(*args) ⇒ Object
Ensembl ExportView Client.
-
#initialize(organism, server = nil) ⇒ Ensembl
constructor
A new instance of Ensembl.
Constructor Details
#initialize(organism, server = nil) ⇒ Ensembl
Returns a new instance of Ensembl.
73 74 75 76 77 |
# File 'lib/bio/io/ensembl.rb', line 73 def initialize(organism, server = nil) @server = server || ENSEMBL_URL @organism = organism @uri = [ @server.chomp('/'), @organism ].join('/') end |
Instance Attribute Details
#organism ⇒ Object (readonly)
Organism name. (ex. ‘Homo_sapiens’).
71 72 73 |
# File 'lib/bio/io/ensembl.rb', line 71 def organism @organism end |
#server ⇒ Object (readonly)
Server URL (ex. ‘www.ensembl.org’)
68 69 70 |
# File 'lib/bio/io/ensembl.rb', line 68 def server @server end |
Class Method Details
.human ⇒ Object
79 80 81 |
# File 'lib/bio/io/ensembl.rb', line 79 def self.human self.new("Homo_sapiens") end |
.mouse ⇒ Object
83 84 85 |
# File 'lib/bio/io/ensembl.rb', line 83 def self.mouse self.new("Mus_musculus") end |
.server_uri(uri = nil) ⇒ Object
204 205 206 207 208 209 210 |
# File 'lib/bio/io/ensembl.rb', line 204 def self.server_uri(uri = nil) if uri @uri = uri else @uri || EBIServerURI end end |
Instance Method Details
#exportview(*args) ⇒ Object
Ensembl ExportView Client.
Retrieve genomic sequence/features from Ensembl ExportView in plain text. Ensembl ExportView exports genomic data (sequence and features) in several file formats including fasta, GFF and tab.
-
ExportViwe (www.ensembl.org/Homo_sapiens/exportview).
Examples
human = Bio::Ensembl.new('Homo_sapiens')
or
human = Bio::Ensembl.human
# Genomic sequence in Fasta format
human.exportview(:seq_region_name => 1,
:anchor1 => 1149206, :anchor2 => 1149229)
human.exportview(1, 1149206, 1149229)
# Feature in GFF
human.exportview(:seq_region_name => 1,
:anchor1 => 1149206, :anchor2 => 1150000,
:options => ['similarity', 'repeat',
'genscan', 'variation', 'gene'])
human.exportview(1, 1149206, 1150000, ['variation', 'gene'])
Feature in TAB
human.exportview(:seq_region_name => 1,
:anchor1 => 1149206, :anchor2 => 1150000,
:options => ['similarity', 'repeat',
'genscan', 'variation', 'gene'],
:format => 'tab')
Arguments
Bio::Ensembl#exportview method allow both orderd arguments and named arguments. (Note: mandatory arguments are marked by ‘*’).
Orderd Arguments
-
seq_region_name - Chromosome number (*)
-
anchor1 - From coordination (*)
-
anchor2 - To coordination (*)
-
options - Features to export (in :format => ‘gff’ or ‘tab’)
['similarity', 'repeat', 'genscan', 'variation', 'gene']
Named Arguments
-
:seq_region_name - Chromosome number (*)
-
:anchor1 - From coordination (*)
-
:anchor2 - To coordination (*)
-
:type1 - From coordination type [‘bp’, ]
-
:type2 - To coordination type [‘bp’, ]
-
:upstream - Bp upstream
-
:downstream - Bp downstream
-
:format - File format [‘fasta’, ‘gff’, ‘tab’]
-
:options - Features to export (for :format => ‘gff’ or ‘tab’)
['similarity', 'repeat', 'genscan', 'variation', 'gene']
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/bio/io/ensembl.rb', line 148 def exportview(*args) defaults = { :type1 => 'bp', :type2 => 'bp', :downstream => '', :upstream => '', :format => 'fasta', :options => [], :action => 'export', :_format => 'Text', :output => 'txt', :submit => 'Continue >>' } if args.first.class == Hash = args.first if [:options] and [:format] != 'fasta' and [:format] != 'tab' .update({:format => 'gff'}) end else = { :seq_region_name => args[0], :anchor1 => args[1], :anchor2 => args[2], } case args[3] when Array .update({:format => 'gff', :options => args[3]}) when Hash .update(args[3]) end if args[4].class == Hash .update(args[4]) end end params = defaults.update() result = Bio::Command.post_form("#{@uri}/exportview", params) return result.body end |