biomart 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,13 @@
1
- === 0.1.0 2009-08-29
1
+ === 0.1.3 2009-10-30
2
2
 
3
- * 1 major enhancement:
4
- * Initial release:
5
- * Basic gathering of information about a Biomart server.
6
- * Counting functionality.
7
- * Basic searching of a single dataset.
3
+ * 1 major bugfix:
4
+ * Ruby 1.9 compatibility added.
5
+
6
+ === 0.1.2 2009-10-29
7
+
8
+ * 1 major bugfix:
9
+ * Added in code to handle poorly formatted tab-separated data
10
+ coming back from a biomart query.
8
11
 
9
12
  === 0.1.1 2009-10-21
10
13
 
@@ -13,8 +16,10 @@
13
16
  to allow a user to ping a biomart server to make sure it is online
14
17
  and functioning as expected.
15
18
 
16
- === 0.1.2 2009-10-29
19
+ === 0.1.0 2009-08-29
17
20
 
18
- * 1 major bugfix:
19
- * Added in code to handle poorly formatted tab-separated data
20
- coming back from a biomart query.
21
+ * 1 major enhancement:
22
+ * Initial release:
23
+ * Basic gathering of information about a Biomart server.
24
+ * Counting functionality.
25
+ * Basic searching of a single dataset.
@@ -1,9 +1,9 @@
1
1
  = Biomart
2
2
 
3
- http://biomart.rubyforge.org
4
-
5
3
  http://github.com/dazoakley/biomart
6
4
 
5
+ http://rubyforge.org/projects/biomart
6
+
7
7
  Biomart provides a simple interface for working with Biomart servers
8
8
  (see http://www.biomart.org for more info on Biomart itself), so you
9
9
  don't have to get down and dirty with the basic webservice calls yourself.
@@ -96,10 +96,10 @@ Alternatively you can also set your proxy url in the environment variable
96
96
 
97
97
  Written by Darren Oakley (daz dot oakley at gmail dot com)
98
98
 
99
- http://biomart.rubyforge.org
100
-
101
99
  http://github.com/dazoakley/biomart
102
100
 
101
+ http://rubyforge.org/projects/biomart
102
+
103
103
  == License
104
104
 
105
105
  (The MIT License)
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{biomart}
5
- s.version = "0.1.2"
5
+ s.version = "0.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Darren Oakley"]
9
- s.date = %q{2009-10-29}
9
+ s.date = %q{2009-10-30}
10
10
  s.description = %q{A ruby API for interacting with Biomart services.}
11
11
  s.email = ["daz.oakley@gmail.com"]
12
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
@@ -7,7 +7,7 @@ require "rubygems"
7
7
  require "builder"
8
8
 
9
9
  module Biomart
10
- VERSION = "0.1.2"
10
+ VERSION = "0.1.3"
11
11
 
12
12
  # This is the base Biomart error/exception class. Rescue it if
13
13
  # you want to catch any exceptions that this code might raise.
@@ -43,7 +43,16 @@ module Biomart
43
43
  def fetch_datasets
44
44
  url = @url + "?type=datasets&mart=#{@name}"
45
45
  document = request( :url => url )
46
- tsv_data = CSV.parse( document, "\t" )
46
+ tsv_data = []
47
+
48
+ if CSV.const_defined? :Reader
49
+ # Ruby < 1.9 CSV code
50
+ tsv_data = CSV.parse( document, "\t" )
51
+ else
52
+ # Ruby >= 1.9 CSV code
53
+ tsv_data = CSV.parse( document, { :col_sep => "\t" } )
54
+ end
55
+
47
56
  tsv_data.each do |t|
48
57
  if t[1] and ( t[3] === "1" )
49
58
  dataset_attr = {
@@ -190,10 +190,21 @@ module Biomart
190
190
  end
191
191
  end
192
192
 
193
- begin
194
- parsed_data = CSV.parse( tsv, "\t" )
195
- rescue CSV::IllegalFormatError => e
196
- parsed_data = parse_tsv_line_by_line( headers.size, tsv )
193
+ parsed_data = []
194
+ if CSV.const_defined? :Reader
195
+ # Ruby < 1.9 CSV code
196
+ begin
197
+ parsed_data = CSV.parse( tsv, "\t" )
198
+ rescue CSV::IllegalFormatError => e
199
+ parsed_data = parse_tsv_line_by_line( headers.size, tsv )
200
+ end
201
+ else
202
+ # Ruby >= 1.9 CSV code
203
+ begin
204
+ parsed_data = CSV.parse( tsv, { :col_sep => "\t" } )
205
+ rescue CSV::MalformedCSVError => e
206
+ parsed_data = parse_tsv_line_by_line( headers.size, tsv )
207
+ end
197
208
  end
198
209
 
199
210
  return {
@@ -211,7 +222,19 @@ module Biomart
211
222
 
212
223
  data_by_line = tsv.split("\n")
213
224
  data_by_line.each do |line|
214
- elements = CSV::parse_line( line, "\t" )
225
+ elements = []
226
+
227
+ if CSV.const_defined? :Reader
228
+ # Ruby < 1.9 CSV code
229
+ elements = CSV::parse_line( line, "\t" )
230
+ else
231
+ # Ruby >= 1.9 CSV code
232
+ begin
233
+ elements = CSV::parse_line( line, { :col_sep => "\t" } )
234
+ rescue CSV::MalformedCSVError => e
235
+ elements = []
236
+ end
237
+ end
215
238
 
216
239
  if elements.size == 0
217
240
  # This is a bad line (causing the above Exception), try and use split to recover.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biomart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Oakley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-29 00:00:00 +00:00
12
+ date: 2009-10-30 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency