bio-polyploid-tools 0.10.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/SECURITY.md +16 -0
- data/VERSION +1 -1
- data/bin/polymarker.rb +30 -21
- data/bin/polymarker_capillary.rb +83 -56
- data/bin/{find_homoeologue_variations.rb → polymarker_deletions.rb} +55 -90
- data/bio-polyploid-tools.gemspec +27 -25
- data/lib/bio/BIOExtensions.rb +1 -1
- data/lib/bio/PolyploidTools/ExonContainer.rb +9 -9
- data/lib/bio/PolyploidTools/NoSNPSequence.rb +39 -33
- data/lib/bio/PolyploidTools/SNP.rb +26 -21
- data/lib/bio/db/blast.rb +1 -1
- data/lib/bio/db/primer3.rb +14 -18
- data/test/data/7B_amplicon_test.fa +12 -0
- data/test/data/7B_amplicon_test.fa.fai +1 -0
- data/test/data/7B_amplicon_test_reference.fa +110 -0
- data/test/data/7B_amplicon_test_reference.fa.fai +3 -0
- data/test/data/7B_amplicon_test_reference.fa.ndb +0 -0
- data/test/data/7B_amplicon_test_reference.fa.nhr +0 -0
- data/test/data/7B_amplicon_test_reference.fa.nin +0 -0
- data/test/data/7B_amplicon_test_reference.fa.not +0 -0
- data/test/data/7B_amplicon_test_reference.fa.nsq +0 -0
- data/test/data/7B_amplicon_test_reference.fa.ntf +0 -0
- data/test/data/7B_amplicon_test_reference.fa.nto +0 -0
- metadata +17 -8
- data/README +0 -21
data/bio-polyploid-tools.gemspec
CHANGED
@@ -2,29 +2,28 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: bio-polyploid-tools
|
5
|
+
# stub: bio-polyploid-tools 1.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bio-polyploid-tools".freeze
|
9
|
-
s.version = "
|
9
|
+
s.version = "1.2.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Ricardo H. Ramirez-Gonzalez".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2020-10-28"
|
15
15
|
s.description = "Repository of tools developed at Crop Genetics in JIC to work with polyploid wheat".freeze
|
16
16
|
s.email = "ricardo.ramirez-gonzalez@jic.ac.uk".freeze
|
17
|
-
s.executables = ["bfr.rb".freeze, "blast_triads.rb".freeze, "blast_triads_promoters.rb".freeze, "count_variations.rb".freeze, "filter_blat_by_target_coverage.rb".freeze, "filter_exonerate_by_identity.rb".freeze, "find_best_blat_hit.rb".freeze, "find_best_exonerate.rb".freeze, "
|
17
|
+
s.executables = ["bfr.rb".freeze, "blast_triads.rb".freeze, "blast_triads_promoters.rb".freeze, "count_variations.rb".freeze, "filter_blat_by_target_coverage.rb".freeze, "filter_exonerate_by_identity.rb".freeze, "find_best_blat_hit.rb".freeze, "find_best_exonerate.rb".freeze, "get_longest_hsp_blastx_triads.rb".freeze, "hexaploid_primers.rb".freeze, "homokaryot_primers.rb".freeze, "mafft_triads.rb".freeze, "mafft_triads_promoters.rb".freeze, "map_markers_to_contigs.rb".freeze, "marker_to_vcf.rb".freeze, "markers_in_region.rb".freeze, "mask_triads.rb".freeze, "polymarker.rb".freeze, "polymarker_capillary.rb".freeze, "polymarker_deletions.rb".freeze, "snp_position_to_polymarker.rb".freeze, "snps_between_bams.rb".freeze, "tag_stats.rb".freeze, "vcfLineToTable.rb".freeze, "vcfToPolyMarker.rb".freeze]
|
18
18
|
s.extra_rdoc_files = [
|
19
|
-
"README",
|
20
19
|
"README.md"
|
21
20
|
]
|
22
21
|
s.files = [
|
23
22
|
".travis.yml",
|
24
23
|
"Gemfile",
|
25
|
-
"README",
|
26
24
|
"README.md",
|
27
25
|
"Rakefile",
|
26
|
+
"SECURITY.md",
|
28
27
|
"VERSION",
|
29
28
|
"bin/bfr.rb",
|
30
29
|
"bin/blast_triads.rb",
|
@@ -34,7 +33,6 @@ Gem::Specification.new do |s|
|
|
34
33
|
"bin/filter_exonerate_by_identity.rb",
|
35
34
|
"bin/find_best_blat_hit.rb",
|
36
35
|
"bin/find_best_exonerate.rb",
|
37
|
-
"bin/find_homoeologue_variations.rb",
|
38
36
|
"bin/get_longest_hsp_blastx_triads.rb",
|
39
37
|
"bin/hexaploid_primers.rb",
|
40
38
|
"bin/homokaryot_primers.rb",
|
@@ -46,6 +44,7 @@ Gem::Specification.new do |s|
|
|
46
44
|
"bin/mask_triads.rb",
|
47
45
|
"bin/polymarker.rb",
|
48
46
|
"bin/polymarker_capillary.rb",
|
47
|
+
"bin/polymarker_deletions.rb",
|
49
48
|
"bin/snp_position_to_polymarker.rb",
|
50
49
|
"bin/snps_between_bams.rb",
|
51
50
|
"bin/tag_stats.rb",
|
@@ -102,6 +101,17 @@ Gem::Specification.new do |s|
|
|
102
101
|
"lib/bio/db/exonerate.rb",
|
103
102
|
"lib/bio/db/primer3.rb",
|
104
103
|
"lib/bioruby-polyploid-tools.rb",
|
104
|
+
"test/data/7B_amplicon_test.fa",
|
105
|
+
"test/data/7B_amplicon_test.fa.fai",
|
106
|
+
"test/data/7B_amplicon_test_reference.fa",
|
107
|
+
"test/data/7B_amplicon_test_reference.fa.fai",
|
108
|
+
"test/data/7B_amplicon_test_reference.fa.ndb",
|
109
|
+
"test/data/7B_amplicon_test_reference.fa.nhr",
|
110
|
+
"test/data/7B_amplicon_test_reference.fa.nin",
|
111
|
+
"test/data/7B_amplicon_test_reference.fa.not",
|
112
|
+
"test/data/7B_amplicon_test_reference.fa.nsq",
|
113
|
+
"test/data/7B_amplicon_test_reference.fa.ntf",
|
114
|
+
"test/data/7B_amplicon_test_reference.fa.nto",
|
105
115
|
"test/data/BS00068396_51.fa",
|
106
116
|
"test/data/BS00068396_51_blast.tab",
|
107
117
|
"test/data/BS00068396_51_contigs.aln",
|
@@ -185,29 +195,21 @@ Gem::Specification.new do |s|
|
|
185
195
|
]
|
186
196
|
s.homepage = "http://github.com/tgac/bioruby-polyploid-tools".freeze
|
187
197
|
s.licenses = ["MIT".freeze]
|
188
|
-
s.rubygems_version = "
|
198
|
+
s.rubygems_version = "3.1.2".freeze
|
189
199
|
s.summary = "Tool to work with polyploids, NGS and molecular biology".freeze
|
190
200
|
|
191
201
|
if s.respond_to? :specification_version then
|
192
202
|
s.specification_version = 4
|
203
|
+
end
|
193
204
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
else
|
203
|
-
s.add_dependency(%q<bio>.freeze, [">= 1.5.1"])
|
204
|
-
s.add_dependency(%q<bio-samtools>.freeze, [">= 2.6.2"])
|
205
|
-
s.add_dependency(%q<descriptive_statistics>.freeze, [">= 0"])
|
206
|
-
s.add_dependency(%q<systemu>.freeze, [">= 2.5.2"])
|
207
|
-
s.add_dependency(%q<shoulda>.freeze, [">= 2.10"])
|
208
|
-
s.add_dependency(%q<test-unit>.freeze, [">= 0"])
|
209
|
-
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
210
|
-
end
|
205
|
+
if s.respond_to? :add_runtime_dependency then
|
206
|
+
s.add_runtime_dependency(%q<bio>.freeze, [">= 1.5.1"])
|
207
|
+
s.add_runtime_dependency(%q<bio-samtools>.freeze, [">= 2.6.2"])
|
208
|
+
s.add_runtime_dependency(%q<descriptive_statistics>.freeze, [">= 0"])
|
209
|
+
s.add_runtime_dependency(%q<systemu>.freeze, [">= 2.5.2"])
|
210
|
+
s.add_development_dependency(%q<shoulda>.freeze, [">= 2.10"])
|
211
|
+
s.add_development_dependency(%q<test-unit>.freeze, [">= 0"])
|
212
|
+
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
211
213
|
else
|
212
214
|
s.add_dependency(%q<bio>.freeze, [">= 1.5.1"])
|
213
215
|
s.add_dependency(%q<bio-samtools>.freeze, [">= 2.6.2"])
|
data/lib/bio/BIOExtensions.rb
CHANGED
@@ -18,7 +18,7 @@ module Bio::PolyploidTools
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def gene_models(path)
|
21
|
-
@gene_models_db = Bio::DB::Fasta::FastaFile.new(
|
21
|
+
@gene_models_db = Bio::DB::Fasta::FastaFile.new(fasta: path)
|
22
22
|
@gene_models_db.index
|
23
23
|
@gene_models_path = path
|
24
24
|
end
|
@@ -48,7 +48,7 @@ module Bio::PolyploidTools
|
|
48
48
|
|
49
49
|
#Sets the reference file for the gene models
|
50
50
|
def chromosomes(path)
|
51
|
-
@chromosomes_db = Bio::DB::Fasta::FastaFile.new(
|
51
|
+
@chromosomes_db = Bio::DB::Fasta::FastaFile.new(fasta: path)
|
52
52
|
@chromosomes_path = path
|
53
53
|
end
|
54
54
|
|
@@ -72,11 +72,10 @@ module Bio::PolyploidTools
|
|
72
72
|
name = opts[:name]
|
73
73
|
path = opts[:reference_path]
|
74
74
|
path = opts[:alig_path]
|
75
|
-
chromosomes[name] = Bio::DB::Fasta::FastaFile.new(
|
75
|
+
chromosomes[name] = Bio::DB::Fasta::FastaFile.new(fasta: path)
|
76
76
|
end
|
77
77
|
|
78
78
|
def add_snp(snp)
|
79
|
-
#TODO: add to the snp the maximum number of hits?
|
80
79
|
snp.max_hits = self.max_hits
|
81
80
|
@snp_map[snp.gene] = Array.new unless @snp_map[snp.gene]
|
82
81
|
@snp_map[snp.gene] << snp
|
@@ -110,7 +109,7 @@ module Bio::PolyploidTools
|
|
110
109
|
ret_str = ""
|
111
110
|
@parents.each do |name, bam|
|
112
111
|
ret_str << ">#{gene_region.id}_SNP-#{snp.position}_#{name} Overlapping_exons:#{gene_region.to_s} localSNPpo:#{local_pos_in_gene+1}\n"
|
113
|
-
to_print = bam.consensus_with_ambiguities(
|
112
|
+
to_print = bam.consensus_with_ambiguities(region: gene_region).to_s
|
114
113
|
to_print[local_pos_in_gene] = to_print[local_pos_in_gene].upcase
|
115
114
|
ret_str << to_print << "\n"
|
116
115
|
end
|
@@ -141,6 +140,7 @@ module Bio::PolyploidTools
|
|
141
140
|
begin
|
142
141
|
file.puts snp.aligned_sequences_fasta
|
143
142
|
rescue Exception=>e
|
143
|
+
#puts snp.inspect
|
144
144
|
@missing_exons << snp.to_s
|
145
145
|
$stderr.puts "print_fasta_snp_exones:" + snp.to_s + ":" + e.to_s
|
146
146
|
$stderr.puts "Local position: #{snp.local_position}"
|
@@ -151,7 +151,7 @@ module Bio::PolyploidTools
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
-
def print_primer_3_exons (file, target_chromosome , parental )
|
154
|
+
def print_primer_3_exons (file, target_chromosome , parental, max_specific_primers: 20 )
|
155
155
|
added = 0
|
156
156
|
|
157
157
|
@snp_map.each do | gene, snp_array|
|
@@ -159,9 +159,9 @@ module Bio::PolyploidTools
|
|
159
159
|
string = ""
|
160
160
|
begin
|
161
161
|
primer_3_min_seq_length
|
162
|
-
string = snp.primer_3_string( snp.chromosome, parental )
|
163
|
-
#TODO: add tan error to the SNP this snp has more than max_hits.
|
164
|
-
#
|
162
|
+
string = snp.primer_3_string( snp.chromosome, parental, max_specific_primers: max_specific_primers )
|
163
|
+
#TODO: add tan error to the SNP this snp has more than max_hits.
|
164
|
+
#Or maybe inside the SNP file.
|
165
165
|
if string.size > 0
|
166
166
|
file.puts string
|
167
167
|
added += 1
|
@@ -55,11 +55,15 @@ module Bio::PolyploidTools
|
|
55
55
|
|
56
56
|
def mask_aligned_chromosomal_snp(chromosome)
|
57
57
|
return nil if aligned_sequences.values.size == 0
|
58
|
-
names =
|
58
|
+
names = aligned_sequences.keys
|
59
|
+
parentals = parental_sequences.keys
|
60
|
+
names = names - parentals
|
61
|
+
|
62
|
+
|
63
|
+
best_target = get_target_sequence(names, chromosome)
|
64
|
+
masked_snps = aligned_sequences[best_target].downcase if aligned_sequences[best_target]
|
65
|
+
masked_snps = "-" * aligned_sequences.values[0].size unless aligned_sequences[best_target]
|
59
66
|
|
60
|
-
masked_snps = aligned_sequences[chromosome].downcase if aligned_sequences[chromosome]
|
61
|
-
|
62
|
-
masked_snps = "-" * aligned_sequences.values[0].size unless aligned_sequences[chromosome]
|
63
67
|
#TODO: Make this chromosome specific, even when we have more than one alignment going to the region we want.
|
64
68
|
i = 0
|
65
69
|
while i < masked_snps.size
|
@@ -105,26 +109,23 @@ module Bio::PolyploidTools
|
|
105
109
|
|
106
110
|
aligned_sequences.each_pair do |name, val|
|
107
111
|
has_del = true if val[i] == '-'
|
108
|
-
print "#{val[i]}\t"
|
112
|
+
#print "#{val[i]}\t"
|
109
113
|
end
|
110
114
|
count += 1 if has_del
|
111
|
-
print "#{count}\n"
|
115
|
+
#print "#{count}\n"
|
112
116
|
end
|
113
117
|
return count
|
114
118
|
end
|
115
119
|
|
116
120
|
def primer_region(target_chromosome, parental_chr )
|
117
121
|
chromosome_seq = aligned_sequences[target_chromosome]
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
chromosome_seq = surrounding_exon_sequences[target_chromosome]
|
124
|
-
|
125
|
-
end
|
122
|
+
names = aligned_sequences.keys
|
123
|
+
target_chromosome = get_target_sequence(names, target_chromosome)
|
124
|
+
chromosome_seq = aligned_sequences[target_chromosome]
|
125
|
+
chromosome_seq = surrounding_exon_sequences[target_chromosome ]if aligned_sequences.size == 0
|
126
|
+
chromosome_seq = "-" * sequence_original.size unless chromosome_seq
|
126
127
|
chromosome_seq = chromosome_seq.downcase
|
127
|
-
|
128
|
+
#puts chromosome_seq
|
128
129
|
mask = mask_aligned_chromosomal_snp(target_chromosome)
|
129
130
|
|
130
131
|
pr = PrimerRegion.new
|
@@ -146,7 +147,7 @@ module Bio::PolyploidTools
|
|
146
147
|
pr.crhomosome_specific_intron << position_in_region
|
147
148
|
elsif Bio::NucleicAcid.is_valid(parental[i], mask[i])
|
148
149
|
parental[i] = mask[i]
|
149
|
-
pr.chromosome_specific << position_in_region if count_deletions_around(1,target_chromosome) < 3
|
150
|
+
pr.chromosome_specific << position_in_region #if count_deletions_around(1,target_chromosome) < 3
|
150
151
|
pr.chromosome_specific_in_mask << i
|
151
152
|
end
|
152
153
|
|
@@ -165,16 +166,15 @@ module Bio::PolyploidTools
|
|
165
166
|
position_in_region += 1
|
166
167
|
end #Closes region with bases
|
167
168
|
end
|
168
|
-
|
169
169
|
pr.sequence=parental.gsub('-','')
|
170
170
|
pr
|
171
171
|
end
|
172
172
|
|
173
|
-
def
|
174
|
-
|
175
|
-
left = opts[:
|
173
|
+
def return_primer_3_string(opts={})
|
174
|
+
#puts "return_primer_3_string #{opts.inspect}"
|
175
|
+
left = opts[:left_pos]
|
176
176
|
right = opts[:right_pos]
|
177
|
-
sequence = opts[:sequence]
|
177
|
+
sequence = opts[:sequence].clone
|
178
178
|
orientation = "forward"
|
179
179
|
if opts[:right_pos]
|
180
180
|
orientation = "forward"
|
@@ -201,7 +201,7 @@ module Bio::PolyploidTools
|
|
201
201
|
|
202
202
|
#In case that we don't have a right primer, we do both orientations
|
203
203
|
unless opts[:right_pos]
|
204
|
-
sequence = opts[:sequence]
|
204
|
+
sequence = opts[:sequence].clone
|
205
205
|
left = sequence.size - left - 1
|
206
206
|
orientation = "reverse"
|
207
207
|
sequence = reverse_complement_string(sequence)
|
@@ -222,8 +222,10 @@ module Bio::PolyploidTools
|
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
225
|
-
def primer_3_all_strings(target_chromosome, parental)
|
225
|
+
def primer_3_all_strings(target_chromosome, parental, max_specific_primers: nil)
|
226
|
+
#puts "primer_3_all_strings: #{target_chromosome} #{parental}"
|
226
227
|
pr = primer_region(target_chromosome, parental )
|
228
|
+
#puts pr.inspect
|
227
229
|
primer_3_propertes = Array.new
|
228
230
|
|
229
231
|
seq_original = String.new(pr.sequence)
|
@@ -236,24 +238,28 @@ module Bio::PolyploidTools
|
|
236
238
|
snp_type = "non-homoeologous"
|
237
239
|
end
|
238
240
|
|
239
|
-
pr.chromosome_specific.
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
241
|
+
pr.chromosome_specific.each_with_index do |pos , i|
|
242
|
+
seq_snp = seq_original.clone
|
243
|
+
#original_base = seq_snp[pos]
|
244
|
+
#puts "___"
|
245
|
+
#puts aligned_sequences.keys.inspect
|
246
|
+
#puts target_chromosome
|
247
|
+
t_chr = get_target_sequence(aligned_sequences.keys, target_chromosome)
|
248
|
+
other_chromosome_base = get_base_in_different_chromosome(pr.chromosome_specific_in_mask[i], t_chr)
|
244
249
|
|
245
250
|
args = {
|
246
251
|
:name =>"#{gene} A chromosome_specific exon #{snp_type} #{chromosome}",
|
247
252
|
:left_pos => pos,
|
248
|
-
:sequence=>
|
253
|
+
:sequence=>seq_snp
|
249
254
|
}
|
250
255
|
|
251
|
-
|
256
|
+
seq_snp = seq_original.clone
|
252
257
|
primer_3_propertes << return_primer_3_string(args)
|
258
|
+
|
253
259
|
args[:name] = "#{gene} B chromosome_specific exon #{snp_type} #{chromosome}"
|
254
|
-
args[:sequence] = seq_snp
|
255
|
-
#TODO: Find base from another chromosome
|
256
260
|
seq_snp[pos] = other_chromosome_base.upcase
|
261
|
+
args[:sequence] = seq_snp
|
262
|
+
|
257
263
|
|
258
264
|
primer_3_propertes << return_primer_3_string(args)
|
259
265
|
end
|
@@ -265,7 +271,7 @@ module Bio::PolyploidTools
|
|
265
271
|
def aligned_sequences
|
266
272
|
|
267
273
|
return @aligned_sequences if @aligned_sequences
|
268
|
-
if sequences_to_align.size
|
274
|
+
if sequences_to_align.size <= 1
|
269
275
|
@aligned_sequences = sequences_to_align
|
270
276
|
return @aligned_sequences
|
271
277
|
end
|
@@ -162,6 +162,7 @@ module Bio::PolyploidTools
|
|
162
162
|
end
|
163
163
|
|
164
164
|
def add_exon(exon, arm, filter_best: true)
|
165
|
+
exon_list[arm] = Array.new unless exon_list[arm]
|
165
166
|
if filter_best and exon_list[arm].size > 0
|
166
167
|
current = exon_list[arm].first
|
167
168
|
exon_list[arm] = [exon] if exon.record.score > current.record.score
|
@@ -370,7 +371,7 @@ module Bio::PolyploidTools
|
|
370
371
|
end
|
371
372
|
|
372
373
|
|
373
|
-
def primer_3_all_strings(target_chromosome, parental)
|
374
|
+
def primer_3_all_strings(target_chromosome, parental, max_specific_primers: 20 )
|
374
375
|
|
375
376
|
pr = primer_region(target_chromosome, parental )
|
376
377
|
primer_3_propertes = Array.new
|
@@ -401,9 +402,16 @@ module Bio::PolyploidTools
|
|
401
402
|
else
|
402
403
|
@snp_type = "non-homoeologous"
|
403
404
|
end
|
405
|
+
|
406
|
+
total_candidates = pr.chromosome_specific.size
|
407
|
+
total_candidates += pr.crhomosome_specific_intron.size
|
408
|
+
total_candidates += pr.almost_chromosome_specific.size
|
409
|
+
total_candidates += pr.almost_crhomosome_specific_intron.size
|
404
410
|
|
405
|
-
|
411
|
+
skip_specific = total_candidates > max_specific_primers
|
406
412
|
|
413
|
+
pr.chromosome_specific.each do |pos|
|
414
|
+
break if skip_specific
|
407
415
|
args = {:name =>"#{gene}:#{original}#{position}#{snp} #{original_name} chromosome_specific exon #{@snp_type} #{chromosome}", :left_pos => pr.snp_pos, :right_pos => pos, :sequence=>seq_original}
|
408
416
|
primer_3_propertes << return_primer_3_string(args)
|
409
417
|
args[:name] = "#{gene}:#{original}#{position}#{snp} #{snp_in} chromosome_specific exon #{@snp_type} #{chromosome}"
|
@@ -411,41 +419,38 @@ module Bio::PolyploidTools
|
|
411
419
|
primer_3_propertes << return_primer_3_string(args)
|
412
420
|
end
|
413
421
|
|
414
|
-
pr.
|
415
|
-
|
422
|
+
pr.crhomosome_specific_intron.each do |pos|
|
423
|
+
break if skip_specific
|
424
|
+
args = {:name =>"#{gene}:#{original}#{position}#{snp} #{original_name} chromosome_specific intron #{@snp_type} #{chromosome}", :left_pos => pr.snp_pos, :right_pos => pos, :sequence=>seq_original}
|
416
425
|
primer_3_propertes << return_primer_3_string(args)
|
417
|
-
args[:name] = "#{gene}:#{original}#{position}#{snp} #{snp_in}
|
426
|
+
args[:name] = "#{gene}:#{original}#{position}#{snp} #{snp_in} chromosome_specific exon #{@snp_type} #{chromosome}"
|
418
427
|
args[:sequence] = seq_snp
|
419
428
|
primer_3_propertes << return_primer_3_string(args)
|
420
|
-
|
421
429
|
end
|
422
430
|
|
423
|
-
pr.
|
424
|
-
|
425
|
-
args = {:name =>"#{gene}:#{original}#{position}#{snp} #{original_name}
|
431
|
+
pr.almost_chromosome_specific.each do |pos|
|
432
|
+
break if skip_specific
|
433
|
+
args = {:name =>"#{gene}:#{original}#{position}#{snp} #{original_name} chromosome_semispecific exon #{@snp_type} #{chromosome}", :left_pos => pr.snp_pos, :right_pos => pos, :sequence=>seq_original}
|
426
434
|
primer_3_propertes << return_primer_3_string(args)
|
427
|
-
args[:name] = "#{gene}:#{original}#{position}#{snp} #{snp_in}
|
435
|
+
args[:name] = "#{gene}:#{original}#{position}#{snp} #{snp_in} chromosome_semispecific exon #{@snp_type} #{chromosome}"
|
428
436
|
args[:sequence] = seq_snp
|
429
437
|
primer_3_propertes << return_primer_3_string(args)
|
430
438
|
end
|
431
439
|
|
432
440
|
pr.almost_crhomosome_specific_intron.each do |pos|
|
441
|
+
break if skip_specific
|
433
442
|
args = {:name =>"#{gene}:#{original}#{position}#{snp} #{original_name} chromosome_semispecific intron #{@snp_type} #{chromosome}", :left_pos => pr.snp_pos, :right_pos => pos, :sequence=>seq_original}
|
434
443
|
primer_3_propertes << return_primer_3_string(args)
|
435
444
|
args[:name] = "#{gene}:#{original}#{position}#{snp} #{snp_in} chromosome_semispecific exon #{@snp_type} #{chromosome}"
|
436
445
|
args[:sequence] = seq_snp
|
437
446
|
primer_3_propertes << return_primer_3_string(args)
|
438
|
-
|
439
447
|
end
|
440
448
|
|
441
|
-
|
442
449
|
args = {:name =>"#{gene}:#{original}#{position}#{snp} #{original_name} chromosome_nonspecific all #{@snp_type} #{chromosome}", :left_pos => pr.snp_pos, :sequence=>seq_original}
|
443
450
|
primer_3_propertes << return_primer_3_string(args)
|
444
451
|
args[:name] = "#{gene}:#{original}#{position}#{snp} #{snp_in} chromosome_nonspecific all #{@snp_type} #{chromosome}"
|
445
452
|
args[:sequence] = seq_snp
|
446
453
|
primer_3_propertes << return_primer_3_string(args)
|
447
|
-
|
448
|
-
|
449
454
|
primer_3_propertes
|
450
455
|
end
|
451
456
|
|
@@ -457,8 +462,8 @@ module Bio::PolyploidTools
|
|
457
462
|
"#{original}#{position}#{snp}".upcase
|
458
463
|
end
|
459
464
|
|
460
|
-
def primer_3_string(target_chromosome, parental)
|
461
|
-
strings = primer_3_all_strings(target_chromosome, parental)
|
465
|
+
def primer_3_string(target_chromosome, parental, max_specific_primers: 20)
|
466
|
+
strings = primer_3_all_strings(target_chromosome, parental, max_specific_primers: max_specific_primers)
|
462
467
|
strings.join
|
463
468
|
end
|
464
469
|
|
@@ -558,7 +563,7 @@ module Bio::PolyploidTools
|
|
558
563
|
def aligned_sequences
|
559
564
|
|
560
565
|
return @aligned_sequences if @aligned_sequences
|
561
|
-
|
566
|
+
return Hash.new if sequences_to_align.size == 0
|
562
567
|
|
563
568
|
options = ['--maxiterate', '1000', '--localpair', '--quiet']
|
564
569
|
mafft = Bio::MAFFT.new( "mafft" , options)
|
@@ -756,13 +761,13 @@ module Bio::PolyploidTools
|
|
756
761
|
self.exon_list.each do |chromosome, exon_arr|
|
757
762
|
exon_arr.each do |exon|
|
758
763
|
exon_start_offset = exon.query_region.start - gene_region.start
|
759
|
-
|
764
|
+
flanking_region = exon.target_flanking_region_from_position(position,flanking_size)
|
760
765
|
#TODO: Padd when the exon goes over the regions...
|
761
|
-
#puts
|
766
|
+
#puts flanking_region.inspect
|
762
767
|
#Ignoring when the exon is in a gap
|
763
768
|
unless exon.snp_in_gap
|
764
|
-
exon_seq = container.chromosome_sequence(
|
765
|
-
@surrounding_exon_sequences["#{chromosome}_#{
|
769
|
+
exon_seq = container.chromosome_sequence(flanking_region)
|
770
|
+
@surrounding_exon_sequences["#{chromosome}_#{flanking_region.start}_#{exon.record.score}"] = exon_seq
|
766
771
|
end
|
767
772
|
end
|
768
773
|
end
|