immunoscore_results_aggregator 0.0.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.
@@ -0,0 +1,68 @@
1
+ #Copyright (c) 2014, Carlo B. Bifulco. All rights reserved.
2
+
3
+ ### Cleaning of the Definines semicolon junk
4
+ class DefinensCSV
5
+
6
+ def initialize file_path
7
+ @file_path=file_path
8
+ @text=File.read @file_path
9
+ #puts @text.encode("UTF-8")
10
+ #clean utf not sure why
11
+ _digest_utf
12
+ #header_line
13
+ csv=CSV.read(@file_path)
14
+ if (csv and csv.count !=0)
15
+ puts @file_path
16
+ header=csv[0][0]
17
+ if header.count(";")>header.count(",") then _parse_semicolon end
18
+ end
19
+
20
+ #parse_semicolon
21
+ end
22
+
23
+
24
+ def _digest_utf
25
+ text=File.read @file_path
26
+ text=text.encode("UTF-16BE", :invalid=>:replace, :replace=>"?").encode("UTF-8")
27
+ fh=File.new @file_path, "w"
28
+ fh.write text
29
+ fh.close
30
+ self
31
+ end
32
+
33
+ #replaces ; from definins csv with ,
34
+ def _parse_semicolon
35
+ #puts "removing semicolons"
36
+ c=CSV.table @file_path, :col_sep=> ";"
37
+ fh=File.new @file_path, "w"
38
+ fh.write c.to_csv
39
+ fh.close
40
+ self
41
+ end
42
+
43
+ def table
44
+ c=CSV.table @file_path
45
+ end
46
+
47
+ def get_dictionary
48
+ table =self.table
49
+ dictionary={}
50
+ table.headers.each do |h|
51
+ dictionary[h]=table[h][0] if table[h]
52
+ end
53
+ dictionary
54
+ end
55
+ end
56
+
57
+
58
+ def csv_clean_all match_pattern="*.csv", root_directory_path=BASE_DIR
59
+ csv_matches=Dir.glob "#{File.absolute_path root_directory_path}/**/#{match_pattern}"
60
+ csv_matches.each do |cm|
61
+ begin
62
+ DefinensCSV.new cm
63
+ rescue
64
+ puts "FAILED on #{cm}"
65
+ end
66
+ end
67
+ end
68
+
data/license.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Carlo B. Bifulco, MD
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
metadata ADDED
@@ -0,0 +1,243 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: immunoscore_results_aggregator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Carlo Bifulco
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-10-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bson_ext
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: mongo_mapper
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bson_ext
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: gibberish
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: bicrypt
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: chronic
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: thor
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: mm-versionable
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: bundler
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: '1.6'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: '1.6'
158
+ - !ruby/object:Gem::Dependency
159
+ name: rake
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ description: immunoscore_results_aggregator
175
+ email: carlobif@gmail.com
176
+ executables:
177
+ - immunoscore_cli.rb
178
+ extensions: []
179
+ extra_rdoc_files: []
180
+ files:
181
+ - .gitignore
182
+ - Gemfile
183
+ - Gemfile.lock
184
+ - README.md
185
+ - Rakefile
186
+ - bin/immunoscore_cli.rb
187
+ - config.rb
188
+ - data_struct.rb
189
+ - docs/aggregator.html
190
+ - docs/analyzer.html
191
+ - docs/data_struct.html
192
+ - docs/database_connection.html
193
+ - docs/docco.css
194
+ - docs/exporter.html
195
+ - docs/immunoscore_results_loader.html
196
+ - docs/public/fonts/aller-bold.eot
197
+ - docs/public/fonts/aller-bold.ttf
198
+ - docs/public/fonts/aller-bold.woff
199
+ - docs/public/fonts/aller-light.eot
200
+ - docs/public/fonts/aller-light.ttf
201
+ - docs/public/fonts/aller-light.woff
202
+ - docs/public/fonts/novecento-bold.eot
203
+ - docs/public/fonts/novecento-bold.ttf
204
+ - docs/public/fonts/novecento-bold.woff
205
+ - docs/public/stylesheets/normalize.css
206
+ - docs/semicolon_cleaner.html
207
+ - immunoscore_results_aggregator.gemspec
208
+ - immunoscore_results_aggregator.rb
209
+ - lib/analyzer.rb
210
+ - lib/data_struct.rb
211
+ - lib/database_connection.rb
212
+ - lib/exporter.rb
213
+ - lib/immunoscore_results_aggregator/version.rb
214
+ - lib/immunoscore_results_loader.rb
215
+ - lib/mongo_aggregator.rb
216
+ - lib/semicolon_cleaner.rb
217
+ - license.txt
218
+ homepage: https://github.com/carlobifulco/immunoscore_results
219
+ licenses:
220
+ - MIT
221
+ post_install_message:
222
+ rdoc_options: []
223
+ require_paths:
224
+ - lib
225
+ required_ruby_version: !ruby/object:Gem::Requirement
226
+ none: false
227
+ requirements:
228
+ - - ! '>='
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
231
+ required_rubygems_version: !ruby/object:Gem::Requirement
232
+ none: false
233
+ requirements:
234
+ - - ! '>='
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ requirements: []
238
+ rubyforge_project:
239
+ rubygems_version: 1.8.23.2
240
+ signing_key:
241
+ specification_version: 3
242
+ summary: immunoscore_results_aggregator
243
+ test_files: []