Class | Bio::Ensembl |
In: |
lib/bio/io/ensembl.rb
|
Parent: | Object |
Codes for backward-compatibility.
ENSEMBL_URL | = | 'http://www.ensembl.org' |
EBIServerURI | = | ENSEMBL_URL |
organism | [R] | Organism name. (ex. ‘Homo_sapiens’). |
server | [R] | Server URL (ex. ‘www.ensembl.org’) |
# File lib/bio/io/ensembl.rb, line 73 73: def initialize(organism, server = nil) 74: @server = server || ENSEMBL_URL 75: @organism = organism 76: @uri = [ @server.chomp('/'), @organism ].join('/') 77: end
# File lib/bio/io/ensembl.rb, line 204 204: def self.server_uri(uri = nil) 205: if uri 206: @uri = uri 207: else 208: @uri || EBIServerURI 209: end 210: end
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.
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')
Bio::Ensembl#exportview method allow both orderd arguments and named arguments. (Note: mandatory arguments are marked by ’*’).
['similarity', 'repeat', 'genscan', 'variation', 'gene']
['similarity', 'repeat', 'genscan', 'variation', 'gene']
# File lib/bio/io/ensembl.rb, line 148 148: def exportview(*args) 149: defaults = { 150: :type1 => 'bp', 151: :type2 => 'bp', 152: :downstream => '', 153: :upstream => '', 154: :format => 'fasta', 155: :options => [], 156: :action => 'export', 157: :_format => 'Text', 158: :output => 'txt', 159: :submit => 'Continue >>' 160: } 161: 162: if args.first.class == Hash 163: options = args.first 164: if options[:options] and options[:format] != 'fasta' and options[:format] != 'tab' 165: options.update({:format => 'gff'}) 166: end 167: else 168: options = { 169: :seq_region_name => args[0], 170: :anchor1 => args[1], 171: :anchor2 => args[2], 172: } 173: 174: case args[3] 175: when Array 176: options.update({:format => 'gff', :options => args[3]}) 177: when Hash 178: options.update(args[3]) 179: end 180: 181: if args[4].class == Hash 182: options.update(args[4]) 183: end 184: end 185: 186: params = defaults.update(options) 187: 188: result = Bio::Command.post_form("#{@uri}/exportview", params) 189: 190: return result.body 191: end