flex-station-data 0.3.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +33 -0
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +106 -0
  5. data/.ruby-version +1 -0
  6. data/CHANGELOG.md +23 -1
  7. data/Gemfile +2 -0
  8. data/Gemfile.lock +51 -28
  9. data/README.md +16 -29
  10. data/Rakefile +5 -1
  11. data/bin/flex-station +33 -11
  12. data/bin/flex-station-linear-regression +19 -37
  13. data/flex-station-data.gemspec +7 -4
  14. data/lib/flex_station_data.rb +2 -0
  15. data/lib/flex_station_data/concerns/callable.rb +33 -0
  16. data/lib/flex_station_data/concerns/presenter.rb +4 -18
  17. data/lib/flex_station_data/concerns/service.rb +4 -18
  18. data/lib/flex_station_data/default_sample_map.rb +33 -0
  19. data/lib/flex_station_data/linear_regression.rb +2 -0
  20. data/lib/flex_station_data/plate.rb +14 -3
  21. data/lib/flex_station_data/presenters/plate_hash.rb +26 -0
  22. data/lib/flex_station_data/presenters/plates_hash.rb +26 -0
  23. data/lib/flex_station_data/presenters/sample_hash.rb +47 -0
  24. data/lib/flex_station_data/presenters/sample_regression_hash.rb +44 -0
  25. data/lib/flex_station_data/sample.rb +20 -5
  26. data/lib/flex_station_data/services/compute_mean.rb +2 -0
  27. data/lib/flex_station_data/services/load_plates.rb +12 -1
  28. data/lib/flex_station_data/services/parse_plate.rb +6 -4
  29. data/lib/flex_station_data/services/parse_plate_readings.rb +43 -36
  30. data/lib/flex_station_data/services/parse_sample_map.rb +47 -0
  31. data/lib/flex_station_data/services/sample_quality.rb +6 -5
  32. data/lib/flex_station_data/services/value_quality.rb +5 -1
  33. data/lib/flex_station_data/version.rb +3 -1
  34. data/lib/flex_station_data/wells.rb +16 -15
  35. metadata +31 -19
  36. data/bin/flex-station-sample-data +0 -54
  37. data/lib/flex_station_data/presenters/linear_regression/plate_hash.rb +0 -27
  38. data/lib/flex_station_data/presenters/linear_regression/plates_hash.rb +0 -28
  39. data/lib/flex_station_data/presenters/linear_regression/sample_hash.rb +0 -47
  40. data/lib/flex_station_data/presenters/linear_regression/sample_regression_hash.rb +0 -43
  41. data/lib/flex_station_data/presenters/linear_regression/verbose_sample_csv.rb +0 -28
  42. data/lib/flex_station_data/presenters/plate_csv.rb +0 -29
  43. data/lib/flex_station_data/presenters/plates_csv.rb +0 -28
  44. data/lib/flex_station_data/presenters/sample_csv.rb +0 -56
  45. data/lib/flex_station_data/readings.rb +0 -16
  46. data/lib/flex_station_data/services/parse_plate_samples.rb +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90dd1e2d4c0a1b2987871308823f9b2f501ec0e0d302cc70e3a042ee82195009
4
- data.tar.gz: ad02c5b5fa0f757d307445bd22bb7b1367e7b6d88564da313f90b73ddaa4a80f
3
+ metadata.gz: 3ec58282e79f9a538c3ac94892a08381067b37c3a3c598cb96e5208cc9ce4480
4
+ data.tar.gz: 7080bda00a6d6b767829ab87459173d3b8544947d13e1c3cb287be0b85dfab92
5
5
  SHA512:
