bio-rocker 0.1.0 → 0.1.01

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ROCker +2 -0
  3. data/lib/rocker.rb +22 -13
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51e493216ea815f9919322e9b1319f9914d824c7
4
- data.tar.gz: 8c7bf556507ef0b11c5f2477fad589a62c016f11
3
+ metadata.gz: a6bf7fe40cc80fa1ef63124c73b82edee4df9c57
4
+ data.tar.gz: e91da1b61e6e07d45444238fd682a312b84a0ddc
5
5
  SHA512:
6
- metadata.gz: b57faf770219b8ab364b25f59696852f219a204f22b12be5fb89d7932e0cb10429316e0b7645bf7e7a18c56590a669f605f444e667cb4a9467626db100df0b34
7
- data.tar.gz: 47223060bd29a689406067e9bff41352ffa841c8475a25943e83dc6cfc2901ae7ad8f3b8eea1a44c5cfbe0b6fccac45dd1cf493eb0000ed19877f451bf0463e8
6
+ metadata.gz: 2efa7d40badd0975e31c23e26c8912fb4c27c07cd8394cc79fc66780623bb2e30aac89eded1a58248d8d214cf416dfcc1a50ecc46b2ca913bc4c8d9e3def6b48
7
+ data.tar.gz: 84b9c0f7f089327c7b56f92299ba0f6d8eb967300b00ebbff688b7fe7cb75b10cdc132fb6aaf1bd09faab2551a718a2230e6ed10ca7b602b845e7b7ea8c69232
data/bin/ROCker CHANGED
@@ -125,7 +125,9 @@ opts = OptionParser.new do |opt|
125
125
  opt.separator "+ ADVANCED PLOTTING ARGUMENTS"
126
126
  opt.on("-t", "--table PATH", "Formated tabular file to be created (or reused). Required unless -b is provided."){ |v| o[:table]=v }
127
127
  opt.on( "--color", "Color alignment by amino acid."){ o[:color]=true }
128
+ opt.on( "--no-transparency", "Do not use (semi-)transparencies."){ |v| o[:transparency] = v }
128
129
  opt.on( "--min-score NUMBER", "Minimum Bit-Score to consider a hit. By default: #{ROCker.default :minscore}"){ |v| o[:minscore]=v.to_f }
130
+ opt.on( "--stats-impact", "Plot impact on statistics, instead of absolute values per window."){ o[:impact]=true }
129
131
  opt.on("-s", "--subject SBJ1,SBJ2,...", Array,
130
132
  "Plot only information regarding this(ese) subject(s). If multiple, separate by comma. By default, all hits are plotted."){ |v| o[:sbj]=v }
131
133
  opt.on("-f", "--plot-format STRING",
data/lib/rocker.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # @author Luis M. Rodriguez-R <lmrodriguezr at gmail dot com>
3
3
  # @author Luis (Coto) Orellana
4
4
  # @license artistic license 2.0
5
- # @update Jan-22-2015
5
+ # @update Feb-04-2015
6
6
  #
7
7
 
8
8
  require 'rocker/blasthit'
@@ -27,7 +27,7 @@ class ROCker
27
27
  # Filter
28
28
  :sbj=>[],
29
29
  # Plot
30
- :color=>false, :gformat=>'pdf', :width=>9, :height=>9
30
+ :color=>false, :gformat=>'pdf', :width=>9, :height=>9, :impact=>false, :transparency=>true,
31
31
  }
32
32
  @@HAS_BUILD_GEMS = nil
33
33
  def self.eutils() @@EUTILS end
@@ -409,8 +409,8 @@ class ROCker
409
409
  data.rrun "par(mar=c(0,4,0,0.5)+.1);"
410
410
  data.rrun "plot(1, t='n', xlim=c(0.5,#{data.aln.cols}+0.5), ylim=range(x$V4)+c(-0.04,0.04)*diff(range(x$V4)), xlab='', ylab='Bit score', xaxs='i', xaxt='n');"
411
411
  data.rrun "noise <- runif(ncol(x),-.2,.2)"
412
- data.rrun "arrows(x0=x$V2, x1=x$V3, y0=x$V4+noise, col=ifelse(x$V5==1, rgb(0,0,.5,.2), rgb(.5,0,0,.2)), length=0);"
413
- data.rrun "points(x$V6, x$V4+noise, col=ifelse(x$V5==1, rgb(0,0,.5,.5), rgb(.5,0,0,.5)), pch=19, cex=1/4);"
412
+ data.rrun "arrows(x0=x$V2, x1=x$V3, y0=x$V4+noise, col=ifelse(x$V5==1, rgb(0,0,.5,#{@o[:transparency] ? ".2" : "1"}), rgb(.5,0,0,#{@o[:transparency] ? ".2" : "1"})), length=0);"
413
+ data.rrun "points(x$V6, x$V4+noise, col=ifelse(x$V5==1, rgb(0,0,.5,#{@o[:transparency] ? ".5" : "1"}), rgb(.5,0,0,#{@o[:transparency] ? ".5" : "1"})), pch=19, cex=1/4);"
414
414
 
