bio-gemma-wrapper 0.99.1 → 0.99.2

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
  SHA256:
3
- metadata.gz: 9ddfd904e74beebe0de1b97732d872fce171732965a835b101b9cc9be815bb05
4
- data.tar.gz: 2dae1c019da23f2f87216694d641fc1eb852aa7800557bd10cfb08cb3425e844
3
+ metadata.gz: e27a8a3abb00b758095df5956b3854674faf5ff681a93bc028df273c40125c0d
4
+ data.tar.gz: e9675dbb0ea0f087dd21774635d38f3cda11b46a88b36c77dd308086fd0ec5f2
5
5
  SHA512:
6
- metadata.gz: 38454a3f12dab85bef711051e73e20a015fe6b6d9c71bafada2197b9aef1aa0eabe3f3709cb0dc9d0c39f4cc454c15bc4d3aea5d06140ccde72fa13aa6285f51
7
- data.tar.gz: 28e77a6995893245c501e602d488b5e0c504549fa91d8c94f902591b87b4454fe9b7923667dfacae2ab1dac7f6f7d814df1ec036b2b4f616dfd4b84c549d35d1
6
+ metadata.gz: 81cf5440fa531d5a831efa787800c8bea230d47cddc666a31fff066551ff347708a41ddf1368c0d3946c7ba9faef8e5882e398ad340850253c53961cce96f662
7
+ data.tar.gz: 582ae78c48a1eb8eeca01172eaeaba9d5ca23e69601967e334f8c218e3a4dd74b297861b01ce49b1357798b49a96c12e737100dcacec7fc34b70da1fc9c75f0d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.99.1
1
+ 0.99.2
data/bin/gemma-wrapper CHANGED
@@ -41,7 +41,7 @@ Gemma gets used from the path. You can override by setting
41
41
  "
42
42
  # These are used for testing compatibility with the gemma tool
43
43
  GEMMA_V_MAJOR = 98
44
- GEMMA_V_MINOR = 1
44
+ GEMMA_V_MINOR = 4
45
45
 
46
46
  basepath = File.dirname(File.dirname(__FILE__))
47
47
  $: << File.join(basepath,'lib')
@@ -239,6 +239,8 @@ DO_COMPUTE_GWA = !DO_COMPUTE_KINSHIP
239
239
  # ---- Set up parallel
240
240
  if options[:parallel]
241
241
  begin
242
+ skip_cite = `echo "will cite" |parallel --citation`
243
+ debug.call(skip_cite)
242
244
  PARALLEL_INFO = `parallel --help`
243
245
  rescue Errno::ENOENT
244
246
  error.call "<parallel> command not found"
@@ -256,7 +258,6 @@ if DO_COMPUTE_GWA and options[:permute_phenotypes]
256
258
  raise "Did not expect GEMMA -p phenotype whith permutations (only use --permutate-phenotypes)" if pheno_idx
257
259
  end
258
260
 
