bio-gemma-wrapper 0.97.1 → 0.98

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -2
  3. data/VERSION +1 -1
  4. data/bin/gemma-wrapper +31 -10
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 740af7561d0fb801b810713cd623f3d25e78971a
4
- data.tar.gz: ce3aaae3418073dc1365bc8755ac73745ef4b01a
3
+ metadata.gz: d8f36b92e82dda9e1e592724204521f9f4f1a950
4
+ data.tar.gz: 077abf1c1a704ab93a27627d511aeba0dbf6b4c5
5
5
  SHA512:
6
- metadata.gz: 30043473cf8b09ecf8a6fdcfa97468ba5d169bc7a0b6b6ab2102f7f978b8cb2c63fb5c5cefd7267cfe526e4748b6481aa9b6dbe7309dceff62f0351f79b16b0e
7
- data.tar.gz: 07e50ab7b2b2d87bed1ce21b5b2d123693898163ff9a175841db190fcc22b43ee37ecc1df7cbc697e89b3dcaa193c489c299d3c50c1aa557d9512c4d494adec6
6
+ metadata.gz: b49bb2c9362eb7babd2cf20f640fc7806719a8c82e31f93a97b4517d5c2777bd4ae55b9e5a1fd37df5f22e63e2673fa01ca4afbc4e07de6955391d77bd7f90fb
7
+ data.tar.gz: 863ef847e4ddff6b544a733e001bcd2291c73ab394573a299d54a8f2581066fb423b40be052ce6a440c1daffbd6ddb7500c5f01b7ce2de0e38e4277c8ae9e53e
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/bio-gemma-wrapper.svg)](https://badge.fury.io/rb/bio-gemma-wrapper)
2
+
1
3
  # GEMMA wrapper caches K between runs with LOCO support
2
4
 
3
5
  ![Genetic associations identified in CFW mice using GEMMA (Parker et al,
@@ -39,10 +41,12 @@ Invoke the tool with
39
41
 
40
42
  gemma-wrapper --help
41
43
 
42
- and it will render
44
+ and it will render something like
43
45
 
44
46
  ```
45
47
  Usage: gemma-wrapper [options] -- [gemma-options]
48
+ --permutate n Permutate # times by shuffling phenotypes
49
+ --permute-phenotypes filen Phenotypes to be shuffled in permutations
46
50
  --loco [x,y,1,2,3...] Run full LOCO
47
51
  --input filen JSON input variables (used for LOCO)
48
52
  --cache-dir path Use a cache directory
@@ -95,7 +99,8 @@ Run it twice to see
95
99
 
96
100
  gemma-wrapper computes the unique HASH value over the command
97
101
  line switches passed into GEMMA as well as the contents of the files
98
- passed in (here the genotype and phenotype files).
102
+ passed in (here the genotype and phenotype files - actually it ignores the phenotype with K because
103
+ GEMMA always computes the same K).
99
104
 
100
105
  You can also get JSON output on STDOUT by providing the --json switch
101
106
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.97.1
1
+ 0.98
@@ -35,9 +35,13 @@ GEMMA wrapper example:
35
35
  -lmm 2 -maf 0.1 \\
36
36
  -debug > GWA.json
37
37
 
38
+ Gemma gets used from the path. You can override by setting
39
+
40
+ env GEMMA_COMMAND=path/bin/gemma gemma-wrapper ...
41
+
38
42
  "
39
43
  # These are used for testing compatibility
40
- GEMMA_V_MAJOR = 97
44
+ GEMMA_V_MAJOR = 98
41
45
  GEMMA_V_MINOR = 0
42
46
 
43
47
  basepath = File.dirname(File.dirname(__FILE__))
@@ -61,6 +65,7 @@ if not gemma_command
61
65
  end
62
66
  end
63
67
 
68
+
64
69
  require 'fileutils'
65
70
  require 'optparse'
66
71
  require 'tmpdir'
@@ -76,13 +81,13 @@ options = { show_help: false, source: 'https://github.com/genetics-statistics/ge
76
81
  opts = OptionParser.new do |o|
77
82
  o.banner = "\nUsage: #{File.basename($0)} [options] -- [gemma-options]"
78
83
 
79
- o.on('--permutate n', Integer, 'Permutate by shuffling phenotypes') do |lst|
84
+ o.on('--permutate n', Integer, 'Permutate # times by shuffling phenotypes') do |lst|
80
85
  options[:permutate] = lst
81
86
  options[:force] = true
82
87
  end
83
88
 
84
- o.on('--phenotypes filen',String, 'Phenotypes to be shuffled in permutations') do |phenotypes|
85
- options[:phenotypes] = phenotypes
89
+ o.on('--permute-phenotypes filen',String, 'Phenotypes to be shuffled in permutations') do |phenotypes|
90
+ options[:permute_phenotypes] = phenotypes
86
91
  raise "Phenotype input file #{phenotypes} does not exist" if !File.exist?(phenotypes)
87
92
  end
88
93
 
@@ -176,6 +181,7 @@ info.call GEMMA_K_BANNER
176
181
 
177
182
  # Check gemma version
178
183
  GEMMA_COMMAND=options[:gemma_command]
184
+
179
185
  gemma_version_header = `#{GEMMA_COMMAND}`.split("\n").grep(/GEMMA|Version/)[0].strip
180
186
  info.call "Using ",gemma_version_header,"\n"
181
187
  gemma_version = gemma_version_header.split(/[,\s]+/)[1]
@@ -197,12 +203,26 @@ if RUBY_VERSION =~ /^1/
197
203
  warning "runs on Ruby 2.x only\n"
198
204
  end
199
205
 
206
+ DO_COMPUTE_KINSHIP = gemma_args.include?("-gk")
207
+ DO_COMPUTE_GWA = !DO_COMPUTE_KINSHIP
208
+
200
209
  # ---- Compute HASH on inputs
201
210
  hashme = []
202
211
  geno_idx = gemma_args.index '-g'
203
- raise "Expected GEMMA -g switch" if geno_idx == nil
204
- hashme = gemma_args
205
- hashme += ['-p', options[:phenotypes]] if options[:phenotypes]
212
+ raise "Expected GEMMA -g genotype file switch" if geno_idx == nil
213
+ pheno_idx = gemma_args.index '-p'
214
+ hashme =
215
+ if DO_COMPUTE_KINSHIP and pheno_idx != nil
216
+ p [pheno_idx,gemma_args[pheno_idx+2..-1]]
217
+ gemma_args[0..pheno_idx-1] + gemma_args[pheno_idx+2..-1]
218
+ else
219
+ gemma_args
220
+ end
221
+
222
+ if DO_COMPUTE_GWA
223
+ raise "Did not expect GEMMA -p phenotype file switch" if pheno_idx
224
+ hashme += ['-p', options[:permute_phenotypes]] if options[:permute_phenotypes]
225
+ end
206
226
 
207
227
  require 'digest/sha1'
208
228
  debug.call "Hashing on ",hashme,"\n"
@@ -302,7 +322,7 @@ end
302
322
  # ---- Run GWA
303
323
  gwas = lambda do | chr, kfn, pfn |
304
324
  record[:type] = "GWA"
305
- error.call "Do not use the GEMMA -k switch with gemma-wrapper!" if GEMMA_ARGS.include? '-k' # K is automatic
325
+ error.call "Do not use the GEMMA -k switch with gemma-wrapper - it is automatic!" if GEMMA_ARGS.include? '-k' # K is automatic
306
326
  hashi, cache_hit = cache.call chr,".assoc.txt"
307
327
  if not cache_hit
308
328
  args = [ '-k', kfn, '-o', hashi ]
@@ -313,7 +333,8 @@ gwas = lambda do | chr, kfn, pfn |
313
333
  end
314
334
 
315
335
  LOCO = options[:loco]
316
- if GEMMA_ARGS.include? '-gk'
336
+ # if GEMMA_ARGS.include? '-gk'
337
+ if DO_COMPUTE_KINSHIP
317
338
  # compute K
318
339
  info.call LOCO
319
340
  if LOCO != nil
@@ -325,7 +346,7 @@ if GEMMA_ARGS.include? '-gk'
325
346
  kinship.call # no LOCO
326
347
  end
327
348
  else
328
- # GWAS
349
+ # DO_COMPUTE_GWA
329
350
  json_in = JSON.parse(File.read(options[:input]))
330
351
  raise "JSON problem, file #{options[:input]} is not -gk derived" if json_in["type"] != "K"
331
352
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-gemma-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.97.1
4
+ version: '0.98'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pjotr Prins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-19 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: GEMMA wrapper adds LOCO and permutation support. Also caches K between
14
14
  runs with LOCO support