cwords 0.1.4-jruby → 0.1.6-jruby

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -6,10 +6,17 @@ Cwords is a software tool that measure correlations of short oligonucleotide seq
6
6
  All software components require Ruby (>=1.8.6, http://www.ruby-lang.org/) and JRuby (>=1.4.0, http://jruby.org/).
7
7
  The software has only been tested on a Unix platform.
8
8
 
9
- The following Ruby gems are required (install with JRuby gem command)
10
9
 
11
- * jgem install progressbar
12
- * jgem install schleyfox-peach --source=http://gems.github.com
10
+ 2. INSTALL
11
+
12
+ * Install Ruby (www.ruby-lang.org, check if it is already installed: 'ruby -v')
13
+ * Install JRruby (www.jruby.org, check if it is already installed: 'jruby -v'),
14
+ make sure that you have the 'jruby' command in your path.
15
+ * Install Rubygems (www.rubygems.org, check if it is already installed: 'gem -v')
16
+ * Install cwords:
17
+
18
+ > gem install cwords
19
+ > cwords --help
13
20
 
14
21
  2. USAGE
15
22
 
data/bin/cwords CHANGED
@@ -2,10 +2,16 @@
2
2
 
3
3
  scriptdir = File.dirname(__FILE__) + "/../scripts/"
4
4
 
5
+ helps = ARGV.join(" ").match(/--help/)
6
+ if (helps)
7
+ # start lightweight
8
+ exec "jruby --client " + scriptdir + "cwords.rb " + ARGV.join(" ")
9
+ end
10
+
5
11
  mems = ARGV.join(" ").match(/M=(\w+)/)
6
12
  mem = mems ? mems[1] : '4096m'
7
13
  argv = ARGV.select{|x| not x=~ /^M=\w+$/}.join(' ')
8
14
  puts "Starting cwords with max heap size " + mem + " ...\n"
9
15
 
10
- cmd = "jruby --server --fast -J-Xmx#{mem} " + scriptdir + "cwords.rb " + argv
16
+ cmd = "jruby --1.9 --server --fast -J-Xmx#{mem} " + scriptdir + "cwords.rb " + argv
11
17
  exec cmd
data/bin/cwords_mkdb CHANGED
@@ -1,10 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
  scriptdir = File.dirname(__FILE__) + "/../scripts/"
3
3
 
4
+ helps = ARGV.join(" ").match(/--help/)
5
+ if (helps)
6
+ # start lightweight
7
+ exec "jruby --client " + scriptdir + "cwords_mkdb.rb " + ARGV.join(" ")
8
+ end
9
+
4
10
  mems = ARGV.join(" ").match(/M=(\w+)/)
5
11
  mem = mems ? mems[1] : '4096m'
6
12
  argv = ARGV.select{|x| not x=~ /^M=\w+$/}.join(' ')
7
- puts "Starting cwords with max heap size " + mem + " ..."
13
+ puts "Starting cwords with max heap size " + mem + " ...\n"
8
14
 
9
- cmd = "jruby --server --fast -J-Xmx#{mem} " + scriptdir + "cwords_mkdb.rb " + argv
15
+ cmd = "jruby --1.9 --server --fast -J-Xmx#{mem} " + scriptdir + "cwords_mkdb.rb " + argv
10
16
  exec cmd
data/scripts/cwords.rb CHANGED
@@ -1,13 +1,5 @@
1
1
  #!/usr/bin/env jruby
2
2
 
3
- ### Requires jruby, www.jruby.org
4
-
5
- ###
6
- ### Running sum analysis for 5 different measures of word enrichment in a sequence:
7
- ### obs : use the observed word count
8
- ### bin : use presence/absence of word
9
- ### pval : use the p-value of the expected occurrences being >= the observed occurence
10
-
11
3
  srcdir = File.dirname(__FILE__)
12
4
  basedir = srcdir + "/../"
13
5
  libdir = basedir + '/lib/'
@@ -80,7 +72,14 @@ def show_help(msg="", code=0, io=STDOUT)
80
72
  exit(code)
81
73
  end
82
74
 
83
- $coptions.parse!(ARGV)
75
+ begin
76
+ $coptions.parse!(ARGV)
77
+ rescue OptionParser::ParseError => error
78
+ puts error.message
79
+ puts $coptions
80
+ exit
81
+ end
82
+
84
83
  # mandatory parameters
85
84
  [:rankfile].each{|p| show_help("option '#{p}' mandatory") if options[p].nil?}
86
85
  show_help("db or seqfile required") if !(options[:db] or options[:seqfile])
@@ -116,7 +115,7 @@ IO.readlines(annofile).each{|l| word_annotation[l.split("\t")[0]] = l.split("\t"
116
115
 
117
116
  # read optional sequences
118
117
  if options[:seqfile]
119
- puts ">> reading sequences ..."
118
+ puts "\n>> reading sequences ..."
120
119
  sequences = Hash.new
121
120
  IO.readlines(options[:seqfile],">")[1..-1].each do |entry|
122
121
  ls = entry.split("\n").map{|x| x.chomp}
@@ -141,7 +140,7 @@ options[:wordsize].each{|ws| ['a','g','c','t'].rep_perm(ws) {|seqa| wids[seqa.jo
141
140
  # sequence file:
142
141
  # take intersection of rank and sequence IDs
143
142
 
144
- puts ">> Mapping and filtering IDs ..."
143
+ puts "\n>> Mapping and filtering IDs ..."
145
144
 
146
145
  all = []
147
146
  begin
@@ -186,7 +185,7 @@ all.each_with_index{|x,i| allorder[x[0]] = i}
186
185
 
187
186
  wordscores = []
188
187
  if sequences
189
- puts ">> Enumerating words in sequences"
188
+ puts "\n>> Enumerating words in sequences"
190
189
  wordscores = Array.new(all.size) {Array.new(wids.size,0)} # {Java::short[wids.size].new}
191
190
  pbar = ProgressBar.new("progress",sequences.size)
192
191
  all.peach(threads) do |seqid,val|
@@ -270,7 +269,7 @@ end
270
269
  ### Correlation analysis
271
270
  ###
272
271
 
273
- puts ">> Analyzing sequence sets: " + analyze.map{|x| x[1]}.join(", ")
272
+ puts "\n>> Analyzing sequence sets: " + analyze.map{|x| x[1]}.join(", ")
274
273
 
275
274
  analyze.each do |set,nm|
276
275
  ngenes = set.size
@@ -1,11 +1,12 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env jruby
2
2
 
3
3
  srcdir = File.dirname(__FILE__)
4
- basedir = srcdir + "../"
4
+ basedir = srcdir + "/../"
5
5
  libdir = basedir + 'lib/'
6
6
  $LOAD_PATH << libdir
7
7
 
8
8
  require 'wordRS-lib.rb'
9
+ require 'rubygems'
9
10
  require 'progressbar'
10
11
  require 'optparse'
11
12
  require 'fileutils'
@@ -42,7 +43,14 @@ def show_help(msg="", code=0, io=STDOUT)
42
43
  exit(code)
43
44
  end
44
45
 
45
- $coptions.parse!(ARGV)
46
+ begin
47
+ $coptions.parse!(ARGV)
48
+ rescue OptionParser::ParseError => error
49
+ puts error.message
50
+ puts $coptions
51
+ exit
52
+ end
53
+
46
54
  #mandatory parameters
47
55
  [:seqfile].each{ |p| show_help("option '#{p}' mandatory") if options[p].nil?}
48
56
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: jruby
11
11
  authors:
12
12
  - Anders Jacobsen