Skip to content

Commit

Permalink
Preparing to run permutations
Browse files Browse the repository at this point in the history
  • Loading branch information
pjotrp committed May 1, 2018
1 parent 1ae0873 commit 35ef628
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.97
0.97.1
17 changes: 16 additions & 1 deletion bin/gemma-wrapper
Expand Up @@ -78,6 +78,11 @@ opts = OptionParser.new do |o|
options[:permutate] = lst
end

o.on('--phenotypes filen',String, 'Phenotypes to be shuffled in permutations') do |phenotypes|
options[:phenotypes] = phenotypes
raise "Phenotype input file #{phenotypes} does not exist" if !File.exist?(phenotypes)
end

o.on('--loco [x,y,1,2,3...]', Array, 'Run full LOCO') do |lst|
options[:loco] = lst
end
Expand Down Expand Up @@ -134,6 +139,7 @@ json_out = lambda do
print record.to_json if options[:json]
end

# ---- Some error handlers
error = lambda do |*msg|
if options[:json]
record[:error] = *msg.join(" ")
Expand All @@ -142,12 +148,14 @@ error = lambda do |*msg|
end
raise *msg
end

debug = lambda do |*msg|
if options[:debug]
record[:debug].push *msg.join("") if options[:json]
OUTPUT.print "DEBUG: ",*msg,"\n"
end
end

warning = lambda do |*msg|
record[:warnings].push *msg.join("")
OUTPUT.print "WARNING: ",*msg,"\n"
Expand All @@ -157,6 +165,8 @@ info = lambda do |*msg|
OUTPUT.print *msg,"\n" if !options[:quiet]
end

# ---- Start banner

GEMMA_K_VERSION=version
GEMMA_K_BANNER = "gemma-wrapper #{version} (Ruby #{RUBY_VERSION}) by Pjotr Prins 2017,2018\n"
info.call GEMMA_K_BANNER
Expand Down Expand Up @@ -234,6 +244,7 @@ invoke_gemma = lambda do |extra_args, cache_hit = false|
end
err
else
debug.call("Invoking ",cmd) if options[:debug]
system(cmd)
$?.exitstatus
end
Expand Down Expand Up @@ -293,7 +304,7 @@ gwas = lambda do | chr, kfn |
if chr != nil
invoke_gemma.call [ '-loco', chr, '-k', kfn, '-o', hashi ]
else
error.call "Not supported"
invoke_gemma.call [ '-k', kfn, '-o', hashi ]
end
end
end
Expand All @@ -318,6 +329,10 @@ else
k_files.each do | chr, kfn | # call a GWA for each chromosome
gwas.call(chr,kfn)
end
# Permute
if options[:permutate]
debug.call(options[:permutate],"x permutations")
end
end

json_out.call
Expand Down

0 comments on commit 35ef628

Please sign in to comment.