Class | Bio::Ensembl
In: | lib/bio/io/ensembl.rb
Parent: | Object

Codes for backward-compatibility.

### Methods

exportview human mouse new server_uri

### Classes and Modules

Class Bio::Ensembl::Base
Class Bio::Ensembl::Human
Class Bio::Ensembl::Mouse

### Constants

ENSEMBL_URL | = | 'http://www.ensembl.org'
EBIServerURI | = | ENSEMBL_URL

### Attributes

organism | [R] | Organism name. (ex. ‘Homo_sapiens’).
server | [R] | Server URL (ex. ‘www.ensembl.org’)

### Public Class methods

human()

[Source]

        # File lib/bio/io/ensembl.rb, line 79
    79:   def self.human
    80:     self.new("Homo_sapiens")
    81:   end

mouse()

[Source]

        # File lib/bio/io/ensembl.rb, line 83
    83:   def self.mouse
    84:     self.new("Mus_musculus")
    85:   end

new(organism, server = nil)

[Source]

        # 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

server_uri(uri = nil)

[Source]

         # 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

### Public Instance methods

exportview(*args)

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

1. seq_region_name - Chromosome number (*)
2. anchor1 - From coordination (*)
3. anchor2 - To coordination (*)
4. 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']

[Source]

         # 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

[Validate]