6
- metadata.gz: a338dc370ee092711577bc532c8790560af9a01eade3efe114e75ad2f4120f10f13078044a4c71c09fbb35583a65e5b75c579a912d2b06ad24b840da8af2e641
7
- data.tar.gz: 231eb833491fc460f2a20eee1b5498525d48d6efae9c29c2c4e3ae43fbdb580067b0f1fe4f114cee078f2e51df5e04d8610a27a73ac3488529674aa087980b2b
6
+ metadata.gz: f9373eb37df249a26f1d4b85232a82dd9ca5bea02082e59eab93a6522fd59d1d325fea5bdbd0d426036c435665b92f0d96b5cdd81bc068420a410e556b4c8943
7
+ data.tar.gz: cecae699c459a5c8b9709e4db78594e27d7e32c94e3763e939412b4505c780be217f6c8889af34f450641c6f00893370b781f2a2d792f78d1ed014f27ce654ca
@@ -0,0 +1,33 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
+ # uses: ruby/setup-ruby@v1
27
+ uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
28
+ with:
29
+ ruby-version: 2.7
30
+ - name: Install dependencies
31
+ run: bundle install
32
+ - name: Run tests
33
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ .idea/
13
+ .rbenv-gemsets
@@ -0,0 +1,106 @@
1
+ Layout/EmptyLinesAroundAttributeAccessor:
2
+ Enabled: true
3
+
4
+ Layout/ExtraSpacing:
5
+ Exclude:
6
+ - spec/**/*_spec.rb
7
+
8
+ Layout/HashAlignment:
9
+ EnforcedHashRocketStyle: table
10
+ EnforcedColonStyle: table
11
+
12
+ Layout/LineLength:
13
+ Exclude:
14
+ - spec/**/*_spec.rb
15
+
16
+ Layout/MultilineMethodCallIndentation:
17
+ EnforcedStyle: indented
18
+
19
+ Layout/SpaceAroundMethodCallOperator:
20
+ Enabled: true
21
+
22
+ Layout/SpaceInsideArrayLiteralBrackets:
23
+ Enabled: false
24
+
25
+ Layout/SpaceInsidePercentLiteralDelimiters:
26
+ Enabled: false
27
+
28
+ Lint/DeprecatedOpenSSLConstant:
29
+ Enabled: true
30
+
31
+ Lint/MixedRegexpCaptureTypes:
32
+ Enabled: true
33
+
34
+ Lint/RaiseException:
35
+ Enabled: true
36
+
37
+ Lint/StructNewOverride:
38
+ Enabled: true
39
+
40
+ Metrics/BlockLength:
41
+ Exclude:
42
+ - spec/**/*_spec.rb
43
+
44
+ Metrics/MethodLength:
45
+ Max: 12
46
+
47
+ Naming/MethodParameterName:
48
+ Enabled: false
49
+
50
+ Naming/VariableNumber:
51
+ EnforcedStyle: snake_case
52
+
53
+ Style/AccessorGrouping:
54
+ Enabled: false
55
+
56
+ Style/BisectedAttrAccessor:
57
+ Enabled: true
58
+
59
+ Style/Documentation:
60
+ Enabled: false
61
+
62
+ Style/ExponentialNotation:
63
+ Enabled: false
64
+
65
+ Style/HashEachMethods:
66
+ Enabled: false
67
+
68
+ Style/HashTransformKeys:
69
+ Enabled: true
70
+
71
+ Style/HashTransformValues:
72
+ Enabled: true
73
+
74
+ Style/PercentLiteralDelimiters:
75
+ Exclude:
76
+ - flex-station-data.gemspec
77
+
78
+ Style/RedundantAssignment:
79
+ Enabled: true
80
+
81
+ Style/RedundantFetchBlock:
82
+ Enabled: true
83
+
84
+ Style/RedundantPercentQ:
85
+ Exclude:
86
+ - flex-station-data.gemspec
87
+
88
+ Style/RedundantRegexpCharacterClass:
89
+ Enabled: true
90
+
91
+ Style/RedundantRegexpEscape:
92
+ Enabled: true
93
+
94
+ Style/SlicingWithRange:
95
+ Enabled: true
96
+
97
+ Style/StringLiterals:
98
+ EnforcedStyle: double_quotes
99
+
100
+ Style/SymbolArray:
101
+ Exclude:
102
+ - spec/**/*_spec.rb
103
+
104
+ Style/WordArray:
105
+ Exclude:
106
+ - spec/**/*_spec.rb
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -1,7 +1,29 @@
1
+ # 1.0.2
2
+
3
+ * Update to Ruby 2.7.1
4
+ * Introduce Rubocop
5
+ * Added "Ruby" GitHub workflow
6
+
7
+ # 1.0.1
8
+
9
+ * Miscellaneous refactoring.
10
+
11
+ # 1.0.0
12
+
13
+ * Removed option for sample data report and verbose linear regression report.
14
+
15
+ # 0.3.2
16
+
17
+ * Internal refactoring
18
+
19
+ # 0.3.1
20
+
21
+ * Fixed bug
22
+
1
23
  # 0.3.0
2
24
 
3
25
  * The linear regression analysis report now produces a summary report of the
4
- regression for each sample. The sample data can by added by sSpecifying the
26
+ regression for each sample. The sample data can by added by specifying the
5
27
  `--verbose` option.
6
28
 
7
29
  # 0.2.0
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in flex-station-data.gemspec
@@ -1,48 +1,70 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flex-station-data (0.3.0)
4
+ flex-station-data (1.0.2)
5
5
  activesupport
6
6
  linefit
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (6.0.0)
11
+ activesupport (6.0.3.2)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 0.7, < 2)
14
14
  minitest (~> 5.1)
15
15
  tzinfo (~> 1.1)
16
- zeitwerk (~> 2.1, >= 2.1.8)
17
- coderay (1.1.2)
18
- concurrent-ruby (1.1.5)
19
- diff-lcs (1.3)
20
- i18n (1.6.0)
16
+ zeitwerk (~> 2.2, >= 2.2.2)
17
+ ast (2.4.1)
18
+ coderay (1.1.3)
19
+ concurrent-ruby (1.1.6)
20
+ diff-lcs (1.4.4)
21
+ i18n (1.8.3)
21
22
  concurrent-ruby (~> 1.0)
22
23
  linefit (0.3.4)
23
- method_source (0.9.2)
24
- minitest (5.11.3)
25
- pry (0.12.2)
26
- coderay (~> 1.1.0)
27
- method_source (~> 0.9.0)
28
- rake (10.5.0)
29
- rspec (3.8.0)
30
- rspec-core (~> 3.8.0)
31
- rspec-expectations (~> 3.8.0)
32
- rspec-mocks (~> 3.8.0)
33
- rspec-core (3.8.2)
34
- rspec-support (~> 3.8.0)
35
- rspec-expectations (3.8.4)
24
+ method_source (1.0.0)
25
+ minitest (5.14.1)
26
+ parallel (1.19.2)
27
+ parser (2.7.1.4)
28
+ ast (~> 2.4.1)
29
+ pry (0.13.1)
30
+ coderay (~> 1.1)
31
+ method_source (~> 1.0)
32
+ rainbow (3.0.0)
33
+ rake (13.0.1)
34
+ regexp_parser (1.7.1)
35
+ rexml (3.2.4)
36
+ rspec (3.9.0)
37
+ rspec-core (~> 3.9.0)
38
+ rspec-expectations (~> 3.9.0)
39
+ rspec-mocks (~> 3.9.0)
40
+ rspec-core (3.9.2)
41
+ rspec-support (~> 3.9.3)
42
+ rspec-expectations (3.9.2)
36
43
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.8.0)
38
- rspec-mocks (3.8.1)
44
+ rspec-support (~> 3.9.0)
45
+ rspec-mocks (3.9.1)
39
46
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.8.0)
41
- rspec-support (3.8.2)
47
+ rspec-support (~> 3.9.0)
48
+ rspec-support (3.9.3)
49
+ rubocop (0.87.1)
50
+ parallel (~> 1.10)
51
+ parser (>= 2.7.1.1)
52
+ rainbow (>= 2.2.2, < 4.0)
53
+ regexp_parser (>= 1.7)
54
+ rexml
55
+ rubocop-ast (>= 0.1.0, < 1.0)
56
+ ruby-progressbar (~> 1.7)
57
+ unicode-display_width (>= 1.4.0, < 2.0)
58
+ rubocop-ast (0.1.0)
59
+ parser (>= 2.7.0.1)
60
+ rubocop-rspec (1.42.0)
61
+ rubocop (>= 0.87.0)
62
+ ruby-progressbar (1.10.1)
42
63
  thread_safe (0.3.6)
43
- tzinfo (1.2.5)
64
+ tzinfo (1.2.7)
44
65
  thread_safe (~> 0.1)
45
- zeitwerk (2.1.9)
66
+ unicode-display_width (1.7.0)
67
+ zeitwerk (2.3.1)
46
68
 
47
69
  PLATFORMS
48
70
  ruby
@@ -51,8 +73,9 @@ DEPENDENCIES
51
73
  bundler (~> 2.0)
52
74
  flex-station-data!
53
75
  pry
54
- rake (~> 10.0)
76
+ rake (~> 13.0)
55
77
  rspec (~> 3.8)
78
+ rubocop-rspec
56
79
 
57
80
  BUNDLED WITH
58
- 2.0.2
81
+ 2.1.4
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Tools for reading and analyzing data from the FlexStation microplate reader.
4
4
 
5
- Currently this is somewhere between alpha and beta.
6
-
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
@@ -28,51 +26,40 @@ To update your installation, use:
28
26
 
29
27
  ## Usage
30
28
 
31
- ### Viewing the sample data
32
-
33
- To view the sample results from a set of plate readings, use the following
29
+ To perform a linear regression analysis on the sample data, use the following
34
30
  command:
35
31
 
36
- $ flex-station sample-data <source file> [--threshold=<threshold>]
32
+ $ flex-station linear-regression <source file> [--threshold=<threshold>] [--min-r-squared=<minimum R²>]
37
33
 
38
34
  Where `source file` is the file that you got from the reader. You can specify
39
35
  multiple source files. The `threshold` setting is optional. If provided,
40
36
  samples with values that are below the `threshold` value will be skipped.
41
37
  `threshold` must be a number.
42
38
 
39
+ If a `--min-r-squared` value is given, samples with a R² value that falls
40
+ below the threshold will be flagged as "poor fits." If no `--min-r-squared` is
41
+ specified, a default of 0.75 will be used.
42
+
43
43
  The output is in CSV format. You'll probably want to save it to a file. You
44
44
  can do that by piping the output to a file:
45
45
 
46
- $ flex-station sample-data source-data.csv --threshold=300 > sample-data.csv
47
-
48
- ### Performing linear regression analysis on the sample data
49
-
50
- To perform a linear regression analysis on the sample data, use the following
51
- command:
52
-
53
- $ flex-station-data liinear-regression <source file> [--threshold=<threshold>] [--verbose] [--min-r-squared=<mininmum R²>]
54
-
55
- Note that the `source file` and `threshold` options are the same as for the
56
- `sample-data` command above. If a `--min-r-squared` value is given, samples
57
- with a R² value that falls below the threshold will be flagged as "poor fits."
58
- If no `--min-r-squared` is specified, a default of 0.75 will be used.
59
-
60
- By default the linear regression tool will produce a summary report giving the
61
- slope, intercept, and R² values for each sample. However if `--verbose` is
62
- specified, it will also include the sample data and regressions for each well.
63
-
64
- As with the sample data tool, you will probably want to pipe the output to a file:
65
-
66
46
  $ flex-station linear-regression source-data.csv --threshold=300 > linear-regression.csv
67
47
 
68
48
  ## Contributing
69
49
 
70
- Bug reports and pull requests are welcome on GitHub at https://github.com/johncarney/flex-station-data. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
50
+ Bug reports and pull requests are welcome on GitHub at
51
+ https://github.com/johncarney/flex-station-data. This project is intended to
52
+ be a safe, welcoming space for collaboration, and contributors are expected to
53
+ adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
54
+ conduct.
71
55
 
72
56
  ## License
73
57
 
74
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
58
+ The gem is available as open source under the terms of the
59
+ [MIT License](https://opensource.org/licenses/MIT).
75
60
 
76
61
  ## Code of Conduct
77
62
 
78
- Everyone interacting in the FlexStationData project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/johncarney/flex-station-data/blob/master/CODE_OF_CONDUCT.md).
63
+ Everyone interacting in the FlexStationData project’s codebases, issue
64
+ trackers, chat rooms and mailing lists is expected to follow the
65
+ [code of conduct](https://github.com/johncarney/flex-station-data/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
5
+ require "rubocop/rake_task"
3
6
 
4
7
  RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new(:rubocop)
5
9
 
6
- task :default => :spec
10
+ task default: %i[ rubocop spec ]
@@ -1,16 +1,38 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "pathname"
5
+ require "flex_station_data/concerns/callable"
4
6
 
5
- case command = ARGV.first
6
- when "sample-data"
7
- system(Pathname(__dir__).join("flex-station-sample-data").to_path, *ARGV.drop(1))
8
- when "linear-regression"
9
- system(Pathname(__dir__).join("flex-station-linear-regression").to_path, *ARGV.drop(1))
10
- when nil
11
- $stderr.puts "USAGE: flex-station <command>"
12
- exit(1)
13
- else
14
- $stderr.puts "Unrecognised command: #{command}"
15
- exit(1)
7
+ class App
8
+ include FlexStationData::Concerns::Callable[:run]
9
+
10
+ attr_reader :command, :args
11
+
12
+ def initialize(command = "help", *args)
13
+ @command = command
14
+ @args = args
15
+ end
16
+
17
+ def dir_path
18
+ Pathname(__dir__)
19
+ end
20
+
21
+ def linear_regression_path
22
+ dir_path.join("flex-station-linear-regression")
23
+ end
24
+
25
+ def run
26
+ case command
27
+ when "linear-regression"
28
+ exec(linear_regression_path.to_path, *args)
29
+ when "help", "--help"
30
+ puts "USAGE: flex-station <command>"
31
+ else
32
+ warn "Unrecognised command: #{command}"
33
+ exit(1)
34
+ end
35
+ end
16
36
  end
37
+
38
+ App.run(*ARGV)