bacterial-annotator 0.3.2 → 0.3.3
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/lib/bacterial-comparator.rb +85 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a97539de7b1dff0da1ac8edaef6e0e10949c74e
|
4
|
+
data.tar.gz: 09fa573de375d54339adf3a8800318a49c059ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 608daa4501f95457e6d412fdc43d0672e74acd4ecf91186ea57da00614033e569688ca2d6a82f89f4266bc62da2ca20d7703a9ace0d04f131de57025c93a7685
|
7
|
+
data.tar.gz: 6ac5946ce49c23bfeb0d32dbc38c41516df960ab73af5f6a1a99689a08f7076ecffb2e361cf4f087d11dd1dcb74858ab35c84aaac687d9a8b28112eee765c05e
|
data/lib/bacterial-comparator.rb
CHANGED
@@ -23,6 +23,7 @@ class BacterialComparator
|
|
23
23
|
Dir.mkdir(@outdir) if ! Dir.exists? @outdir
|
24
24
|
@genomes_list = options[:genomes_list]
|
25
25
|
@proc = options[:proc].to_i
|
26
|
+
@phylo_nb_genes = options[:phylo_nb_genes]
|
26
27
|
|
27
28
|
min_cov = options[:min_cov].to_f
|
28
29
|
min_pid = options[:pidentity].to_f
|
@@ -199,25 +200,102 @@ class BacterialComparator
|
|
199
200
|
|
200
201
|
end
|
201
202
|
|
203
|
+
|
202
204
|
def mafft_align_all_pep
|
203
205
|
puts "# MAFFT multialign all protein sequences.."
|
204
206
|
Dir.chdir("#{@outdir}/genes-align-pep/")
|
205
|
-
|
206
|
-
|
207
|
-
|
207
|
+
|
208
|
+
is_done = 1
|
209
|
+
if Dir["*.pep"].length == Dir["*.aln"].length
|
210
|
+
Dir["*.aln"].each do |a|
|
211
|
+
if File.size(a) == 0
|
212
|
+
is_done = 0
|
213
|
+
end
|
214
|
+
end
|
215
|
+
else
|
216
|
+
is_done = 0
|
217
|
+
end
|
218
|
+
|
219
|
+
if is_done==0
|
220
|
+
Parallel.map(Dir["*.pep"], in_processes: @proc) { |f|
|
221
|
+
mafft_align f
|
222
|
+
}
|
223
|
+
end
|
224
|
+
|
225
|
+
concat_alignments "genes-align-pep.concat.fasta"
|
208
226
|
Dir.chdir("../../")
|
227
|
+
|
209
228
|
end
|
210
229
|
|
211
230
|
def mafft_align_all_dna
|
212
231
|
puts "# MAFFT multialign all gene sequences.."
|
213
|
-
puts "# MAFFT multialign all protein sequences.."
|
214
232
|
Dir.chdir("#{@outdir}/genes-align-dna/")
|
215
|
-
|
216
|
-
|
217
|
-
|
233
|
+
|
234
|
+
is_done = 1
|
235
|
+
if Dir["*.dna"].length == Dir["*.aln"].length
|
236
|
+
Dir["*.aln"].each do |a|
|
237
|
+
if File.size(a) == 0
|
238
|
+
is_done = 0
|
239
|
+
end
|
240
|
+
end
|
241
|
+
else
|
242
|
+
is_done = 0
|
243
|
+
end
|
244
|
+
|
245
|
+
if is_done == 0
|
246
|
+
Parallel.map(Dir["*.dna"], in_processes: @proc) { |f|
|
247
|
+
mafft_align f
|
248
|
+
}
|
249
|
+
end
|
250
|
+
|
251
|
+
concat_alignments "genes-align-dna.concat.fasta"
|
218
252
|
Dir.chdir("../../")
|
253
|
+
|
219
254
|
end
|
220
255
|
|
221
256
|
|
257
|
+
def concat_alignments outfile
|
258
|
+
|
259
|
+
fout = File.open("../#{outfile}", "w")
|
260
|
+
|
261
|
+
ref_id = Dir["../../#{@genomes_list[0]}/*.pep"][0].gsub(/.*\//,"").gsub(".pep","")
|
262
|
+
|
263
|
+
seq = ""
|
264
|
+
Dir["*.aln"].each do |f|
|
265
|
+
flat = Bio::FlatFile.auto(f)
|
266
|
+
ref_seq = flat.entries[0]
|
267
|
+
seq += ref_seq.seq
|
268
|
+
end
|
269
|
+
|
270
|
+
bioseq = Bio::Sequence.auto(seq)
|
271
|
+
out = bioseq.output_fasta("#{ref_id}",60)
|
272
|
+
fout.write(out)
|
273
|
+
|
274
|
+
for i in 1..@genomes_list.length
|
275
|
+
seq = ""
|
276
|
+
Dir["*.aln"].each do |f|
|
277
|
+
flat = Bio::FlatFile.auto(f)
|
278
|
+
j=0
|
279
|
+
flat.each_entry do |entry|
|
280
|
+
if j<i
|
281
|
+
j+=1
|
282
|
+
next
|
283
|
+
elsif i == j
|
284
|
+
seq += entry.seq
|
285
|
+
j+=1
|
286
|
+
else
|
287
|
+
break
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
bioseq = Bio::Sequence.auto(seq)
|
292
|
+
out = bioseq.output_fasta("#{@genomes_list[i-1]}",60)
|
293
|
+
fout.write(out)
|
294
|
+
end
|
295
|
+
|
296
|
+
fout.close
|
297
|
+
|
298
|
+
end
|
299
|
+
|
222
300
|
|
223
301
|
end # end of Class
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bacterial-annotator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxime Deraspe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bio
|