Permalink
Browse files

Bugfix to stop 'pointerFilters' being ignored on config parsing. This…

… will then stop errors being thrown if someone tries to use them.
  • Loading branch information...
1 parent 3906ea6 commit 8b7c3e62cc8184ced923a416f770f02715858c3d Daz Oakley committed Feb 18, 2011
Showing with 24 additions and 13 deletions.
  1. +5 −0 History.txt
  2. +11 −11 lib/biomart/dataset.rb
  3. +5 −1 lib/biomart/filter.rb
  4. +1 −1 lib/biomart/version.rb
  5. +2 −0 test/test_biomart.rb
View
@@ -1,3 +1,8 @@
+=== 0.2.1 2011-02-18
+
+* 1 major bugfix:
+ * More forceful filter checking in 0.2.1 was causing queries on 'pointerFilters' to error out unnecessarily.
+
=== 0.2.1 2011-02-16
* 1 minor bugfix:
View
@@ -217,17 +217,17 @@ def fetch_configuration
url = @url + "?type=configuration&dataset=#{@name}"
document = REXML::Document.new( request( :url => url ) )
- # Top-Level filters...
- REXML::XPath.each( document, '//FilterDescription' ) do |f|
- unless f.attributes["displayType"].eql? "container"
- @filters[ f.attributes["internalName"] ] = Filter.new( f.attributes )
- end
- end
-
- # Filters nested inside containers...
- REXML::XPath.each( document, '//FilterDescription/Option' ) do |f|
- if f.attributes["displayType"] != nil
- @filters[ f.attributes["internalName"] ] = Filter.new( f.attributes )
+ # Filters...
+ ['//FilterDescription','//FilterDescription/Option'].each do |filter_xpath|
+ REXML::XPath.each( document, filter_xpath ) do |f|
+ if f.attributes["displayType"] != nil
+ next if f.attributes["displayType"] == "container"
+ @filters[ f.attributes["internalName"] ] = Filter.new( f.attributes )
+ else f.attributes["pointerFilter"] != nil
+ pointer_filter = Filter.new( f.attributes )
+ @filters[ pointer_filter.name ] = pointer_filter
+ @filters[ pointer_filter.pointer_filter ] = pointer_filter
+ end
end
end
View
@@ -2,7 +2,7 @@ module Biomart
# Class representation for a biomart filter.
# Will belong to a Biomart::Dataset.
class Filter
- attr_reader :name, :display_name, :default_value, :qualifier, :type
+ attr_reader :name, :display_name, :default_value, :qualifier, :type, :pointer_dataset, :pointer_filter
def initialize(args)
@name = args["internalName"]
@@ -14,6 +14,10 @@ def initialize(args)
@type = args["type"]
@multiple_values = args["multipleValues"] ? true : false
+ @pointer_dataset = args["pointerDataset"]
+ @pointer_filter = args["pointerFilter"]
+ @pointer_interface = args["pointerInterface"]
+
@type.downcase! unless @type.nil?
end
View
@@ -1,3 +1,3 @@
module Biomart
- VERSION = "0.2.1"
+ VERSION = "0.2.2"
end
View
@@ -49,6 +49,7 @@ def setup
@ensembl_var = Biomart::Dataset.new( "http://www.ensembl.org/biomart", { :name => "hsapiens_snp" } )
@emma = Biomart::Dataset.new( "http://www.emmanet.org/biomart", { :name => "strains" } )
@dcc = Biomart::Dataset.new( "http://www.knockoutmouse.org/biomart", { :name => "dcc" } )
+ @mgi = Biomart::Dataset.new( "http://biomart.informatics.jax.org/biomart", { :name => "markers" } )
end
should "have basic metadata" do
@@ -60,6 +61,7 @@ def setup
should "have filters" do
assert( @htgt_targ.list_filters.is_a?( Array ), "Biomart::Dataset.list_filters is not returning an array." )
assert( @htgt_targ.list_filters.include?( "ensembl_gene_id" ), "Biomart::Dataset filter parsing is off - ensembl_gene_id is not in htgt_targ!" )
+ assert( @mgi.list_filters.include?( "ancestor_term_1023_filter" ), "Biomart::Dataset filter parsing is off - ancestor_term_1023_filter is not in mgi markers!" )
assert( @kermits.filters["ensembl_gene_id"].is_a?( Biomart::Filter ), "Biomart::Dataset is not creating Biomart::Filter objects." )
end

0 comments on commit 8b7c3e6

Please sign in to comment.