Class: DwcaHunter::ResourceOpenTree
- Defined in:
- lib/dwca_hunter/resources/opentree.rb
Overview
Harvesting resource for Open Tree of Life
Instance Attribute Summary
Attributes inherited from Resource
#abbr, #command, #download_path, #title, #url, #uuid
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(opts = {}) ⇒ ResourceOpenTree
constructor
A new instance of ResourceOpenTree.
- #make_dwca ⇒ Object
- #unpack ⇒ Object
Methods inherited from Resource
gunzip, #needs_download?, #needs_unpack?, unzip
Constructor Details
#initialize(opts = {}) ⇒ ResourceOpenTree
Returns a new instance of ResourceOpenTree.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dwca_hunter/resources/opentree.rb', line 6 def initialize(opts = {}) @command = "open-tree" @title = "Open Tree of Life Reference Taxonomy" @uuid = "e10865e2-cdd9-4f97-912f-08f3d5ef49f7" @data = [] @extensions = [] @count = 1 @clades = {} @core = [["http://rs.tdwg.org/dwc/terms/taxonId", "http://globalnames.org/terms/localID", "http://purl.org/dc/terms/scientificName", "http://purl.org/dc/terms/parentNameUsageId", "http://purl.org/dc/terms/taxonRank", "http://globalnames.org/ottCrossMaps", "http://globalnames.org/ottNotes"]] @eml = { id: @uuid, title: @title, authors: [{ url: "https://tree.opentreeoflife.org" }], abstract: "Open Tree of Life aims to construct a comprehensive, " \ "dynamic and digitally-available tree of life by " \ "synthesizing published phylogenetic trees along with" \ "taxonomic data. The project is a collaborative effort" \ "between 11 PIs across 10 institutions.", metadata_providers: [ { first_name: "Dmitry", last_name: "Mozzherin", email: "[email protected]" } ], url: @url } @url = "http://opendata.globalnames.org/id-crossmap/ott3.0.tgz" @download_path = File.join(Dir.tmpdir, "dwca_hunter", "opentree", "data.tar.gz") super end |
Instance Method Details
#download ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/dwca_hunter/resources/opentree.rb', line 53 def download return unless @needs_download DwcaHunter.logger_write(object_id, "Downloading file -- "\ "it will take some time...") dlr = DwcaHunter::Downloader.new(url, @download_path) dlr.download end |
#make_dwca ⇒ Object
47 48 49 50 51 |
# File 'lib/dwca_hunter/resources/opentree.rb', line 47 def make_dwca DwcaHunter.logger_write(object_id, "Extracting data") collect_data generate_dwca end |
#unpack ⇒ Object
43 44 45 |
# File 'lib/dwca_hunter/resources/opentree.rb', line 43 def unpack unpack_tar if @needs_unpack end |