lederhosen 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/lederhosen.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "lederhosen"
8
- s.version = "1.3.4"
8
+ s.version = "1.3.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Austin G. Davis-Richardson"]
12
- s.date = "2012-12-03"
12
+ s.date = "2012-12-04"
13
13
  s.description = "Various tools for OTU clustering"
14
14
  s.email = "harekrishna@gmail.com"
15
15
  s.executables = ["lederhosen"]
@@ -76,6 +76,13 @@ module Lederhosen
76
76
 
77
77
  # parse a taxonomic description using the
78
78
  # taxcollector format returning name at each level (genus, etc...)
79
+ #
80
+ # - If the species names contains the word '_bacterium', use the strain
81
+ # name as the species name:
82
+ #
83
+ # Escherichia_bacterium -> Escherichia_bacterium_strain_X123
84
+ # Arcanobacterium_phocae -> Arcanobacterium_phocae (no change)
85
+ #
79
86
  def parse_taxonomy_taxcollector(taxonomy)
80
87
 
81
88
  levels = { 'domain' => 0,
@@ -85,7 +92,8 @@ module Lederhosen
85
92
  'order' => 3,
86
93
  'family' => 4,
87
94
  'genus' => 5,
88
- 'species' => 6 }
95
+ 'species' => 6,
96
+ 'strain' => 7 }
89
97
 
90
98
  names = Hash.new
91
99
 
@@ -94,6 +102,12 @@ module Lederhosen
94
102
  names[level] = name
95
103
  end
96
104
 
105
+ # check if species name contains the word 'bacterium'
106
+ # if so, replace it with the strain name
107
+ if names['species'] =~ /_bacterium/
108
+ names['species'] = names['strain']
109
+ end
110
+
97
111
  # keep original taxonomic description
98
112
  names['original'] = taxonomy
99
113
 
@@ -3,7 +3,7 @@ module Lederhosen
3
3
  MAJOR = 1
4
4
  MINOR = 3
5
5
  CODENAME = 'Dirndl' # changes for minor versions
6
- PATCH = 4
6
+ PATCH = 5
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH].join('.')
9
9
  end
@@ -6,7 +6,7 @@ describe 'no_tasks' do
6
6
 
7
7
  let(:greengenes_taxonomies) { ['124 U55236.1 Methanobrevibacter thaueri str. CW k__Archaea; p__Euryarchaeota; c__Methanobacteria; o__Methanobacteriales; f__Methanobacteriaceae; g__Methanobrevibacter; Unclassified; otu_127',
8
8
  'k__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;o__Enterobacteriales;f__Enterobacteriaceae;g__Rahnella;s__' ]}
9
- let(:taxcollector_taxonomies) { ['[0]Bacteria;[1]Actinobacteria;[2]Actinobacteria;[3]null;[4]null;[5]null;[6]bacterium_TH3;[7]bacterium_TH3;[8]bacterium_TH3|M79434|8'] }
9
+ let(:taxcollector_taxonomies) { ['[0]Bacteria;[1]Actinobacteria;[2]Actinobacteria;[3]null;[4]null;[5]null;[6]bacterium_TH3;[7]bacterium_TH3;[8]bacterium_TH3|M79434|8'] }
10
10
 
11
11
  it '#detect_taxonomy_format should recognize GreenGenes' do
12
12
  greengenes_taxonomies.each do |greengenes_taxonomy|
@@ -29,7 +29,7 @@ describe 'no_tasks' do
29
29
  taxonomy = lederhosen.parse_taxonomy_taxcollector(taxcollector_taxonomy)
30
30
  taxonomy['original'].should == taxcollector_taxonomy
31
31
 
32
- levels = %w{domain phylum class order family genus species kingdom original}
32
+ levels = %w{domain phylum class order family genus species kingdom original strain}
33
33
 
34
34
  taxonomy.keys.each do |v|
35
35
  levels.should include v
@@ -59,4 +59,10 @@ describe 'no_tasks' do
59
59
  lederhosen.parse_taxonomy(taxcollector_taxonomy).should_not be_nil
60
60
  end
61
61
  end
62
+
63
+ it '#parse_taxonomy_taxcollector should replace unclassified species names with strain name' do
64
+ t = '[0]Bacteria;[1]Actinobacteria;[2]Actinobacteria;[3]Actinomycetales;[4]test;[5]null;[6]Propionibacterineae_bacterium;[7]Propionibacterineae_bacterium_870BRRJ;[8]Propionibacterineae_bacterium_870BRRJ|genus'
65
+ tax = lederhosen.parse_taxonomy(t)
66
+ tax['species'].should == tax['strain']
67
+ end
62
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lederhosen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-03 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dna
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  segments:
162
162
  - 0
163
- hash: 2143498304454718392
163
+ hash: 502535867079393177
164
164
  required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  none: false
166
166
  requirements: