bsi-pipeline 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e760c06f87edb57bc12c989c853a24d011ea87a1
4
- data.tar.gz: 65d77160c4c42829be1db9842146916c8e667ba2
3
+ metadata.gz: 50e0b28ec4df04a63b0d9c6a530b36c30e7072b7
4
+ data.tar.gz: 58b68121e0ea1345f0321d00d46ef63f2f3b1a9c
5
5
  SHA512:
6
- metadata.gz: c957a5e5f1a99aa80f1faaf21d8c76cb0d7b47415b9d45d9b9bf71e9a532cce0019c745a14456ebfe126775bb101ffaf002bfaadd88bdce9a1e4f12cb41b051e
7
- data.tar.gz: 4d359b7fd19877a0cd20c1bbb14a6ed016d78bb7e9ca6ec8bc3330773455fc54e1244e4da248fe2dc7f8cdeb3a695eee71b28ffdfd416f508b9c78da0c16a930
6
+ metadata.gz: 67ba71b202d5062375f2585f580f2dd589d520217ffe039b01de598e2877092b70078b56e7e1fbfea3d35872c41501b5570e2cf13c3d894f3e629f9c2d0353aa
7
+ data.tar.gz: aeb9871c95343cc74790eee7bb9661dc280715d412d790be1dcab265504c6eb115b36ec15c3d326ababb59f363858ee530f41103a615855abf5fee5e32ee8c96
@@ -56,7 +56,7 @@ module Pipeline
56
56
  specimen_family.each_with_index do |spec, i|
57
57
  # Assign sample and sequence numbers
58
58
  spec.sample_id = family_sample_id
59
- spec.sequence = i+1
59
+ spec.sequence = i+1
60
60
  end
61
61
  end
62
62
  end
@@ -81,21 +81,25 @@ module Pipeline
81
81
 
82
82
  def import(all_specimens, options={})
83
83
  @specimens = all_specimens
84
+ study_ids = @specimens.map{|e| e.study_id}.uniq
84
85
  subject_ids = @specimens.map{|e| e.subject_id}.uniq
85
86
 
86
- subject_ids.each_with_index do |sid, i|
87
- # Filter by subject_id
88
- subset = @specimens.select{|e| e.subject_id == sid}
87
+ study_ids.each do |study|
88
+ subject_ids.each_with_index do |sid, i|
89
+ # Filter by subject_id and study_id
90
+ subset = @specimens.select{|e| e.study_id == study && e.subject_id == sid}
89
91
 
90
- batch_properties = {
91
- 'batch.description' => "Subject: #{sid}"
92
- }
92
+ batch_properties = {
93
+ 'batch.description' => "Subject: #{sid}",
94
+ 'batch.study_id' => study.to_s
95
+ }
93
96
 
94
- @batch = AddBatch.new(@bsi, batch_properties)
95
- @batch.add_specimens(subset)
96
- @batch.commit if options['commit']
97
+ @batch = AddBatch.new(@bsi, batch_properties)
98
+ @batch.add_specimens(subset)
99
+ @batch.commit if options['commit']
97
100
 
98
- @batches << @batch
101
+ @batches << @batch
102
+ end
99
103
  end
100
104
 
101
105
  @bsi.common.logoff
@@ -1,5 +1,5 @@
1
1
  module Bsi
2
2
  module Pipeline
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -51,6 +51,7 @@ describe AddBatch do
51
51
  end
52
52
 
53
53
  it 'returns array of Pipeline::BSI::Models::Specimen objects' do
54
+ expect(@batch.specimens).to be_instance_of Array
54
55
  end
55
56
  end
56
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bsi-pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elijah Christensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-29 00:00:00.000000000 Z
11
+ date: 2014-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler