bio-polyploid-tools 0.2.3 → 0.3.1

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: 019bf8dc15f35de0be9a55567b8041f9b98ac326
4
- data.tar.gz: 3e0a76bbefead5c5284c64a01b36645748a70098
3
+ metadata.gz: e22a969416448c22a39bc4ba2e0b019392a97ed4
4
+ data.tar.gz: 16fa6b61e54d6a6da47867826435194605ce0d22
5
5
  SHA512:
6
- metadata.gz: 98e2d6c023ee8d89014efe65da619f0a98808c1540c3773aaef901de9f5c2338a3cc4645bdee1a3cdc430d525587c27d576d1f19e2ac8e59d7724a6efaac5901
7
- data.tar.gz: 3d09c9a1972b7538eb160ee89786f9bdd3f8c52fec554da110222241767e7a17f6efd7f0f42a219fb06cd3689037fbee2ec88eeae0cb94e40333a5c491259421
6
+ metadata.gz: 96f1764086a490876516b7f9cf09c70d825733c518ecf4c21ad185ef24dda889e4398a3fe2a2f8e206feb056e2fe6c474fe7b938d03148c50a1a3ae2e6a6e048
7
+ data.tar.gz: 4792600da52fc6fdc31f15b2ed4c1e7db294aaf87d3c4538b6242951a24a6f4ba9a359f271a12d66af4c8e51f6eee746f588cb21d65a545216ffeb4bb05f8411
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source "http://rubygems.org"
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
6
  gem "bio", ">= 1.4.3"
7
- gem "bio-samtools", ">= 2.0.3"
7
+ gem "bio-samtools", ">= 2.0.4"
8
8
  gem "rake"
9
9
  gem "jeweler"
10
10
 
@@ -4,7 +4,7 @@ GEM
4
4
  addressable (2.3.6)
5
5
  atomic (1.1.16)
6
6
  bio (1.4.3.0001)
7
- bio-samtools (2.0.3)
7
+ bio-samtools (2.0.4)
8
8
  bio (>= 1.4.2)
9
9
  bio-svgenes (>= 0.4.1)
10
10
  bio-svgenes (0.4.1)
@@ -61,7 +61,7 @@ PLATFORMS
61
61
 
62
62
  DEPENDENCIES
63
63
  bio (>= 1.4.3)
64
- bio-samtools (>= 2.0.3)
64
+ bio-samtools (>= 2.0.4)
65
65
  jeweler
66
66
  rake
