Class: Catalog::Nomenclature::PaperCatalog
- Inherits:
-
Catalog::Nomenclature
- Object
- Catalog
- Catalog::Nomenclature
- Catalog::Nomenclature::PaperCatalog
- Defined in:
- lib/catalog/nomenclature/paper_catalog.rb
Overview
Paper style comprehansive checklist
Instance Attribute Summary collapse
-
#accepted_only ⇒ Object
Optional attribute.
-
#classification_scope ⇒ Object
Higher level taxon to include all descendants.
-
#distribution ⇒ Object
Optional attribute to add distribution “distribution=true”.
-
#otu_contents ⇒ Object
Optional attribute to add otu_contents.
-
#otu_filter ⇒ Object
Optional attribute.
-
#otu_id_filter_array ⇒ Object
Returns list of otu_ids.
-
#project_id ⇒ Object
Required attribute to build the key.
-
#rank_filter ⇒ Object
Optional attribute.
-
#results_hash ⇒ Object
Returns taxa sorted hierarchically with all metadata.
-
#source_hash ⇒ Object
Returns list of sources.
-
#taxon_name_filter ⇒ Object
Optional attribute.
-
#taxon_name_ids ⇒ Object
Returns list of taxon_name_ids.
-
#type_information ⇒ Object
Optional attribute.
Attributes inherited from Catalog
Instance Method Summary collapse
- #build_the_list ⇒ Object
-
#initialize(classification_scope: nil, project_id: nil, rank_filter: nil, otu_filter: nil, taxon_name_filter: nil, accepted_only: false, type_information: false, distribution: false, otu_contents: false) ⇒ PaperCatalog
constructor
A new instance of PaperCatalog.
Methods inherited from Catalog::Nomenclature
Methods inherited from Catalog
all_dates, #build, chronological_item_sort, #citations, #entries_sorted, #entry_sort_valid?, #items, #items_chronologically, #objects_for_source, #reference_object_global_id, #reference_object_valid_taxon_name_global_id, #sources, #sources_to_json, topic_year_metadata, #topics, #topics_to_json, year_hash, year_metadata
Constructor Details
#initialize(classification_scope: nil, project_id: nil, rank_filter: nil, otu_filter: nil, taxon_name_filter: nil, accepted_only: false, type_information: false, distribution: false, otu_contents: false) ⇒ PaperCatalog
Returns a new instance of PaperCatalog.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 74 def initialize( classification_scope: nil, project_id: nil, rank_filter: nil, otu_filter: nil, taxon_name_filter: nil, accepted_only: false, type_information: false, distribution: false, otu_contents: false) @classification_scope = classification_scope @project_id = project_id @rank_filter = rank_filter.to_s.downcase.split('|') @otu_filter = otu_filter @taxon_name_filter = taxon_name_filter @accepted_only = accepted_only @type_information = type_information @distribution = distribution @otu_contents = otu_contents @taxon_name_ids = [] @otu_id_filter_array = otu_filter_array #Main logic @results_hash = {names: {}, sources: {}} @position = 0 build_the_list end |
Instance Attribute Details
#accepted_only ⇒ Object
Optional attribute. Restrict output to valid_names “accepted_only=true”
35 36 37 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 35 def accepted_only @accepted_only end |
#classification_scope ⇒ Object
Higher level taxon to include all descendants
10 11 12 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 10 def classification_scope @classification_scope end |
#distribution ⇒ Object
Optional attribute to add distribution “distribution=true”
45 46 47 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 45 def distribution @distribution end |
#otu_contents ⇒ Object
Optional attribute to add otu_contents
50 51 52 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 50 def otu_contents @otu_contents end |
#otu_filter ⇒ Object
Optional attribute. Restrict output to particular otus_ids “otu_filter=3|5|15”.
25 26 27 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 25 def otu_filter @otu_filter end |
#otu_id_filter_array ⇒ Object
Returns list of otu_ids
62 63 64 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 62 def otu_id_filter_array @otu_id_filter_array end |
#project_id ⇒ Object
Required attribute to build the key
15 16 17 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 15 def project_id @project_id end |
#rank_filter ⇒ Object
Optional attribute. Restrict output to particular ranks “rank_filter=genus|species|subspecies”. Returns all ranks if values is nil
20 21 22 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 20 def rank_filter @rank_filter end |
#results_hash ⇒ Object
Returns taxa sorted hierarchically with all metadata
72 73 74 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 72 def results_hash @results_hash end |
#source_hash ⇒ Object
Returns list of sources
67 68 69 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 67 def source_hash @source_hash end |
#taxon_name_filter ⇒ Object
Optional attribute. Restrict output to particular taxon_name_ids “taxon_name_filter=3|5|15”.
30 31 32 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 30 def taxon_name_filter @taxon_name_filter end |
#taxon_name_ids ⇒ Object
Returns list of taxon_name_ids
57 58 59 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 57 def taxon_name_ids @taxon_name_ids end |
#type_information ⇒ Object
Optional attribute. Add type information “type=true”
40 41 42 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 40 def type_information @type_information end |
Instance Method Details
#build_the_list ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/catalog/nomenclature/paper_catalog.rb', line 104 def build_the_list results_hash return {} if project_id.nil? return {} if classification_scope.blank? && otu_filter.blank? && taxon_name_filter.blank? taxon = classification_scope.blank? ? nil : TaxonName.find(classification_scope.to_i) if !taxon_name_filter.blank? tn_ids = taxon_name_filter.to_s.split('|').map(&:to_i) TaxonName.where(id: tn_ids).each do |t| add_taxon_to_results(t) if t.id == t.cached_valid_taxon_name_id end elsif !taxon.nil? # ancestors = get_ancestors(taxon) # descendants = get_descendants(taxon) end if results_hash.names.count > 0 && accepted_only.to_s != 'true' # synonyms = get_synonyms end if taxon_name_ids.count > 0 # statuses = get_taxon_name_classifications # relationships = get_taxon_name_relationships end end |