Sha256: 0df66a0bf6e27e461e76a9240fff9f352194be4b984c08310eccf1ea41a08b5d

Contents?: true

Size: 1.34 KB

Versions: 348

Compression:

Stored size: 1.34 KB

Contents

#!/usr/bin/env ruby

require 'rbbt-util'
require 'rbbt/util/simpleopt'

$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands

options = SOPT.setup <<EOF

Produce a heatmap

$ rbbt stat heatmap [options] <filename.tsv> [file.png]

-h--help Print this help
-w--width* Image Width
-h--height* Image Height
-s--size* Image Size (Height and Width)
-l--logs Take logs
-p--positive single color heatmap (positive values)

EOF
if options[:help]
  if defined? rbbt_usage
    rbbt_usage 
  else
    puts SOPT.usage
  end
  exit 0
end

file, png = ARGV

raise "No file" if file.nil?

width, height, size, logs, positive = options.values_at :width, :height, :size, :logs, :positive

size = 800 if size.nil?
width = size if width.nil?
height = size if height.nil?
logs = false if logs.nil?
positive = false if positive.nil?


require 'rbbt/util/R'
if png
    R.run <<-EOF
data = rbbt.tsv2matrix(rbbt.tsv('#{file}'))
rbbt.pheatmap('#{png}', data, width=#{ width }, height=#{ height }, take_log=#{R.ruby2R logs}, positive=#{R.ruby2R positive})
    EOF
else
    TmpFile.with_file(nil, :extension => 'png') do |png|
        R.run <<-EOF
data = rbbt.tsv2matrix(rbbt.tsv('#{file}'))
rbbt.pheatmap('#{png}', data, width=#{ width }, height=#{ height }, take_log=#{R.ruby2R logs}, positive=#{R.ruby2R positive})
        EOF
        `eog #{png}`
    end
end

Version data entries

348 entries across 348 versions & 1 rubygems

Version Path
rbbt-util-5.44.1 share/rbbt_commands/stat/heatmap
rbbt-util-5.43.0 share/rbbt_commands/stat/heatmap
rbbt-util-5.42.0 share/rbbt_commands/stat/heatmap
rbbt-util-5.41.1 share/rbbt_commands/stat/heatmap
rbbt-util-5.41.0 share/rbbt_commands/stat/heatmap
rbbt-util-5.40.5 share/rbbt_commands/stat/heatmap
rbbt-util-5.40.4 share/rbbt_commands/stat/heatmap
rbbt-util-5.40.3 share/rbbt_commands/stat/heatmap
rbbt-util-5.40.0 share/rbbt_commands/stat/heatmap
rbbt-util-5.39.0 share/rbbt_commands/stat/heatmap
rbbt-util-5.38.1 share/rbbt_commands/stat/heatmap
rbbt-util-5.38.0 share/rbbt_commands/stat/heatmap
rbbt-util-5.37.16 share/rbbt_commands/stat/heatmap
rbbt-util-5.37.15 share/rbbt_commands/stat/heatmap
rbbt-util-5.37.14 share/rbbt_commands/stat/heatmap
rbbt-util-5.37.13 share/rbbt_commands/stat/heatmap
rbbt-util-5.37.12 share/rbbt_commands/stat/heatmap
rbbt-util-5.37.11 share/rbbt_commands/stat/heatmap
rbbt-util-5.37.10 share/rbbt_commands/stat/heatmap
rbbt-util-5.37.9 share/rbbt_commands/stat/heatmap