415
415
  puts "Plotting windows." unless @o[:q]
416
416
  if some_thr
@@ -433,17 +433,26 @@ class ROCker
433
433
 
434
434
  puts "Plotting statistics." unless @o[:q]
435
435
  data.rrun "par(mar=c(5,4,0,0.5)+.1);"
436
- unless @o[:q] or not some_thr
437
- puts " * sensitivity: #{data.rrun "100*sum(w$tp)/(sum(w$tp)+sum(w$fn))", :float}%"
438
- puts " * specificity: #{data.rrun "100*sum(w$tn)/(sum(w$fp)+sum(w$tn))", :float}%"
439
- puts " * accuracy: #{data.rrun "100*(sum(w$tp)+sum(w$tn))/(sum(w$p)+sum(w$n))", :float}%"
440
- end
441
- data.rrun "plot(1, t='n', xlim=c(0,#{data.aln.cols}),ylim=c(50,100),xlab='Alignment position (amino acids)',ylab='Precision',xaxs='i');"
436
+ data.rrun "plot(1, t='n', xlim=c(0,#{data.aln.cols}),ylim=c(#{@o[:impact] ? "-2,.1" : "50,100"}),xlab='Alignment position (amino acids)',ylab='Precision',xaxs='i');"
442
437
  if some_thr
438
+ sn = data.rrun "100*sum(w$tp)/(sum(w$tp)+sum(w$fn))", :float
439
+ sp = data.rrun "100*sum(w$tn)/(sum(w$fp)+sum(w$tn))", :float
440
+ ac = data.rrun "100*(sum(w$tp)+sum(w$tn))/(sum(w$p)+sum(w$n))", :float
441
+ unless @o[:q]
442
+ puts " * sensitivity: #{sn}%"
443
+ puts " * specificity: #{sp}%"
444
+ puts " * accuracy: #{ac}%"
445
+ end
443
446
  data.rrun "pos <- (w$V1+w$V2)/2"
444
- data.rrun "lines(pos[!is.na(w$specificity)], w$specificity[!is.na(w$specificity)], col='darkred', lwd=2, t='o', cex=1/3, pch=19);"
445
- data.rrun "lines(pos[!is.na(w$sensitivity)], w$sensitivity[!is.na(w$sensitivity)], col='darkgreen', lwd=2, t='o', cex=1/3, pch=19);"
446
- data.rrun "lines(pos[!is.na(w$accuracy)], w$accuracy[!is.na(w$accuracy)], col='darkblue', lwd=2, t='o', cex=1/3, pch=19);"
447
+ if @o[:impact]
448
+ data.rrun "lines(pos[!is.na(w$specificity)], (w$specificity[!is.na(w$specificity)]-#{sp})*w$tp[!is.na(w$specificity)]/sum(w$tp), col='darkred', lwd=2, t='o', cex=1/3, pch=19);"
449
+ data.rrun "lines(pos[!is.na(w$sensitivity)], (w$sensitivity[!is.na(w$sensitivity)]-#{sn})*w$tn[!is.na(w$sensitivity)]/sum(w$tn), col='darkgreen', lwd=2, t='o', cex=1/3, pch=19);"
450
+ data.rrun "lines(pos[!is.na(w$accuracy)], (w$accuracy[!is.na(w$accuracy)]-#{ac})*(w$tp+w$tn)[!is.na(w$accuracy)]/sum(c(w$tp, w$tn)), col='darkblue', lwd=2, t='o', cex=1/3, pch=19);"
451
+ else
452
+ data.rrun "lines(pos[!is.na(w$specificity)], w$specificity[!is.na(w$specificity)], col='darkred', lwd=2, t='o', cex=1/3, pch=19);"
453
+ data.rrun "lines(pos[!is.na(w$sensitivity)], w$sensitivity[!is.na(w$sensitivity)], col='darkgreen', lwd=2, t='o', cex=1/3, pch=19);"
454
+ data.rrun "lines(pos[!is.na(w$accuracy)], w$accuracy[!is.na(w$accuracy)], col='darkblue', lwd=2, t='o', cex=1/3, pch=19);"
455
+ end
447
456
  #data.rrun "lines(pos[!is.na(w$precision)], w$precision[!is.na(w$precision)], col='purple', lwd=2, t='o', cex=1/3, pch=19);"
448
457
  end
449
458
  data.rrun "legend('bottomright',legend=c('Specificity','Sensitivity','Accuracy'),lwd=2,col=c('darkred','darkgreen','darkblue'),ncol=3,bty='n')"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-rocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.01
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis (Coto) Orellana