bio-polymarker_db_batch 0.4.0 → 0.5.0

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
  SHA1:
3
- metadata.gz: 34300c3ab7db4b1aa97f72a1eb129b132cb2f151
4
- data.tar.gz: 1c2793e119d6fb7db7a8e1fcd8f2038d1e769d5f
3
+ metadata.gz: 660fa22d63f669c926d128aece6bd65f4f55e36f
4
+ data.tar.gz: 4b907713e95acc39e85825b49a01f97ebf477805
5
5
  SHA512:
6
- metadata.gz: 2c969309580aefa5b53d02760719ecb8356732698095ec8f0937a1a0aa0a5af900f7586eece85c4f7cc5fdfcaf6671e8c138cf3f0854af342e1203fc12174e09
7
- data.tar.gz: d3a7b2b7a6372fe5e982923eea9a0a8d1693e157dc9788ea0d2c79c05aaddd8dd98611b95cc946e0132658d671bd5abeea64719d057daf53e199b68f39ff6b53
6
+ metadata.gz: 3a055fa7de5e42d50a9d6d61b8b75afd8e5f94c2b50b41bb22efc9fb184dc60b87e44c349653e20fcf7ce6528e4a207b572df6ad82b3177afa41acc5eaddfd12
7
+ data.tar.gz: 683cf0eae0d13e9c7005387811f8c58e4f1f7d13f3d0774cec74f55cd67dc65b799b8c06370e3df68e5c1d367e4179a24f4ad550da28f4d0484339d83c2f8aa9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
@@ -12,7 +12,7 @@ options = {}
12
12
 
13
13
 
14
14
  OptionParser.new do |opts|
15
- opts.banner = "Usage: run_pending_polymarker.rb [options]"
15
+ opts.banner = "Usage: monitor_running_polymarker.rb [options]"
16
16
 
17
17
  opts.on("-p", "--preferences FILE" "File with the preferences") do |o|
18
18
  options[:preferences] = o
@@ -25,13 +25,10 @@ pol=Bio::DB::Polymarker.new(options[:preferences])
25
25
 
26
26
  #pol.mysql_version
27
27
  pol.each_running do |row|
28
- #puts row.join(",")
29
- #puts row.inspect
30
28
  pol.review_running_status(row[0], row[1])
31
29
  end
32
30
 
33
31
  pol.each_timeout do |row|
34
- #puts "Timeouts: #{row[0]}"
35
32
  pol.update_error_status(row[0], "Timeout")
36
33
  end
37
34
 
@@ -4,7 +4,7 @@ class Bio::DB::Polymarker
4
4
 
5
5
  def initialize( props)
6
6
  @properties =Hash[*File.read(props).split(/[=\n]+/)]
7
- #puts @properties.inspect
7
+ puts @properties.inspect
8
8
  end
9
9
 
10
10
  def mysql_version
@@ -54,7 +54,7 @@ class Bio::DB::Polymarker
54
54
  def each_snp_in_file(file_id)
55
55
  query="SELECT name, chromosome, sequence FROM snp, snp_file_snp WHERE snp_file_snp.snpList_snpId = snp.snpId AND snp_file_snp.snp_file_snp_file_id = '#{file_id}' AND snp.process = 1;"
56
56
  ret = 0
57
- puts query
57
+ #puts query
58
58
  if block_given?
59
59
  ret = execute_query(query){|row| yield row }
60
60
  else
@@ -64,21 +64,38 @@ class Bio::DB::Polymarker
64
64
  end
65
65
 
66
66
  def write_output_file_and_execute(file_id, filename)
67
- puts "Writting: #{file_id}_#{filename}"
67
+ #puts "Writting: #{file_id}_#{filename}"
68
68
  path =@properties["execution_path"]+"/#{file_id}_#{filename}"
69
69
  puts "Writting: #{path}"
70
70
  f=File.open(path, "w")
71
-
72
71
  each_snp_in_file(file_id) do |row|
73
72
  f.puts(row.join(","))
74
73
  end
75
- execute_polymarker(path)
76
- update_status(file_id, "SUBMITTED")
77
74
  f.close
75
+ execute_polymarker(file_id, path)
76
+ update_status(file_id, "SUBMITTED")
77
+
78
+ end
79
+
80
+ def get_preferences(file_id)
81
+ query="SELECT name, value FROM preferences \
82
+ join snp_file_preferences on preferenceID = preferences_preferenceID \
83
+ where snp_file_snp_file_id = #{file_id};"
84
+ preferences = Hash.new
85
+ execute_query(query) do |row|
86
+ preferences[row[0].to_sym] = row[1]
87
+ end
88
+ return preferences
78
89
  end
79
90
 
80
- def execute_polymarker(snp_file)
81
- cmd="#{@properties['wrapper_prefix'] } polymarker.rb -m #{snp_file} -o #{snp_file}_out -c #{@properties['path_to_chromosomes']} #{@properties['wrapper_suffix'] }"
91
+ def execute_polymarker(file_id, snp_file)
92
+
93
+ preferences = get_preferences(file_id)
94
+
95
+ cmd=@properties['wrapper_prefix']
96
+ cmd << "polymarker.rb -m #{snp_file} -o #{snp_file}_out "
97
+ cmd << "-c #{@properties['path_to_chromosomes']}/#{preferences[:reference]} "
98
+ cmd << @properties['wrapper_suffix']
82
99
  #polymarker.rb -m 1_GWAS_SNPs.csv -o 1_test -c /Users/ramirezr/Documents/TGAC/references/Triticum_aestivum.IWGSP1.21.dna_rm.genome.fa
83
100
  execute_command(cmd)
84
101
  end
@@ -101,8 +118,6 @@ class Bio::DB::Polymarker
101
118
  def update_error_status(snp_file_id, error_message)
102
119
  snp_file = get_snp_file(snp_file_id)
103
120
  return if snp_file['status'] == "ERROR"
104
-
105
-
106
121
  pst = con.prepare "UPDATE snp_file SET status = 'ERROR', error=? WHERE snp_file_id = ?"
107
122
  puts "update_error_status: #{pst}"
108
123
  pst.execute error_message, snp_file_id
@@ -161,7 +176,7 @@ END_OF_MESSAGE
161
176
 
162
177
  lines.each do |l|
163
178
  error = l.include?("ERROR") unless error
164
- error_message << l if error
179
+ error_message << lines if error
165
180
  end
166
181
  end
167
182
 
@@ -222,7 +237,7 @@ END_OF_MESSAGE
222
237
  return n_rows unless block_given?
223
238
  return ret
224
239
  end
225
- raise "Unsuported query #{query}"
240
+ raise "Unsuported query '#{query}'"
226
241
 
227
242
  end
228
243
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-polymarker_db_batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo H. Ramirez-Gonzalez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio-polyploid-tools