67
67
  systemu (>= 2.5.2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.1
data/bin/bfr.rb CHANGED
@@ -55,7 +55,7 @@ OptionParser.new do |opts|
55
55
  end
56
56
 
57
57
  opts.on("-n", "--chunk FILE", "Sorted BAM file with the alginments from bulk1 2 (corresponding to the phenotype of parental 2)") do |o|
58
- options[:chunk] = o.to_1
58
+ options[:chunk] = o.to_i
59
59
  end
60
60
 
61
61
 
@@ -76,14 +76,22 @@ primer_3_input="#{output_folder}/primer_3_input_temp"
76
76
  primer_3_output="#{output_folder}/primer_3_output_temp"
77
77
  exons_filename="#{output_folder}/exons_genes_and_contigs.fa"
78
78
  output_primers="#{output_folder}/primers.csv"
79
+ @status_file="#{output_folder}/status.txt"
79
80
 
80
81
  primer_3_config=File.expand_path(File.dirname(__FILE__) + '/../conf/primer3_config')
81
82
  model=options[:model]
82
83
 
83
84
 
85
+ def write_status(status)
86
+ f=File.open(@status_file, "a")
87
+ f.puts "#{Time.now.to_s},#{status}"
88
+ f.close
89
+ end
90
+
84
91
  min_identity= 90
85
92
  snps = Array.new
86
93
 
94
+ write_status "Loading Reference"
87
95
  #0. Load the fasta index
88
96
  fasta_reference_db = nil
89
97
  if fasta_reference
@@ -93,9 +101,12 @@ if fasta_reference
93
101
  end
94
102
 
95
103
 
104
+
105
+
96
106
  #1. Read all the SNP files
97
107
  #All the SNPs should be on the same chromosome as the first SNP.
98
108
  #chromosome = nil
109
+ write_status "Reading SNPs"
99
110
  File.open(test_file) do | f |
100
111
  f.each_line do | line |
101
112
  # p line.chomp!
@@ -121,7 +132,7 @@ end
121
132
  #1.1 Close fasta file
122
133
  #fasta_reference_db.close() if fasta_reference_db
123
134
  #2. Generate all the fasta files
124
-
135
+ write_status "Writing sequences to align"
125
136
  written_seqs = Set.new
126
137
  file = File.open(temp_fasta_query, "w")
127
138
  snps.each do |snp|
@@ -135,6 +146,7 @@ file.close
135
146
  #3. Run exonerate on each of the possible chromosomes for the SNP
136
147
  #puts chromosome
137
148
  #chr_group = chromosome[0]
149
+ write_status "Searching markers in genome"
138
150
  exo_f = File.open(exonerate_file, "w")
139
151
  contigs_f = File.open(temp_contigs, "w")
140
152
  filename=path_to_contigs
@@ -165,6 +177,7 @@ contigs_f.close()
165
177
  #4. Load all the results from exonerate and get the input filename for primer3
166
178
  #Custom arm selection function that only uses the first two characters. Maybe
167
179
  #we want to make it a bit more cleaver
180
+ write_status "Reading best alignment on each chromosome"
168
181
  arm_selection_first_two = lambda do | contig_name |
169
182
  ret = contig_name[0,2]
170
183
  return ret
@@ -188,6 +201,9 @@ snps.each do |snp|
188
201
  end
189
202
  container.add_alignments({:exonerate_file=>exonerate_file, :arm_selection=>arm_selection_embl, :min_identity=>min_identity})
190
203
 
204
+
205
+ #4.1 generating primer3 file
206
+ write_status "Running primer3"
191
207
  file = File.open(exons_filename, "w")
192
208
  container.print_fasta_snp_exones(file)
193
209
  file.close
@@ -204,7 +220,9 @@ file.close
204
220
 
205
221
  Bio::DB::Primer3.run({:in=>primer_3_input, :out=>primer_3_output})
206
222
 
223
+
207
224
  #5. Pick the best primer and make the primer3 output
225
+ write_status "Selecting best primers"
208
226
  kasp_container=Bio::DB::Primer3::KASPContainer.new
209
227
  kasp_container.line_1=snp_in
210
228
  kasp_container.line_2=original_name
@@ -217,3 +235,4 @@ kasp_container.add_primers_file(primer_3_output)
217
235
  header = "Marker,SNP,RegionSize,chromosome,total_contigs,contig_regions,SNP_type,#{snp_in},#{original_name},common,primer_type,orientation,#{snp_in}_TM,#{original_name}_TM,common_TM,selected_from,product_size"
218
236
  File.open(output_primers, 'w') { |f| f.write("#{header}\n#{kasp_container.print_primers}") }
219
237
 
238
+ write_status "DONE"
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: bio-polyploid-tools 0.2.3 ruby lib
5
+ # stub: bio-polyploid-tools 0.3.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bio-polyploid-tools"
9
- s.version = "0.2.3"
9
+ s.version = "0.3.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Ricardo H. Ramirez-Gonzalez"]
14
- s.date = "2014-04-27"
14
+ s.date = "2014-05-08"
15
15
  s.description = "Repository of tools developed in TGAC and Crop Genetics in JIC to work with polyploid wheat"
16
16
  s.email = "ricardo.ramirez-gonzalez@tgac.ac.uk"
17
17
  s.executables = ["bfr.rb", "count_variations.rb", "filter_blat_by_target_coverage.rb", "find_best_blat_hit.rb", "find_best_exonerate.rb", "hexaploid_primers.rb", "homokaryot_primers.rb", "map_markers_to_contigs.rb", "markers_in_region.rb", "polymarker.rb", "snps_between_bams.rb"]
@@ -102,6 +102,7 @@ Gem::Specification.new do |s|
102
102
  "test/data/S22380157.fa.fai",
103
103
  "test/data/Test3Aspecific.csv",
104
104
  "test/data/Test3Aspecific_contigs.fa",
105
+ "test/data/bfr_out_test.csv",
105
106
  "test/data/patological_cases5D.csv",
106
107
  "test/data/short_primer_design_test.csv",
107
108
  "test/data/test_primer3_error.csv",
@@ -121,20 +122,20 @@ Gem::Specification.new do |s|
121
122
 
122
123
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
123
124
  s.add_runtime_dependency(%q<bio>, [">= 1.4.3"])
124
- s.add_runtime_dependency(%q<bio-samtools>, [">= 2.0.3"])
125
+ s.add_runtime_dependency(%q<bio-samtools>, [">= 2.0.4"])
125
126
  s.add_runtime_dependency(%q<rake>, [">= 0"])
126
127
  s.add_runtime_dependency(%q<jeweler>, [">= 0"])
127
128
  s.add_runtime_dependency(%q<systemu>, [">= 2.5.2"])
128
129
  else
129
130
  s.add_dependency(%q<bio>, [">= 1.4.3"])
130
- s.add_dependency(%q<bio-samtools>, [">= 2.0.3"])
131
+ s.add_dependency(%q<bio-samtools>, [">= 2.0.4"])
131
132
  s.add_dependency(%q<rake>, [">= 0"])
132
133
  s.add_dependency(%q<jeweler>, [">= 0"])
133
134
  s.add_dependency(%q<systemu>, [">= 2.5.2"])
134
135
  end
135
136
  else
136
137
  s.add_dependency(%q<bio>, [">= 1.4.3"])
137
- s.add_dependency(%q<bio-samtools>, [">= 2.0.3"])
138
+ s.add_dependency(%q<bio-samtools>, [">= 2.0.4"])
138
139
  s.add_dependency(%q<rake>, [">= 0"])
139
140
  s.add_dependency(%q<jeweler>, [">= 0"])
140
141
  s.add_dependency(%q<systemu>, [">= 2.5.2"])
@@ -81,11 +81,7 @@ module Bio::PolyploidTools
81
81
  end
82
82
  end
83
83
 
84
- def primer_3_input_for_snp(snp)
85
- gene_region = snp.covered_region
86
- local_pos_in_gene = snp.local_position
87
- puts ""
88
- end
84
+
89
85
 
90
86
  def fasta_string_for_snp(snp)
91
87
  gene_region = snp.covered_region
@@ -110,7 +106,6 @@ module Bio::PolyploidTools
110
106
  to_print[local_pos_in_gene] = to_print[local_pos_in_gene].upcase
111
107
  ret_str << to_print
112
108
  end
113
- puts ret_str
114
109
  ret_str
115
110
  end
116
111
 
@@ -22,15 +22,18 @@ module Bio::PolyploidTools
22
22
  reg_str.chomp!
23
23
  snp = SNP.new
24
24
  snp.gene, snp.original, snp.position, snp.snp, snp.chromosome = reg_str.split(",")
25
- snp.position = snp.position.strip!.to_i
26
- snp.original.upcase!.strip!
27
- snp.snp.upcase!.strip!
25
+ snp.position.strip!
26
+ snp.position = snp.position.to_i
27
+ snp.original.upcase!
28
+ snp.original.strip!
29
+ snp.snp.upcase!
30
+ snp.snp.strip!
28
31
  snp.chromosome.strip!
29
32
  snp.exon_list = Hash.new()
30
33
  snp.use_reference = false
31
34
  snp
32
35
  end
33
-
36
+
34
37
  def initialize
35
38
  @genomes_count = 3 #TODO: if we want to use this with other polyploids, me need to set this as a variable in the main script.
36
39
  end
@@ -1,5 +1,6 @@
1
1
 
2
2
  require_relative "SNP"
3
+ require 'bio-samtools'
3
4
  module Bio::PolyploidTools
4
5
  class SNPSequenceException < RuntimeError
5
6
  end
@@ -0,0 +1,5 @@
1
+ LIB1721 LIB1722 LIB1716 LIB1719 gnl|UG|Ta#S22380157 g 210 C 1.06 144 136 LIB1722 0.17 0.18 24 24
2
+ LIB1721 LIB1722 LIB1716 LIB1719 gnl|UG|Ta#S22380157 g 297 A 0.8 172 164 LIB1722 0.2 0.16 34 26
3
+ LIB1721 LIB1722 LIB1716 LIB1719 gnl|UG|Ta#S22380157 t 300 C 0.84 173 168 LIB1722 0.18 0.15 32 26
4
+ LIB1721 LIB1722 LIB1716 LIB1719 gnl|UG|Ta#S22380157 g 645 A 0.4 78 87 LIB1721 0.28 0.71 22 62
5
+ LIB1721 LIB1722 LIB1716 LIB1719 gnl|UG|Ta#S22380157 a 674 G 0.36 49 55 LIB1722 0.45 0.16 22 9
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-polyploid-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.1
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-04-27 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.3
33
+ version: 2.0.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.3
40
+ version: 2.0.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -182,6 +182,7 @@ files:
182
182
  - test/data/S22380157.fa.fai
183
183
  - test/data/Test3Aspecific.csv
184
184
  - test/data/Test3Aspecific_contigs.fa
185
+ - test/data/bfr_out_test.csv
185
186
  - test/data/patological_cases5D.csv
186
187
  - test/data/short_primer_design_test.csv
187
188
  - test/data/test_primer3_error.csv