Class: InterMine::Results::ResultsReader

Inherits:
Object
  • Object
show all
Defined in:
lib/intermine/bio.rb

Overview

Extensions to the ResultsReader object

These methods provide mechanisms for accessing the results in raw format, and iterating over them line by line in a memory efficient manner. They are in no way content aware.

:include:contact_header.rdoc

Constant Summary collapse

RESOURCE_PATH =

The path to use to get the resource paths for the query variants

"/check/"

Instance Method Summary collapse

Instance Method Details

#adjust_path(variant) ⇒ Object

Adjust the path of this query to suit the currently selected format.



209
210
211
212
213
214
215
216
# File 'lib/intermine/bio.rb', line 209

def adjust_path(variant)
    @resources ||= {}
    root = @query.service.root
    uri = URI.parse(root + RESOURCE_PATH + "query." + variant.to_s)
    @resources[variant] = Net::HTTP.get(uri.host, uri.path)
    path = @resources[variant]
    @uri = URI.parse(root + path)
end

#each_bed(ucscCompatible = true) ⇒ Object

Yield results as UCSC-BED



199
200
201
202
203
204
205
206
# File 'lib/intermine/bio.rb', line 199

def each_bed(ucscCompatible=true)
    adjust_path(:bed)
    p = params("bed")
    p["ucscCompatible"] = "no" unless ucscCompatible
    each_line(p) do |line|
        yield line
    end
end

#each_fastaObject

Yield results as fasta



191
192
193
194
195
196
# File 'lib/intermine/bio.rb', line 191

def each_fasta
    adjust_path(:fasta)
    each_line(params("fasta")) do |line|
        yield line
    end
end

#each_gff3Object

Yield results as GFF3



183
184
185
186
187
188
# File 'lib/intermine/bio.rb', line 183

def each_gff3
    adjust_path(:gff3)
    each_line(params("gff3")) do |line|
        yield line
    end
end