259
-
260
261
  execute = lambda { |cmd|
261
262
  info.call("Executing: #{cmd}")
262
263
  err = 0
@@ -276,14 +277,6 @@ execute = lambda { |cmd|
276
277
  err
277
278
  }
278
279
 
279
- hashme =
280
- if DO_COMPUTE_KINSHIP and pheno_idx != nil
281
- # Remove the phenotype file from the hash for GRM computation
282
- gemma_args[0..pheno_idx-1] + gemma_args[pheno_idx+2..-1]
283
- else
284
- gemma_args
285
- end
286
-
287
280
  compute_hash = lambda do | phenofn = nil |
288
281
  # Compute a HASH on the inputs
289
282
  debug.call "Hashing on ",hashme,"\n"
@@ -302,6 +295,7 @@ compute_hash = lambda do | phenofn = nil |
302
295
  hashes << item
303
296
  end
304
297
  end
298
+ debug.call(hashes)
305
299
  Digest::SHA1.hexdigest hashes.join(' ')
306
300
  end
307
301
 
@@ -311,12 +305,23 @@ options[:hash] = HASH
311
305
  # Create cache dir
312
306
  FileUtils::mkdir_p options[:cache_dir]
313
307
 
308
+ Dir.mktmpdir do |tmpdir| # tmpdir for GEMMA output
309
+
314
310
  error.call "Do not use the GEMMA -o switch!" if gemma_args.include? '-o'
315
311
  error.call "Do not use the GEMMA -outdir switch!" if gemma_args.include? '-outdir'
312
+ GEMMA_ARGS_HASH = gemma_args.dup # do not include outdir
316
313
  gemma_args << '-outdir'
317
- gemma_args << options[:cache_dir]
314
+ gemma_args << tmpdir
318
315
  GEMMA_ARGS = gemma_args
319
316
 
317
+ hashme =
318
+ if DO_COMPUTE_KINSHIP and pheno_idx != nil
319
+ # Remove the phenotype file from the hash for GRM computation
320
+ GEMMA_ARGS_HASH[0..pheno_idx-1] + GEMMA_ARGS_HASH[pheno_idx+2..-1]
321
+ else
322
+ GEMMA_ARGS_HASH
323
+ end
324
+
320
325
  debug.call "Options: ",options,"\n" if !options[:quiet]
321
326
 
322
327
  invoke_gemma = lambda do |extra_args, cache_hit = false, chr = "full", permutation = 1|
@@ -326,7 +331,7 @@ invoke_gemma = lambda do |extra_args, cache_hit = false, chr = "full", permutati
326
331
  if options[:slurm]
327
332
  info.call cmd
328
333
  hashi = HASH
329
- prefix = options[:cache_dir]+'/'+hashi
334
+ prefix = tmpdir+'/'+hashi
330
335
  scriptfn = prefix+".#{chr}.#{permutation}-pbs.sh"
331
336
  script = "#!/bin/bash
332
337
  #SBATCH --job-name=gemma-#{scriptfn}
@@ -371,6 +376,7 @@ srun #{cmd}
371
376
  end
372
377
  end
373
378
 
379
+ # Takes the hash value and checks whether the (output) file exists
374
380
  # returns datafn, logfn, cache_hit
375
381
  cache = lambda do | chr, ext, h=HASH, permutation=0 |
376
382
  inject = (chr==nil ? "" : ".#{chr}" )+ext
@@ -517,3 +523,17 @@ if options[:parallel]
517
523
  info.call("Run successful!")
518
524
  end
519
525
  json_out.call
526
+
527
+ # copy all output files to the cache_dir. If a file exists only emit a warning
528
+ Dir.glob("*.txt", base: tmpdir) do | fn |
529
+ source = tmpdir + "/" + fn
530
+ dest = options[:cache_dir] + "/" + fn
531
+ if not File.exist?(dest) or options[:force]
532
+ info.call "Move #{source} to #{dest}"
533
+ FileUtils.mv source, dest, verbose: false
534
+ else
535
+ warning.call "File #{dest} already exists. Not overwriting"
536
+ end
537
+ end
538
+
539
+ end # tmpdir
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.name = 'bio-gemma-wrapper'
3
3
  s.version = File.read('VERSION')
4
4
  s.summary = "GEMMA with LOCO and permutations"
5
- s.description = "GEMMA wrapper adds LOCO and permutation support. Also caches K between runs with LOCO support"
5
+ s.description = "GEMMA wrapper adds LOCO and permutation support. Also runs in parallel and caches K between runs with LOCO support"
6
6
  s.authors = ["Pjotr Prins"]
7
7
  s.email = 'pjotr.public01@thebird.nl'
8
8
  s.files = ["bin/gemma-wrapper",
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-gemma-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.1
4
+ version: 0.99.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pjotr Prins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-11 00:00:00.000000000 Z
11
+ date: 2021-08-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: GEMMA wrapper adds LOCO and permutation support. Also caches K between
14
- runs with LOCO support
13
+ description: GEMMA wrapper adds LOCO and permutation support. Also runs in parallel
14
+ and caches K between runs with LOCO support
15
15
  email: pjotr.public01@thebird.nl
16
16
  executables:
17
17
  - gemma-wrapper
@@ -43,8 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  - !ruby/object:Gem::Version
44
44
  version: '0'
45
45
  requirements: []
46
- rubyforge_project:
47
- rubygems_version: 2.7.6.2
46
+ rubygems_version: 3.2.5
48
47
  signing_key:
49
48
  specification_version: 4
50
49
  summary: GEMMA with LOCO and permutations